diff options
Diffstat (limited to 'Source/WebCore')
55 files changed, 185 insertions, 587 deletions
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/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..458604d 100644 --- a/Source/WebCore/platform/NotImplemented.h +++ b/Source/WebCore/platform/NotImplemented.h @@ -47,7 +47,7 @@ #define notImplemented() do { \ static bool havePrinted = false; \ if (!havePrinted && !supressNotImplementedWarning()) { \ - LOGV("%s: notImplemented", __PRETTY_FUNCTION__); \ + ALOGV("%s: notImplemented", __PRETTY_FUNCTION__); \ havePrinted = true; \ } \ } while (0) 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 8358b2a..24813b9 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 d1fe51a..1b816f2 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 5206b7a..77bc208 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -472,8 +472,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); |