diff options
Diffstat (limited to 'Source')
85 files changed, 367 insertions, 1574 deletions
diff --git a/Source/Android.mk b/Source/Android.mk index fd1f622..6612cae 100644 --- a/Source/Android.mk +++ b/Source/Android.mk @@ -224,10 +224,6 @@ ifeq ($(ENABLE_SVG_ANIMATION),true) LOCAL_CFLAGS += -DENABLE_SVG_ANIMATION=1 endif -ifeq ($(WEBCORE_INSTRUMENTATION),true) -LOCAL_CFLAGS += -DANDROID_INSTRUMENT -endif - # LOCAL_LDLIBS is used in simulator builds only and simulator builds are only # valid on Linux LOCAL_LDLIBS += -lpthread -ldl @@ -246,10 +242,6 @@ LOCAL_SHARED_LIBRARIES := \ libicui18n \ libmedia -ifeq ($(WEBCORE_INSTRUMENTATION),true) -LOCAL_SHARED_LIBRARIES += libhardware_legacy -endif - # We have to use the android version of libdl. LOCAL_SHARED_LIBRARIES += libdl diff --git a/Source/JavaScriptCore/parser/Parser.cpp b/Source/JavaScriptCore/parser/Parser.cpp index dc15e4f..fc1e986 100644 --- a/Source/JavaScriptCore/parser/Parser.cpp +++ b/Source/JavaScriptCore/parser/Parser.cpp @@ -27,17 +27,10 @@ #include "JSParser.h" #include "Lexer.h" -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif - namespace JSC { void Parser::parse(JSGlobalData* globalData, FunctionParameters* parameters, JSParserStrictness strictness, JSParserMode mode, int* errLine, UString* errMsg) { -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::JavaScriptParseTimeCounter); -#endif ASSERT(globalData); m_sourceElements = 0; @@ -65,9 +58,6 @@ void Parser::parse(JSGlobalData* globalData, FunctionParameters* parameters, JSP *errMsg = parseError ? parseError : "Parse error"; m_sourceElements = 0; } -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::JavaScriptParseTimeCounter, __FUNCTION__); -#endif } void Parser::didFinishParsing(SourceElements* sourceElements, ParserArenaData<DeclarationStacks::VarStack>* varStack, diff --git a/Source/JavaScriptCore/runtime/TimeoutChecker.h b/Source/JavaScriptCore/runtime/TimeoutChecker.h index 71ce169..5925641 100644 --- a/Source/JavaScriptCore/runtime/TimeoutChecker.h +++ b/Source/JavaScriptCore/runtime/TimeoutChecker.h @@ -31,10 +31,6 @@ #include <wtf/Assertions.h> -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif - namespace JSC { class ExecState; @@ -52,10 +48,6 @@ namespace JSC { { if (!m_startCount) reset(); -#ifdef ANDROID_INSTRUMENT - if (!m_startCount) - android::TimeCounter::start(android::TimeCounter::JavaScriptTimeCounter); -#endif ++m_startCount; } @@ -63,10 +55,6 @@ namespace JSC { { ASSERT(m_startCount); --m_startCount; -#ifdef ANDROID_INSTRUMENT - if (!m_startCount) - android::TimeCounter::record(android::TimeCounter::JavaScriptTimeCounter, __FUNCTION__); -#endif } void reset(); diff --git a/Source/JavaScriptCore/wtf/Assertions.cpp b/Source/JavaScriptCore/wtf/Assertions.cpp index 930368c..0642414 100644 --- a/Source/JavaScriptCore/wtf/Assertions.cpp +++ b/Source/JavaScriptCore/wtf/Assertions.cpp @@ -66,6 +66,10 @@ #include <execinfo.h> #endif +#if OS(ANDROID) +#include <utils/Log.h> +#endif + extern "C" { #if PLATFORM(BREWMP) @@ -124,7 +128,9 @@ static void vprintf_stderr_common(const char* format, va_list args) vsnprintf(buffer.data(), size, format, args); printLog(buffer); } - +#elif OS(ANDROID) + LOG_PRI_VA(ANDROID_LOG_DEBUG, "WebKit", format, args); + return; #elif HAVE(ISDEBUGGERPRESENT) if (IsDebuggerPresent()) { size_t size = 1024; diff --git a/Source/JavaScriptCore/wtf/Platform.h b/Source/JavaScriptCore/wtf/Platform.h index e92af89..d7cd222 100644 --- a/Source/JavaScriptCore/wtf/Platform.h +++ b/Source/JavaScriptCore/wtf/Platform.h @@ -676,7 +676,10 @@ #if PLATFORM(ANDROID) #define WEBCORE_NAVIGATOR_VENDOR "Google Inc." -#define LOG_DISABLED 1 +// Force LOG_ERROR() to be enabled in all builds. All other logging and +// assertions are enabled in debug builds only. +#define ERROR_DISABLED 0 + // This must be defined before we include FastMalloc.h in config.h. #define USE_SYSTEM_MALLOC 1 diff --git a/Source/WebCore/Android.mk b/Source/WebCore/Android.mk index 6542931..6d43300 100644 --- a/Source/WebCore/Android.mk +++ b/Source/WebCore/Android.mk @@ -811,6 +811,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ plugins/DOMPluginArray.cpp \ plugins/PluginData.cpp \ plugins/PluginDatabase.cpp \ + plugins/PluginDebug.cpp \ plugins/PluginMainThreadScheduler.cpp \ plugins/PluginPackage.cpp \ plugins/PluginStream.cpp \ diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp index e025008..c3a0cbb 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -76,10 +76,6 @@ #include <wtf/UnusedParam.h> #include <wtf/text/CString.h> -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif - namespace WebCore { static void handleFatalErrorInV8() @@ -283,10 +279,6 @@ bool V8DOMWindowShell::initContextIfNeeded() if (!m_context.IsEmpty()) return false; -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::JavaScriptInitTimeCounter); -#endif - // Create a handle scope for all local handles. v8::HandleScope handleScope; @@ -352,10 +344,6 @@ bool V8DOMWindowShell::initContextIfNeeded() // we do isolated worlds the WebCore way. m_frame->loader()->dispatchDidClearWindowObjectInWorld(0); -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::JavaScriptInitTimeCounter, __FUNCTION__); -#endif - return true; } diff --git a/Source/WebCore/bindings/v8/V8Proxy.cpp b/Source/WebCore/bindings/v8/V8Proxy.cpp index ca57fa8..d90cf1c 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.cpp +++ b/Source/WebCore/bindings/v8/V8Proxy.cpp @@ -83,14 +83,6 @@ #include <wtf/UnusedParam.h> #include <wtf/text/StringConcatenate.h> -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif - -#if PLATFORM(ANDROID) -#include <wtf/text/CString.h> -#endif - namespace WebCore { // Static list of registered extensions @@ -209,16 +201,6 @@ V8Proxy::~V8Proxy() } v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition0& scriptStartPosition, v8::ScriptData* scriptData) -#ifdef ANDROID_INSTRUMENT -{ - android::TimeCounter::start(android::TimeCounter::JavaScriptParseTimeCounter); - v8::Handle<v8::Script> script = compileScriptInternal(code, fileName, scriptStartPosition, scriptData); - android::TimeCounter::record(android::TimeCounter::JavaScriptParseTimeCounter, __FUNCTION__); - return script; -} - -v8::Handle<v8::Script> V8Proxy::compileScriptInternal(v8::Handle<v8::String> code, const String& fileName, const TextPosition0& scriptStartPosition, v8::ScriptData* scriptData) -#endif { const uint16_t* fileNameString = fromWebCoreString(fileName); v8::Handle<v8::String> name = v8::String::New(fileNameString, fileName.length()); @@ -398,16 +380,6 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod } v8::Local<v8::Value> V8Proxy::runScript(v8::Handle<v8::Script> script, bool isInlineCode) -#ifdef ANDROID_INSTRUMENT -{ - android::TimeCounter::start(android::TimeCounter::JavaScriptExecuteTimeCounter); - v8::Local<v8::Value> result = runScriptInternal(script, isInlineCode); - android::TimeCounter::record(android::TimeCounter::JavaScriptExecuteTimeCounter, __FUNCTION__); - return result; -} - -v8::Local<v8::Value> V8Proxy::runScriptInternal(v8::Handle<v8::Script> script, bool isInlineCode) -#endif { if (script.IsEmpty()) return notHandledByInterceptor(); @@ -472,9 +444,6 @@ v8::Local<v8::Value> V8Proxy::runScriptInternal(v8::Handle<v8::Script> script, b v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]) { -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::JavaScriptExecuteTimeCounter); -#endif V8GCController::checkMemoryUsage(); v8::Local<v8::Value> result; { @@ -521,9 +490,6 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8 if (v8::V8::IsDead()) handleFatalErrorInV8(); -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::JavaScriptExecuteTimeCounter, __FUNCTION__); -#endif return result; } diff --git a/Source/WebCore/bindings/v8/V8Proxy.h b/Source/WebCore/bindings/v8/V8Proxy.h index fc52b19..777815b 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.h +++ b/Source/WebCore/bindings/v8/V8Proxy.h @@ -171,10 +171,6 @@ namespace WebCore { // Run an already compiled script. v8::Local<v8::Value> runScript(v8::Handle<v8::Script>, bool isInlineCode); -#ifdef ANDROID_INSTRUMENT - v8::Local<v8::Value> runScriptInternal(v8::Handle<v8::Script> script, bool inline_code); -#endif - // Call the function with the given receiver and arguments. v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]); @@ -244,10 +240,6 @@ namespace WebCore { static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition0& scriptStartPosition, v8::ScriptData* = 0); -#ifdef ANDROID_INSTRUMENT - static v8::Handle<v8::Script> compileScriptInternal(v8::Handle<v8::String> code, const String& fileName, int baseLine, v8::ScriptData* scriptData); -#endif - // If the exception code is different from zero, a DOM exception is // schedule to be thrown. static void setDOMException(int exceptionCode); diff --git a/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp b/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp index 42efaac..15b4bda 100644 --- a/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp +++ b/Source/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp @@ -72,11 +72,16 @@ JavaValue convertNPVariantToJavaValue(NPVariant value, const String& javaClass) break; } - jsize length = 0; - if (NPVARIANT_IS_INT32(npvLength)) - length = static_cast<jsize>(NPVARIANT_TO_INT32(npvLength)); - else if (NPVARIANT_IS_DOUBLE(npvLength)) - length = static_cast<jsize>(NPVARIANT_TO_DOUBLE(npvLength)); + // Convert to null if the length property is not a number. + if (!NPVARIANT_IS_INT32(npvLength) && !NPVARIANT_IS_DOUBLE(npvLength)) + break; + + // Convert to null if the length property is out of bounds. + double doubleLength = NPVARIANT_IS_INT32(npvLength) ? NPVARIANT_TO_INT32(npvLength) : NPVARIANT_TO_DOUBLE(npvLength); + if (doubleLength < 0.0 || doubleLength > INT32_MAX) + break; + + jsize length = static_cast<jsize>(doubleLength); if (!strcmp(javaClassName.data(), "[Ljava.lang.String;")) { // Match JSC behavior by only allowing Object arrays if they are Strings. @@ -85,7 +90,7 @@ JavaValue convertNPVariantToJavaValue(NPVariant value, const String& javaClass) for (jsize i = 0; i < length; i++) { NPVariant npvValue; _NPN_GetProperty(0, object, _NPN_GetIntIdentifier(i), &npvValue); - if(NPVARIANT_IS_STRING(npvValue)) { + if (NPVARIANT_IS_STRING(npvValue)) { NPString str = NPVARIANT_TO_STRING(npvValue); env->SetObjectArrayElement(static_cast<jobjectArray>(javaArray), i, env->NewStringUTF(str.UTF8Characters)); } @@ -100,11 +105,10 @@ JavaValue convertNPVariantToJavaValue(NPVariant value, const String& javaClass) NPVariant npvValue; _NPN_GetProperty(0, object, _NPN_GetIntIdentifier(i), &npvValue); jbyte bVal = 0; - if (NPVARIANT_IS_INT32(npvValue)) { + if (NPVARIANT_IS_INT32(npvValue)) bVal = static_cast<jbyte>(NPVARIANT_TO_INT32(npvValue)); - } else if (NPVARIANT_IS_DOUBLE(npvValue)) { + else if (NPVARIANT_IS_DOUBLE(npvValue)) bVal = static_cast<jbyte>(NPVARIANT_TO_DOUBLE(npvValue)); - } env->SetByteArrayRegion(static_cast<jbyteArray>(javaArray), i, 1, &bVal); } } else if (!strcmp(javaClassName.data(), "[C")) { @@ -115,12 +119,8 @@ JavaValue convertNPVariantToJavaValue(NPVariant value, const String& javaClass) NPVariant npvValue; _NPN_GetProperty(0, object, _NPN_GetIntIdentifier(i), &npvValue); jchar cVal = 0; - if (NPVARIANT_IS_INT32(npvValue)) { + if (NPVARIANT_IS_INT32(npvValue)) cVal = static_cast<jchar>(NPVARIANT_TO_INT32(npvValue)); - } else if (NPVARIANT_IS_STRING(npvValue)) { - NPString str = NPVARIANT_TO_STRING(npvValue); - cVal = str.UTF8Characters[0]; - } env->SetCharArrayRegion(static_cast<jcharArray>(javaArray), i, 1, &cVal); } } else if (!strcmp(javaClassName.data(), "[D")) { @@ -155,11 +155,10 @@ JavaValue convertNPVariantToJavaValue(NPVariant value, const String& javaClass) NPVariant npvValue; _NPN_GetProperty(0, object, _NPN_GetIntIdentifier(i), &npvValue); jint iVal = 0; - if (NPVARIANT_IS_INT32(npvValue)) { + if (NPVARIANT_IS_INT32(npvValue)) iVal = NPVARIANT_TO_INT32(npvValue); - } else if (NPVARIANT_IS_DOUBLE(npvValue)) { + else if (NPVARIANT_IS_DOUBLE(npvValue)) iVal = static_cast<jint>(NPVARIANT_TO_DOUBLE(npvValue)); - } env->SetIntArrayRegion(static_cast<jintArray>(javaArray), i, 1, &iVal); } } else if (!strcmp(javaClassName.data(), "[J")) { @@ -170,11 +169,10 @@ JavaValue convertNPVariantToJavaValue(NPVariant value, const String& javaClass) NPVariant npvValue; _NPN_GetProperty(0, object, _NPN_GetIntIdentifier(i), &npvValue); jlong jVal = 0; - if (NPVARIANT_IS_INT32(npvValue)) { + if (NPVARIANT_IS_INT32(npvValue)) jVal = static_cast<jlong>(NPVARIANT_TO_INT32(npvValue)); - } else if (NPVARIANT_IS_DOUBLE(npvValue)) { + else if (NPVARIANT_IS_DOUBLE(npvValue)) jVal = static_cast<jlong>(NPVARIANT_TO_DOUBLE(npvValue)); - } env->SetLongArrayRegion(static_cast<jlongArray>(javaArray), i, 1, &jVal); } } else if (!strcmp(javaClassName.data(), "[S")) { @@ -185,11 +183,10 @@ JavaValue convertNPVariantToJavaValue(NPVariant value, const String& javaClass) NPVariant npvValue; _NPN_GetProperty(0, object, _NPN_GetIntIdentifier(i), &npvValue); jshort sVal = 0; - if (NPVARIANT_IS_INT32(npvValue)) { + if (NPVARIANT_IS_INT32(npvValue)) sVal = static_cast<jshort>(NPVARIANT_TO_INT32(npvValue)); - } else if (NPVARIANT_IS_DOUBLE(npvValue)) { + else if (NPVARIANT_IS_DOUBLE(npvValue)) sVal = static_cast<jshort>(NPVARIANT_TO_DOUBLE(npvValue)); - } env->SetShortArrayRegion(static_cast<jshortArray>(javaArray), i, 1, &sVal); } } else if (!strcmp(javaClassName.data(), "[Z")) { diff --git a/Source/WebCore/bridge/jni/v8/JavaValueV8.h b/Source/WebCore/bridge/jni/v8/JavaValueV8.h index 3e1c623..c6ff315 100644 --- a/Source/WebCore/bridge/jni/v8/JavaValueV8.h +++ b/Source/WebCore/bridge/jni/v8/JavaValueV8.h @@ -49,7 +49,18 @@ class JavaInstance; // currently used only with V8. // See https://bugs.webkit.org/show_bug.cgi?id=57023. struct JavaValue { - JavaValue() : m_type(JavaTypeInvalid) {} +// ANDROID + JavaValue() + : m_type(JavaTypeInvalid) + , m_booleanValue(false) + , m_byteValue(0) + , m_charValue(0) + , m_shortValue(0) + , m_intValue(0) + , m_longValue(0) + , m_floatValue(0.0) + , m_doubleValue(0.0) {} +// ANDROID JavaType m_type; // We don't use a union because we want to be able to ref-count some of the diff --git a/Source/WebCore/css/CSSImportRule.cpp b/Source/WebCore/css/CSSImportRule.cpp index 09e313e..81ade39 100644 --- a/Source/WebCore/css/CSSImportRule.cpp +++ b/Source/WebCore/css/CSSImportRule.cpp @@ -170,26 +170,4 @@ void CSSImportRule::addSubresourceStyleURLs(ListHashSet<KURL>& urls) addSubresourceURL(urls, m_styleSheet->baseURL()); } -#ifdef ANDROID_INSTRUMENT -void* CSSImportRule::operator new(size_t size) -{ - return StyleBase::operator new(size); -} - -void* CSSImportRule::operator new[](size_t size) -{ - return StyleBase::operator new[](size); -} - -void CSSImportRule::operator delete(void* p, size_t size) -{ - StyleBase::operator delete(p, size); -} - -void CSSImportRule::operator delete[](void* p, size_t size) -{ - StyleBase::operator delete[](p, size); -} -#endif - } // namespace WebCore diff --git a/Source/WebCore/css/CSSImportRule.h b/Source/WebCore/css/CSSImportRule.h index 3f44f5b..ad4e97d 100644 --- a/Source/WebCore/css/CSSImportRule.h +++ b/Source/WebCore/css/CSSImportRule.h @@ -66,14 +66,6 @@ private: // from CachedResourceClient virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*); -#ifdef ANDROID_INSTRUMENT - // Overridden to resolve the ambiguous - void* operator new(size_t size); - void* operator new[](size_t size); - void operator delete(void* p, size_t size); - void operator delete[](void* p, size_t size); -#endif - String m_strHref; RefPtr<MediaList> m_lstMedia; RefPtr<CSSStyleSheet> m_styleSheet; diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index 831e438..78b6b24 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -92,10 +92,6 @@ extern int cssyyparse(void* parser); using namespace std; using namespace WTF; -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif - namespace WebCore { static const unsigned INVALID_NUM_PARSED_PROPERTIES = UINT_MAX; @@ -230,9 +226,6 @@ void CSSParser::setupParser(const char* prefix, const String& string, const char void CSSParser::parseSheet(CSSStyleSheet* sheet, const String& string, int startLineNumber, StyleRuleRangeMap* ruleRangeMap) { -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter); -#endif setStyleSheet(sheet); m_defaultNamespace = starAtom; // Reset the default namespace. m_ruleRangeMap = ruleRangeMap; @@ -247,37 +240,22 @@ void CSSParser::parseSheet(CSSStyleSheet* sheet, const String& string, int start m_ruleRangeMap = 0; m_currentRuleData = 0; m_rule = 0; -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__); -#endif } PassRefPtr<CSSRule> CSSParser::parseRule(CSSStyleSheet* sheet, const String& string) { -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter); -#endif setStyleSheet(sheet); m_allowNamespaceDeclarations = false; setupParser("@-webkit-rule{", string, "} "); cssyyparse(this); -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__); -#endif return m_rule.release(); } PassRefPtr<CSSRule> CSSParser::parseKeyframeRule(CSSStyleSheet *sheet, const String &string) { -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter); -#endif setStyleSheet(sheet); setupParser("@-webkit-keyframe-rule{ ", string, "} "); cssyyparse(this); -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__); -#endif return m_keyframe.release(); } @@ -440,9 +418,6 @@ bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int property bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important) { -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter); -#endif ASSERT(!declaration->stylesheet() || declaration->stylesheet()->isCSSStyleSheet()); setStyleSheet(static_cast<CSSStyleSheet*>(declaration->stylesheet())); @@ -464,9 +439,6 @@ bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int property clearProperties(); } -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__); -#endif return ok; } @@ -499,9 +471,6 @@ bool CSSParser::parseColor(RGBA32& color, const String& string, bool strict) bool CSSParser::parseColor(CSSMutableStyleDeclaration* declaration, const String& string) { -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter); -#endif ASSERT(!declaration->stylesheet() || declaration->stylesheet()->isCSSStyleSheet()); setStyleSheet(static_cast<CSSStyleSheet*>(declaration->stylesheet())); @@ -509,9 +478,6 @@ bool CSSParser::parseColor(CSSMutableStyleDeclaration* declaration, const String cssyyparse(this); m_rule = 0; -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__); -#endif return (m_numParsedProperties && m_parsedProperties[0]->m_id == CSSPropertyColor); } @@ -533,9 +499,6 @@ bool CSSParser::parseSystemColor(RGBA32& color, const String& string, Document* void CSSParser::parseSelector(const String& string, Document* doc, CSSSelectorList& selectorList) { -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter); -#endif RefPtr<CSSStyleSheet> dummyStyleSheet = CSSStyleSheet::create(doc); setStyleSheet(dummyStyleSheet.get()); @@ -549,18 +512,10 @@ void CSSParser::parseSelector(const String& string, Document* doc, CSSSelectorLi // The style sheet will be deleted right away, so it won't outlive the document. ASSERT(dummyStyleSheet->hasOneRef()); - -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__); -#endif } bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const String& string, RefPtr<CSSStyleSourceData>* styleSourceData) { -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter); -#endif - // Length of the "@-webkit-decls{" prefix. static const unsigned prefixLength = 15; @@ -599,9 +554,6 @@ bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const m_currentRuleData = 0; m_inStyleRuleOrDeclaration = false; } -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__); -#endif return ok; } @@ -610,9 +562,6 @@ bool CSSParser::parseMediaQuery(MediaList* queries, const String& string) if (string.isEmpty()) return true; -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter); -#endif ASSERT(!m_mediaQuery); // can't use { because tokenizer state switches from mediaquery to initial state when it sees { token. @@ -626,9 +575,6 @@ bool CSSParser::parseMediaQuery(MediaList* queries, const String& string) queries->appendMediaQuery(m_mediaQuery.release()); } -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__); -#endif return ok; } @@ -2016,7 +1962,6 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyTextOverline: case CSSPropertyTextUnderline: return false; - #if ENABLE(WCSS) case CSSPropertyWapInputFormat: validPrimitive = true; diff --git a/Source/WebCore/css/CSSStyleDeclaration.cpp b/Source/WebCore/css/CSSStyleDeclaration.cpp index 1c465e5..d4acc2a 100644 --- a/Source/WebCore/css/CSSStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSStyleDeclaration.cpp @@ -27,6 +27,7 @@ #include "CSSPropertyNames.h" #include "CSSRule.h" #include <wtf/ASCIICType.h> +#include <wtf/text/CString.h> using namespace WTF; diff --git a/Source/WebCore/css/StyleBase.cpp b/Source/WebCore/css/StyleBase.cpp index 5d9d79d..93dbda0 100644 --- a/Source/WebCore/css/StyleBase.cpp +++ b/Source/WebCore/css/StyleBase.cpp @@ -65,37 +65,4 @@ KURL StyleBase::baseURL() const return sheet->ownerNode()->document()->baseURL(); } -#ifdef ANDROID_INSTRUMENT -static size_t styleSize = 0; - -void* StyleBase::operator new(size_t size) -{ - styleSize += size; - return ::operator new(size); -} - -void* StyleBase::operator new[](size_t size) -{ - styleSize += size; - return ::operator new[](size); -} - -void StyleBase::operator delete(void* p, size_t size) -{ - styleSize -= size; - ::operator delete(p); -} - -void StyleBase::operator delete[](void* p, size_t size) -{ - styleSize -= size; - ::operator delete[](p); -} - -size_t StyleBase::reportStyleSize() -{ - return styleSize; -} -#endif - } diff --git a/Source/WebCore/css/StyleBase.h b/Source/WebCore/css/StyleBase.h index 94efa01..63c671e 100644 --- a/Source/WebCore/css/StyleBase.h +++ b/Source/WebCore/css/StyleBase.h @@ -72,18 +72,6 @@ namespace WebCore { StyleSheet* stylesheet(); -#ifdef ANDROID_INSTRUMENT - // Overridden to prevent the normal new from being called. - void* operator new(size_t size); - void* operator new[](size_t size); - - // Overridden to prevent the normal delete from being called. - void operator delete(void* p, size_t size); - void operator delete[](void* p, size_t size); - - static size_t reportStyleSize(); -#endif - protected: StyleBase(StyleBase* parent) : m_parent(parent) diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 6e21dc3..20dad55 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -194,10 +194,6 @@ #include "HTMLTextAreaElement.h" #endif -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif - #if ENABLE(TOUCH_EVENTS) #if USE(V8) #include "RuntimeEnabledFeatures.h" @@ -1475,10 +1471,6 @@ void Document::recalcStyle(StyleChange change) frameView->beginDeferredRepaints(); } -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::CalculateStyleTimeCounter); -#endif - ASSERT(!renderer() || renderArena()); if (!renderer() || !renderArena()) goto bail_out; @@ -1500,10 +1492,6 @@ void Document::recalcStyle(StyleChange change) if (change >= Inherit || n->childNeedsStyleRecalc() || n->needsStyleRecalc()) n->recalcStyle(change); -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::CalculateStyleTimeCounter, __FUNCTION__); -#endif - #if USE(ACCELERATED_COMPOSITING) if (view()) { bool layoutPending = view()->layoutPending() || renderer()->needsLayout(); @@ -2729,8 +2717,8 @@ void Document::processArguments(const String& features, void* data, ArgumentsCal #ifdef ANDROID_META_SUPPORT if (frame()) frame()->settings()->setMetadataSettings(keyString, valueString); -#endif if (callback && data) +#endif callback(keyString, valueString, this, data); } } diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 1fd4b92..0967ef5 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -2498,39 +2498,6 @@ Node* Node::enclosingLinkEventParentOrSelf() return 0; } -#ifdef ANDROID_INSTRUMENT -static size_t nodeSize = 0; - -void* Node::operator new(size_t size) -{ - nodeSize += size; - return ::operator new(size); -} - -void* Node::operator new[](size_t size) -{ - nodeSize += size; - return ::operator new[](size); -} - -void Node::operator delete(void* p, size_t size) -{ - nodeSize -= size; - ::operator delete(p); -} - -void Node::operator delete[](void* p, size_t size) -{ - nodeSize -= size; - ::operator delete[](p); -} - -size_t Node::reportDOMNodesSize() -{ - return nodeSize; -} -#endif - // -------- ScriptExecutionContext* Node::scriptExecutionContext() const diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h index 1fe30ad..08b1921 100644 --- a/Source/WebCore/dom/Node.h +++ b/Source/WebCore/dom/Node.h @@ -528,18 +528,6 @@ public: unsigned short compareDocumentPosition(Node*); -#ifdef ANDROID_INSTRUMENT - // Overridden to prevent the normal new from being called. - void* operator new(size_t size); - void* operator new[](size_t size); - - // Overridden to prevent the normal delete from being called. - void operator delete(void* p, size_t size); - void operator delete[](void* p, size_t size); - - static size_t reportDOMNodesSize(); -#endif - virtual Node* toNode() { return this; } virtual InputElement* toInputElement(); diff --git a/Source/WebCore/dom/ProcessingInstruction.cpp b/Source/WebCore/dom/ProcessingInstruction.cpp index 7135644..30111d8 100644 --- a/Source/WebCore/dom/ProcessingInstruction.cpp +++ b/Source/WebCore/dom/ProcessingInstruction.cpp @@ -297,26 +297,4 @@ void ProcessingInstruction::finishParsingChildren() ContainerNode::finishParsingChildren(); } -#ifdef ANDROID_INSTRUMENT -void* ProcessingInstruction::operator new(size_t size) -{ - return Node::operator new(size); -} - -void* ProcessingInstruction::operator new[](size_t size) -{ - return Node::operator new[](size); -} - -void ProcessingInstruction::operator delete(void* p, size_t size) -{ - Node::operator delete(p, size); -} - -void ProcessingInstruction::operator delete[](void* p, size_t size) -{ - Node::operator delete[](p, size); -} -#endif - } // namespace diff --git a/Source/WebCore/dom/ProcessingInstruction.h b/Source/WebCore/dom/ProcessingInstruction.h index fd98566..1be8710 100644 --- a/Source/WebCore/dom/ProcessingInstruction.h +++ b/Source/WebCore/dom/ProcessingInstruction.h @@ -56,14 +56,6 @@ public: private: ProcessingInstruction(Document*, const String& target, const String& data); -#ifdef ANDROID_INSTRUMENT - // Overridden to resolve the ambiguous - void* operator new(size_t size); - void* operator new[](size_t size); - void operator delete(void* p, size_t size); - void operator delete[](void* p, size_t size); -#endif - virtual String nodeName() const; virtual NodeType nodeType() const; virtual String nodeValue() const; diff --git a/Source/WebCore/dom/Text.cpp b/Source/WebCore/dom/Text.cpp index 906e421..c4ea0a6 100644 --- a/Source/WebCore/dom/Text.cpp +++ b/Source/WebCore/dom/Text.cpp @@ -31,6 +31,8 @@ #include "SVGNames.h" #endif +#include <wtf/text/CString.h> + #if ENABLE(WML) #include "WMLDocument.h" #include "WMLVariables.h" diff --git a/Source/WebCore/html/HTMLCanvasElement.h b/Source/WebCore/html/HTMLCanvasElement.h index 9eab209..207c384 100644 --- a/Source/WebCore/html/HTMLCanvasElement.h +++ b/Source/WebCore/html/HTMLCanvasElement.h @@ -128,22 +128,6 @@ public: void makeRenderingResultsAvailable(); -#ifdef ANDROID_INSTRUMENT - void* operator new(size_t size) { - return HTMLElement::operator new(size); - } - void* operator new[](size_t size) { - return HTMLElement::operator new[](size); - } - - void operator delete(void* p, size_t size) { - HTMLElement::operator delete(p, size); - } - void operator delete[](void* p, size_t size) { - HTMLElement::operator delete[](p, size); - } -#endif - private: HTMLCanvasElement(const QualifiedName&, Document*); diff --git a/Source/WebCore/html/HTMLDocument.cpp b/Source/WebCore/html/HTMLDocument.cpp index dd41514..a1be93d 100644 --- a/Source/WebCore/html/HTMLDocument.cpp +++ b/Source/WebCore/html/HTMLDocument.cpp @@ -438,26 +438,4 @@ bool HTMLDocument::isFrameSet() const return bodyElement && bodyElement->hasTagName(framesetTag); } -#ifdef ANDROID_INSTRUMENT -void* HTMLDocument::operator new(size_t size) -{ - return Node::operator new(size); -} - -void* HTMLDocument::operator new[](size_t size) -{ - return Node::operator new[](size); -} - -void HTMLDocument::operator delete(void* p, size_t size) -{ - Node::operator delete(p, size); -} - -void HTMLDocument::operator delete[](void* p, size_t size) -{ - Node::operator delete[](p, size); -} -#endif - } diff --git a/Source/WebCore/html/HTMLDocument.h b/Source/WebCore/html/HTMLDocument.h index 3310b71..d39f392 100644 --- a/Source/WebCore/html/HTMLDocument.h +++ b/Source/WebCore/html/HTMLDocument.h @@ -82,14 +82,6 @@ public: protected: HTMLDocument(Frame*, const KURL&); -#ifdef ANDROID_INSTRUMENT - // Overridden to resolve the ambiguous - void* operator new(size_t size); - void* operator new[](size_t size); - void operator delete(void* p, size_t size); - void operator delete[](void* p, size_t size); -#endif - private: virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&); diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp index 7cbf38b..4673109 100644 --- a/Source/WebCore/html/HTMLLinkElement.cpp +++ b/Source/WebCore/html/HTMLLinkElement.cpp @@ -504,28 +504,6 @@ void HTMLLinkElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const styleSheet->addSubresourceStyleURLs(urls); } -#ifdef ANDROID_INSTRUMENT -void* HTMLLinkElement::operator new(size_t size) -{ - return Node::operator new(size); -} - -void* HTMLLinkElement::operator new[](size_t size) -{ - return Node::operator new[](size); -} - -void HTMLLinkElement::operator delete(void* p, size_t size) -{ - Node::operator delete(p, size); -} - -void HTMLLinkElement::operator delete[](void* p, size_t size) -{ - Node::operator delete[](p, size); -} -#endif - void HTMLLinkElement::addPendingSheet(PendingSheetType type) { if (type <= m_pendingSheetType) diff --git a/Source/WebCore/html/HTMLLinkElement.h b/Source/WebCore/html/HTMLLinkElement.h index f602d38..1a6eba9 100644 --- a/Source/WebCore/html/HTMLLinkElement.h +++ b/Source/WebCore/html/HTMLLinkElement.h @@ -120,14 +120,6 @@ private: void addPendingSheet(PendingSheetType); void removePendingSheet(); -#ifdef ANDROID_INSTRUMENT - // Overridden to resolve the ambiguous - void* operator new(size_t size); - void* operator new[](size_t size); - void operator delete(void* p, size_t size); - void operator delete[](void* p, size_t size); -#endif - private: HTMLLinkElement(const QualifiedName&, Document*, bool createdByParser); diff --git a/Source/WebCore/html/parser/HTMLDocumentParser.cpp b/Source/WebCore/html/parser/HTMLDocumentParser.cpp index 8f95cc5..46dddf0 100644 --- a/Source/WebCore/html/parser/HTMLDocumentParser.cpp +++ b/Source/WebCore/html/parser/HTMLDocumentParser.cpp @@ -41,10 +41,6 @@ #include "NestingLevelIncrementer.h" #include "Settings.h" -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif - namespace WebCore { using namespace HTMLNames; @@ -318,10 +314,6 @@ void HTMLDocumentParser::insert(const SegmentedString& source) if (isStopped()) return; -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::start(android::TimeCounter::ParsingTimeCounter); -#endif - // pumpTokenizer can cause this parser to be detached from the Document, // but we need to ensure it isn't deleted yet. RefPtr<HTMLDocumentParser> protect(this); @@ -369,18 +361,12 @@ void HTMLDocumentParser::append(const SegmentedString& source) // We've gotten data off the network in a nested write. // We don't want to consume any more of the input stream now. Do // not worry. We'll consume this data in a less-nested write(). -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::ParsingTimeCounter, __FUNCTION__); -#endif return; } pumpTokenizerIfPossible(AllowYield); endIfDelayed(); -#ifdef ANDROID_INSTRUMENT - android::TimeCounter::record(android::TimeCounter::ParsingTimeCounter, __FUNCTION__); -#endif } void HTMLDocumentParser::end() diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp index 85b1541..f999fdb 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp @@ -119,11 +119,6 @@ #include "ArchiveFactory.h" #endif -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#include "RenderArena.h" -#endif - namespace WebCore { using namespace HTMLNames; @@ -1114,11 +1109,7 @@ void FrameLoader::handleFallbackContent() } void FrameLoader::provisionalLoadStarted() -{ -#ifdef ANDROID_INSTRUMENT - if (!m_frame->tree()->parent()) - android::TimeCounter::reset(); -#endif +{ if (m_stateMachine.firstLayoutDone()) m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad); m_frame->navigationScheduler()->cancel(true); @@ -2308,7 +2299,7 @@ void FrameLoader::finishedLoadingDocument(DocumentLoader* loader) if (m_stateMachine.creatingInitialEmptyDocument()) return; #endif - + #if !ENABLE(WEB_ARCHIVE) m_client->finishedLoading(loader); #else @@ -2499,12 +2490,6 @@ void FrameLoader::checkLoadCompleteForThisFrame() if (Page* page = m_frame->page()) page->progress()->progressCompleted(m_frame); - -#ifdef ANDROID_INSTRUMENT - if (!m_frame->tree()->parent() && m_frame->document()->renderArena()) - android::TimeCounter::report(m_URL, cache()->getLiveSize(), cache()->getDeadSize(), - m_frame->document()->renderArena()->reportPoolSize()); -#endif return; } diff --git a/Source/WebCore/loader/archive/android/WebArchiveAndroid.cpp b/Source/WebCore/loader/archive/android/WebArchiveAndroid.cpp index 55d7cec..048d787 100644 --- a/Source/WebCore/loader/archive/android/WebArchiveAndroid.cpp +++ b/Source/WebCore/loader/archive/android/WebArchiveAndroid.cpp @@ -36,6 +36,7 @@ #include <libxml/tree.h> #include <libxml/xmlstring.h> #include <libxml/xmlwriter.h> +#include <utils/Log.h> #include <wtf/text/CString.h> namespace WebCore { diff --git a/Source/WebCore/loader/cache/MemoryCache.h b/Source/WebCore/loader/cache/MemoryCache.h index a092eac..c9b91f9 100644 --- a/Source/WebCore/loader/cache/MemoryCache.h +++ b/Source/WebCore/loader/cache/MemoryCache.h @@ -171,12 +171,6 @@ public: void removeResourcesWithOrigin(SecurityOrigin*); void getOriginsWithCache(SecurityOriginSet& origins); -#ifdef ANDROID_INSTRUMENT - unsigned getLiveSize() { return m_liveSize; } - unsigned getDeadSize() { return m_deadSize; } -#endif - - private: MemoryCache(); ~MemoryCache(); // Not implemented to make sure nobody accidentally calls delete -- WebCore does not delete singletons. diff --git a/Source/WebCore/loader/icon/IconDatabase.cpp b/Source/WebCore/loader/icon/IconDatabase.cpp index 3cefea7..2bb22ec 100644 --- a/Source/WebCore/loader/icon/IconDatabase.cpp +++ b/Source/WebCore/loader/icon/IconDatabase.cpp @@ -73,7 +73,7 @@ static const int updateTimerDelay = 5; static bool checkIntegrityOnOpen = false; -#ifndef NDEBUG +#if !LOG_DISABLED || !ERROR_DISABLED static String urlForLogging(const String& url) { static unsigned urlTruncationLength = 120; @@ -967,7 +967,7 @@ void* IconDatabase::iconDatabaseSyncThread() LOG(IconDatabase, "(THREAD) IconDatabase sync thread started"); -#ifndef NDEBUG +#if !LOG_DISABLED double startTime = currentTime(); #endif @@ -993,7 +993,7 @@ void* IconDatabase::iconDatabaseSyncThread() if (shouldStopThreadActivity()) return syncThreadMainLoop(); -#ifndef NDEBUG +#if !LOG_DISABLED double timeStamp = currentTime(); LOG(IconDatabase, "(THREAD) Open took %.4f seconds", timeStamp - startTime); #endif @@ -1002,7 +1002,7 @@ void* IconDatabase::iconDatabaseSyncThread() if (shouldStopThreadActivity()) return syncThreadMainLoop(); -#ifndef NDEBUG +#if !LOG_DISABLED double newStamp = currentTime(); LOG(IconDatabase, "(THREAD) performOpenInitialization() took %.4f seconds, now %.4f seconds from thread start", newStamp - timeStamp, newStamp - startTime); timeStamp = newStamp; @@ -1025,7 +1025,7 @@ void* IconDatabase::iconDatabaseSyncThread() if (shouldStopThreadActivity()) return syncThreadMainLoop(); -#ifndef NDEBUG +#if !LOG_DISABLED newStamp = currentTime(); LOG(IconDatabase, "(THREAD) performImport() took %.4f seconds, now %.4f seconds from thread start", newStamp - timeStamp, newStamp - startTime); timeStamp = newStamp; @@ -1042,7 +1042,7 @@ void* IconDatabase::iconDatabaseSyncThread() if (shouldStopThreadActivity()) return syncThreadMainLoop(); -#ifndef NDEBUG +#if !LOG_DISABLED newStamp = currentTime(); LOG(IconDatabase, "(THREAD) performURLImport() took %.4f seconds. Entering main loop %.4f seconds from thread start", newStamp - timeStamp, newStamp - startTime); #endif @@ -1358,7 +1358,7 @@ void* IconDatabase::syncThreadMainLoop() while (!m_threadTerminationRequested) { m_syncLock.unlock(); -#ifndef NDEBUG +#if !LOG_DISABLED double timeStamp = currentTime(); #endif LOG(IconDatabase, "(THREAD) Main work loop starting"); @@ -1391,7 +1391,7 @@ void* IconDatabase::syncThreadMainLoop() // has asked to delay pruning static bool prunedUnretainedIcons = false; if (didWrite && !m_privateBrowsingEnabled && !prunedUnretainedIcons && !databaseCleanupCounter) { -#ifndef NDEBUG +#if !LOG_DISABLED double time = currentTime(); #endif LOG(IconDatabase, "(THREAD) Starting pruneUnretainedIcons()"); @@ -1410,7 +1410,7 @@ void* IconDatabase::syncThreadMainLoop() break; } -#ifndef NDEBUG +#if !LOG_DISABLED double newstamp = currentTime(); LOG(IconDatabase, "(THREAD) Main work loop ran for %.4f seconds, %s requested to terminate", newstamp - timeStamp, shouldStopThreadActivity() ? "was" : "was not"); #endif @@ -1458,7 +1458,7 @@ bool IconDatabase::readFromDatabase() { ASSERT_ICON_SYNC_THREAD(); -#ifndef NDEBUG +#if !LOG_DISABLED double timeStamp = currentTime(); #endif @@ -1567,7 +1567,7 @@ bool IconDatabase::writeToDatabase() { ASSERT_ICON_SYNC_THREAD(); -#ifndef NDEBUG +#if !LOG_DISABLED double timeStamp = currentTime(); #endif @@ -1772,7 +1772,7 @@ void* IconDatabase::cleanupSyncThread() { ASSERT_ICON_SYNC_THREAD(); -#ifndef NDEBUG +#if !LOG_DISABLED double timeStamp = currentTime(); #endif @@ -1792,7 +1792,7 @@ void* IconDatabase::cleanupSyncThread() deleteAllPreparedStatements(); m_syncDB.close(); -#ifndef NDEBUG +#if !LOG_DISABLED LOG(IconDatabase, "(THREAD) Final closure took %.4f seconds", currentTime() - timeStamp); #endif diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp index 8a1ad69..049f08b 100644 --- a/Source/WebCore/page/Frame.cpp +++ b/Source/WebCore/page/Frame.cpp @@ -113,10 +113,6 @@ #include "WMLNames.h" #endif -#if PLATFORM(ANDROID) -#include "WebViewCore.h" -#endif - using namespace std; namespace WebCore { diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp index 49a7d0c..a79910b 100644 --- a/Source/WebCore/page/FrameView.cpp +++ b/Source/WebCore/page/FrameView.cpp @@ -62,11 +62,6 @@ #include "TextResourceDecoder.h" #include <wtf/CurrentTime.h> -#ifdef ANDROID_INSTRUMENT -#include "FrameTree.h" -#include "TimeCounter.h" -#endif - #if USE(ACCELERATED_COMPOSITING) #include "RenderLayerCompositor.h" #endif @@ -872,11 +867,6 @@ void FrameView::layout(bool allowSubtree) return; } -#ifdef ANDROID_INSTRUMENT - if (!m_frame->tree() || !m_frame->tree()->parent()) - android::TimeCounter::start(android::TimeCounter::LayoutTimeCounter); -#endif - m_nestedLayoutCount++; if (!m_layoutRoot) { @@ -1014,10 +1004,6 @@ void FrameView::layout(bool allowSubtree) updateDashboardRegions(); #endif -#ifdef ANDROID_INSTRUMENT - if (!m_frame->tree()->parent()) - android::TimeCounter::record(android::TimeCounter::LayoutTimeCounter, __FUNCTION__); -#endif ASSERT(!root->needsLayout()); updateCanBlitOnScrollRecursively(); diff --git a/Source/WebCore/platform/Arena.cpp b/Source/WebCore/platform/Arena.cpp index 231e1b6..33980ed 100644 --- a/Source/WebCore/platform/Arena.cpp +++ b/Source/WebCore/platform/Arena.cpp @@ -255,16 +255,4 @@ void FinishArenaPool(ArenaPool *pool) FreeArenaList(pool, &pool->first, true); } -#ifdef ANDROID_INSTRUMENT -size_t ReportPoolSize(const ArenaPool* pool) -{ - size_t total = 0; - for (const Arena *a = &pool->first; a; a = a->next) - total += (a->limit - a->base); - for (const Arena *fa = arena_freelist; fa; fa = fa->next ) - total += (fa->limit - fa->base); - return total; -} -#endif - } diff --git a/Source/WebCore/platform/Arena.h b/Source/WebCore/platform/Arena.h index e937955..06e09f2 100644 --- a/Source/WebCore/platform/Arena.h +++ b/Source/WebCore/platform/Arena.h @@ -134,10 +134,6 @@ void* ArenaAllocate(ArenaPool *pool, unsigned int nb); fastFree(a); \ (a) = 0; -#ifdef ANDROID_INSTRUMENT -size_t ReportPoolSize(const ArenaPool* pool); -#endif - } #endif diff --git a/Source/WebCore/platform/NotImplemented.h b/Source/WebCore/platform/NotImplemented.h index a71e99c..e9758b0 100644 --- a/Source/WebCore/platform/NotImplemented.h +++ b/Source/WebCore/platform/NotImplemented.h @@ -38,21 +38,7 @@ #define supressNotImplementedWarning() false #endif -#if OS(ANDROID) - -#include <cutils/log.h> -#ifndef LOG_TAG -#define LOG_TAG "WebCore" -#endif -#define notImplemented() do { \ - static bool havePrinted = false; \ - if (!havePrinted && !supressNotImplementedWarning()) { \ - LOGV("%s: notImplemented", __PRETTY_FUNCTION__); \ - havePrinted = true; \ - } \ - } while (0) - -#elif defined(NDEBUG) +#if defined(NDEBUG) #define notImplemented() ((void)0) #else diff --git a/Source/WebCore/platform/android/SharedTimerAndroid.cpp b/Source/WebCore/platform/android/SharedTimerAndroid.cpp index e4f3b36..a3f3db5 100644 --- a/Source/WebCore/platform/android/SharedTimerAndroid.cpp +++ b/Source/WebCore/platform/android/SharedTimerAndroid.cpp @@ -51,7 +51,7 @@ void setSharedTimerFireTime(double fireTime) { long long timeInMs = static_cast<long long>((fireTime - WTF::currentTime()) * 1000); - LOGV("setSharedTimerFireTime: in %ld millisec", timeInMs); + ALOGV("setSharedTimerFireTime: in %ld millisec", timeInMs); if (JavaSharedClient::GetTimerClient()) JavaSharedClient::GetTimerClient()->setSharedTimer(timeInMs); } diff --git a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp index 7ec2d78..b4a619b 100644 --- a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp @@ -131,7 +131,7 @@ void BaseLayerAndroid::prefetchBasePicture(SkRect& viewport, float currentScale, viewport.fTop, viewport.fRight, viewport.fBottom, - scale); + currentScale); bounds.fLeft = static_cast<int>(floorf(viewport.fLeft * invTileWidth)) - PREFETCH_X_DIST; bounds.fTop = static_cast<int>(floorf(viewport.fTop * invTileHeight)) - PREFETCH_Y_DIST; @@ -141,7 +141,7 @@ void BaseLayerAndroid::prefetchBasePicture(SkRect& viewport, float currentScale, XLOG("prefetch rect %d %d %d %d, scale %f, preparing page %p", bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom, - scale * PREFETCH_SCALE, + prefetchScale, prefetchTiledPage); prefetchTiledPage->setScale(prefetchScale); diff --git a/Source/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp b/Source/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp index 4c5af9e..3194cb9 100644 --- a/Source/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp +++ b/Source/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp @@ -86,7 +86,7 @@ EGLContext DoubleBufferedTexture::producerAcquireContext() return EGL_NO_CONTEXT; if (m_pContext != EGL_NO_CONTEXT) { - LOGV("AquireContext has previously generated a context.\n"); + ALOGV("AquireContext has previously generated a context.\n"); return m_pContext; } @@ -110,10 +110,10 @@ EGLContext DoubleBufferedTexture::producerAcquireContext() m_textureB->lock(); m_textureA->initSourceTexture(); - LOGV("Initialized Textures A (%d)", m_textureA->getSourceTextureId()); + ALOGV("Initialized Textures A (%d)", m_textureA->getSourceTextureId()); if (m_sharedTextureMode == EglImageMode) { m_textureB->initSourceTexture(); - LOGV("Initialized Textures B (%d)", m_textureB->getSourceTextureId()); + ALOGV("Initialized Textures B (%d)", m_textureB->getSourceTextureId()); } m_textureA->unlock(); @@ -131,10 +131,10 @@ void DoubleBufferedTexture::producerDeleteTextures() if (m_sharedTextureMode == EglImageMode) m_textureB->lock(); - LOGV("Deleting Producer Textures A (%d)", m_textureA->getSourceTextureId()); + ALOGV("Deleting Producer Textures A (%d)", m_textureA->getSourceTextureId()); m_textureA->deleteSourceTexture(); if (m_sharedTextureMode == EglImageMode){ - LOGV("Deleting Producer Textures B (%d)", m_textureB->getSourceTextureId()); + ALOGV("Deleting Producer Textures B (%d)", m_textureB->getSourceTextureId()); m_textureB->deleteSourceTexture(); } @@ -150,10 +150,10 @@ void DoubleBufferedTexture::consumerDeleteTextures() if (m_sharedTextureMode == EglImageMode) m_textureB->lock(); - LOGV("Deleting Consumer Textures A (%d)", m_textureA->getTargetTextureId()); + ALOGV("Deleting Consumer Textures A (%d)", m_textureA->getTargetTextureId()); m_textureA->deleteTargetTexture(); if (m_sharedTextureMode == EglImageMode) { - LOGV("Deleting Consumer Textures B (%d)", m_textureB->getTargetTextureId()); + ALOGV("Deleting Consumer Textures B (%d)", m_textureB->getTargetTextureId()); m_textureB->deleteTargetTexture(); } @@ -165,9 +165,9 @@ void DoubleBufferedTexture::consumerDeleteTextures() TextureInfo* DoubleBufferedTexture::producerLock() { SharedTexture* sharedTex = getWriteableTexture(); - LOGV("Acquiring P Lock (%d)", sharedTex->getSourceTextureId()); + ALOGV("Acquiring P Lock (%d)", sharedTex->getSourceTextureId()); TextureInfo* texInfo = sharedTex->lockSource(); - LOGV("Acquired P Lock"); + ALOGV("Acquired P Lock"); return texInfo; } @@ -176,9 +176,9 @@ void DoubleBufferedTexture::producerRelease() { // get the writable texture and unlock it SharedTexture* sharedTex = getWriteableTexture(); - LOGV("Releasing P Lock (%d)", sharedTex->getSourceTextureId()); + ALOGV("Releasing P Lock (%d)", sharedTex->getSourceTextureId()); sharedTex->releaseSource(); - LOGV("Released P Lock (%d)", sharedTex->getSourceTextureId()); + ALOGV("Released P Lock (%d)", sharedTex->getSourceTextureId()); } void DoubleBufferedTexture::producerReleaseAndSwap() @@ -193,14 +193,14 @@ void DoubleBufferedTexture::producerReleaseAndSwap() TextureInfo* DoubleBufferedTexture::consumerLock() { SharedTexture* sharedTex = getReadableTexture(); - LOGV("Acquiring C Lock (%d)", sharedTex->getSourceTextureId()); + ALOGV("Acquiring C Lock (%d)", sharedTex->getSourceTextureId()); m_lockedConsumerTexture = sharedTex; TextureInfo* texInfo = sharedTex->lockTarget(); - LOGV("Acquired C Lock"); + ALOGV("Acquired C Lock"); if (!texInfo) - LOGV("Released C Lock (Empty)"); + ALOGV("Released C Lock (Empty)"); return texInfo; } @@ -211,7 +211,7 @@ void DoubleBufferedTexture::consumerRelease() // producer may have swapped out the readable buffer SharedTexture* sharedTex = m_lockedConsumerTexture; sharedTex->releaseTarget(); - LOGV("Released C Lock (%d)", sharedTex->getSourceTextureId()); + ALOGV("Released C Lock (%d)", sharedTex->getSourceTextureId()); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/android/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/FontAndroid.cpp index 81dbdae..8fe27a8 100644 --- a/Source/WebCore/platform/graphics/android/FontAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/FontAndroid.cpp @@ -52,6 +52,7 @@ #include <wtf/OwnPtr.h> #include <wtf/PassOwnArrayPtr.h> #include <wtf/PassOwnPtr.h> +#include <wtf/unicode/CharacterNames.h> #include <wtf/unicode/Unicode.h> #endif @@ -98,6 +99,10 @@ static bool setupForText(SkPaint* paint, GraphicsContext* gc, SkLayerDrawLooper* looper = new SkLayerDrawLooper; paint->setLooper(looper)->unref(); + // The layerDrawLooper uses at the root paint to determine the text + // encoding so we need to make sure it is properly configured. + updateForFont(paint, font); + // Specify the behavior of the looper SkLayerDrawLooper::LayerInfo info; info.fPaintBits = SkLayerDrawLooper::kEntirePaint_Bits; @@ -375,7 +380,7 @@ static int truncateFixedPointToInteger(HB_Fixed value) // can call |reset| to start over again. class TextRunWalker { public: - TextRunWalker(const TextRun&, unsigned, const Font*); + TextRunWalker(const TextRun&, unsigned, unsigned, const Font*); ~TextRunWalker(); bool isWordBreak(unsigned, bool); @@ -421,10 +426,10 @@ public: // Return the length of the array returned by |glyphs| unsigned length() const { return m_item.num_glyphs; } - // Return the x offset for each of the glyphs. Note that this is translated + // Return the offset for each of the glyphs. Note that this is translated // by the current x offset and that the x offset is updated for each script // run. - const SkScalar* xPositions() const { return m_xPositions; } + const SkPoint* positions() const { return m_positions; } // Get the advances (widths) for each glyph. const HB_Fixed* advances() const { return m_item.advances; } @@ -468,7 +473,7 @@ private: void createGlyphArrays(int); void resetGlyphArrays(); void shapeGlyphs(); - void setGlyphXPositions(bool); + void setGlyphPositions(bool); static void normalizeSpacesAndMirrorChars(const UChar* source, bool rtl, UChar* destination, int length); @@ -481,9 +486,10 @@ private: const Font* const m_font; HB_ShaperItem m_item; uint16_t* m_glyphs16; // A vector of 16-bit glyph ids. - SkScalar* m_xPositions; // A vector of x positions for each glyph. + SkPoint* m_positions; // A vector of positions for each glyph. ssize_t m_indexOfNextScriptRun; // Indexes the script run in |m_run|. const unsigned m_startingX; // Offset in pixels of the first script run. + const unsigned m_startingY; // Offset in pixels of the first script run. unsigned m_offsetX; // Offset in pixels to the start of the next script run. unsigned m_pixelWidth; // Width (in px) of the current script run. unsigned m_numCodePoints; // Code points in current script run. @@ -515,9 +521,10 @@ const char* TextRunWalker::paths[] = { "/system/fonts/DroidSansThai.ttf" }; -TextRunWalker::TextRunWalker(const TextRun& run, unsigned startingX, const Font* font) +TextRunWalker::TextRunWalker(const TextRun& run, unsigned startingX, unsigned startingY, const Font* font) : m_font(font) , m_startingX(startingX) + , m_startingY(startingY) , m_offsetX(m_startingX) , m_run(getNormalizedTextRun(run, m_normalizedRun, m_normalizedBuffer)) , m_iterateBackwards(m_run.rtl()) @@ -646,7 +653,7 @@ bool TextRunWalker::nextScriptRun() setupFontForScriptRun(); shapeGlyphs(); - setGlyphXPositions(rtl()); + setGlyphPositions(rtl()); return true; } @@ -733,6 +740,16 @@ void TextRunWalker::setupFontForScriptRun() } m_item.face = complexPlatformData->harfbuzzFace(); m_item.font->userData = const_cast<FontPlatformData*>(complexPlatformData); + + int size = complexPlatformData->size(); + m_item.font->x_ppem = size; + m_item.font->y_ppem = size; + // x_ and y_scale are the conversion factors from font design space (fEmSize) to 1/64th of device pixels in 16.16 format. + const int devicePixelFraction = 64; + const int multiplyFor16Dot16 = 1 << 16; + int scale = devicePixelFraction * size * multiplyFor16Dot16 / complexPlatformData->emSizeInFontUnits(); + m_item.font->x_scale = scale; + m_item.font->y_scale = scale; } HB_FontRec* TextRunWalker::allocHarfbuzzFont() @@ -741,13 +758,6 @@ HB_FontRec* TextRunWalker::allocHarfbuzzFont() memset(font, 0, sizeof(HB_FontRec)); font->klass = &harfbuzzSkiaClass; font->userData = 0; - // The values which harfbuzzSkiaClass returns are already scaled to - // pixel units, so we just set all these to one to disable further - // scaling. - font->x_ppem = 1; - font->y_ppem = 1; - font->x_scale = 1; - font->y_scale = 1; return font; } @@ -759,7 +769,7 @@ void TextRunWalker::deleteGlyphArrays() delete[] m_item.advances; delete[] m_item.offsets; delete[] m_glyphs16; - delete[] m_xPositions; + delete[] m_positions; } void TextRunWalker::createGlyphArrays(int size) @@ -770,7 +780,7 @@ void TextRunWalker::createGlyphArrays(int size) m_item.offsets = new HB_FixedPoint[size]; m_glyphs16 = new uint16_t[size]; - m_xPositions = new SkScalar[size]; + m_positions = new SkPoint[size]; m_item.num_glyphs = size; m_glyphsArrayCapacity = size; // Save the GlyphArrays size. @@ -786,7 +796,7 @@ void TextRunWalker::resetGlyphArrays() memset(m_item.advances, 0, size * sizeof(m_item.advances[0])); memset(m_item.offsets, 0, size * sizeof(m_item.offsets[0])); memset(m_glyphs16, 0, size * sizeof(m_glyphs16[0])); - memset(m_xPositions, 0, size * sizeof(m_xPositions[0])); + memset(m_positions, 0, size * sizeof(m_positions[0])); } void TextRunWalker::shapeGlyphs() @@ -806,7 +816,7 @@ void TextRunWalker::shapeGlyphs() } } -void TextRunWalker::setGlyphXPositions(bool isRTL) +void TextRunWalker::setGlyphPositions(bool isRTL) { int position = 0; // logClustersIndex indexes logClusters for the first (or last when @@ -821,7 +831,9 @@ void TextRunWalker::setGlyphXPositions(bool isRTL) int i = isRTL ? m_item.num_glyphs - iter - 1 : iter; m_glyphs16[i] = m_item.glyphs[i]; - m_xPositions[i] = SkIntToScalar(m_offsetX + position); + int offsetX = truncateFixedPointToInteger(m_item.offsets[i].x); + int offsetY = truncateFixedPointToInteger(m_item.offsets[i].y); + m_positions[i].set(SkIntToScalar(m_offsetX + position) + offsetX, m_startingY + offsetY); int advance = truncateFixedPointToInteger(m_item.advances[i]); // The first half of the conjunction works around the case where @@ -874,10 +886,14 @@ void TextRunWalker::normalizeSpacesAndMirrorChars(const UChar* source, bool rtl, UChar32 character; int nextPosition = position; U16_NEXT(source, nextPosition, length, character); + if (Font::treatAsSpace(character)) - character = ' '; + character = space; + else if (Font::treatAsZeroWidthSpace(character)) + character = zeroWidthSpace; else if (rtl) character = u_charMirror(character); + U16_APPEND(destination, position, length, character, error); ASSERT(!error); position = nextPosition; @@ -943,7 +959,7 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, { int fromX = -1, toX = -1, fromAdvance = -1, toAdvance = -1; - TextRunWalker walker(run, 0, this); + TextRunWalker walker(run, 0, 0, this); walker.setWordAndLetterSpacing(wordSpacing(), letterSpacing()); // Base will point to the x offset for the current script run. Note that, in @@ -970,14 +986,14 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, // find which glyph this code-point contributed to and find its x // position. int glyph = walker.logClusters()[from]; - fromX = base + walker.xPositions()[glyph]; + fromX = base + walker.positions()[glyph].x(); fromAdvance = walker.advances()[glyph]; } else from -= numCodePoints; if (toX == -1 && to < numCodePoints) { int glyph = walker.logClusters()[to]; - toX = base + walker.xPositions()[glyph]; + toX = base + walker.positions()[glyph].x(); toAdvance = walker.advances()[glyph]; } else to -= numCodePoints; @@ -1024,7 +1040,7 @@ void Font::drawComplexText(GraphicsContext* gc, TextRun const& run, SkCanvas* canvas = gc->platformContext()->mCanvas; bool haveMultipleLayers = isCanvasMultiLayered(canvas); - TextRunWalker walker(run, point.x(), this); + TextRunWalker walker(run, point.x(), point.y(), this); walker.setWordAndLetterSpacing(wordSpacing(), letterSpacing()); walker.setPadding(run.expansion()); @@ -1032,14 +1048,14 @@ void Font::drawComplexText(GraphicsContext* gc, TextRun const& run, if (fill) { walker.fontPlatformDataForScriptRun()->setupPaint(&fillPaint); adjustTextRenderMode(&fillPaint, haveMultipleLayers); - canvas->drawPosTextH(walker.glyphs(), walker.length() << 1, - walker.xPositions(), point.y(), fillPaint); + canvas->drawPosText(walker.glyphs(), walker.length() << 1, + walker.positions(), fillPaint); } if (stroke) { walker.fontPlatformDataForScriptRun()->setupPaint(&strokePaint); adjustTextRenderMode(&strokePaint, haveMultipleLayers); - canvas->drawPosTextH(walker.glyphs(), walker.length() << 1, - walker.xPositions(), point.y(), strokePaint); + canvas->drawPosText(walker.glyphs(), walker.length() << 1, + walker.positions(), strokePaint); } } } @@ -1047,7 +1063,7 @@ void Font::drawComplexText(GraphicsContext* gc, TextRun const& run, float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const { - TextRunWalker walker(run, 0, this); + TextRunWalker walker(run, 0, 0, this); walker.setWordAndLetterSpacing(wordSpacing(), letterSpacing()); return walker.widthOfFullRun(); } @@ -1079,7 +1095,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, float x, { // (Mac code ignores includePartialGlyphs, and they don't know what it's // supposed to do, so we just ignore it as well.) - TextRunWalker walker(run, 0, this); + TextRunWalker walker(run, 0, 0, this); walker.setWordAndLetterSpacing(wordSpacing(), letterSpacing()); // If this is RTL text, the first glyph from the left is actually the last diff --git a/Source/WebCore/platform/graphics/android/FontPlatformData.h b/Source/WebCore/platform/graphics/android/FontPlatformData.h index 5c3313e..1e46971 100644 --- a/Source/WebCore/platform/graphics/android/FontPlatformData.h +++ b/Source/WebCore/platform/graphics/android/FontPlatformData.h @@ -82,6 +82,7 @@ public: float size() const { return mTextSize; } unsigned hash() const; + int emSizeInFontUnits() const; bool isFixedPitch() const; #ifndef NDEBUG @@ -113,6 +114,7 @@ private: SkTypeface* mTypeface; float mTextSize; + mutable int mEmSizeInFontUnits; bool mFakeBold; bool mFakeItalic; FontOrientation mOrientation; diff --git a/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp b/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp index 3c90246..e4fa435 100644 --- a/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp @@ -33,6 +33,7 @@ #ifdef SUPPORT_COMPLEX_SCRIPTS #include "HarfbuzzSkia.h" #endif +#include "SkAdvancedTypefaceMetrics.h" #include "SkPaint.h" #include "SkTypeface.h" @@ -74,7 +75,7 @@ FontPlatformData::RefCountedHarfbuzzFace::~RefCountedHarfbuzzFace() } FontPlatformData::FontPlatformData() - : mTypeface(NULL), mTextSize(0), mFakeBold(false), mFakeItalic(false), + : mTypeface(NULL), mTextSize(0), mEmSizeInFontUnits(0), mFakeBold(false), mFakeItalic(false), mOrientation(Horizontal), mTextOrientation(TextOrientationVerticalRight) { inc_count(); @@ -87,10 +88,10 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src) SkSafeRef(src.mTypeface); } - mTypeface = src.mTypeface; - - mTextSize = src.mTextSize; - mFakeBold = src.mFakeBold; + mTypeface = src.mTypeface; + mTextSize = src.mTextSize; + mEmSizeInFontUnits = src.mEmSizeInFontUnits; + mFakeBold = src.mFakeBold; mFakeItalic = src.mFakeItalic; m_harfbuzzFace = src.m_harfbuzzFace; mOrientation = src.mOrientation; @@ -102,7 +103,7 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src) FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold, bool fakeItalic, FontOrientation orientation, TextOrientation textOrientation) - : mTypeface(tf), mTextSize(textSize), mFakeBold(fakeBold), mFakeItalic(fakeItalic), + : mTypeface(tf), mTextSize(textSize), mEmSizeInFontUnits(0), mFakeBold(fakeBold), mFakeItalic(fakeItalic), mOrientation(orientation), mTextOrientation(textOrientation) { if (hashTableDeletedFontValue() != mTypeface) { @@ -114,8 +115,8 @@ FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold } FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize) - : mTypeface(src.mTypeface), mTextSize(textSize), mFakeBold(src.mFakeBold), mFakeItalic(src.mFakeItalic), - m_harfbuzzFace(src.m_harfbuzzFace), mOrientation(src.mOrientation), mTextOrientation(src.mTextOrientation) + : mTypeface(src.mTypeface), mTextSize(textSize), mEmSizeInFontUnits(src.mEmSizeInFontUnits), mFakeBold(src.mFakeBold), mFakeItalic(src.mFakeItalic), + mOrientation(src.mOrientation), mTextOrientation(src.mTextOrientation), m_harfbuzzFace(src.m_harfbuzzFace) { if (hashTableDeletedFontValue() != mTypeface) { SkSafeRef(mTypeface); @@ -126,7 +127,7 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize) } FontPlatformData::FontPlatformData(float size, bool bold, bool oblique) - : mTypeface(NULL), mTextSize(size), mFakeBold(bold), mFakeItalic(oblique), + : mTypeface(NULL), mTextSize(size), mEmSizeInFontUnits(0), mFakeBold(bold), mFakeItalic(oblique), mOrientation(Horizontal), mTextOrientation(TextOrientationVerticalRight) { inc_count(); @@ -134,7 +135,7 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool oblique) } FontPlatformData::FontPlatformData(const FontPlatformData& src, SkTypeface* tf) - : mTypeface(tf), mTextSize(src.mTextSize), mFakeBold(src.mFakeBold), + : mTypeface(tf), mTextSize(src.mTextSize), mEmSizeInFontUnits(0), mFakeBold(src.mFakeBold), mFakeItalic(src.mFakeItalic), mOrientation(src.mOrientation), mTextOrientation(src.mTextOrientation) { @@ -158,6 +159,22 @@ FontPlatformData::~FontPlatformData() } } +int FontPlatformData::emSizeInFontUnits() const +{ + if (mEmSizeInFontUnits) + return mEmSizeInFontUnits; + + SkAdvancedTypefaceMetrics* metrics = 0; + if (mTypeface) + metrics = mTypeface->getAdvancedTypefaceMetrics(SkAdvancedTypefaceMetrics::kNo_PerGlyphInfo); + if (metrics) { + mEmSizeInFontUnits = metrics->fEmSize; + metrics->unref(); + } else + mEmSizeInFontUnits = 1000; // default value copied from Skia. + return mEmSizeInFontUnits; +} + FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src) { if (hashTableDeletedFontValue() != src.mTypeface) { @@ -167,9 +184,10 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src) SkSafeUnref(mTypeface); } - mTypeface = src.mTypeface; - mTextSize = src.mTextSize; - mFakeBold = src.mFakeBold; + mTypeface = src.mTypeface; + mEmSizeInFontUnits = src.mEmSizeInFontUnits; + mTextSize = src.mTextSize; + mFakeBold = src.mFakeBold; mFakeItalic = src.mFakeItalic; m_harfbuzzFace = src.m_harfbuzzFace; mOrientation = src.mOrientation; diff --git a/Source/WebCore/platform/graphics/android/GLUtils.cpp b/Source/WebCore/platform/graphics/android/GLUtils.cpp index 97a53fe..eb459df 100644 --- a/Source/WebCore/platform/graphics/android/GLUtils.cpp +++ b/Source/WebCore/platform/graphics/android/GLUtils.cpp @@ -370,6 +370,9 @@ GLuint GLUtils::createBaseTileGLTexture(int width, int height) GLUtils::checkGlError("glTexImage2D"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); +#ifdef DEBUG + delete pixels; +#endif return texture; } diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp index a3c82ce..1087640 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -480,8 +480,10 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect, // TODO: upload as many textures as possible within a certain time limit bool ret = ImagesManager::instance()->uploadTextures(); - if (scale < MIN_SCALE_WARNING || scale > MAX_SCALE_WARNING) + if (scale < MIN_SCALE_WARNING || scale > MAX_SCALE_WARNING) { XLOGC("WARNING, scale seems corrupted after update: %e", scale); + CRASH(); + } // gather the textures we can use TilesManager::instance()->gatherLayerTextures(); diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index 3e062f8..387c3e0 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -733,7 +733,7 @@ bool GraphicsLayerAndroid::createAnimationFromKeyframes(const KeyframeValueList& KeyframeValueList* operationsList = new KeyframeValueList(AnimatedPropertyOpacity); for (unsigned int i = 0; i < valueList.size(); i++) { FloatAnimationValue* originalValue = (FloatAnimationValue*)valueList.at(i); - PassRefPtr<TimingFunction> timingFunction(const_cast<TimingFunction*>(originalValue->timingFunction())); + RefPtr<TimingFunction> timingFunction(const_cast<TimingFunction*>(originalValue->timingFunction())); FloatAnimationValue* value = new FloatAnimationValue(originalValue->keyTime(), originalValue->value(), timingFunction); @@ -775,7 +775,7 @@ bool GraphicsLayerAndroid::createTransformAnimationsFromKeyframes(const Keyframe KeyframeValueList* operationsList = new KeyframeValueList(AnimatedPropertyWebkitTransform); for (unsigned int i = 0; i < valueList.size(); i++) { TransformAnimationValue* originalValue = (TransformAnimationValue*)valueList.at(i); - PassRefPtr<TimingFunction> timingFunction(const_cast<TimingFunction*>(originalValue->timingFunction())); + RefPtr<TimingFunction> timingFunction(const_cast<TimingFunction*>(originalValue->timingFunction())); TransformAnimationValue* value = new TransformAnimationValue(originalValue->keyTime(), originalValue->value(), timingFunction); diff --git a/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp b/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp index 691fbca..439733b 100644 --- a/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp @@ -195,7 +195,7 @@ void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sou ASSERT(destx >= 0); ASSERT(destx < m_size.width()); ASSERT(originx >= 0); - ASSERT(originx <= sourceRect.right()); + ASSERT(originx <= sourceRect.maxX()); int endx = destPoint.x() + sourceRect.maxX(); ASSERT(endx <= m_size.width()); @@ -207,7 +207,7 @@ void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sou ASSERT(desty >= 0); ASSERT(desty < m_size.height()); ASSERT(originy >= 0); - ASSERT(originy <= sourceRect.bottom()); + ASSERT(originy <= sourceRect.maxY()); int endy = destPoint.y() + sourceRect.maxY(); ASSERT(endy <= m_size.height()); diff --git a/Source/WebCore/platform/graphics/android/MediaTexture.cpp b/Source/WebCore/platform/graphics/android/MediaTexture.cpp index 1676186..f3d1756 100644 --- a/Source/WebCore/platform/graphics/android/MediaTexture.cpp +++ b/Source/WebCore/platform/graphics/android/MediaTexture.cpp @@ -283,7 +283,6 @@ void MediaTexture::setDimensions(const ANativeWindow* window, void MediaTexture::setFramerateCallback(const ANativeWindow* window, FramerateCallbackProc callback) { - XLOG("Release ANW %p (%p):(%p)", this, m_surfaceTexture.get(), m_surfaceTextureClient.get()); android::Mutex::Autolock lock(m_mediaLock); for (unsigned int i = 0; i < m_videoTextures.size(); i++) { if (m_videoTextures[i]->nativeWindow.get() == window) { diff --git a/Source/WebCore/platform/graphics/android/SharedTexture.cpp b/Source/WebCore/platform/graphics/android/SharedTexture.cpp index 74cd2c6..429c589 100644 --- a/Source/WebCore/platform/graphics/android/SharedTexture.cpp +++ b/Source/WebCore/platform/graphics/android/SharedTexture.cpp @@ -178,7 +178,7 @@ void SharedTexture::releaseSource() if (m_eglImage == EGL_NO_IMAGE_KHR && m_sourceTexture->m_width && m_sourceTexture->m_height) { GLUtils::createEGLImageFromTexture(m_sourceTexture->m_textureId, &m_eglImage); - LOGV("Generating Image (%d) 0x%x", m_sourceTexture->m_textureId, m_eglImage); + ALOGV("Generating Image (%d) 0x%x", m_sourceTexture->m_textureId, m_eglImage); glFinish(); // ensures the texture is ready to be used by the consumer } @@ -219,7 +219,7 @@ TextureInfo* SharedTexture::lockTarget() glGenTextures(1, &m_targetTexture->m_textureId); GLUtils::createTextureFromEGLImage(m_targetTexture->m_textureId, m_eglImage); - LOGV("Generating Consumer Texture from 0x%x", m_eglImage); + ALOGV("Generating Consumer Texture from 0x%x", m_eglImage); m_isNewImage = false; } return m_targetTexture; diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/TransferQueue.cpp index b92edaf..afcfb47 100644 --- a/Source/WebCore/platform/graphics/android/TransferQueue.cpp +++ b/Source/WebCore/platform/graphics/android/TransferQueue.cpp @@ -524,7 +524,7 @@ void TransferQueue::saveGLState() glGetIntegerv(GL_VIEWPORT, m_GLStateBeforeBlit.viewport); glGetBooleanv(GL_SCISSOR_TEST, m_GLStateBeforeBlit.scissor); glGetBooleanv(GL_DEPTH_TEST, m_GLStateBeforeBlit.depth); -#if DEBUG +#ifdef DEBUG glGetFloatv(GL_COLOR_CLEAR_VALUE, m_GLStateBeforeBlit.clearColor); #endif } @@ -536,7 +536,7 @@ void TransferQueue::setGLStateForCopy(int width, int height) glDisable(GL_SCISSOR_TEST); glDisable(GL_DEPTH_TEST); // Clear the content is only for debug purpose. -#if DEBUG +#ifdef DEBUG glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); #endif @@ -554,7 +554,7 @@ void TransferQueue::restoreGLState() if (m_GLStateBeforeBlit.depth[0]) glEnable(GL_DEPTH_TEST); -#if DEBUG +#ifdef DEBUG glClearColor(m_GLStateBeforeBlit.clearColor[0], m_GLStateBeforeBlit.clearColor[1], m_GLStateBeforeBlit.clearColor[2], diff --git a/Source/WebCore/rendering/InlineTextBox.cpp b/Source/WebCore/rendering/InlineTextBox.cpp index 5815b8b..e8a9c7f 100644 --- a/Source/WebCore/rendering/InlineTextBox.cpp +++ b/Source/WebCore/rendering/InlineTextBox.cpp @@ -43,6 +43,7 @@ #include "Text.h" #include "break_lines.h" #include <wtf/AlwaysInline.h> +#include <wtf/text/CString.h> using namespace std; diff --git a/Source/WebCore/rendering/RenderArena.cpp b/Source/WebCore/rendering/RenderArena.cpp index 57ed978..e15101f 100644 --- a/Source/WebCore/rendering/RenderArena.cpp +++ b/Source/WebCore/rendering/RenderArena.cpp @@ -136,11 +136,4 @@ void RenderArena::free(size_t size, void* ptr) #endif } -#ifdef ANDROID_INSTRUMENT -size_t RenderArena::reportPoolSize() const -{ - return ReportPoolSize(&m_pool); -} -#endif - } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderArena.h b/Source/WebCore/rendering/RenderArena.h index 5d2559a..e1ff535 100644 --- a/Source/WebCore/rendering/RenderArena.h +++ b/Source/WebCore/rendering/RenderArena.h @@ -53,10 +53,6 @@ public: void* allocate(size_t); void free(size_t, void*); -#ifdef ANDROID_INSTRUMENT - size_t reportPoolSize() const; -#endif - private: // Underlying arena pool ArenaPool m_pool; diff --git a/Source/WebCore/storage/AbstractDatabase.h b/Source/WebCore/storage/AbstractDatabase.h index 9279adc..e0a277f 100644 --- a/Source/WebCore/storage/AbstractDatabase.h +++ b/Source/WebCore/storage/AbstractDatabase.h @@ -36,7 +36,7 @@ #include "SQLiteDatabase.h" #include <wtf/Forward.h> #include <wtf/ThreadSafeRefCounted.h> -#ifndef NDEBUG +#if !LOG_DISABLED || !ERROR_DISABLED #include "SecurityOrigin.h" #endif @@ -109,7 +109,7 @@ protected: unsigned long m_estimatedSize; String m_filename; -#ifndef NDEBUG +#if !LOG_DISABLED || !ERROR_DISABLED String databaseDebugName() const { return m_contextThreadSecurityOrigin->toString() + "::" + m_name; } #endif diff --git a/Source/WebCore/storage/DatabaseTask.cpp b/Source/WebCore/storage/DatabaseTask.cpp index 343ae1e..ad744e5 100644 --- a/Source/WebCore/storage/DatabaseTask.cpp +++ b/Source/WebCore/storage/DatabaseTask.cpp @@ -62,7 +62,7 @@ void DatabaseTaskSynchronizer::taskCompleted() DatabaseTask::DatabaseTask(Database* database, DatabaseTaskSynchronizer* synchronizer) : m_database(database) , m_synchronizer(synchronizer) -#ifndef NDEBUG +#if !LOG_DISABLED , m_complete(false) #endif { @@ -70,13 +70,17 @@ DatabaseTask::DatabaseTask(Database* database, DatabaseTaskSynchronizer* synchro DatabaseTask::~DatabaseTask() { +#if !LOG_DISABLED ASSERT(m_complete || !m_synchronizer); +#endif } void DatabaseTask::performTask() { // Database tasks are meant to be used only once, so make sure this one hasn't been performed before. +#if !LOG_DISABLED ASSERT(!m_complete); +#endif LOG(StorageAPI, "Performing %s %p\n", debugTaskName(), this); @@ -86,7 +90,7 @@ void DatabaseTask::performTask() if (m_synchronizer) m_synchronizer->taskCompleted(); -#ifndef NDEBUG +#if !LOG_DISABLED m_complete = true; #endif } @@ -108,7 +112,7 @@ void Database::DatabaseOpenTask::doPerformTask() m_success = database()->performOpenAndVerify(m_setVersionInNewDatabase, m_code); } -#ifndef NDEBUG +#if !LOG_DISABLED const char* Database::DatabaseOpenTask::debugTaskName() const { return "DatabaseOpenTask"; @@ -128,7 +132,7 @@ void Database::DatabaseCloseTask::doPerformTask() database()->close(); } -#ifndef NDEBUG +#if !LOG_DISABLED const char* Database::DatabaseCloseTask::debugTaskName() const { return "DatabaseCloseTask"; @@ -150,7 +154,7 @@ void Database::DatabaseTransactionTask::doPerformTask() m_transaction->database()->inProgressTransactionCompleted(); } -#ifndef NDEBUG +#if !LOG_DISABLED const char* Database::DatabaseTransactionTask::debugTaskName() const { return "DatabaseTransactionTask"; @@ -172,7 +176,7 @@ void Database::DatabaseTableNamesTask::doPerformTask() m_tableNames = database()->performGetTableNames(); } -#ifndef NDEBUG +#if !LOG_DISABLED const char* Database::DatabaseTableNamesTask::debugTaskName() const { return "DatabaseTableNamesTask"; diff --git a/Source/WebCore/storage/DatabaseTask.h b/Source/WebCore/storage/DatabaseTask.h index e1df591..faadc69 100644 --- a/Source/WebCore/storage/DatabaseTask.h +++ b/Source/WebCore/storage/DatabaseTask.h @@ -90,7 +90,7 @@ private: Database* m_database; DatabaseTaskSynchronizer* m_synchronizer; -#ifndef NDEBUG +#if !LOG_DISABLED virtual const char* debugTaskName() const = 0; bool m_complete; #endif @@ -107,7 +107,7 @@ private: DatabaseOpenTask(Database*, bool setVersionInNewDatabase, DatabaseTaskSynchronizer*, ExceptionCode&, bool& success); virtual void doPerformTask(); -#ifndef NDEBUG +#if !LOG_DISABLED virtual const char* debugTaskName() const; #endif @@ -127,7 +127,7 @@ private: DatabaseCloseTask(Database*, DatabaseTaskSynchronizer*); virtual void doPerformTask(); -#ifndef NDEBUG +#if !LOG_DISABLED virtual const char* debugTaskName() const; #endif }; @@ -146,7 +146,7 @@ private: DatabaseTransactionTask(PassRefPtr<SQLTransaction>); virtual void doPerformTask(); -#ifndef NDEBUG +#if !LOG_DISABLED virtual const char* debugTaskName() const; #endif @@ -164,7 +164,7 @@ private: DatabaseTableNamesTask(Database*, DatabaseTaskSynchronizer*, Vector<String>& names); virtual void doPerformTask(); -#ifndef NDEBUG +#if !LOG_DISABLED virtual const char* debugTaskName() const; #endif diff --git a/Source/WebCore/storage/SQLTransaction.cpp b/Source/WebCore/storage/SQLTransaction.cpp index dfcd568..0b1ad25 100644 --- a/Source/WebCore/storage/SQLTransaction.cpp +++ b/Source/WebCore/storage/SQLTransaction.cpp @@ -117,7 +117,7 @@ void SQLTransaction::enqueueStatement(PassRefPtr<SQLStatement> statement) m_statementQueue.append(statement); } -#ifndef NDEBUG +#if !LOG_DISABLED const char* SQLTransaction::debugStepName(SQLTransaction::TransactionStepMethod step) { if (step == &SQLTransaction::acquireLock) diff --git a/Source/WebCore/storage/SQLTransaction.h b/Source/WebCore/storage/SQLTransaction.h index 4c84f91..a0a83ed 100644 --- a/Source/WebCore/storage/SQLTransaction.h +++ b/Source/WebCore/storage/SQLTransaction.h @@ -105,7 +105,7 @@ private: void deliverTransactionErrorCallback(); void cleanupAfterTransactionErrorCallback(); -#ifndef NDEBUG +#if !LOG_DISABLED static const char* debugStepName(TransactionStepMethod); #endif diff --git a/Source/WebCore/svg/SVGFontFaceUriElement.h b/Source/WebCore/svg/SVGFontFaceUriElement.h index ad9ba97..3806315 100644 --- a/Source/WebCore/svg/SVGFontFaceUriElement.h +++ b/Source/WebCore/svg/SVGFontFaceUriElement.h @@ -45,22 +45,6 @@ private: virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); virtual void insertedIntoDocument(); -#ifdef ANDROID_INSTRUMENT - void* operator new(size_t size) { - return SVGElement::operator new(size); - } - void* operator new[](size_t size) { - return SVGElement::operator new[](size); - } - - void operator delete(void* p, size_t size) { - SVGElement::operator delete(p, size); - } - void operator delete[](void* p, size_t size) { - SVGElement::operator delete[](p, size); - } -#endif - void loadFont(); CachedResourceHandle<CachedFont> m_cachedFont; diff --git a/Source/WebCore/xml/XSLImportRule.h b/Source/WebCore/xml/XSLImportRule.h index 3c5939d..5c0ca8a 100644 --- a/Source/WebCore/xml/XSLImportRule.h +++ b/Source/WebCore/xml/XSLImportRule.h @@ -52,22 +52,6 @@ public: bool isLoading(); void loadSheet(); -#ifdef ANDROID_INSTRUMENT - void* operator new(size_t size) { - return StyleBase::operator new(size); - } - void* operator new[](size_t size) { - return StyleBase::operator new[](size); - } - - void operator delete(void* p, size_t size) { - StyleBase::operator delete(p, size); - } - void operator delete[](void* p, size_t size) { - StyleBase::operator delete[](p, size); - } -#endif - private: XSLImportRule(XSLStyleSheet* parentSheet, const String& href); diff --git a/Source/WebKit/Android.mk b/Source/WebKit/Android.mk index bbe212c..fb6ee31 100644 --- a/Source/WebKit/Android.mk +++ b/Source/WebKit/Android.mk @@ -31,7 +31,6 @@ LOCAL_SRC_FILES := \ android/WebCoreSupport/PlatformBridge.cpp \ android/WebCoreSupport/ResourceLoaderAndroid.cpp \ android/WebCoreSupport/UrlInterceptResponse.cpp \ - android/WebCoreSupport/V8Counters.cpp ifeq ($(HTTP_STACK),chrome) LOCAL_SRC_FILES += \ @@ -55,7 +54,6 @@ LOCAL_SRC_FILES += \ android/RenderSkinMediaButton.cpp \ android/RenderSkinNinePatch.cpp \ android/RenderSkinRadio.cpp \ - android/TimeCounter.cpp \ \ android/benchmark/Intercept.cpp \ android/benchmark/MyJavaVM.cpp \ diff --git a/Source/WebKit/android/AndroidLog.h b/Source/WebKit/android/AndroidLog.h index 3d3eaaa..8f54c02 100644 --- a/Source/WebKit/android/AndroidLog.h +++ b/Source/WebKit/android/AndroidLog.h @@ -27,6 +27,7 @@ #define AndroidLog_h #ifdef ANDROID_DOM_LOGGING +#include <utils/Log.h> #include <stdio.h> extern FILE* gDomTreeFile; #define DOM_TREE_LOG_FILE "/sdcard/domTree.txt" diff --git a/Source/WebKit/android/TimeCounter.cpp b/Source/WebKit/android/TimeCounter.cpp deleted file mode 100644 index 2393f8a..0000000 --- a/Source/WebKit/android/TimeCounter.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright 2009, The Android Open Source Project - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#define LOG_TAG "WebCore" - -#include "config.h" -#include "TimeCounter.h" - -#include "MemoryCache.h" -#include "KURL.h" -#include "Node.h" -#include "SystemTime.h" -#include "StyleBase.h" -#include <sys/time.h> -#include <time.h> -#include <utils/Log.h> -#include <wtf/CurrentTime.h> -#include <wtf/text/CString.h> - -#if USE(JSC) -#include "JSDOMWindow.h" -#include <runtime/JSGlobalObject.h> -#include <runtime/JSLock.h> -#endif - -using namespace WebCore; -using namespace WTF; -using namespace JSC; - -namespace android { - -uint32_t getThreadMsec() -{ -#if defined(HAVE_POSIX_CLOCKS) - struct timespec tm; - - clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tm); - return tm.tv_sec * 1000LL + tm.tv_nsec / 1000000; -#else - struct timeval now; - struct timezone zone; - - gettimeofday(&now, &zone); - return now.tv_sec * 1000LL + now.tv_usec / 1000; -#endif -} - -#ifdef ANDROID_INSTRUMENT - -static double sStartTotalTime; -static uint32_t sStartThreadTime; -static double sLastTotalTime; -static uint32_t sLastThreadTime; - -uint32_t TimeCounter::sStartWebCoreThreadTime; -uint32_t TimeCounter::sEndWebCoreThreadTime; -bool TimeCounter::sRecordWebCoreTime; -uint32_t TimeCounter::sTotalTimeUsed[TimeCounter::TotalTimeCounterCount]; -uint32_t TimeCounter::sLastTimeUsed[TimeCounter::TotalTimeCounterCount]; -uint32_t TimeCounter::sCounter[TimeCounter::TotalTimeCounterCount]; -uint32_t TimeCounter::sLastCounter[TimeCounter::TotalTimeCounterCount]; -uint32_t TimeCounter::sStartTime[TimeCounter::TotalTimeCounterCount]; - -int QemuTracerAuto::reentry_count = 0; - -static const char* timeCounterNames[] = { - "css parsing", - "javascript", - "javascript init", - "javascript parsing", - "javascript execution", - "calculate style", - "Java callback (frame bridge)", - "parsing (may include calcStyle, Java callback or inline script execution)", - "layout", - "native 1 (frame bridge)", - "native 2 (resource load)", - "native 3 (shared timer)", - "build nav (webview core)", - "record content (webview core)", - "native 4 (webview core)", - "draw content (webview ui)", -}; - -void TimeCounter::record(enum Type type, const char* functionName) -{ - recordNoCounter(type, functionName); - sCounter[type]++; -} - -void TimeCounter::recordNoCounter(enum Type type, const char* functionName) -{ - uint32_t time = sEndWebCoreThreadTime = getThreadMsec(); - uint32_t elapsed = time - sStartTime[type]; - sTotalTimeUsed[type] += elapsed; - if (elapsed > 1000) - LOGW("***** %s() used %d ms\n", functionName, elapsed); -} - -void TimeCounter::report(const KURL& url, int live, int dead, size_t arenaSize) -{ - String urlString = url; - int totalTime = static_cast<int>((currentTime() - sStartTotalTime) * 1000); - int threadTime = getThreadMsec() - sStartThreadTime; - LOGD("*-* Total load time: %d ms, thread time: %d ms for %s\n", - totalTime, threadTime, urlString.utf8().data()); - for (Type type = (Type) 0; type < TotalTimeCounterCount; type - = (Type) (type + 1)) { - char scratch[256]; - int index = sprintf(scratch, "*-* Total %s time: %d ms", - timeCounterNames[type], sTotalTimeUsed[type]); - if (sCounter[type] > 0) - sprintf(&scratch[index], " called %d times", sCounter[type]); - LOGD("%s", scratch); - } - LOGD("Current cache has %d bytes live and %d bytes dead", live, dead); - LOGD("Current render arena takes %d bytes", arenaSize); -#if USE(JSC) - JSLock lock(false); - Heap::Statistics jsHeapStatistics = JSDOMWindow::commonJSGlobalData()->heap.statistics(); - LOGD("Current JavaScript heap size is %d and has %d bytes free", - jsHeapStatistics.size, jsHeapStatistics.free); -#endif - LOGD("Current CSS styles use %d bytes", StyleBase::reportStyleSize()); - LOGD("Current DOM nodes use %d bytes", WebCore::Node::reportDOMNodesSize()); -} - -void TimeCounter::reportNow() -{ - double current = currentTime(); - uint32_t currentThread = getThreadMsec(); - int elapsedTime = static_cast<int>((current - sLastTotalTime) * 1000); - int elapsedThreadTime = currentThread - sLastThreadTime; - LOGD("*-* Elapsed time: %d ms, ui thread time: %d ms, webcore thread time:" - " %d ms\n", elapsedTime, elapsedThreadTime, sEndWebCoreThreadTime - - sStartWebCoreThreadTime); - for (Type type = (Type) 0; type < TotalTimeCounterCount; type - = (Type) (type + 1)) { - if (sTotalTimeUsed[type] == sLastTimeUsed[type]) - continue; - char scratch[256]; - int index = sprintf(scratch, "*-* Diff %s time: %d ms", - timeCounterNames[type], sTotalTimeUsed[type] - sLastTimeUsed[type]); - if (sCounter[type] > sLastCounter[type]) - sprintf(&scratch[index], " called %d times", sCounter[type] - - sLastCounter[type]); - LOGD("%s", scratch); - } - memcpy(sLastTimeUsed, sTotalTimeUsed, sizeof(sTotalTimeUsed)); - memcpy(sLastCounter, sCounter, sizeof(sCounter)); - sLastTotalTime = current; - sLastThreadTime = currentThread; - sRecordWebCoreTime = true; -} - -void TimeCounter::reset() { - bzero(sTotalTimeUsed, sizeof(sTotalTimeUsed)); - bzero(sCounter, sizeof(sCounter)); - LOGD("*-* Start browser instrument\n"); - sStartTotalTime = currentTime(); - sStartThreadTime = getThreadMsec(); -} - -void TimeCounter::start(enum Type type) -{ - uint32_t time = getThreadMsec(); - if (sRecordWebCoreTime) { - sStartWebCoreThreadTime = time; - sRecordWebCoreTime = false; - } - sStartTime[type] = time; -} - -#endif // ANDROID_INSTRUMENT - -} diff --git a/Source/WebKit/android/TimeCounter.h b/Source/WebKit/android/TimeCounter.h deleted file mode 100644 index ecede27..0000000 --- a/Source/WebKit/android/TimeCounter.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2009, The Android Open Source Project - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TimeCounter_h -#define TimeCounter_h - -#include "hardware_legacy/qemu_tracing.h" - -namespace WebCore { - -class KURL; - -} - -namespace android { - -uint32_t getThreadMsec(); - -#ifdef ANDROID_INSTRUMENT - -class TimeCounter { -public: - enum Type { - // function base counters - CSSParseTimeCounter, - JavaScriptTimeCounter, - JavaScriptInitTimeCounter, - JavaScriptParseTimeCounter, - JavaScriptExecuteTimeCounter, - CalculateStyleTimeCounter, - JavaCallbackTimeCounter, - ParsingTimeCounter, - LayoutTimeCounter, - // file base counters - NativeCallbackTimeCounter, // WebCoreFrameBridge.cpp - ResourceTimeCounter, // WebCoreResourceLoader.cpp - SharedTimerTimeCounter, // JavaBridge.cpp - WebViewCoreBuildNavTimeCounter, - WebViewCoreRecordTimeCounter, - WebViewCoreTimeCounter, // WebViewCore.cpp - WebViewUIDrawTimeCounter, - TotalTimeCounterCount - }; - - static void record(enum Type type, const char* functionName); - static void recordNoCounter(enum Type type, const char* functionName); - static void report(const WebCore::KURL& , int live, int dead, size_t arenaSize); - static void reportNow(); - static void reset(); - static void start(enum Type type); -private: - static uint32_t sStartWebCoreThreadTime; - static uint32_t sEndWebCoreThreadTime; - static bool sRecordWebCoreTime; - static uint32_t sTotalTimeUsed[TotalTimeCounterCount]; - static uint32_t sLastTimeUsed[TotalTimeCounterCount]; - static uint32_t sCounter[TotalTimeCounterCount]; - static uint32_t sLastCounter[TotalTimeCounterCount]; - static uint32_t sStartTime[TotalTimeCounterCount]; - friend class TimeCounterAuto; -}; - -class TimeCounterAuto { -public: - TimeCounterAuto(TimeCounter::Type type) : - m_type(type), m_startTime(getThreadMsec()) {} - ~TimeCounterAuto() { - uint32_t time = getThreadMsec(); - TimeCounter::sEndWebCoreThreadTime = time; - TimeCounter::sTotalTimeUsed[m_type] += time - m_startTime; - TimeCounter::sCounter[m_type]++; - } -private: - TimeCounter::Type m_type; - uint32_t m_startTime; -}; - -class QemuTracerAuto { -public: - QemuTracerAuto() { - if (!reentry_count) - qemu_start_tracing(); - reentry_count++; - } - - ~QemuTracerAuto() { - reentry_count--; - if (!reentry_count) - qemu_stop_tracing(); - } -private: - static int reentry_count; -}; -#endif // ANDROID_INSTRUMENT - -} - -#endif diff --git a/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h b/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h index 022511a..e59fe09 100644 --- a/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h +++ b/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h @@ -45,9 +45,20 @@ #undef LOG_ASSERT #endif +// Chromium won't build without NDEBUG set, so we set it for all source files +// that use Chromium code. This means that if NDEBUG was previously unset, we +// have to redefine ASSERT() to a no-op, as this is enabled in debug builds. +// Unfortunately, ASSERT() is defined from config.h, so we can't get in first. +#ifndef NDEBUG +#define NDEBUG 1 +#undef ASSERT +#define ASSERT(assertion) (void(0)) +#endif + #include <android/net/android_network_library_impl.h> #include <android/jni/jni_utils.h> #include <base/callback.h> +#include <base/lazy_instance.h> #include <base/memory/ref_counted.h> #include <base/message_loop_proxy.h> #include <base/openssl_util.h> diff --git a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp index 0be31eb..d26d523 100644 --- a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp @@ -267,11 +267,11 @@ void FrameLoaderClientAndroid::dispatchDidReceiveIcon() { // There is a bug in webkit where cancelling an icon load is treated as a // failure. When this is fixed, we can ASSERT again that we have an icon. if (icon) { - LOGV("Received icon (%p) for %s", icon, + ALOGV("Received icon (%p) for %s", icon, url.utf8().data()); m_webFrame->didReceiveIcon(icon); } else { - LOGV("Icon data for %s unavailable, registering for notification...", + ALOGV("Icon data for %s unavailable, registering for notification...", url.utf8().data()); registerForIconNotification(); } @@ -1016,7 +1016,7 @@ WTF::PassRefPtr<WebCore::Frame> FrameLoaderClientAndroid::createFrame(const KURL newFrame->setView(frameView); newFrame->init(); newFrame->selection()->setFocused(true); - LOGV("::WebCore:: createSubFrame returning %p", newFrame); + ALOGV("::WebCore:: createSubFrame returning %p", newFrame); // The creation of the frame may have run arbitrary JavaScript that removed it from the page already. if (!pFrame->page()) @@ -1331,8 +1331,8 @@ void FrameLoaderClientAndroid::dispatchDidClearWindowObjectInWorld(DOMWrapperWor return; ASSERT(m_frame); - LOGV("::WebCore:: windowObjectCleared called on frame %p for %s\n", - m_frame, m_frame->loader()->url().string().ascii().data()); + ALOGV("::WebCore:: windowObjectCleared called on frame %p for %s\n", + m_frame, m_frame->document()->url().string().ascii().data()); m_webFrame->windowObjectCleared(m_frame); } diff --git a/Source/WebKit/android/WebCoreSupport/V8Counters.cpp b/Source/WebKit/android/WebCoreSupport/V8Counters.cpp deleted file mode 100644 index d164f9a..0000000 --- a/Source/WebKit/android/WebCoreSupport/V8Counters.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2010, The Android Open Source Project - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#ifdef ANDROID_INSTRUMENT - -#define LOG_TAG "WebCore" - -#include "config.h" -#include "V8Counters.h" - -#include "NotImplemented.h" -#include <utils/Log.h> -#include <wtf/text/CString.h> -#include <wtf/text/StringHash.h> - -#if USE(V8) - -namespace WebCore { - -V8Counters::Counter::Counter(bool isHistogram) - : m_count(0), m_sampleTotal(0), m_isHistogram(isHistogram) { } - -void V8Counters::Counter::addSample(int sample) -{ - m_count++; - m_sampleTotal += sample; -} - -HashMap<String, V8Counters::Counter*> V8Counters::m_counters; - -// static -int* V8Counters::counterForName(const char* name) -{ - Counter* counter = m_counters.get(name); - if (!counter) { - counter = new Counter(false); - m_counters.add(name, counter); - } - return *counter; -} - -// static -void* V8Counters::createHistogram(const char* name, int min, int max, - size_t buckets) -{ - Counter* counter = new Counter(true); - m_counters.add(name, counter); - return counter; -} - -// static -void V8Counters::addHistogramSample(void* histogram, int sample) -{ - Counter* counter = reinterpret_cast<Counter*>(histogram); - counter->addSample(sample); -} - -// static -void V8Counters::initCounters() -{ - static bool isInitialized = false; - if (!isInitialized) { - v8::V8::SetCounterFunction(counterForName); - v8::V8::SetCreateHistogramFunction(createHistogram); - v8::V8::SetAddHistogramSampleFunction(addHistogramSample); - isInitialized = true; - } -} - -// static -void V8Counters::dumpCounters() -{ - LOGD("+----------------------------------------+-------------+\n"); - LOGD("| Name | Value |\n"); - LOGD("+----------------------------------------+-------------+\n"); - typedef HashMap<String, V8Counters::Counter*>::iterator CounterIterator; - for (CounterIterator iter = m_counters.begin(); iter != m_counters.end(); ++iter) { - Counter* counter = iter->second; - if (counter->isHistogram()) { - LOGD("| c:%-36s | %11i |\n", iter->first.latin1().data(), counter->count()); - LOGD("| t:%-36s | %11i |\n", iter->first.latin1().data(), counter->sampleTotal()); - } else { - LOGD("| %-38s | %11i |\n", iter->first.latin1().data(), counter->count()); - } - } - LOGD("+----------------------------------------+-------------+\n"); -} - -} - -#endif // ANDROID_INSTRUMENT - -#endif // USE(V8) diff --git a/Source/WebKit/android/WebCoreSupport/V8Counters.h b/Source/WebKit/android/WebCoreSupport/V8Counters.h deleted file mode 100644 index 499b856..0000000 --- a/Source/WebKit/android/WebCoreSupport/V8Counters.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2010, The Android Open Source Project - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Counters_h -#define V8Counters_h - -#if USE(V8) - -#ifdef ANDROID_INSTRUMENT - -#include <PlatformString.h> -#include <v8.h> -#include <wtf/HashMap.h> - -namespace WebCore { - -class V8Counters { -public: - // Counter callbacks, see v8.h - static int* counterForName(const char* name); - - static void* createHistogram(const char* name, - int min, - int max, - size_t buckets); - - static void addHistogramSample(void* histogram, int sample); - - static void initCounters(); - static void dumpCounters(); -private: - class Counter { - public: - Counter(bool isHistogram); - - int count() { return m_count; } - int sampleTotal() { return m_sampleTotal; } - bool isHistogram() { return m_isHistogram; } - void addSample(int32_t sample); - - operator int*() { return &m_count; } - private: - int m_count; - int m_sampleTotal; - bool m_isHistogram; - }; - - static HashMap<String, Counter*> m_counters; -}; - -} - -#endif // ANDROID_INSTRUMENT -#endif // USE(V8) -#endif // V8Counters_h diff --git a/Source/WebKit/android/WebCoreSupport/WebCookieJar.cpp b/Source/WebKit/android/WebCoreSupport/WebCookieJar.cpp index 1dc4637..b33cbc2 100644 --- a/Source/WebKit/android/WebCoreSupport/WebCookieJar.cpp +++ b/Source/WebKit/android/WebCoreSupport/WebCookieJar.cpp @@ -98,7 +98,7 @@ static std::string databaseDirectory(bool isPrivateBrowsing) return databaseFilePath; } -scoped_refptr<WebCookieJar>* instance(bool isPrivateBrowsing) +static scoped_refptr<WebCookieJar>* instance(bool isPrivateBrowsing) { static scoped_refptr<WebCookieJar> regularInstance; static scoped_refptr<WebCookieJar> privateInstance; @@ -123,14 +123,23 @@ void WebCookieJar::cleanup(bool isPrivateBrowsing) MutexLocker lock(instanceMutex); scoped_refptr<WebCookieJar>* instancePtr = instance(isPrivateBrowsing); *instancePtr = 0; - removeFileOrDirectory(databaseDirectory(isPrivateBrowsing).c_str()); } WebCookieJar::WebCookieJar(const std::string& databaseFilePath) - : m_allowCookies(true) -{ + : m_cookieStoreInitialized(false) + , m_databaseFilePath(databaseFilePath) + , m_allowCookies(true) {} + +WebCookieJar::~WebCookieJar() { + removeFileOrDirectory(m_databaseFilePath.c_str()); +} + +void WebCookieJar::initCookieStore() { + MutexLocker lock(m_cookieStoreInitializeMutex); + if (m_cookieStoreInitialized) + return; // Setup the permissions for the file - const char* cDatabasePath = databaseFilePath.c_str(); + const char* cDatabasePath = m_databaseFilePath.c_str(); mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; if (access(cDatabasePath, F_OK) == 0) chmod(cDatabasePath, mode); @@ -140,9 +149,10 @@ WebCookieJar::WebCookieJar(const std::string& databaseFilePath) close(fd); } - FilePath cookiePath(databaseFilePath.c_str()); + FilePath cookiePath(cDatabasePath); m_cookieDb = new SQLitePersistentCookieStore(cookiePath); m_cookieStore = new net::CookieMonster(m_cookieDb.get(), 0); + m_cookieStoreInitialized = true; } bool WebCookieJar::allowCookies() @@ -157,13 +167,6 @@ void WebCookieJar::setAllowCookies(bool allow) m_allowCookies = allow; } -int WebCookieJar::getNumCookiesInDatabase() -{ - if (!m_cookieStore) - return 0; - return m_cookieStore->GetCookieMonster()->GetAllCookies().size(); -} - // From CookiePolicy in chromium int WebCookieJar::CanGetCookies(const GURL&, const GURL&) const { @@ -178,6 +181,18 @@ int WebCookieJar::CanSetCookie(const GURL&, const GURL&, const std::string&) con return m_allowCookies ? net::OK : net::ERR_ACCESS_DENIED; } +net::CookieStore* WebCookieJar::cookieStore() +{ + if (!m_cookieStoreInitialized) + initCookieStore(); + return m_cookieStore.get(); +} + +int WebCookieJar::getNumCookiesInDatabase() +{ + return cookieStore()->GetCookieMonster()->GetAllCookies().size(); +} + class FlushSemaphore : public base::RefCounted<FlushSemaphore> { public: diff --git a/Source/WebKit/android/WebCoreSupport/WebCookieJar.h b/Source/WebKit/android/WebCoreSupport/WebCookieJar.h index b6490af..25d9e78 100644 --- a/Source/WebKit/android/WebCoreSupport/WebCookieJar.h +++ b/Source/WebKit/android/WebCoreSupport/WebCookieJar.h @@ -55,9 +55,10 @@ public: static bool acceptFileSchemeCookies(); static void setAcceptFileSchemeCookies(bool); + // TODO // Instead of this it would probably be better to add the cookie methods // here so the rest of WebKit doesn't have to know about Chromium classes - net::CookieStore* cookieStore() { return m_cookieStore.get(); } + net::CookieStore* cookieStore(); net::CookiePolicy* cookiePolicy() { return this; } // Get the number of cookies that have actually been saved to flash. @@ -65,8 +66,16 @@ public: int getNumCookiesInDatabase(); private: + friend class base::RefCountedThreadSafe<WebCookieJar>; WebCookieJar(const std::string& databaseFilePath); + ~WebCookieJar(); + void initCookieStore(); +private: + bool m_cookieStoreInitialized; + WTF::Mutex m_cookieStoreInitializeMutex; + + const std::string m_databaseFilePath; scoped_refptr<SQLitePersistentCookieStore> m_cookieDb; scoped_refptr<net::CookieStore> m_cookieStore; bool m_allowCookies; diff --git a/Source/WebKit/android/WebCoreSupport/WebRequest.cpp b/Source/WebKit/android/WebCoreSupport/WebRequest.cpp index 90b0939..c239b80 100644 --- a/Source/WebKit/android/WebCoreSupport/WebRequest.cpp +++ b/Source/WebKit/android/WebCoreSupport/WebRequest.cpp @@ -30,6 +30,7 @@ #include "MainThread.h" #include "UrlInterceptResponse.h" #include "WebCoreFrameBridge.h" +#include "WebCoreJni.h" #include "WebRequestContext.h" #include "WebResourceRequest.h" #include "WebUrlLoaderClient.h" @@ -58,7 +59,24 @@ while (0) namespace android { namespace { - const int kInitialReadBufSize = 32768; +const int kInitialReadBufSize = 32768; +const char* kXRequestedWithHeader = "X-Requested-With"; + +struct RequestPackageName { + std::string value; + RequestPackageName(); +}; + +RequestPackageName::RequestPackageName() { + JNIEnv* env = JSC::Bindings::getJNIEnv(); + jclass bridgeClass = env->FindClass("android/webkit/JniUtil"); + jmethodID method = env->GetStaticMethodID(bridgeClass, "getPackageName", "()Ljava/lang/String;"); + value = jstringToStdString(env, static_cast<jstring>(env->CallStaticObjectMethod(bridgeClass, method))); + env->DeleteLocalRef(bridgeClass); +} + +base::LazyInstance<RequestPackageName> s_packageName(base::LINKER_INITIALIZED); + } WebRequest::WebRequest(WebUrlLoaderClient* loader, const WebResourceRequest& webResourceRequest) @@ -79,6 +97,7 @@ WebRequest::WebRequest(WebUrlLoaderClient* loader, const WebResourceRequest& web m_request = new net::URLRequest(gurl, this); m_request->SetExtraRequestHeaders(webResourceRequest.requestHeaders()); + m_request->SetExtraRequestHeaderByName(kXRequestedWithHeader, s_packageName.Get().value, true); m_request->set_referrer(webResourceRequest.referrer()); m_request->set_method(webResourceRequest.method()); m_request->set_load_flags(webResourceRequest.loadFlags()); diff --git a/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp index a6e58c8..3ca841f 100644 --- a/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp +++ b/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp @@ -37,6 +37,7 @@ #include "WebRequest.h" #include "WebResourceRequest.h" +#include <utils/Log.h> #include <wtf/text/CString.h> using base::Lock; diff --git a/Source/WebKit/android/WebCoreSupport/WebViewClientError.cpp b/Source/WebKit/android/WebCoreSupport/WebViewClientError.cpp index 260c76e..1857e9c 100644 --- a/Source/WebKit/android/WebCoreSupport/WebViewClientError.cpp +++ b/Source/WebKit/android/WebCoreSupport/WebViewClientError.cpp @@ -79,6 +79,7 @@ WebViewClientError ToWebViewClientError(net::Error error) { case ERR_CONNECTION_ABORTED: case ERR_CONNECTION_FAILED: case ERR_SOCKET_NOT_CONNECTED: + case ERR_CACHE_MISS: return ERROR_CONNECT; case ERR_ADDRESS_INVALID: diff --git a/Source/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp b/Source/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp index e837244..2969252 100644 --- a/Source/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp @@ -562,7 +562,7 @@ void FormManager::ExtractForms(Frame* frame) { ResetFrame(frame); - WTF::PassRefPtr<HTMLCollection> web_forms = frame->document()->forms(); + WTF::RefPtr<HTMLCollection> web_forms = frame->document()->forms(); for (size_t i = 0; i < web_forms->length(); ++i) { // Owned by |form_elements|. diff --git a/Source/WebKit/android/jni/JavaBridge.cpp b/Source/WebKit/android/jni/JavaBridge.cpp index 68eb367..60f4523 100644 --- a/Source/WebKit/android/jni/JavaBridge.cpp +++ b/Source/WebKit/android/jni/JavaBridge.cpp @@ -41,9 +41,6 @@ #include "PluginDatabase.h" #include "Timer.h" #include "TimerClient.h" -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif #include "WebCache.h" #include "WebCoreJni.h" @@ -364,7 +361,7 @@ void JavaBridge::Finalize(JNIEnv* env, jobject obj) JavaBridge* javaBridge = (JavaBridge*) (env->GetIntField(obj, gJavaBridge_ObjectID)); LOG_ASSERT(javaBridge, "Finalize should not be called twice for the same java bridge!"); - LOGV("webcore_javabridge::nativeFinalize(%p)\n", javaBridge); + ALOGV("webcore_javabridge::nativeFinalize(%p)\n", javaBridge); delete javaBridge; env->SetIntField(obj, gJavaBridge_ObjectID, 0); } @@ -374,14 +371,8 @@ void JavaBridge::SharedTimerFired(JNIEnv* env, jobject) { if (sSharedTimerFiredCallback) { -#ifdef ANDROID_INSTRUMENT - TimeCounter::start(TimeCounter::SharedTimerTimeCounter); -#endif SkAutoMemoryUsageProbe mup("JavaBridge::sharedTimerFired"); sSharedTimerFiredCallback(); -#ifdef ANDROID_INSTRUMENT - TimeCounter::record(TimeCounter::SharedTimerTimeCounter, __FUNCTION__); -#endif } } diff --git a/Source/WebKit/android/jni/PictureSet.cpp b/Source/WebKit/android/jni/PictureSet.cpp index 4d9d16c..1bd72bd 100644 --- a/Source/WebKit/android/jni/PictureSet.cpp +++ b/Source/WebKit/android/jni/PictureSet.cpp @@ -36,7 +36,6 @@ #include "SkRect.h" #include "SkRegion.h" #include "SkStream.h" -#include "TimeCounter.h" #define MAX_DRAW_TIME 100 #define MIN_SPLITTABLE 400 @@ -693,6 +692,22 @@ void PictureSet::clear() mWidth = mHeight = 0; } +uint32_t getThreadMsec() +{ +#if defined(HAVE_POSIX_CLOCKS) + struct timespec tm; + + clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tm); + return tm.tv_sec * 1000LL + tm.tv_nsec / 1000000; +#else + struct timeval now; + struct timezone zone; + + gettimeofday(&now, &zone); + return now.tv_sec * 1000LL + now.tv_usec / 1000; +#endif +} + bool PictureSet::draw(SkCanvas* canvas) { #ifdef FAST_PICTURESET diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp index d53ddb6..79494e6 100644 --- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -116,13 +116,8 @@ #elif USE(V8) #include "JavaNPObjectV8.h" #include "JavaInstanceJobjectV8.h" -#include "V8Counters.h" #endif // USE(JSC) -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif - #if ENABLE(WEB_AUTOFILL) #include "autofill/WebAutofill.h" #endif @@ -422,10 +417,7 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader, bool mainResource, bool synchronous) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif - LOGV("::WebCore:: startLoadingResource(%p, %s)", + ALOGV("::WebCore:: startLoadingResource(%p, %s)", loader, request.url().string().latin1().data()); JNIEnv* env = getJNIEnv(); @@ -449,7 +441,7 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader, + urlStr.substring(colon); } } - LOGV("%s lower=%s", __FUNCTION__, urlStr.latin1().data()); + ALOGV("%s lower=%s", __FUNCTION__, urlStr.latin1().data()); jstring jUrlStr = wtfStringToJstring(env, urlStr); jstring jMethodStr = NULL; if (!method.isEmpty()) @@ -475,7 +467,7 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader, break; } - LOGV("::WebCore:: startLoadingResource %s with cacheMode %d", urlStr.ascii().data(), cacheMode); + ALOGV("::WebCore:: startLoadingResource %s with cacheMode %d", urlStr.ascii().data(), cacheMode); ResourceHandleInternal* loaderInternal = loader->getInternal(); jstring jUsernameString = loaderInternal->m_user.isEmpty() ? @@ -500,7 +492,7 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader, if (checkException(env)) return 0; - PassRefPtr<WebCore::ResourceLoaderAndroid> h; + RefPtr<WebCore::ResourceLoaderAndroid> h; if (jLoadListener) h = WebCoreResourceLoader::create(env, jLoadListener); env->DeleteLocalRef(jLoadListener); @@ -510,10 +502,7 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader, UrlInterceptResponse* WebFrame::shouldInterceptRequest(const WTF::String& url) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif - LOGV("::WebCore:: shouldInterceptRequest(%s)", url.latin1().data()); + ALOGV("::WebCore:: shouldInterceptRequest(%s)", url.latin1().data()); JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); @@ -534,10 +523,7 @@ void WebFrame::reportError(int errorCode, const WTF::String& description, const WTF::String& failingUrl) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif - LOGV("::WebCore:: reportError(%d, %s)", errorCode, description.ascii().data()); + ALOGV("::WebCore:: reportError(%d, %s)", errorCode, description.ascii().data()); JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -573,9 +559,6 @@ WebFrame::convertIDNToUnicode(const WebCore::KURL& url) { void WebFrame::loadStarted(WebCore::Frame* frame) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -589,7 +572,7 @@ WebFrame::loadStarted(WebCore::Frame* frame) const WebCore::KURL& url = documentLoader->url(); if (url.isEmpty()) return; - LOGV("::WebCore:: loadStarted %s", url.string().ascii().data()); + ALOGV("::WebCore:: loadStarted %s", url.string().ascii().data()); bool isMainFrame = (!frame->tree() || !frame->tree()->parent()); WebCore::FrameLoadType loadType = frame->loader()->loadType(); @@ -609,7 +592,7 @@ WebFrame::loadStarted(WebCore::Frame* frame) WebCore::Image* icon = WebCore::iconDatabase().synchronousIconForPageURL(urlString, WebCore::IntSize(16, 16)); if (icon) favicon = webcoreImageToJavaBitmap(env, icon); - LOGV("favicons", "Starting load with icon %p for %s", icon, url.string().utf8().data()); + ALOGV("favicons", "Starting load with icon %p for %s", icon, url.string().utf8().data()); } jstring urlStr = wtfStringToJstring(env, urlString); @@ -633,9 +616,6 @@ WebFrame::loadStarted(WebCore::Frame* frame) void WebFrame::transitionToCommitted(WebCore::Frame* frame) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -650,9 +630,6 @@ WebFrame::transitionToCommitted(WebCore::Frame* frame) void WebFrame::didFinishLoad(WebCore::Frame* frame) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -667,7 +644,7 @@ WebFrame::didFinishLoad(WebCore::Frame* frame) const WebCore::KURL& url = documentLoader->url(); if (url.isEmpty()) return; - LOGV("::WebCore:: didFinishLoad %s", url.string().ascii().data()); + ALOGV("::WebCore:: didFinishLoad %s", url.string().ascii().data()); bool isMainFrame = (!frame->tree() || !frame->tree()->parent()); WebCore::FrameLoadType loadType = loader->loadType(); @@ -681,10 +658,7 @@ WebFrame::didFinishLoad(WebCore::Frame* frame) void WebFrame::addHistoryItem(WebCore::HistoryItem* item) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif - LOGV("::WebCore:: addHistoryItem"); + ALOGV("::WebCore:: addHistoryItem"); JNIEnv* env = getJNIEnv(); WebHistory::AddItem(mJavaFrame->history(env), item); } @@ -692,10 +666,7 @@ WebFrame::addHistoryItem(WebCore::HistoryItem* item) void WebFrame::removeHistoryItem(int index) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif - LOGV("::WebCore:: removeHistoryItem at %d", index); + ALOGV("::WebCore:: removeHistoryItem at %d", index); JNIEnv* env = getJNIEnv(); WebHistory::RemoveItem(mJavaFrame->history(env), index); } @@ -703,10 +674,7 @@ WebFrame::removeHistoryItem(int index) void WebFrame::updateHistoryIndex(int newIndex) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif - LOGV("::WebCore:: updateHistoryIndex to %d", newIndex); + ALOGV("::WebCore:: updateHistoryIndex to %d", newIndex); JNIEnv* env = getJNIEnv(); WebHistory::UpdateHistoryIndex(mJavaFrame->history(env), newIndex); } @@ -714,11 +682,8 @@ WebFrame::updateHistoryIndex(int newIndex) void WebFrame::setTitle(const WTF::String& title) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif #ifndef NDEBUG - LOGV("setTitle(%s)", title.ascii().data()); + ALOGV("setTitle(%s)", title.ascii().data()); #endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); @@ -735,10 +700,7 @@ WebFrame::setTitle(const WTF::String& title) void WebFrame::windowObjectCleared(WebCore::Frame* frame) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif - LOGV("::WebCore:: windowObjectCleared"); + ALOGV("::WebCore:: windowObjectCleared"); JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -751,9 +713,6 @@ WebFrame::windowObjectCleared(WebCore::Frame* frame) void WebFrame::setProgress(float newProgress) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -773,9 +732,6 @@ WebFrame::userAgentForURL(const WebCore::KURL* url) void WebFrame::didReceiveIcon(WebCore::Image* icon) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif LOG_ASSERT(icon, "DidReceiveIcon called without an image!"); JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); @@ -794,9 +750,6 @@ WebFrame::didReceiveIcon(WebCore::Image* icon) void WebFrame::didReceiveTouchIconURL(const WTF::String& url, bool precomposed) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -812,9 +765,6 @@ WebFrame::didReceiveTouchIconURL(const WTF::String& url, bool precomposed) void WebFrame::updateVisitedHistory(const WebCore::KURL& url, bool reload) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -831,9 +781,6 @@ WebFrame::updateVisitedHistory(const WebCore::KURL& url, bool reload) bool WebFrame::canHandleRequest(const WebCore::ResourceRequest& request) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -874,9 +821,6 @@ WebFrame::shouldSaveFormData() WebCore::Frame* WebFrame::createWindow(bool dialog, bool userGesture) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -890,9 +834,6 @@ WebFrame::createWindow(bool dialog, bool userGesture) void WebFrame::requestFocus() const { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -904,9 +845,6 @@ WebFrame::requestFocus() const void WebFrame::closeWindow(WebViewCore* webViewCore) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif assert(webViewCore); JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); @@ -925,9 +863,6 @@ struct PolicyFunctionWrapper { void WebFrame::decidePolicyForFormResubmission(WebCore::FramePolicyFunction func) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -965,9 +900,6 @@ WebFrame::density() const void WebFrame::didReceiveAuthenticationChallenge(WebUrlLoaderClient* client, const std::string& host, const std::string& realm, bool useCachedCredentials, bool suppressDialog) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -985,9 +917,6 @@ WebFrame::didReceiveAuthenticationChallenge(WebUrlLoaderClient* client, const st void WebFrame::reportSslCertError(WebUrlLoaderClient* client, int error, const std::string& cert, const std::string& url) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -1008,9 +937,6 @@ WebFrame::reportSslCertError(WebUrlLoaderClient* client, int error, const std::s void WebFrame::requestClientCert(WebUrlLoaderClient* client, const std::string& hostAndPort) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); int jHandle = reinterpret_cast<int>(client); @@ -1024,9 +950,6 @@ WebFrame::requestClientCert(WebUrlLoaderClient* client, const std::string& hostA void WebFrame::downloadStart(const std::string& url, const std::string& userAgent, const std::string& contentDisposition, const std::string& mimetype, long long contentLength) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -1047,9 +970,6 @@ WebFrame::downloadStart(const std::string& url, const std::string& userAgent, co void WebFrame::didReceiveData(const char* data, int size) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -1064,9 +984,6 @@ WebFrame::didReceiveData(const char* data, int size) { void WebFrame::didFinishLoading() { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -1078,9 +995,6 @@ WebFrame::didFinishLoading() { void WebFrame::setCertificate(const std::string& cert) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -1098,9 +1012,6 @@ void WebFrame::setCertificate(const std::string& cert) void WebFrame::autoLogin(const std::string& loginHeader) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimerCoutner::JavaCallbackTimeCounter); -#endif JNIEnv* env = getJNIEnv(); AutoJObject javaFrame = mJavaFrame->frame(env); if (!javaFrame.get()) @@ -1174,7 +1085,7 @@ void WebFrame::maybeSavePassword(WebCore::Frame* frame, const WebCore::ResourceR bool WebFrame::getUsernamePasswordFromDom(WebCore::Frame* frame, WTF::String& username, WTF::String& password) { bool found = false; - WTF::PassRefPtr<WebCore::HTMLCollection> form = frame->document()->forms(); + WTF::RefPtr<WebCore::HTMLCollection> form = frame->document()->forms(); WebCore::Node* node = form->firstItem(); while (node && !found && !node->namespaceURI().isNull() && !node->namespaceURI().isEmpty()) { @@ -1271,9 +1182,6 @@ jbyteArray WebFrame::getPostData(const WebCore::ResourceRequest& request) static void CallPolicyFunction(JNIEnv* env, jobject obj, jint func, jint decision) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "nativeCallPolicyFunction must take a valid frame pointer!"); PolicyFunctionWrapper* pFunc = (PolicyFunctionWrapper*)func; @@ -1295,12 +1203,6 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss initChromium(); #endif -#ifdef ANDROID_INSTRUMENT -#if USE(V8) - V8Counters::initCounters(); -#endif - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif // Create a new page ChromeClientAndroid* chromeC = new ChromeClientAndroid; EditorClientAndroid* editorC = new EditorClientAndroid; @@ -1362,7 +1264,7 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss WebCore::SecurityOrigin::setLocalLoadPolicy( WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData); - LOGV("::WebCore:: createFrame %p", frame); + ALOGV("::WebCore:: createFrame %p", frame); // Set the mNativeFrame field in Frame SET_NATIVE_FRAME(env, obj, (int)frame); @@ -1384,13 +1286,10 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss static void DestroyFrame(JNIEnv* env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "nativeDestroyFrame must take a valid frame pointer!"); - LOGV("::WebCore:: deleting frame %p", pFrame); + ALOGV("::WebCore:: deleting frame %p", pFrame); WebCore::FrameView* view = pFrame->view(); view->ref(); @@ -1415,9 +1314,6 @@ static void DestroyFrame(JNIEnv* env, jobject obj) static void LoadUrl(JNIEnv *env, jobject obj, jstring url, jobject headers) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "nativeLoadUrl must take a valid frame pointer!"); @@ -1463,15 +1359,12 @@ static void LoadUrl(JNIEnv *env, jobject obj, jstring url, jobject headers) env->DeleteLocalRef(set); env->DeleteLocalRef(mapClass); } - LOGV("LoadUrl %s", kurl.string().latin1().data()); + ALOGV("LoadUrl %s", kurl.string().latin1().data()); pFrame->loader()->load(request, false); } static void PostUrl(JNIEnv *env, jobject obj, jstring url, jbyteArray postData) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "nativePostUrl must take a valid frame pointer!"); @@ -1491,7 +1384,7 @@ static void PostUrl(JNIEnv *env, jobject obj, jstring url, jbyteArray postData) env->ReleaseByteArrayElements(postData, bytes, 0); } - LOGV("PostUrl %s", kurl.string().latin1().data()); + ALOGV("PostUrl %s", kurl.string().latin1().data()); WebCore::FrameLoadRequest frameRequest(pFrame->document()->securityOrigin(), request); pFrame->loader()->loadFrameRequest(frameRequest, false, false, 0, 0, WebCore::SendReferrer); } @@ -1499,9 +1392,6 @@ static void PostUrl(JNIEnv *env, jobject obj, jstring url, jbyteArray postData) static void LoadData(JNIEnv *env, jobject obj, jstring baseUrl, jstring data, jstring mimeType, jstring encoding, jstring failUrl) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "nativeLoadData must take a valid frame pointer!"); @@ -1510,7 +1400,7 @@ static void LoadData(JNIEnv *env, jobject obj, jstring baseUrl, jstring data, // Setup the substituteData const char* dataStr = env->GetStringUTFChars(data, NULL); - WTF::PassRefPtr<WebCore::SharedBuffer> sharedBuffer = + WTF::RefPtr<WebCore::SharedBuffer> sharedBuffer = WebCore::SharedBuffer::create(); LOG_ASSERT(dataStr, "nativeLoadData has a null data string."); sharedBuffer->append(dataStr, strlen(dataStr)); @@ -1526,12 +1416,9 @@ static void LoadData(JNIEnv *env, jobject obj, jstring baseUrl, jstring data, static void StopLoading(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "nativeStopLoading must take a valid frame pointer!"); - LOGV("::WebCore:: stopLoading %p", pFrame); + ALOGV("::WebCore:: stopLoading %p", pFrame); // Stop loading the page and do not send an unload event pFrame->loader()->stopForUserCancel(); @@ -1626,9 +1513,6 @@ static jstring SaveWebArchive(JNIEnv *env, jobject obj, jstring basename, jboole static jstring ExternalRepresentation(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "android_webcore_nativeExternalRepresentation must take a valid frame pointer!"); @@ -1661,9 +1545,6 @@ static StringBuilder FrameAsText(WebCore::Frame *pFrame, jboolean dumpChildFrame static jstring DocumentAsText(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "android_webcore_nativeDocumentAsText must take a valid frame pointer!"); @@ -1673,9 +1554,6 @@ static jstring DocumentAsText(JNIEnv *env, jobject obj) static jstring ChildFramesAsText(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "android_webcore_nativeDocumentAsText must take a valid frame pointer!"); @@ -1689,9 +1567,6 @@ static jstring ChildFramesAsText(JNIEnv *env, jobject obj) static void Reload(JNIEnv *env, jobject obj, jboolean allowStale) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "nativeReload must take a valid frame pointer!"); @@ -1709,9 +1584,6 @@ static void Reload(JNIEnv *env, jobject obj, jboolean allowStale) static void GoBackOrForward(JNIEnv *env, jobject obj, jint pos) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "nativeGoBackOrForward must take a valid frame pointer!"); @@ -1725,9 +1597,6 @@ static void GoBackOrForward(JNIEnv *env, jobject obj, jint pos) static jobject StringByEvaluatingJavaScriptFromString(JNIEnv *env, jobject obj, jstring script) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "stringByEvaluatingJavaScriptFromString must take a valid frame pointer!"); @@ -1831,9 +1700,6 @@ private: static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePointer, jobject javascriptObj, jstring interfaceName) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = 0; if (nativeFramePointer == 0) pFrame = GET_NATIVE_FRAME(env, obj); @@ -1843,7 +1709,7 @@ static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePoi JavaVM* vm; env->GetJavaVM(&vm); - LOGV("::WebCore:: addJSInterface: %p", pFrame); + ALOGV("::WebCore:: addJSInterface: %p", pFrame); #if USE(JSC) // Copied from qwebframe.cpp @@ -1893,17 +1759,11 @@ static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePoi static void SetCacheDisabled(JNIEnv *env, jobject obj, jboolean disabled) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::memoryCache()->setDisabled(disabled); } static jboolean CacheDisabled(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif return WebCore::memoryCache()->disabled(); } @@ -1936,17 +1796,6 @@ static void ClearWebViewCache() static void ClearCache(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#if USE(JSC) - JSC::JSLock lock(false); - JSC::Heap::Statistics jsHeapStatistics = WebCore::JSDOMWindow::commonJSGlobalData()->heap.statistics(); - LOGD("About to gc and JavaScript heap size is %d and has %d bytes free", - jsHeapStatistics.size, jsHeapStatistics.free); -#endif // USE(JSC) - LOGD("About to clear cache and current cache has %d bytes live and %d bytes dead", - memoryCache()->getLiveSize(), memoryCache()->getDeadSize()); -#endif // ANDROID_INSTRUMENT ClearWebCoreCache(); ClearWebViewCache(); #if USE(JSC) @@ -1960,9 +1809,6 @@ static void ClearCache(JNIEnv *env, jobject obj) static jboolean DocumentHasImages(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "DocumentHasImages must take a valid frame pointer!"); @@ -1971,14 +1817,11 @@ static jboolean DocumentHasImages(JNIEnv *env, jobject obj) static jboolean HasPasswordField(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "HasPasswordField must take a valid frame pointer!"); bool found = false; - WTF::PassRefPtr<WebCore::HTMLCollection> form = pFrame->document()->forms(); + WTF::RefPtr<WebCore::HTMLCollection> form = pFrame->document()->forms(); WebCore::Node* node = form->firstItem(); // Null/Empty namespace means that node is not created in HTMLFormElement // class, but just normal Element class. @@ -2001,9 +1844,6 @@ static jboolean HasPasswordField(JNIEnv *env, jobject obj) static jobjectArray GetUsernamePassword(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "GetUsernamePassword must take a valid frame pointer!"); jobjectArray strArray = NULL; @@ -2022,16 +1862,13 @@ static jobjectArray GetUsernamePassword(JNIEnv *env, jobject obj) static void SetUsernamePassword(JNIEnv *env, jobject obj, jstring username, jstring password) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); LOG_ASSERT(pFrame, "SetUsernamePassword must take a valid frame pointer!"); WebCore::HTMLInputElement* usernameEle = NULL; WebCore::HTMLInputElement* passwordEle = NULL; bool found = false; - WTF::PassRefPtr<WebCore::HTMLCollection> form = pFrame->document()->forms(); + WTF::RefPtr<WebCore::HTMLCollection> form = pFrame->document()->forms(); WebCore::Node* node = form->firstItem(); while (node && !found && !node->namespaceURI().isNull() && !node->namespaceURI().isEmpty()) { @@ -2109,11 +1946,8 @@ WebFrame::saveFormData(HTMLFormElement* form) static void OrientationChanged(JNIEnv *env, jobject obj, int orientation) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); -#endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); - LOGV("Sending orientation: %d", orientation); + ALOGV("Sending orientation: %d", orientation); pFrame->sendOrientationChangeEvent(orientation); } @@ -2127,7 +1961,8 @@ static jboolean GetShouldStartScrolledRight(JNIEnv *env, jobject obj, RenderStyle* style = document->renderer()->style(); WritingMode writingMode = style->writingMode(); LOG_ASSERT(writingMode != WebCore::BottomToTopWritingMode, - "BottomToTopWritingMode isn't supported"); + "BottomToTopWritingMode isn't possible in any " + "language and cannot be specified in w3c writing-mode."); if (writingMode == WebCore::RightToLeftWritingMode) startScrolledRight = true; // vertical-rl pages start scrolled right else if (writingMode == WebCore::TopToBottomWritingMode) diff --git a/Source/WebKit/android/jni/WebCoreResourceLoader.cpp b/Source/WebKit/android/jni/WebCoreResourceLoader.cpp index f9acc97..3aa4422 100644 --- a/Source/WebKit/android/jni/WebCoreResourceLoader.cpp +++ b/Source/WebKit/android/jni/WebCoreResourceLoader.cpp @@ -34,9 +34,6 @@ #include "ResourceHandleInternal.h" #include "ResourceResponse.h" #include "SkUtils.h" -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif #include "WebCoreJni.h" #include <JNIHelp.h> @@ -133,10 +130,6 @@ bool WebCoreResourceLoader::willLoadFromCache(const WebCore::KURL& url, int64_t // ---------------------------------------------------------------------------- void WebCoreResourceLoader::SetResponseHeader(JNIEnv* env, jobject obj, jint nativeResponse, jstring key, jstring val) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::ResourceTimeCounter); -#endif - WebCore::ResourceResponse* response = (WebCore::ResourceResponse*)nativeResponse; LOG_ASSERT(response, "nativeSetResponseHeader must take a valid response pointer!"); @@ -149,20 +142,17 @@ jint WebCoreResourceLoader::CreateResponse(JNIEnv* env, jobject obj, jstring url jstring statusText, jstring mimeType, jlong expectedLength, jstring encoding) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::ResourceTimeCounter); -#endif LOG_ASSERT(url, "Must have a url in the response!"); WebCore::KURL kurl(WebCore::ParsedURLString, jstringToWtfString(env, url)); WTF::String encodingStr; WTF::String mimeTypeStr; if (mimeType) { mimeTypeStr = jstringToWtfString(env, mimeType); - LOGV("Response setMIMEType: %s", mimeTypeStr.latin1().data()); + ALOGV("Response setMIMEType: %s", mimeTypeStr.latin1().data()); } if (encoding) { encodingStr = jstringToWtfString(env, encoding); - LOGV("Response setTextEncodingName: %s", encodingStr.latin1().data()); + ALOGV("Response setTextEncodingName: %s", encodingStr.latin1().data()); } WebCore::ResourceResponse* response = new WebCore::ResourceResponse( kurl, mimeTypeStr, (long long)expectedLength, @@ -171,16 +161,13 @@ jint WebCoreResourceLoader::CreateResponse(JNIEnv* env, jobject obj, jstring url if (statusText) { WTF::String status = jstringToWtfString(env, statusText); response->setHTTPStatusText(status); - LOGV("Response setStatusText: %s", status.latin1().data()); + ALOGV("Response setStatusText: %s", status.latin1().data()); } return (int)response; } void WebCoreResourceLoader::ReceivedResponse(JNIEnv* env, jobject obj, jint nativeResponse) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::ResourceTimeCounter); -#endif WebCore::ResourceHandle* handle = GET_NATIVE_HANDLE(env, obj); LOG_ASSERT(handle, "nativeReceivedResponse must take a valid handle!"); // ResourceLoader::didFail() can set handle to be NULL, we need to check @@ -196,10 +183,7 @@ void WebCoreResourceLoader::ReceivedResponse(JNIEnv* env, jobject obj, jint nati void WebCoreResourceLoader::AddData(JNIEnv* env, jobject obj, jbyteArray dataArray, jint length) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::ResourceTimeCounter); -#endif - LOGV("webcore_resourceloader data(%d)", length); + ALOGV("webcore_resourceloader data(%d)", length); WebCore::ResourceHandle* handle = GET_NATIVE_HANDLE(env, obj); LOG_ASSERT(handle, "nativeAddData must take a valid handle!"); @@ -219,10 +203,7 @@ void WebCoreResourceLoader::AddData(JNIEnv* env, jobject obj, jbyteArray dataArr void WebCoreResourceLoader::Finished(JNIEnv* env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::ResourceTimeCounter); -#endif - LOGV("webcore_resourceloader finished"); + ALOGV("webcore_resourceloader finished"); WebCore::ResourceHandle* handle = GET_NATIVE_HANDLE(env, obj); LOG_ASSERT(handle, "nativeFinished must take a valid handle!"); // ResourceLoader::didFail() can set handle to be NULL, we need to check @@ -236,10 +217,7 @@ void WebCoreResourceLoader::Finished(JNIEnv* env, jobject obj) jstring WebCoreResourceLoader::RedirectedToUrl(JNIEnv* env, jobject obj, jstring baseUrl, jstring redirectTo, jint nativeResponse) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::ResourceTimeCounter); -#endif - LOGV("webcore_resourceloader redirectedToUrl"); + ALOGV("webcore_resourceloader redirectedToUrl"); WebCore::ResourceHandle* handle = GET_NATIVE_HANDLE(env, obj); LOG_ASSERT(handle, "nativeRedirectedToUrl must take a valid handle!"); // ResourceLoader::didFail() can set handle to be NULL, we need to check @@ -275,10 +253,7 @@ jstring WebCoreResourceLoader::RedirectedToUrl(JNIEnv* env, jobject obj, void WebCoreResourceLoader::Error(JNIEnv* env, jobject obj, jint id, jstring description, jstring failingUrl) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::ResourceTimeCounter); -#endif - LOGV("webcore_resourceloader error"); + ALOGV("webcore_resourceloader error"); WebCore::ResourceHandle* handle = GET_NATIVE_HANDLE(env, obj); LOG_ASSERT(handle, "nativeError must take a valid handle!"); // ResourceLoader::didFail() can set handle to be NULL, we need to check diff --git a/Source/WebKit/android/jni/WebHistory.cpp b/Source/WebKit/android/jni/WebHistory.cpp index 7ec73a3..42a7ecf 100644 --- a/Source/WebKit/android/jni/WebHistory.cpp +++ b/Source/WebKit/android/jni/WebHistory.cpp @@ -375,7 +375,7 @@ static void write_string(WTF::Vector<char>& v, const WTF::String& str) char* data = v.begin() + vectorLen; // Write the actual string int l = SkUTF16_ToUTF8(str.characters(), strLen, data); - LOGV("Writing string %d %.*s", l, l, data); + LOG_VERBOSE("Writing string %d %.*s", l, l, data); // Go back and write the utf8 length. Subtract sizeof(unsigned) from // data to get the position to write the length. memcpy(data - sizeof(unsigned), (char*)&l, sizeof(unsigned)); @@ -417,10 +417,10 @@ static void write_item(WTF::Vector<char>& v, WebCore::HistoryItem* item) LOG_ASSERT(bridge, "We should have a bridge here!"); // Screen scale const float scale = bridge->scale(); - LOGV("Writing scale %f", scale); + LOG_VERBOSE("Writing scale %f", scale); v.append((char*)&scale, sizeof(float)); const float textWrapScale = bridge->textWrapScale(); - LOGV("Writing text wrap scale %f", textWrapScale); + LOG_VERBOSE("Writing text wrap scale %f", textWrapScale); v.append((char*)&textWrapScale, sizeof(float)); // Scroll position. @@ -433,19 +433,19 @@ static void write_item(WTF::Vector<char>& v, WebCore::HistoryItem* item) const WTF::Vector<WTF::String>& docState = item->documentState(); WTF::Vector<WTF::String>::const_iterator end = docState.end(); unsigned stateSize = docState.size(); - LOGV("Writing docState %d", stateSize); + LOG_VERBOSE("Writing docState %d", stateSize); v.append((char*)&stateSize, sizeof(unsigned)); for (WTF::Vector<WTF::String>::const_iterator i = docState.begin(); i != end; ++i) { write_string(v, *i); } // Is target item - LOGV("Writing isTargetItem %d", item->isTargetItem()); + LOG_VERBOSE("Writing isTargetItem %d", item->isTargetItem()); v.append((char)item->isTargetItem()); // Children count unsigned childCount = item->children().size(); - LOGV("Writing childCount %d", childCount); + LOG_VERBOSE("Writing childCount %d", childCount); v.append((char*)&childCount, sizeof(unsigned)); } @@ -490,12 +490,12 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, // Read the original url // Read the expected length of the string. - int l; + size_t l; memcpy(&l, data, sizeofUnsigned); // Increment data pointer by the size of an unsigned int. data += sizeofUnsigned; if (l) { - LOGV("Original url %d %.*s", l, l, data); + LOG_VERBOSE("Original url %d %.*s", l, l, data); // If we have a length, check if that length exceeds the data length // and return null if there is not enough data. if (data + l < end) @@ -513,7 +513,7 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, memcpy(&l, data, sizeofUnsigned); data += sizeofUnsigned; if (l) { - LOGV("Url %d %.*s", l, l, data); + LOG_VERBOSE("Url %d %.*s", l, l, data); if (data + l < end) newItem->setURLString(e.decode(data, l)); else @@ -527,7 +527,7 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, memcpy(&l, data, sizeofUnsigned); data += sizeofUnsigned; if (l) { - LOGV("Title %d %.*s", l, l, data); + LOG_VERBOSE("Title %d %.*s", l, l, data); if (data + l < end) newItem->setTitle(e.decode(data, l)); else @@ -539,13 +539,13 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, // Generate a new ResourceRequest object for populating form information. WTF::String formContentType; - WTF::PassRefPtr<WebCore::FormData> formData = NULL; + WTF::RefPtr<WebCore::FormData> formData = NULL; // Read the form content type memcpy(&l, data, sizeofUnsigned); data += sizeofUnsigned; if (l) { - LOGV("Content type %d %.*s", l, l, data); + LOG_VERBOSE("Content type %d %.*s", l, l, data); if (data + l < end) formContentType = e.decode(data, l); else @@ -559,7 +559,7 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, memcpy(&l, data, sizeofUnsigned); data += sizeofUnsigned; if (l) { - LOGV("Form data %d %.*s", l, l, data); + LOG_VERBOSE("Form data %d %.*s", l, l, data); if (data + l < end) formData = WebCore::FormData::create(data, l); else @@ -591,7 +591,7 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, memcpy(&l, data, sizeofUnsigned); data += sizeofUnsigned; if (l) { - LOGV("Target %d %.*s", l, l, data); + LOG_VERBOSE("Target %d %.*s", l, l, data); if (data + l < end) newItem->setTarget(e.decode(data, l)); else @@ -606,11 +606,11 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, float fValue; // Read the screen scale memcpy(&fValue, data, sizeof(float)); - LOGV("Screen scale %f", fValue); + LOG_VERBOSE("Screen scale %f", fValue); bridge->setScale(fValue); data += sizeof(float); memcpy(&fValue, data, sizeofUnsigned); - LOGV("Text wrap scale %f", fValue); + LOG_VERBOSE("Text wrap scale %f", fValue); bridge->setTextWrapScale(fValue); data += sizeof(float); @@ -631,7 +631,7 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, // Read the document state memcpy(&l, data, sizeofUnsigned); - LOGV("Document state %d", l); + LOG_VERBOSE("Document state %d", l); data += sizeofUnsigned; if (l) { // Check if we have enough data to at least parse the sizes of each @@ -653,7 +653,7 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, docState.append(e.decode(data, strLen)); else return false; - LOGV("\t\t%d %.*s", strLen, strLen, data); + LOG_VERBOSE("\t\t%d %.*s", strLen, strLen, data); data += strLen; } newItem->setDocumentState(docState); @@ -668,7 +668,7 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, unsigned char c = (unsigned char)data[0]; if (c > 1) return false; - LOGV("Target item %d", c); + LOG_VERBOSE("Target item %d", c); newItem->setIsTargetItem((bool)c); data++; if (end - data < sizeofUnsigned) @@ -676,7 +676,7 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, // Read the child count memcpy(&l, data, sizeofUnsigned); - LOGV("Child count %d", l); + LOG_VERBOSE("Child count %d", l); data += sizeofUnsigned; *pData = data; if (l) { @@ -686,7 +686,7 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, while (l--) { // No need to check the length each time because read_item_recursive // will return null if there isn't enough data left to parse. - WTF::PassRefPtr<WebCore::HistoryItem> child = WebCore::HistoryItem::create(); + WTF::RefPtr<WebCore::HistoryItem> child = WebCore::HistoryItem::create(); // Set a bridge that will not call into java. child->setBridge(new WebHistoryItem(static_cast<WebHistoryItem*>(bridge))); // Read the child item. diff --git a/Source/WebKit/android/jni/WebIconDatabase.cpp b/Source/WebKit/android/jni/WebIconDatabase.cpp index d5f8947..e46b600 100644 --- a/Source/WebKit/android/jni/WebIconDatabase.cpp +++ b/Source/WebKit/android/jni/WebIconDatabase.cpp @@ -185,7 +185,7 @@ static void Open(JNIEnv* env, jobject obj, jstring path) } } if (didSetPermissions) { - LOGV("Opening WebIconDatabase file '%s'", pathStr.latin1().data()); + ALOGV("Opening WebIconDatabase file '%s'", pathStr.latin1().data()); bool res = iconDb.open(pathStr, WebCore::IconDatabase::defaultDatabaseFilename()); if (!res) LOGE("Open failed!"); @@ -200,7 +200,7 @@ static void Close(JNIEnv* env, jobject obj) static void RemoveAllIcons(JNIEnv* env, jobject obj) { - LOGV("Removing all icons"); + ALOGV("Removing all icons"); WebCore::iconDatabase().removeAllIcons(); } @@ -212,7 +212,7 @@ static jobject IconForPageUrl(JNIEnv* env, jobject obj, jstring url) // FIXME: This method should not be used from outside WebCore and will be removed. // http://trac.webkit.org/changeset/81484 WebCore::Image* icon = WebCore::iconDatabase().synchronousIconForPageURL(urlStr, WebCore::IntSize(16, 16)); - LOGV("Retrieving icon for '%s' %p", urlStr.latin1().data(), icon); + ALOGV("Retrieving icon for '%s' %p", urlStr.latin1().data(), icon); return webcoreImageToJavaBitmap(env, icon); } @@ -221,7 +221,7 @@ static void RetainIconForPageUrl(JNIEnv* env, jobject obj, jstring url) LOG_ASSERT(url, "No url given to retainIconForPageUrl"); WTF::String urlStr = jstringToWtfString(env, url); - LOGV("Retaining icon for '%s'", urlStr.latin1().data()); + ALOGV("Retaining icon for '%s'", urlStr.latin1().data()); WebCore::iconDatabase().retainIconForPageURL(urlStr); } @@ -230,7 +230,7 @@ static void ReleaseIconForPageUrl(JNIEnv* env, jobject obj, jstring url) LOG_ASSERT(url, "No url given to releaseIconForPageUrl"); WTF::String urlStr = jstringToWtfString(env, url); - LOGV("Releasing icon for '%s'", urlStr.latin1().data()); + ALOGV("Releasing icon for '%s'", urlStr.latin1().data()); WebCore::iconDatabase().releaseIconForPageURL(urlStr); } diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 6cc15d7..08b0219 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -131,7 +131,6 @@ #if USE(V8) #include "ScriptController.h" -#include "V8Counters.h" #include <wtf/text/CString.h> #endif @@ -152,10 +151,6 @@ FILE* gDomTreeFile = 0; FILE* gRenderTreeFile = 0; #endif -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif - #if USE(ACCELERATED_COMPOSITING) #include "GraphicsLayerAndroid.h" #include "RenderLayerCompositor.h" @@ -588,11 +583,6 @@ void WebViewCore::recordPictureSet(PictureSet* content) if (!success) return; - { // collect WebViewCoreRecordTimeCounter after layoutIfNeededRecursive -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreRecordTimeCounter); -#endif - // if the webkit page dimensions changed, discard the pictureset and redraw. WebCore::FrameView* view = m_mainFrame->view(); int width = view->contentsWidth(); @@ -710,8 +700,6 @@ void WebViewCore::recordPictureSet(PictureSet* content) } #endif - } // WebViewCoreRecordTimeCounter - WebCore::Node* oldFocusNode = currentFocus(); m_frameCacheOutOfDate = true; WebCore::IntRect oldBounds; @@ -1085,7 +1073,7 @@ void WebViewCore::didFirstLayout() const WebCore::KURL& url = m_mainFrame->document()->url(); if (url.isEmpty()) return; - LOGV("::WebCore:: didFirstLayout %s", url.string().ascii().data()); + ALOGV("::WebCore:: didFirstLayout %s", url.string().ascii().data()); WebCore::FrameLoadType loadType = m_mainFrame->loader()->loadType(); @@ -1597,9 +1585,6 @@ void WebViewCore::updateFrameCache() LOGW("updateFrameCache: pending style recalc, ignoring."); return; } -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreBuildNavTimeCounter); -#endif m_frameCacheOutOfDate = false; m_temp = new CachedRoot(); m_temp->init(m_mainFrame, &m_history); @@ -2231,7 +2216,7 @@ String WebViewCore::modifySelectionTextNavigationAxis(DOMSelection* selection, i if (m_currentNodeDomNavigationAxis && CacheBuilder::validNode(m_mainFrame, m_mainFrame, m_currentNodeDomNavigationAxis)) { - PassRefPtr<Range> rangeRef = + RefPtr<Range> rangeRef = selection->frame()->document()->createRange(); rangeRef->selectNode(m_currentNodeDomNavigationAxis, ec); m_currentNodeDomNavigationAxis = 0; @@ -2243,7 +2228,7 @@ String WebViewCore::modifySelectionTextNavigationAxis(DOMSelection* selection, i } else if (m_cursorNode && CacheBuilder::validNode(m_mainFrame, m_mainFrame, m_cursorNode)) { - PassRefPtr<Range> rangeRef = + RefPtr<Range> rangeRef = selection->frame()->document()->createRange(); rangeRef->selectNode(reinterpret_cast<Node*>(m_cursorNode), ec); if (ec) @@ -2447,13 +2432,13 @@ String WebViewCore::modifySelectionTextNavigationAxis(DOMSelection* selection, i scrollNodeIntoView(m_mainFrame, selection->anchorNode()); // format markup for the visible content - PassRefPtr<Range> range = selection->getRangeAt(0, ec); + RefPtr<Range> range = selection->getRangeAt(0, ec); if (ec) return String(); IntRect bounds = range->boundingBox(); selectAt(bounds.center().x(), bounds.center().y()); markup = formatMarkup(selection); - LOGV("Selection markup: %s", markup.utf8().data()); + ALOGV("Selection markup: %s", markup.utf8().data()); return markup; } @@ -2712,7 +2697,7 @@ String WebViewCore::modifySelectionDomNavigationAxis(DOMSelection* selection, in m_currentNodeDomNavigationAxis = currentNode; scrollNodeIntoView(m_mainFrame, currentNode); String selectionString = createMarkup(currentNode); - LOGV("Selection markup: %s", selectionString.utf8().data()); + ALOGV("Selection markup: %s", selectionString.utf8().data()); return selectionString; } return String(); @@ -2774,7 +2759,7 @@ String WebViewCore::formatMarkup(DOMSelection* selection) { ExceptionCode ec = 0; String markup = String(); - PassRefPtr<Range> wholeRange = selection->getRangeAt(0, ec); + RefPtr<Range> wholeRange = selection->getRangeAt(0, ec); if (ec) return String(); if (!wholeRange->startContainer() || !wholeRange->startContainer()) @@ -2784,7 +2769,7 @@ String WebViewCore::formatMarkup(DOMSelection* selection) Node* firstNode = wholeRange->firstNode(); Node* pastLastNode = wholeRange->pastLastNode(); Node* currentNode = firstNode; - PassRefPtr<Range> currentRange; + RefPtr<Range> currentRange; while (currentNode != pastLastNode) { Node* nextNode = currentNode->traverseNextNode(); @@ -3935,9 +3920,6 @@ static jstring RequestLabel(JNIEnv *env, jobject obj, int framePointer, static void ClearContent(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); viewImpl->clearContent(); } @@ -3951,11 +3933,8 @@ static void SetSize(JNIEnv *env, jobject obj, jint width, jint height, jint textWrapWidth, jfloat scale, jint screenWidth, jint screenHeight, jint anchorX, jint anchorY, jboolean ignoreHeight) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); - LOGV("webviewcore::nativeSetSize(%u %u)\n viewImpl: %p", (unsigned)width, (unsigned)height, viewImpl); + ALOGV("webviewcore::nativeSetSize(%u %u)\n viewImpl: %p", (unsigned)width, (unsigned)height, viewImpl); LOG_ASSERT(viewImpl, "viewImpl not set in nativeSetSize"); viewImpl->setSizeScreenWidthAndScale(width, height, textWrapWidth, scale, screenWidth, screenHeight, anchorX, anchorY, ignoreHeight); @@ -3963,9 +3942,6 @@ static void SetSize(JNIEnv *env, jobject obj, jint width, jint height, static void SetScrollOffset(JNIEnv *env, jobject obj, jint gen, jboolean sendScrollEvent, jint x, jint y) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "need viewImpl"); @@ -3975,9 +3951,6 @@ static void SetScrollOffset(JNIEnv *env, jobject obj, jint gen, jboolean sendScr static void SetGlobalBounds(JNIEnv *env, jobject obj, jint x, jint y, jint h, jint v) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "need viewImpl"); @@ -3988,18 +3961,12 @@ static jboolean Key(JNIEnv *env, jobject obj, jint keyCode, jint unichar, jint repeatCount, jboolean isShift, jboolean isAlt, jboolean isSym, jboolean isDown) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif return GET_NATIVE_VIEW(env, obj)->key(PlatformKeyboardEvent(keyCode, unichar, repeatCount, isDown, isShift, isAlt, isSym)); } static void Click(JNIEnv *env, jobject obj, int framePtr, int nodePtr, jboolean fake) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in Click"); @@ -4015,27 +3982,18 @@ static void ContentInvalidateAll(JNIEnv *env, jobject obj) static void DeleteSelection(JNIEnv *env, jobject obj, jint start, jint end, jint textGeneration) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); viewImpl->deleteSelection(start, end, textGeneration); } static void SetSelection(JNIEnv *env, jobject obj, jint start, jint end) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); viewImpl->setSelection(start, end); } static jstring ModifySelection(JNIEnv *env, jobject obj, jint direction, jint granularity) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); String selectionString = viewImpl->modifySelection(direction, granularity); return wtfStringToJstring(env, selectionString); @@ -4045,9 +4003,6 @@ static void ReplaceTextfieldText(JNIEnv *env, jobject obj, jint oldStart, jint oldEnd, jstring replace, jint start, jint end, jint textGeneration) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); WTF::String webcoreString = jstringToWtfString(env, replace); viewImpl->replaceTextfieldText(oldStart, @@ -4058,9 +4013,6 @@ static void PassToJs(JNIEnv *env, jobject obj, jint generation, jstring currentText, jint keyCode, jint keyValue, jboolean down, jboolean cap, jboolean fn, jboolean sym) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WTF::String current = jstringToWtfString(env, currentText); GET_NATIVE_VIEW(env, obj)->passToJs(generation, current, PlatformKeyboardEvent(keyCode, keyValue, 0, down, cap, fn, sym)); @@ -4069,19 +4021,13 @@ static void PassToJs(JNIEnv *env, jobject obj, static void ScrollFocusedTextInput(JNIEnv *env, jobject obj, jfloat xPercent, jint y) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); viewImpl->scrollFocusedTextInput(xPercent, y); } static void SetFocusControllerActive(JNIEnv *env, jobject obj, jboolean active) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif - LOGV("webviewcore::nativeSetFocusControllerActive()\n"); + ALOGV("webviewcore::nativeSetFocusControllerActive()\n"); WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in nativeSetFocusControllerActive"); viewImpl->setFocusControllerActive(active); @@ -4089,10 +4035,7 @@ static void SetFocusControllerActive(JNIEnv *env, jobject obj, jboolean active) static void SaveDocumentState(JNIEnv *env, jobject obj, jint frame) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif - LOGV("webviewcore::nativeSaveDocumentState()\n"); + ALOGV("webviewcore::nativeSaveDocumentState()\n"); WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in nativeSaveDocumentState"); viewImpl->saveDocumentState((WebCore::Frame*) frame); @@ -4118,9 +4061,6 @@ static bool UpdateLayers(JNIEnv *env, jobject obj, jint jbaseLayer) static jint RecordContent(JNIEnv *env, jobject obj, jobject region, jobject pt) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); SkRegion* nativeRegion = GraphicsJNI::getNativeRegion(env, region); SkIPoint nativePt; @@ -4131,18 +4071,12 @@ static jint RecordContent(JNIEnv *env, jobject obj, jobject region, jobject pt) static void SplitContent(JNIEnv *env, jobject obj, jint content) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); viewImpl->splitContent(reinterpret_cast<PictureSet*>(content)); } static void SendListBoxChoice(JNIEnv* env, jobject obj, jint choice) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in nativeSendListBoxChoice"); viewImpl->popupReply(choice); @@ -4157,9 +4091,6 @@ static void SendListBoxChoice(JNIEnv* env, jobject obj, jint choice) static void SendListBoxChoices(JNIEnv* env, jobject obj, jbooleanArray jArray, jint size) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in nativeSendListBoxChoices"); jboolean* ptrArray = env->GetBooleanArrayElements(jArray, 0); @@ -4178,9 +4109,6 @@ static void SendListBoxChoices(JNIEnv* env, jobject obj, jbooleanArray jArray, static jstring FindAddress(JNIEnv *env, jobject obj, jstring addr, jboolean caseInsensitive) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif if (!addr) return 0; int length = env->GetStringLength(addr); @@ -4201,9 +4129,6 @@ static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jintArra jintArray xArray, jintArray yArray, jint count, jint actionIndex, jint metaState) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); jint* ptrIdArray = env->GetIntArrayElements(idArray, 0); @@ -4226,9 +4151,6 @@ static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jintArra static void TouchUp(JNIEnv *env, jobject obj, jint touchGeneration, jint frame, jint node, jint x, jint y) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->touchUp(touchGeneration, @@ -4237,9 +4159,6 @@ static void TouchUp(JNIEnv *env, jobject obj, jint touchGeneration, static jstring RetrieveHref(JNIEnv *env, jobject obj, jint x, jint y) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); WTF::String result = viewImpl->retrieveHref(x, y); @@ -4250,9 +4169,6 @@ static jstring RetrieveHref(JNIEnv *env, jobject obj, jint x, jint y) static jstring RetrieveAnchorText(JNIEnv *env, jobject obj, jint x, jint y) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); WTF::String result = viewImpl->retrieveAnchorText(x, y); @@ -4274,9 +4190,6 @@ static void StopPaintingCaret(JNIEnv *env, jobject obj) static void MoveFocus(JNIEnv *env, jobject obj, jint framePtr, jint nodePtr) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->moveFocus((WebCore::Frame*) framePtr, (WebCore::Node*) nodePtr); @@ -4285,9 +4198,6 @@ static void MoveFocus(JNIEnv *env, jobject obj, jint framePtr, jint nodePtr) static void MoveMouse(JNIEnv *env, jobject obj, jint frame, jint x, jint y) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->moveMouse((WebCore::Frame*) frame, x, y); @@ -4296,9 +4206,6 @@ static void MoveMouse(JNIEnv *env, jobject obj, jint frame, static void MoveMouseIfLatest(JNIEnv *env, jobject obj, jint moveGeneration, jint frame, jint x, jint y) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->moveMouseIfLatest(moveGeneration, @@ -4307,9 +4214,6 @@ static void MoveMouseIfLatest(JNIEnv *env, jobject obj, jint moveGeneration, static void UpdateFrameCache(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->updateFrameCache(); @@ -4317,9 +4221,6 @@ static void UpdateFrameCache(JNIEnv *env, jobject obj) static jint GetContentMinPrefWidth(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); @@ -4338,9 +4239,6 @@ static jint GetContentMinPrefWidth(JNIEnv *env, jobject obj) static void SetViewportSettingsFromNative(JNIEnv *env, jobject obj) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); @@ -4361,9 +4259,6 @@ static void SetViewportSettingsFromNative(JNIEnv *env, jobject obj) static void SetBackgroundColor(JNIEnv *env, jobject obj, jint color) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); @@ -4394,15 +4289,6 @@ static void DumpNavTree(JNIEnv *env, jobject obj) viewImpl->dumpNavTree(); } -static void DumpV8Counters(JNIEnv*, jobject) -{ -#if USE(V8) -#ifdef ANDROID_INSTRUMENT - V8Counters::dumpCounters(); -#endif -#endif -} - static void SetJsFlags(JNIEnv *env, jobject obj, jstring flags) { #if USE(V8) @@ -4438,9 +4324,6 @@ static void GeolocationPermissionsProvide(JNIEnv* env, jobject obj, jstring orig } static void RegisterURLSchemeAsLocal(JNIEnv* env, jobject obj, jstring scheme) { -#ifdef ANDROID_INSTRUMENT - TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); -#endif WebCore::SchemeRegistry::registerURLSchemeAsLocal(jstringToWtfString(env, scheme)); } @@ -4713,8 +4596,6 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) DumpRenderTree }, { "nativeDumpNavTree", "()V", (void*) DumpNavTree }, - { "nativeDumpV8Counters", "()V", - (void*) DumpV8Counters }, { "nativeSetNewStorageLimit", "(J)V", (void*) SetNewStorageLimit }, { "nativeGeolocationPermissionsProvide", "(Ljava/lang/String;ZZ)V", diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 1dfa385..2de9ac6 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -53,9 +53,6 @@ #include "SkPicture.h" #include "SkRect.h" #include "SkTime.h" -#ifdef ANDROID_INSTRUMENT -#include "TimeCounter.h" -#endif #include "TilesManager.h" #include "WebCoreJni.h" #include "WebRequestContext.h" @@ -2130,13 +2127,6 @@ static void nativeHideCursor(JNIEnv *env, jobject obj) view->hideCursor(); } -static void nativeInstrumentReport(JNIEnv *env, jobject obj) -{ -#ifdef ANDROID_INSTRUMENT - TimeCounter::reportNow(); -#endif -} - static void nativeSelectBestAt(JNIEnv *env, jobject obj, jobject jrect) { WebView* view = GET_NATIVE_VIEW(env, obj); @@ -2810,8 +2800,6 @@ static JNINativeMethod gJavaWebViewMethods[] = { (void*) nativeHitSelection }, { "nativeImageURI", "(II)Ljava/lang/String;", (void*) nativeImageURI }, - { "nativeInstrumentReport", "()V", - (void*) nativeInstrumentReport }, { "nativeLayerBounds", "(I)Landroid/graphics/Rect;", (void*) nativeLayerBounds }, { "nativeMotionUp", "(III)Z", diff --git a/Source/WebKit/android/wds/client/AdbConnection.cpp b/Source/WebKit/android/wds/client/AdbConnection.cpp index 465f9c3..617ed72 100644 --- a/Source/WebKit/android/wds/client/AdbConnection.cpp +++ b/Source/WebKit/android/wds/client/AdbConnection.cpp @@ -89,7 +89,7 @@ bool AdbConnection::sendRequest(const char* fmt, ...) const { int res = vsnprintf(buf, MAX_COMMAND_LENGTH, fmt, args); va_end(args); - LOGV("Sending command: %04X%.*s", res, res, buf); + ALOGV("Sending command: %04X%.*s", res, res, buf); // Construct the payload length char payloadLen[PAYLOAD_LENGTH + 1]; @@ -156,7 +156,7 @@ bool AdbConnection::checkOkayResponse() const { // Check for a response other than OKAY/FAIL if ((res == ADB_RESPONSE_LENGTH) && (strncmp(buf, "OKAY", res) == 0)) { - LOGV("Command OKAY"); + ALOGV("Command OKAY"); return true; } else if (strncmp(buf, "FAIL", ADB_RESPONSE_LENGTH) == 0) { // Something happened, print out the reason for failure @@ -224,7 +224,7 @@ const DeviceList& AdbConnection::getDeviceList() { static const char emulator[] = "emulator-"; if (strncmp(serial, emulator, sizeof(emulator) - 1) == 0) t = Device::EMULATOR; - LOGV("Adding device %s (%s)", serial, state); + ALOGV("Adding device %s (%s)", serial, state); m_devices.add(new Device(serial, t, this)); // Reset for the next line diff --git a/Source/WebKit/android/wds/client/main.cpp b/Source/WebKit/android/wds/client/main.cpp index 1c7d856..7e96f30 100644 --- a/Source/WebKit/android/wds/client/main.cpp +++ b/Source/WebKit/android/wds/client/main.cpp @@ -141,7 +141,7 @@ int main(int argc, char** argv) { return 1; } - LOGV("Connecting to localhost port " PORT_STR); + ALOGV("Connecting to localhost port " PORT_STR); const char* command = argv[optind]; int commandLen = strlen(command); |