diff options
40 files changed, 733 insertions, 317 deletions
diff --git a/LayoutTests/http/tests/ssl/referer-301-expected.txt b/LayoutTests/http/tests/ssl/referer-301-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/http/tests/ssl/referer-301-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/http/tests/ssl/referer-301.html b/LayoutTests/http/tests/ssl/referer-301.html new file mode 100644 index 0000000..2764a7e --- /dev/null +++ b/LayoutTests/http/tests/ssl/referer-301.html @@ -0,0 +1,14 @@ +<body> +<a href="redir.php">Click me.<a/> The resulting request (as dumped on screen) should not have a Referer header. +<script> +if (window.layoutTestController) { + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); +} + +if (location.protocol != "https:") + location = "https://127.0.0.1:8443/ssl/referer-301.html"; +else + location = "resources/referer-301-redir.php"; +</script> +</body> diff --git a/LayoutTests/http/tests/ssl/referer-303-expected.txt b/LayoutTests/http/tests/ssl/referer-303-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/http/tests/ssl/referer-303-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/http/tests/ssl/referer-303.html b/LayoutTests/http/tests/ssl/referer-303.html new file mode 100644 index 0000000..b6a3c2e --- /dev/null +++ b/LayoutTests/http/tests/ssl/referer-303.html @@ -0,0 +1,14 @@ +<body> +<a href="redir.php">Click me.<a/> The resulting request (as dumped on screen) should not have a Referer header. +<script> +if (window.layoutTestController) { + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); +} + +if (location.protocol != "https:") + location = "https://127.0.0.1:8443/ssl/referer-303.html"; +else + location = "resources/referer-303-redir.php"; +</script> +</body> diff --git a/LayoutTests/http/tests/ssl/resources/no-http-referer.cgi b/LayoutTests/http/tests/ssl/resources/no-http-referer.cgi new file mode 100755 index 0000000..273d03c --- /dev/null +++ b/LayoutTests/http/tests/ssl/resources/no-http-referer.cgi @@ -0,0 +1,18 @@ +#!/usr/bin/perl -wT +use strict; + +print "Content-Type: text/html\n"; +print "Cache-Control: no-store\n\n"; + +my $failed = 0; +foreach (keys %ENV) { + if ($_ =~ "HTTP_REFERER") { + print "FAIL. " . $_ . ": " . $ENV{$_} . "\n"; + $failed = 1; + } +} +if (!$failed) { + print "PASS\n"; +} + +print "<script>if (window.layoutTestController) layoutTestController.notifyDone()</script>"; diff --git a/LayoutTests/http/tests/ssl/resources/referer-301-redir.php b/LayoutTests/http/tests/ssl/resources/referer-301-redir.php new file mode 100644 index 0000000..d93dc7a --- /dev/null +++ b/LayoutTests/http/tests/ssl/resources/referer-301-redir.php @@ -0,0 +1,5 @@ +<?php +header("HTTP/1.1 301 Moved Permanently"); +header("Location: http://127.0.0.1:8000/ssl/resources/no-http-referer.cgi"); +header("Cache-Control: no-cache,no-store"); +?> diff --git a/LayoutTests/http/tests/ssl/resources/referer-303-redir.php b/LayoutTests/http/tests/ssl/resources/referer-303-redir.php new file mode 100644 index 0000000..63f859d --- /dev/null +++ b/LayoutTests/http/tests/ssl/resources/referer-303-redir.php @@ -0,0 +1,5 @@ +<?php +header("HTTP/1.1 303 See Other"); +header("Location: http://127.0.0.1:8000/ssl/resources/no-http-referer.cgi"); +header("Cache-Control: no-cache,no-store"); +?> diff --git a/LayoutTests/http/tests/ssl/verify-ssl-enabled-expected.txt b/LayoutTests/http/tests/ssl/verify-ssl-enabled-expected.txt new file mode 100644 index 0000000..20c6407 --- /dev/null +++ b/LayoutTests/http/tests/ssl/verify-ssl-enabled-expected.txt @@ -0,0 +1 @@ +HTTPS is on! diff --git a/LayoutTests/http/tests/ssl/verify-ssl-enabled.php b/LayoutTests/http/tests/ssl/verify-ssl-enabled.php new file mode 100644 index 0000000..de1158b --- /dev/null +++ b/LayoutTests/http/tests/ssl/verify-ssl-enabled.php @@ -0,0 +1,6 @@ +<script> + if (window.layoutTestController) + layoutTestController.dumpAsText(); +</script> + +HTTPS is <?= $_SERVER['HTTPS'] ?>! diff --git a/LayoutTests/platform/android/layout_test_directories.txt b/LayoutTests/platform/android/layout_test_directories.txt index 3b63850..a6abb82 100755 --- a/LayoutTests/platform/android/layout_test_directories.txt +++ b/LayoutTests/platform/android/layout_test_directories.txt @@ -38,6 +38,7 @@ fast/xpath http/conf http/tests/appcache http/tests/resources +http/tests/ssl platform/android platform/android-v8 storage diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp index 7cecddd..1a8e686 100644 --- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp +++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp @@ -56,28 +56,27 @@ BackedDoubleBufferedTexture::~BackedDoubleBufferedTexture() TextureInfo* BackedDoubleBufferedTexture::producerLock() { - m_varLock.lock(); + m_busyLock.lock(); m_busy = true; - m_varLock.unlock(); + m_busyLock.unlock(); return DoubleBufferedTexture::producerLock(); } void BackedDoubleBufferedTexture::producerRelease() { DoubleBufferedTexture::producerRelease(); - android::Mutex::Autolock lock(m_varLock); + android::Mutex::Autolock lock(m_busyLock); m_busy = false; } void BackedDoubleBufferedTexture::producerReleaseAndSwap() { DoubleBufferedTexture::producerReleaseAndSwap(); - android::Mutex::Autolock lock(m_varLock); + android::Mutex::Autolock lock(m_busyLock); m_busy = false; } -void BackedDoubleBufferedTexture::producerUpdate(BaseTile* painter, - TextureInfo* textureInfo, PaintingInfo& info) +void BackedDoubleBufferedTexture::producerUpdate(TextureInfo* textureInfo) { // no need to upload a texture since the bitmap is empty if (!m_bitmap.width() && !m_bitmap.height()) { @@ -93,34 +92,9 @@ void BackedDoubleBufferedTexture::producerUpdate(BaseTile* painter, textureInfo->m_height = m_bitmap.height(); } - m_varLock.lock(); - // set the painting information for this texture - if (equalsIdTextureA(textureInfo->m_textureId)) - m_paintingInfoA = info; - else if (equalsIdTextureB(textureInfo->m_textureId)) - m_paintingInfoB = info; - m_varLock.unlock(); - producerReleaseAndSwap(); } -// Compare the current texture displayed with some PaintingInfo. -bool BackedDoubleBufferedTexture::consumerTextureUpToDate(PaintingInfo& info) -{ - android::Mutex::Autolock lock(m_varLock); - if (isTextureAReadable()) - return info == m_paintingInfoA; - return info == m_paintingInfoB; -} - -bool BackedDoubleBufferedTexture::consumerTextureSimilar(PaintingInfo& info) -{ - android::Mutex::Autolock lock(m_varLock); - if (isTextureAReadable()) - return info.similar(m_paintingInfoA); - return info.similar(m_paintingInfoB); -} - bool BackedDoubleBufferedTexture::acquire(BaseTile* owner) { if (m_owner == owner) @@ -128,7 +102,7 @@ bool BackedDoubleBufferedTexture::acquire(BaseTile* owner) // if the writable texture is busy (i.e. currently being written to) then we // can't change the owner out from underneath that texture - android::Mutex::Autolock lock(m_varLock); + android::Mutex::Autolock lock(m_busyLock); if (!m_busy) { if (m_owner) m_owner->removeTexture(); diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h index 1faa110..6bbb97a 100644 --- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h +++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h @@ -36,42 +36,6 @@ namespace WebCore { class BaseTile; -class PaintingInfo { -public: - PaintingInfo() : m_x(-1), m_y(-1), m_webview(0), m_picture(0) { } - PaintingInfo(int x, int y, GLWebViewState* webview) - : m_x(x) - , m_y(y) - , m_webview(webview) - , m_picture(0) - { - if(webview) - m_picture = webview->currentPictureCounter(); - } - bool operator==(const PaintingInfo& info) - { - return m_webview == info.m_webview - && m_x == info.m_x - && m_y == info.m_y - && m_picture == info.m_picture; - } - bool similar(const PaintingInfo& info) - { - return m_webview == info.m_webview - && m_x == info.m_x - && m_y == info.m_y; - } - void setPosition(int x, int y) { m_x = x; m_y = y; } - void setGLWebViewState(GLWebViewState* webview) { m_webview = webview; } - void setPictureUsed(unsigned int picture) { m_picture = picture; } - -private: - int m_x; - int m_y; - GLWebViewState* m_webview; - unsigned int m_picture; -}; - // DoubleBufferedTexture using a SkBitmap as backing mechanism class BackedDoubleBufferedTexture : public DoubleBufferedTexture { public: @@ -88,7 +52,7 @@ public: // updates the texture with current bitmap and releases (and if needed also // swaps) the texture. - void producerUpdate(BaseTile* painter, TextureInfo* textureInfo, PaintingInfo& info); + void producerUpdate(TextureInfo* textureInfo); // The level can be one of the following values: // * -1 for an unused texture. @@ -107,11 +71,7 @@ public: BaseTile* owner() { return m_owner; } // only used by the consumer thread SkCanvas* canvas() { return m_canvas; } // only used by the producer thread - // checks to see if the current readable texture equals the provided PaintingInfo - bool consumerTextureUpToDate(PaintingInfo& info); - // checks to see if the current readable texture is similar to the provided PaintingInfo - bool consumerTextureSimilar(PaintingInfo& info); - + // This is to be only used for debugging on the producer thread bool busy() { return m_busy; } private: @@ -120,12 +80,13 @@ private: int m_usedLevel; BaseTile* m_owner; - //The following values are shared among threads and use m_varLock to stay synced - PaintingInfo m_paintingInfoA; - PaintingInfo m_paintingInfoB; + // This values signals that the texture is currently in use by the consumer. + // This allows us to prevent the owner of the texture from changing while the + // consumer is holding a lock on the texture. bool m_busy; - - android::Mutex m_varLock; + // We mutex protect the reads/writes of m_busy to ensure that we are reading + // the most up-to-date value even across processors in an SMP system. + android::Mutex m_busyLock; }; } // namespace WebCore diff --git a/WebCore/platform/graphics/android/BaseTile.cpp b/WebCore/platform/graphics/android/BaseTile.cpp index 5ab801e..1c81634 100644 --- a/WebCore/platform/graphics/android/BaseTile.cpp +++ b/WebCore/platform/graphics/android/BaseTile.cpp @@ -72,6 +72,9 @@ BaseTile::BaseTile(TiledPage* page, int x, int y) , m_y(y) , m_texture(0) , m_scale(1) + , m_dirty(true) + , m_lastDirtyPicture(0) + , m_lastPaintedPicture(0) { #ifdef DEBUG_COUNT gBaseTileCount++; @@ -80,6 +83,7 @@ BaseTile::BaseTile(TiledPage* page, int x, int y) BaseTile::~BaseTile() { + setUsedLevel(-1); #ifdef DEBUG_COUNT gBaseTileCount--; #endif @@ -90,26 +94,43 @@ BaseTile::~BaseTile() void BaseTile::reserveTexture() { BackedDoubleBufferedTexture* texture = TilesManager::instance()->getAvailableTexture(this); - // We update atomically, so paintBitmap() can see the correct value - android_atomic_acquire_store((int32_t)texture, (int32_t*)&m_texture); - XLOG("%x (%d, %d) reserveTexture res: %x...", this, x(), y(), m_texture); + + android::AutoMutex lock(m_atomicSync); + if (m_texture != texture) { + m_lastPaintedPicture = 0; + m_dirty = true; + } + m_texture = texture; } void BaseTile::removeTexture() { XLOG("%x removeTexture res: %x...", this, m_texture); // We update atomically, so paintBitmap() can see the correct value - android_atomic_acquire_store(0, (int32_t*)&m_texture); + android::AutoMutex lock(m_atomicSync); + m_texture = 0; } void BaseTile::setScale(float scale) { + android::AutoMutex lock(m_atomicSync); + if (m_scale != scale) + m_dirty = true; m_scale = scale; - // FIXME: the following two lines force a memory barrier which causes - // m_scale to be observable on other cores. We should replace this - // with a dedicated system function if/when available. - int32_t tempValue = 0; - android_atomic_acquire_load(&tempValue); +} + +void BaseTile::markAsDirty(int pictureCount) +{ + android::AutoMutex lock(m_atomicSync); + m_lastDirtyPicture = pictureCount; + if (m_lastPaintedPicture < m_lastDirtyPicture) + m_dirty = true; +} + +bool BaseTile::isDirty() +{ + android::AutoMutex lock(m_atomicSync); + return m_dirty; } void BaseTile::setUsedLevel(int usedLevel) @@ -120,13 +141,13 @@ void BaseTile::setUsedLevel(int usedLevel) void BaseTile::draw(float transparency, SkRect& rect) { + // No need to mutex protect reads of m_texture as it is only written to by + // the consumer thread. if (!m_texture) { XLOG("%x (%d, %d) trying to draw, but no m_texture!", this, x(), y()); return; } - PaintingInfo info(m_x, m_y, m_page->glWebViewState()); - TextureInfo* textureInfo = m_texture->consumerLock(); if (!textureInfo) { XLOG("%x (%d, %d) trying to draw, but no textureInfo!", this, x(), y()); @@ -134,61 +155,57 @@ void BaseTile::draw(float transparency, SkRect& rect) return; } - if (m_texture->consumerTextureSimilar(info)) { + m_atomicSync.lock(); + bool isTexturePainted = m_lastPaintedPicture; + m_atomicSync.unlock(); + + if (isTexturePainted) TilesManager::instance()->shader()->drawQuad(rect, textureInfo->m_textureId, transparency); - } m_texture->consumerRelease(); } -bool BaseTile::isBitmapReady() +bool BaseTile::isTileReady() { if (!m_texture) return false; if (m_texture->owner() != this) return false; - PaintingInfo info(m_x, m_y, m_page->glWebViewState()); - return m_texture->consumerTextureUpToDate(info); + + android::AutoMutex lock(m_atomicSync); + return !m_dirty; } // This is called from the texture generation thread void BaseTile::paintBitmap() { - const int x = m_x; - const int y = m_y; - TiledPage* tiledPage = m_page; - - // We acquire the texture atomically. Once we have it, we - // can continue with it, and m_texture can be updated without - // consequences. - BackedDoubleBufferedTexture* texture = reinterpret_cast<BackedDoubleBufferedTexture*>( - android_atomic_release_load((int32_t*)&m_texture)); - // The loading of m_texture forces the execution of a memory barrier, - // which ensures that we are observing the most recent value of m_scale - // written by another core. + // We acquire the values below atomically. This ensures that we are reading + // values correctly across cores. Further, once we have these values they + // can be updated by other threads without consequence. + m_atomicSync.lock(); + bool dirty = m_dirty; + BackedDoubleBufferedTexture* texture = m_texture; float scale = m_scale; + m_atomicSync.unlock(); - if (!texture) + if(!dirty || !texture) return; + const int x = m_x; + const int y = m_y; + TiledPage* tiledPage = m_page; + TextureInfo* textureInfo = texture->producerLock(); - // at this point we can safely check the ownership - // (if the texture got transferred to another BaseTile - // under us) + // at this point we can safely check the ownership (if the texture got + // transferred to another BaseTile under us) if (texture->owner() != this || texture->usedLevel() > 1) { texture->producerRelease(); return; } - PaintingInfo info(x, y, tiledPage->glWebViewState()); - if (texture->consumerTextureUpToDate(info)) { - texture->producerRelease(); - return; - } - float tileWidth = textureInfo->m_width; float tileHeight = textureInfo->m_height; @@ -203,7 +220,7 @@ void BaseTile::paintBitmap() canvas->scale(scale, scale); canvas->translate(-x * w, -y * h); - tiledPage->paintBaseLayerContent(canvas); + int pictureCount = tiledPage->paintBaseLayerContent(canvas); canvas->restore(); @@ -219,7 +236,13 @@ void BaseTile::paintBitmap() canvas->drawLine(tileWidth, 0, tileWidth, tileHeight, paint); #endif - texture->producerUpdate(this, textureInfo, info); + texture->producerUpdate(textureInfo); + + m_atomicSync.lock(); + m_lastPaintedPicture = pictureCount; + if (m_lastPaintedPicture >= m_lastDirtyPicture) + m_dirty = false; + m_atomicSync.unlock(); } } // namespace WebCore diff --git a/WebCore/platform/graphics/android/BaseTile.h b/WebCore/platform/graphics/android/BaseTile.h index 429d950..896edb3 100644 --- a/WebCore/platform/graphics/android/BaseTile.h +++ b/WebCore/platform/graphics/android/BaseTile.h @@ -36,6 +36,7 @@ #include <EGL/egl.h> #include <EGL/eglext.h> #include <GLES2/gl2.h> +#include <utils/threads.h> namespace WebCore { @@ -69,12 +70,15 @@ public: void reserveTexture(); void removeTexture(); void setUsedLevel(int); - bool isBitmapReady(); + bool isTileReady(); void draw(float transparency, SkRect& rect); // the only thread-safe function called by the background thread void paintBitmap(); + void markAsDirty(int pictureCount); + bool isDirty(); + float scale() const { return m_scale; } void setScale(float scale); @@ -89,9 +93,25 @@ private: int m_x; int m_y; - // these variables can be updated throughout the lifetime of the object + // The remaining variables can be updated throughout the lifetime of the object BackedDoubleBufferedTexture* m_texture; float m_scale; + // used to signal that the that the tile is out-of-date and needs to be redrawn + bool m_dirty; + // stores the id of the latest picture from webkit that caused this tile to + // become dirty. A tile is no longer dirty when it has been painted with a + // picture that is newer than this value. + int m_lastDirtyPicture; + // stores the id of the latest picture painted to the tile. If the id is 0 + // then we know that the picture has not yet been painted an there is nothing + // to display (dirty or otherwise). + int m_lastPaintedPicture; + + // This mutex serves two purposes. (1) It ensures that certain operations + // happen atomically and (2) it makes sure those operations are synchronized + // across all threads and cores. + android::Mutex m_atomicSync; + }; } // namespace WebCore diff --git a/WebCore/platform/graphics/android/DoubleBufferedTexture.h b/WebCore/platform/graphics/android/DoubleBufferedTexture.h index d16d5f3..2b2fd03 100644 --- a/WebCore/platform/graphics/android/DoubleBufferedTexture.h +++ b/WebCore/platform/graphics/android/DoubleBufferedTexture.h @@ -50,11 +50,6 @@ public: TextureInfo* consumerLock(); void consumerRelease(); -protected: - bool equalsIdTextureA(GLuint id) { return id == m_textureA.getSourceTextureId(); } - bool equalsIdTextureB(GLuint id) { return id == m_textureB.getSourceTextureId(); } - bool isTextureAReadable() { return getReadableTexture() == &m_textureA; } - private: SharedTexture* getReadableTexture(); SharedTexture* getWriteableTexture(); diff --git a/WebCore/platform/graphics/android/FontCacheAndroid.cpp b/WebCore/platform/graphics/android/FontCacheAndroid.cpp index 6ec72c9..dac005f 100644 --- a/WebCore/platform/graphics/android/FontCacheAndroid.cpp +++ b/WebCore/platform/graphics/android/FontCacheAndroid.cpp @@ -33,9 +33,55 @@ #include "SkPaint.h" #include "SkTypeface.h" #include "SkUtils.h" +#include <wtf/text/CString.h> namespace WebCore { +static const char* getFallbackFontName(const FontDescription& fontDescription) +{ + switch (fontDescription.genericFamily()) { + case FontDescription::StandardFamily: + case FontDescription::SerifFamily: + return "serif"; + case FontDescription::SansSerifFamily: + return "sans-serif"; + case FontDescription::MonospaceFamily: + return "monospace"; + case FontDescription::CursiveFamily: + return "cursive"; + case FontDescription::FantasyFamily: + return "fantasy"; + case FontDescription::NoFamily: + default: + return ""; + } +} + +static bool isFallbackFamily(String family) +{ + return family.startsWith("-webkit-") + || equalIgnoringCase(family, "serif") + || equalIgnoringCase(family, "sans-serif") + || equalIgnoringCase(family, "sans") + || equalIgnoringCase(family, "monospace") + || equalIgnoringCase(family, "cursive") + || equalIgnoringCase(family, "fantasy"); +} + +static char* AtomicStringToUTF8String(const AtomicString& utf16) +{ + SkASSERT(sizeof(uint16_t) == sizeof(utf16.characters()[0])); + const uint16_t* uni = (uint16_t*)utf16.characters(); + + size_t bytes = SkUTF16_ToUTF8(uni, utf16.length(), NULL); + char* utf8 = (char*)sk_malloc_throw(bytes + 1); + + (void)SkUTF16_ToUTF8(uni, utf16.length(), utf8); + utf8[bytes] = 0; + return utf8; +} + + void FontCache::platformInit() { } @@ -52,57 +98,41 @@ SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font) return 0; } -SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& font) -{ - static AtomicString str("sans-serif"); - return getCachedFontData(font, str); -} - -static char* AtomicStringToUTF8String(const AtomicString& utf16) +SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& description) { - SkASSERT(sizeof(uint16_t) == sizeof(utf16.characters()[0])); - const uint16_t* uni = (uint16_t*)utf16.characters(); + static const AtomicString sansStr("sans-serif"); + static const AtomicString serifStr("serif"); + static const AtomicString monospaceStr("monospace"); - size_t bytes = SkUTF16_ToUTF8(uni, utf16.length(), NULL); - char* utf8 = (char*)sk_malloc_throw(bytes + 1); + FontPlatformData* fontPlatformData = 0; + switch (description.genericFamily()) { + case FontDescription::SerifFamily: + fontPlatformData = getCachedFontPlatformData(description, serifStr); + break; + case FontDescription::MonospaceFamily: + fontPlatformData = getCachedFontPlatformData(description, monospaceStr); + break; + case FontDescription::SansSerifFamily: + default: + fontPlatformData = getCachedFontPlatformData(description, sansStr); + break; + } - (void)SkUTF16_ToUTF8(uni, utf16.length(), utf8); - utf8[bytes] = 0; - return utf8; + ASSERT(fontPlatformData); + return getCachedFontData(fontPlatformData); } FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family) { - char* storage = 0; + char* storage = 0; const char* name = 0; + FontPlatformData* result = 0; - if (family.length() == 0) { - static const struct { - FontDescription::GenericFamilyType mType; - const char* mName; - } gNames[] = { - { FontDescription::SerifFamily, "serif" }, - { FontDescription::SansSerifFamily, "sans-serif" }, - { FontDescription::MonospaceFamily, "monospace" }, - { FontDescription::CursiveFamily, "cursive" }, - { FontDescription::FantasyFamily, "fantasy" } - }; - - FontDescription::GenericFamilyType type = fontDescription.genericFamily(); - for (unsigned i = 0; i < SK_ARRAY_COUNT(gNames); i++) - { - if (type == gNames[i].mType) - { - name = gNames[i].mName; - break; - } - } - // if we fall out of the loop, its ok for name to still be 0 - } - else { // convert the name to utf8 + if (family.length()) { storage = AtomicStringToUTF8String(family); name = storage; - } + } else + name = getFallbackFontName(fontDescription); int style = SkTypeface::kNormal; if (fontDescription.weight() >= FontWeightBold) @@ -110,12 +140,22 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD if (fontDescription.italic()) style |= SkTypeface::kItalic; + // CreateFromName always returns a typeface, falling back to a default font + // if the one requested is not found. Calling Equal() with a null pointer + // serves to compare the returned font against the default. If we detect + // the default, we ignore it and allow WebCore to give us the next font on + // the CSS fallback list. The only exception is if the family name is a + // commonly used generic family, which will be the case when called by + // getSimilarFontPlatformData() and getLastResortFallbackFont(). + SkTypeface* tf = SkTypeface::CreateFromName(name, (SkTypeface::Style)style); - - FontPlatformData* result = new FontPlatformData(tf, - fontDescription.computedSize(), - (style & SkTypeface::kBold) && !tf->isBold(), - (style & SkTypeface::kItalic) && !tf->isItalic()); + + if (!SkTypeface::Equal(tf, 0) || isFallbackFamily(family.string())) { + result = new FontPlatformData(tf, fontDescription.computedSize(), + (style & SkTypeface::kBold) && !tf->isBold(), + (style & SkTypeface::kItalic) && !tf->isItalic()); + } + tf->unref(); sk_free(storage); return result; diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp index e1e517c..814e590 100644 --- a/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -81,7 +81,6 @@ GLWebViewState::GLWebViewState() , m_extra(0) , m_navLayer(0) { - m_invalidatedRect.setEmpty(); m_tiledPageA = new TiledPage(FIRST_TILED_PAGE_ID, this); m_tiledPageB = new TiledPage(SECOND_TILED_PAGE_ID, this); #ifdef DEBUG_COUNT @@ -108,8 +107,13 @@ void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, IntRect& rect) m_navLayer = 0; if (m_baseLayer) { m_baseLayer->setGLWebViewState(this); - m_invalidatedRect.set(rect); m_currentPictureCounter++; + + if (!rect.isEmpty()) { + // find which tiles fall within the invalRect and mark them as dirty + m_tiledPageA->invalidateRect(rect, m_currentPictureCounter); + m_tiledPageB->invalidateRect(rect, m_currentPictureCounter); + } } } @@ -132,7 +136,7 @@ void GLWebViewState::resetExtra(bool repaint) m_navLayer = 0; } -void GLWebViewState::paintBaseLayerContent(SkCanvas* canvas) +int GLWebViewState::paintBaseLayerContent(SkCanvas* canvas) { android::Mutex::Autolock lock(m_baseLayerLock); if (m_baseLayer) { @@ -140,6 +144,7 @@ void GLWebViewState::paintBaseLayerContent(SkCanvas* canvas) if (m_extra && m_navLayer) m_extra->draw(canvas, m_navLayer); } + return m_currentPictureCounter; } void GLWebViewState::scheduleUpdate(const double& currentTime, float scale) diff --git a/WebCore/platform/graphics/android/GLWebViewState.h b/WebCore/platform/graphics/android/GLWebViewState.h index 95bc07d..04dea6d 100644 --- a/WebCore/platform/graphics/android/GLWebViewState.h +++ b/WebCore/platform/graphics/android/GLWebViewState.h @@ -95,8 +95,9 @@ class LayerAndroid; // get the GL textures from an existing pool, and reuse them. // // The way we do it is that when we call TiledPage::prepare(), we group the -// tiles we need into a TilesSet, call TilesSet::reserveTextures() (which -// associates the GL textures to the BaseTiles). +// tiles we need (i.e. in the viewport and dirty) into a TilesSet and call +// BaseTile::reserveTexture() for each tile (which ensures there is a specific +// GL textures backing the BaseTiles). // // reserveTexture() will ask the TilesManager for a texture. The allocation // mechanism goal is to (in order): @@ -104,8 +105,22 @@ class LayerAndroid; // - prefers to allocate textures that are as far from the viewport as possible // - prefers to allocate textures that are used by different TiledPages // -// Note that to compute the distance of tiles, each time we prepare() a -// TiledPage, we compute the distance of the tiles in it from the viewport. +// Note that to compute the distance of each tile from the viewport, each time +// we prepare() a TiledPage. Also during each prepare() we compute which tiles +// are dirty based on the info we have received from webkit. +// +// BaseTile Invalidation +// ------------------ +// +// We do not want to redraw a tile if the tile is up-to-date. A tile is +// considered to be dirty an in need of redrawing in the following cases +// - the tile has acquires a new texture +// - webkit invalidates all or part of the tiles contents +// +// To handle the case of webkit invalidation we store two ids (counters) of the +// pictureSets in the tile. The first id (A) represents the pictureSet used to +// paint the tile and the second id (B) represents the pictureSet in which the +// tile was invalidated by webkit. Thus, if A < B then tile is dirty. // // Painting scheduling // ------------------- @@ -155,7 +170,7 @@ public: int originalTilesPosY() const { return m_originalTilesPosY; } void setOriginalTilesPosY(int pos) { m_originalTilesPosY = pos; } - void paintBaseLayerContent(SkCanvas* canvas); + int paintBaseLayerContent(SkCanvas* canvas); void setBaseLayer(BaseLayerAndroid* layer, IntRect& rect); void setExtra(android::DrawExtra* extra, LayerAndroid* navLayer); void resetExtra(bool repaint); @@ -176,7 +191,6 @@ public: int firstTileY() const { return m_firstTileY; } unsigned int currentPictureCounter() const { return m_currentPictureCounter; } - SkRect& invalidatedRect() { return m_invalidatedRect; } private: @@ -207,7 +221,6 @@ private: android::Mutex m_baseLayerLock; BaseLayerAndroid* m_baseLayer; unsigned int m_currentPictureCounter; - SkRect m_invalidatedRect; bool m_usePageA; TiledPage* m_tiledPageA; TiledPage* m_tiledPageB; diff --git a/WebCore/platform/graphics/android/TexturesGenerator.cpp b/WebCore/platform/graphics/android/TexturesGenerator.cpp index f81a297..193ca46 100644 --- a/WebCore/platform/graphics/android/TexturesGenerator.cpp +++ b/WebCore/platform/graphics/android/TexturesGenerator.cpp @@ -53,10 +53,13 @@ void TexturesGenerator::schedulePaintForTileSet(TileSet* set) { android::Mutex::Autolock lock(mRequestedPixmapsLock); for (unsigned int i = 0; i < mRequestedPixmaps.size(); i++) { - TileSet* s = mRequestedPixmaps[i]; - if (s && *s == *set) { - // Similar set already in the queue - delete set; + TileSet** s = &mRequestedPixmaps[i]; + // A similar set is already in the queue. The newer set may have additional + // dirty tiles so delete the existing set and replace it with the new one. + if (*s && **s == *set) { + TileSet* oldSet = *s; + *s = set; + delete oldSet; return; } } diff --git a/WebCore/platform/graphics/android/TileSet.cpp b/WebCore/platform/graphics/android/TileSet.cpp index fe13ef3..4530640 100644 --- a/WebCore/platform/graphics/android/TileSet.cpp +++ b/WebCore/platform/graphics/android/TileSet.cpp @@ -56,10 +56,8 @@ int TileSet::count() } #endif -TileSet::TileSet(int id, int firstTileX, int firstTileY, int rows, int cols) - : m_id(id) - , m_firstTileX(firstTileX) - , m_firstTileY(firstTileY) +TileSet::TileSet(TiledPage* tiledPage, int rows, int cols) + : m_tiledPage(tiledPage) , m_nbRows(rows) , m_nbCols(cols) { @@ -77,36 +75,12 @@ TileSet::~TileSet() bool TileSet::operator==(const TileSet& set) { - return m_id == set.m_id - && m_firstTileX == set.m_firstTileX - && m_firstTileY == set.m_firstTileY + return m_tiledPage == set.m_tiledPage && m_nbRows == set.m_nbRows && m_nbCols == set.m_nbCols; } -void TileSet::reserveTextures() -{ -#ifdef DEBUG - if (m_tiles.size()) { - TiledPage* page = m_tiles[0]->page(); - XLOG("reserveTextures (%d tiles) for page %x (sibling: %x)", m_tiles.size(), page, page->sibling()); - TilesManager::instance()->printTextures(); - } -#endif // DEBUG - - for (unsigned int i = 0; i < m_tiles.size(); i++) - m_tiles[i]->reserveTexture(); - -#ifdef DEBUG - if (m_tiles.size()) { - TiledPage* page = m_tiles[0]->page(); - XLOG(" DONE reserveTextures (%d tiles) for page %x (sibling: %x)", m_tiles.size(), page, page->sibling()); - TilesManager::instance()->printTextures(); - } -#endif // DEBUG -} - void TileSet::paint() { XLOG("%x, painting %d tiles", this, m_tiles.size()); diff --git a/WebCore/platform/graphics/android/TileSet.h b/WebCore/platform/graphics/android/TileSet.h index adf6d13..fd65ad7 100644 --- a/WebCore/platform/graphics/android/TileSet.h +++ b/WebCore/platform/graphics/android/TileSet.h @@ -45,11 +45,10 @@ public: #ifdef DEBUG_COUNT static int count(); #endif - TileSet(int id, int firstTileX, int firstTileY, int rows, int cols); + TileSet(TiledPage* tiledPage, int nbRows, int nbCols); ~TileSet(); bool operator==(const TileSet& set); - void reserveTextures(); void paint(); void add(BaseTile* texture) @@ -59,17 +58,13 @@ public: TiledPage* page() { - if (m_tiles.size()) - return m_tiles[0]->page(); - return 0; + return m_tiledPage; } private: Vector<BaseTile*> m_tiles; - int m_id; - int m_firstTileX; - int m_firstTileY; + TiledPage* m_tiledPage; int m_nbRows; int m_nbCols; }; diff --git a/WebCore/platform/graphics/android/TiledPage.cpp b/WebCore/platform/graphics/android/TiledPage.cpp index 6430b02..6b11c52 100644 --- a/WebCore/platform/graphics/android/TiledPage.cpp +++ b/WebCore/platform/graphics/android/TiledPage.cpp @@ -29,6 +29,7 @@ #if USE(ACCELERATED_COMPOSITING) #include "GLUtils.h" +#include "IntRect.h" #include "TilesManager.h" #ifdef DEBUG @@ -64,6 +65,7 @@ TiledPage::TiledPage(int id, GLWebViewState* state) , m_scale(1) , m_invScale(1) , m_glWebViewState(state) + , m_latestPictureInval(0) { #ifdef DEBUG_COUNT gTilePageCount++; @@ -94,6 +96,24 @@ BaseTile* TiledPage::getBaseTile(int x, int y) return m_baseTiles.get(key); } +void TiledPage::invalidateRect(const IntRect& inval, const int pictureCount) +{ + // Given the current scale level we need to mark the appropriate tiles as dirty + TilesManager* manager = TilesManager::instance(); + const float invTileContentWidth = m_scale / manager->tileWidth(); + const float invTileContentHeight = m_scale / manager->tileHeight(); + + const int firstDirtyTileX = static_cast<int>(floorf(inval.x() * invTileContentWidth)); + const int firstDirtyTileY = static_cast<int>(floorf(inval.y() * invTileContentHeight)); + const int lastDirtyTileX = static_cast<int>(ceilf(inval.right() * invTileContentWidth)); + const int lastDirtyTileY = static_cast<int>(ceilf(inval.bottom() * invTileContentHeight)); + + // We defer marking the tile as dirty until the next time we need to prepare + // to draw. + m_invalRegion.op(firstDirtyTileX, firstDirtyTileY, lastDirtyTileX, lastDirtyTileY, SkRegion::kUnion_Op); + m_latestPictureInval = pictureCount; +} + void TiledPage::prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y, TileSet* set) { if (y < 0) @@ -119,11 +139,16 @@ void TiledPage::prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y } tile = m_baseTiles.get(key); tile->setScale(m_scale); - set->add(tile); + + // ensure there is a texture associated with the tile and then check to + // see if the texture is dirty and in need of repainting + tile->reserveTexture(); + if(tile->isDirty()) + set->add(tile); } } -void TiledPage::setTileLevels(int firstTileX, int firstTileY) +void TiledPage::updateTileState(int firstTileX, int firstTileY) { if (!m_glWebViewState) return; @@ -138,6 +163,11 @@ void TiledPage::setTileLevels(int firstTileX, int firstTileY) if(!tile) continue; + // if the tile is in the dirty region then we must invalidate it + if (m_invalRegion.contains(tile->x(), tile->y())) + tile->markAsDirty(m_latestPictureInval); + + // set the used level of the tile (e.g. distance from the viewport) int dx = 0; int dy = 0; @@ -156,6 +186,10 @@ void TiledPage::setTileLevels(int firstTileX, int firstTileY) XLOG("setTileLevel tile: %x, fxy(%d, %d), level: %d", tile, firstTileX, firstTileY, d); tile->setUsedLevel(d); } + + // clear the invalidated region as all tiles within that region have now + // been marked as dirty. + m_invalRegion.setEmpty(); } void TiledPage::prepare(bool goingDown, bool goingLeft, int firstTileX, int firstTileY) @@ -163,10 +197,13 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, int firstTileX, int firs if (!m_glWebViewState) return; + // update the tiles distance from the viewport + updateTileState(firstTileX, firstTileY); + int nbTilesWidth = m_glWebViewState->nbTilesWidth(); int nbTilesHeight = m_glWebViewState->nbTilesHeight(); - TileSet* highResSet = new TileSet(m_id, firstTileX, firstTileY, nbTilesHeight, nbTilesWidth); + TileSet* highResSet = new TileSet(this, nbTilesHeight, nbTilesWidth); // We chose to display tiles depending on the scroll direction: if (goingDown) { @@ -178,23 +215,6 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, int firstTileX, int firs prepareRow(goingLeft, nbTilesWidth, firstTileX, startingTileY - i, highResSet); } - // update the tiles distance from the viewport - setTileLevels(firstTileX, firstTileY); - - -#ifdef DEBUG - XLOG("+++ BEFORE RESERVE TEXTURES (%d x %d) at (%d, %d), TiledPage %x", - nbTilesWidth, nbTilesHeight, firstTileX, firstTileY, this); - TilesManager::instance()->printTextures(); -#endif // DEBUG - highResSet->reserveTextures(); - -#ifdef DEBUG - TilesManager::instance()->printTextures(); - XLOG("--- AFTER RESERVE TEXTURES (%d x %d) at (%d, %d), TiledPage %x", - nbTilesWidth, nbTilesHeight, firstTileX, firstTileY, this); -#endif // DEBUG - // schedulePaintForTileSet will take ownership of the highResSet here, // so no delete necessary. TilesManager::instance()->schedulePaintForTileSet(highResSet); @@ -213,7 +233,7 @@ bool TiledPage::ready(int firstTileX, int firstTileY) int x = j + firstTileX; int y = i + firstTileY; BaseTile* t = getBaseTile(x, y); - if (!t || !t->isBitmapReady()) + if (!t || !t->isTileReady()) return false; } } @@ -260,10 +280,11 @@ void TiledPage::draw(float transparency, SkRect& viewport, int firstTileX, int f #endif // DEBUG } -void TiledPage::paintBaseLayerContent(SkCanvas* canvas) +int TiledPage::paintBaseLayerContent(SkCanvas* canvas) { if (m_glWebViewState) - m_glWebViewState->paintBaseLayerContent(canvas); + return m_glWebViewState->paintBaseLayerContent(canvas); + return 0; } TiledPage* TiledPage::sibling() diff --git a/WebCore/platform/graphics/android/TiledPage.h b/WebCore/platform/graphics/android/TiledPage.h index 8be2361..62756ff 100644 --- a/WebCore/platform/graphics/android/TiledPage.h +++ b/WebCore/platform/graphics/android/TiledPage.h @@ -30,11 +30,13 @@ #include "BaseTile.h" #include "SkCanvas.h" +#include "SkRegion.h" #include "TileSet.h" namespace WebCore { class GLWebViewState; +class IntRect; typedef std::pair<int, int> TileKey; typedef HashMap<TileKey, BaseTile*> TileMap; @@ -68,15 +70,17 @@ public: void draw(float transparency, SkRect& viewport, int firstTileX, int firstTileY); // used by individual tiles to generate the bitmap for their tile - void paintBaseLayerContent(SkCanvas*); + int paintBaseLayerContent(SkCanvas*); // used by individual tiles to get the information about the current picture GLWebViewState* glWebViewState() { return m_glWebViewState; } float scale() const { return m_scale; } void setScale(float scale) { m_scale = scale; m_invScale = 1 / scale; } + void invalidateRect(const IntRect& invalRect, const int pictureCount); + private: - void setTileLevels(int firstTileX, int firstTileY); + void updateTileState(int firstTileX, int firstTileY); void prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y, TileSet* set); BaseTile* getBaseTile(int x, int y); @@ -86,6 +90,13 @@ private: float m_scale; float m_invScale; GLWebViewState* m_glWebViewState; + + // used to identify the tiles that have been invalidated (marked dirty) since + // the last time updateTileState() has been called. The region is stored in + // terms of the (x,y) coordinates used to determine the location of the tile + // within the page, not in content/view pixel coordinates. + SkRegion m_invalRegion; + int m_latestPictureInval; }; } // namespace WebCore diff --git a/WebCore/platform/graphics/android/TilesManager.cpp b/WebCore/platform/graphics/android/TilesManager.cpp index 54ca9ad..9ebfe02 100644 --- a/WebCore/platform/graphics/android/TilesManager.cpp +++ b/WebCore/platform/graphics/android/TilesManager.cpp @@ -136,8 +136,7 @@ void TilesManager::paintTexturesDefault() #else canvas->drawARGB(255, 255, 255, 255); #endif // DEBUG - PaintingInfo info; - texture->producerUpdate(0, textureInfo, info); + texture->producerUpdate(textureInfo); } } } @@ -186,9 +185,9 @@ BackedDoubleBufferedTexture* TilesManager::getAvailableTexture(BaseTile* owner) } } if (farthestTexture && farthestTexture->acquire(owner)) { - farthestTexture->setUsedLevel(0); XLOG("farthest texture, getAvailableTexture(%x) => texture %x (level %d)", owner, farthestTexture, farthestTexture->usedLevel()); + farthestTexture->setUsedLevel(0); return farthestTexture; } diff --git a/WebCore/platform/network/android/ResourceRequestAndroid.cpp b/WebCore/platform/network/android/ResourceRequestAndroid.cpp index 7f4bccb..00735f3 100644 --- a/WebCore/platform/network/android/ResourceRequestAndroid.cpp +++ b/WebCore/platform/network/android/ResourceRequestAndroid.cpp @@ -30,10 +30,17 @@ namespace WebCore { unsigned initializeMaximumHTTPConnectionCountPerHost() { +#if USE(CHROME_NETWORK_STACK) + // The chromium network stack already handles limiting the number of + // parallel requests per host, so there's no need to do it here. Therefore, + // this is set to a high value that should never be hit in practice. + return 10000; +#else // This is used by the loader to control the number of parallel load // requests. Our java framework has 4 threads that can each pipeline up to // 5 requests. Use 20 as a maximum number. return 20; +#endif } } // namespace WebCore diff --git a/WebKit/Android.mk b/WebKit/Android.mk index 7906da3..b9bc5a8 100644 --- a/WebKit/Android.mk +++ b/WebKit/Android.mk @@ -32,13 +32,15 @@ LOCAL_SRC_FILES := \ ifeq ($(HTTP_STACK),chrome) LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ + android/WebCoreSupport/ChromiumLogging.cpp \ android/WebCoreSupport/WebCache.cpp \ android/WebCoreSupport/WebUrlLoader.cpp \ android/WebCoreSupport/WebUrlLoaderClient.cpp \ android/WebCoreSupport/WebRequest.cpp \ android/WebCoreSupport/WebRequestContext.cpp \ android/WebCoreSupport/WebResourceRequest.cpp \ - android/WebCoreSupport/WebResponse.cpp + android/WebCoreSupport/WebResponse.cpp \ + android/WebCoreSupport/WebViewClientError.cpp else LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ android/WebCoreSupport/ResourceLoaderAndroid.cpp diff --git a/WebKit/android/WebCoreSupport/ChromiumLogging.cpp b/WebKit/android/WebCoreSupport/ChromiumLogging.cpp new file mode 100644 index 0000000..07fbeb8 --- /dev/null +++ b/WebKit/android/WebCoreSupport/ChromiumLogging.cpp @@ -0,0 +1,68 @@ +/* + * 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. + */ + +#include "config.h" +#include "ChromiumLogging.h" + +#include "ChromiumIncludes.h" + +#include <cutils/log.h> +#include <string> + +namespace android { + +bool logMessageHandler(int severity, const std::string& str) { + int androidSeverity = ANDROID_LOG_VERBOSE; + switch(severity) { + case logging::LOG_FATAL: + androidSeverity = ANDROID_LOG_FATAL; + break; + case logging::LOG_ERROR_REPORT: + case logging::LOG_ERROR: + androidSeverity = ANDROID_LOG_ERROR; + break; + case logging::LOG_WARNING: + androidSeverity = ANDROID_LOG_WARN; + break; + default: + androidSeverity = ANDROID_LOG_VERBOSE; + break; + } + android_printLog(androidSeverity, "chromium", "%s", str.c_str()); + return false; +} + +void initChromiumLogging() +{ + static Lock loggingLock; + AutoLock aLock(loggingLock); + static bool loggingStarted = false; + if (!loggingStarted) { + logging::SetLogMessageHandler(logMessageHandler); + loggingStarted = true; + } +} + +} // namespace android diff --git a/WebKit/android/WebCoreSupport/ChromiumLogging.h b/WebKit/android/WebCoreSupport/ChromiumLogging.h new file mode 100644 index 0000000..74b71b4 --- /dev/null +++ b/WebKit/android/WebCoreSupport/ChromiumLogging.h @@ -0,0 +1,38 @@ +/* + * 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 ChromiumLogging_h +#define ChromiumLogging_h + +namespace android { + +// Sends chromium logs to logcat +// +// This only calls into chromium once, but can be called multiple times. +// It should be called before any other calls into external/chromium. +void initChromiumLogging(); +} + +#endif diff --git a/WebKit/android/WebCoreSupport/WebRequest.cpp b/WebKit/android/WebCoreSupport/WebRequest.cpp index ef09ff7..f21c1a2 100644 --- a/WebKit/android/WebCoreSupport/WebRequest.cpp +++ b/WebKit/android/WebCoreSupport/WebRequest.cpp @@ -130,10 +130,18 @@ void WebRequest::finish(bool success) m_urlLoader = 0; } -void WebRequest::AppendBytesToUpload(WTF::Vector<char>* data) +void WebRequest::appendFileToUpload(std::string filename) +{ + // AppendFileToUpload is only valid before calling start + ASSERT(m_loadState == Created, "appendFileToUpload called on a WebRequest not in CREATED state: (%s)", m_url.c_str()); + FilePath filePath(filename); + m_request->AppendFileToUpload(filePath); +} + +void WebRequest::appendBytesToUpload(WTF::Vector<char>* data) { // AppendBytesToUpload is only valid before calling start - ASSERT(m_loadState == Created, "Start called on a WebRequest not in CREATED state: (%s)", m_url.c_str()); + ASSERT(m_loadState == Created, "appendBytesToUpload called on a WebRequest not in CREATED state: (%s)", m_url.c_str()); m_request->AppendBytesToUpload(data->data(), data->size()); delete data; } diff --git a/WebKit/android/WebCoreSupport/WebRequest.h b/WebKit/android/WebCoreSupport/WebRequest.h index 1f73d2a..c82096e 100644 --- a/WebKit/android/WebCoreSupport/WebRequest.h +++ b/WebKit/android/WebCoreSupport/WebRequest.h @@ -60,7 +60,8 @@ public: WebRequest(WebUrlLoaderClient*, const WebResourceRequest&, int inputStream); // Optional, but if used has to be called before start - void AppendBytesToUpload(Vector<char>* data); + void appendBytesToUpload(Vector<char>* data); + void appendFileToUpload(std::string filename); void start(bool isPrivateBrowsing); void cancel(); diff --git a/WebKit/android/WebCoreSupport/WebRequestContext.cpp b/WebKit/android/WebCoreSupport/WebRequestContext.cpp index d7fa6b8..4b29f10 100644 --- a/WebKit/android/WebCoreSupport/WebRequestContext.cpp +++ b/WebKit/android/WebCoreSupport/WebRequestContext.cpp @@ -27,6 +27,7 @@ #include "WebRequestContext.h" #include "ChromiumIncludes.h" +#include "ChromiumLogging.h" #include "JNIUtility.h" #include "WebCoreJni.h" #include "WebUrlLoaderClient.h" @@ -193,6 +194,9 @@ WebRequestContext* WebRequestContext::getPrivateBrowsingContext() WebRequestContext* WebRequestContext::get(bool isPrivateBrowsing) { + // Initialize chromium logging, needs to be done before any chromium code is called + initChromiumLogging(); + return isPrivateBrowsing ? getPrivateBrowsingContext() : getRegularContext(); } diff --git a/WebKit/android/WebCoreSupport/WebResourceRequest.cpp b/WebKit/android/WebCoreSupport/WebResourceRequest.cpp index 8954887..e8fb520 100644 --- a/WebKit/android/WebCoreSupport/WebResourceRequest.cpp +++ b/WebKit/android/WebCoreSupport/WebResourceRequest.cpp @@ -30,17 +30,6 @@ #include <wtf/text/CString.h> -namespace { -const std::string android_asset("file:///android_asset/"); -const std::string android_res("file:///android_res/"); -const std::string android_content("content:"); - -// Matched in BrowserFrame.java -const int RESOURCE = 1; -const int ASSET = 2; -const int CONTENT = 3; -} - namespace android { WebResourceRequest::WebResourceRequest(const WebCore::ResourceRequest& resourceRequest) @@ -77,28 +66,6 @@ WebResourceRequest::WebResourceRequest(const WebCore::ResourceRequest& resourceR m_userAgent = resourceRequest.httpUserAgent().utf8().data(); m_url = resourceRequest.url().string().utf8().data(); - - // Android has special file urls, resolve these - m_specialAndroidFileType = 0; - std::string::size_type loc = m_url.find(android_asset); - if (loc != std::string::npos && loc == 0) { - m_url = m_url.erase(0, android_asset.length()); - m_specialAndroidFileType = ASSET; - return; - } - - loc = m_url.find(android_res); - if (loc != std::string::npos && loc == 0) { - m_url = m_url.erase(0, android_res.length()); - m_specialAndroidFileType = RESOURCE; - return; - } - - loc = m_url.find(android_content); - if (loc != std::string::npos && loc == 0) { - m_specialAndroidFileType = CONTENT; - return; - } } } // namespace android diff --git a/WebKit/android/WebCoreSupport/WebResourceRequest.h b/WebKit/android/WebCoreSupport/WebResourceRequest.h index 6274624..d0c7f90 100644 --- a/WebKit/android/WebCoreSupport/WebResourceRequest.h +++ b/WebKit/android/WebCoreSupport/WebResourceRequest.h @@ -66,22 +66,11 @@ public: return m_url; } - bool isAndroidUrl() const - { - return m_specialAndroidFileType != 0; - } - - int androidFileType() const - { - return m_specialAndroidFileType; - } - private: std::string m_method; std::string m_referrer; std::string m_userAgent; net::HttpRequestHeaders m_requestHeaders; - int m_specialAndroidFileType; std::string m_url; }; diff --git a/WebKit/android/WebCoreSupport/WebResponse.cpp b/WebKit/android/WebCoreSupport/WebResponse.cpp index 5c9b79b..bad733c 100644 --- a/WebKit/android/WebCoreSupport/WebResponse.cpp +++ b/WebKit/android/WebCoreSupport/WebResponse.cpp @@ -36,6 +36,9 @@ namespace android { WebResponse::WebResponse(URLRequest* request) : m_httpStatusCode(0) { + // The misleadingly-named os_error() is actually a net::Error enum constant. + m_error = net::Error(request->status().os_error()); + m_url = request->url().spec(); m_host = request->url().HostNoBrackets(); request->GetMimeType(&m_mime); @@ -57,9 +60,9 @@ WebResponse::WebResponse(URLRequest* request) } WebResponse::WebResponse(const string &url, const string &mimeType, long long expectedSize, const string &encoding, int httpStatusCode) - : m_encoding(encoding) + : m_error(net::OK) + , m_encoding(encoding) , m_httpStatusCode(httpStatusCode) - , m_httpStatusText("") , m_expectedSize(expectedSize) , m_mime(mimeType) , m_url(url) @@ -81,8 +84,7 @@ WebCore::ResourceResponse WebResponse::createResourceResponse() WebCore::ResourceError WebResponse::createResourceError() { - // TODO: Last parameter is a localized string, get the correct one from android - WebCore::ResourceError error(m_host.c_str(), m_httpStatusCode, m_url.c_str(), m_httpStatusText.c_str()); + WebCore::ResourceError error(m_host.c_str(), ToWebViewClientError(m_error), m_url.c_str(), net::ErrorToString(m_error)); return error; } diff --git a/WebKit/android/WebCoreSupport/WebResponse.h b/WebKit/android/WebCoreSupport/WebResponse.h index eafc4e3..3c7c601 100644 --- a/WebKit/android/WebCoreSupport/WebResponse.h +++ b/WebKit/android/WebCoreSupport/WebResponse.h @@ -28,6 +28,7 @@ #include "ChromiumIncludes.h" #include "KURL.h" +#include "WebViewClientError.h" #include <map> #include <string> @@ -61,6 +62,7 @@ public: WebCore::ResourceError createResourceError(); private: + net::Error m_error; std::string m_encoding; int m_httpStatusCode; std::string m_host; diff --git a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp index 8925fbc..6d8e192 100644 --- a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp +++ b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp @@ -37,6 +37,31 @@ #include "WebRequest.h" #include "WebResourceRequest.h" +#include <wtf/text/CString.h> + +namespace { +const char* androidAsset = "file:///android_asset/"; +const char* androidResource = "file:///android_res/"; +const char* androidContent = "content:"; +const int androidAssetLen = strlen(androidAsset); +const int androidResourceLen = strlen(androidResource); +const int androidContentLen = strlen(androidContent); + +bool isAndroidUrl(const std::string& url) +{ + if (!url.compare(0, androidAssetLen, androidAsset)) + return true; + + if (!url.compare(0, androidResourceLen, androidResource)) + return true; + + if (!url.compare(0, androidContentLen, androidContent)) + return true; + + return false; +} +} + namespace android { base::Thread* WebUrlLoaderClient::ioThread() @@ -93,8 +118,8 @@ WebUrlLoaderClient::WebUrlLoaderClient(WebFrame* webFrame, WebCore::ResourceHand , m_finished(false) { WebResourceRequest webResourceRequest(resourceRequest); - if (webResourceRequest.isAndroidUrl()) { - int inputStream = webFrame->inputStreamForAndroidResource(webResourceRequest.url().c_str(), webResourceRequest.androidFileType()); + if (isAndroidUrl(webResourceRequest.url())) { + int inputStream = webFrame->inputStreamForAndroidResource(webResourceRequest.url().c_str()); m_request = new WebRequest(this, webResourceRequest, inputStream); return; } @@ -107,6 +132,7 @@ WebUrlLoaderClient::WebUrlLoaderClient(WebFrame* webFrame, WebCore::ResourceHand Vector<FormDataElement> elements = resourceRequest.httpBody()->elements(); for (iter = elements.begin(); iter != elements.end(); iter++) { FormDataElement element = *iter; + switch (element.m_type) { case FormDataElement::data: if (!element.m_data.isEmpty()) { @@ -115,22 +141,29 @@ WebUrlLoaderClient::WebUrlLoaderClient(WebFrame* webFrame, WebCore::ResourceHand base::Thread* thread = ioThread(); if (thread) { Vector<char>* data = new Vector<char>(element.m_data); - thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(m_request.get(), &WebRequest::AppendBytesToUpload, data)); + thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(m_request.get(), &WebRequest::appendBytesToUpload, data)); } } break; -#if ENABLE(BLOB) case FormDataElement::encodedFile: - if (element.m_fileLength == -1) - continue; // TODO: Not supporting directories yet - else { - // TODO: Add fileuploads after Google log-in is fixed. - // Chrome code is here: webkit/glue/weburlloader_impl.cc:391 + { + // Chromium check if it is a directory by checking + // element.m_fileLength, that doesn't work in Android + std::string filename = element.m_filename.utf8().data(); + if (filename.size() > 0) { + base::Thread* thread = ioThread(); + if (thread) + thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(m_request.get(), &WebRequest::appendFileToUpload, filename)); + } } break; -#endif +#if ENABLE(BLOB) + case FormDataElement::encodedBlob: + LOG_ASSERT(false, "Unexpected use of FormDataElement::encodedBlob"); + break; +#endif // ENABLE(BLOB) default: - // TODO: Add a warning/DCHECK/assert here, should never happen + LOG_ASSERT(false, "Unexpected default case in WebUrlLoaderClient.cpp"); break; } } diff --git a/WebKit/android/WebCoreSupport/WebViewClientError.cpp b/WebKit/android/WebCoreSupport/WebViewClientError.cpp new file mode 100644 index 0000000..8e50cfe --- /dev/null +++ b/WebKit/android/WebCoreSupport/WebViewClientError.cpp @@ -0,0 +1,117 @@ +/* + * 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. + */ + +#include "config.h" +#include "WebViewClientError.h" + +using namespace net; + +namespace android { + +WebViewClientError ToWebViewClientError(net::Error error) { + // Note: many net::Error constants don't have an obvious mapping. + // These will be handled by the default case, ERROR_UNKNOWN. + switch(error) { + case ERR_UNSUPPORTED_AUTH_SCHEME: + return ERROR_UNSUPPORTED_AUTH_SCHEME; + + case ERR_INVALID_AUTH_CREDENTIALS: + case ERR_MISSING_AUTH_CREDENTIALS: + case ERR_MISCONFIGURED_AUTH_ENVIRONMENT: + return ERROR_AUTHENTICATION; + + case ERR_TOO_MANY_REDIRECTS: + return ERROR_REDIRECT_LOOP; + + case ERR_UPLOAD_FILE_CHANGED: + return ERROR_FILE_NOT_FOUND; + + case ERR_INVALID_URL: + return ERROR_BAD_URL; + + case ERR_DISALLOWED_URL_SCHEME: + case ERR_UNKNOWN_URL_SCHEME: + return ERROR_UNSUPPORTED_SCHEME; + + case ERR_IO_PENDING: + case ERR_NETWORK_IO_SUSPENDED: + return ERROR_IO; + + case ERR_CONNECTION_TIMED_OUT: + case ERR_TIMED_OUT: + return ERROR_TIMEOUT; + + case ERR_FILE_TOO_BIG: + return ERROR_FILE; + + case ERR_HOST_RESOLVER_QUEUE_TOO_LARGE: + case ERR_INSUFFICIENT_RESOURCES: + case ERR_OUT_OF_MEMORY: + return ERROR_TOO_MANY_REQUESTS; + + case ERR_CONNECTION_CLOSED: + case ERR_CONNECTION_RESET: + case ERR_CONNECTION_REFUSED: + case ERR_CONNECTION_ABORTED: + case ERR_CONNECTION_FAILED: + case ERR_SOCKET_NOT_CONNECTED: + return ERROR_CONNECT; + + case ERR_ADDRESS_INVALID: + case ERR_ADDRESS_UNREACHABLE: + case ERR_NAME_NOT_RESOLVED: + case ERR_NAME_RESOLUTION_FAILED: + return ERROR_HOST_LOOKUP; + + case ERR_SSL_PROTOCOL_ERROR: + case ERR_SSL_CLIENT_AUTH_CERT_NEEDED: + case ERR_TUNNEL_CONNECTION_FAILED: + case ERR_NO_SSL_VERSIONS_ENABLED: + case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: + case ERR_SSL_RENEGOTIATION_REQUESTED: + case ERR_CERT_ERROR_IN_SSL_RENEGOTIATION: + case ERR_BAD_SSL_CLIENT_AUTH_CERT: + case ERR_SSL_NO_RENEGOTIATION: + case ERR_SSL_DECOMPRESSION_FAILURE_ALERT: + case ERR_SSL_BAD_RECORD_MAC_ALERT: + case ERR_SSL_UNSAFE_NEGOTIATION: + case ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: + case ERR_SSL_SNAP_START_NPN_MISPREDICTION: + case ERR_SSL_CLIENT_AUTH_PRIVATE_KEY_ACCESS_DENIED: + case ERR_SSL_CLIENT_AUTH_CERT_NO_PRIVATE_KEY: + return ERROR_FAILED_SSL_HANDSHAKE; + + case ERR_PROXY_AUTH_UNSUPPORTED: + case ERR_PROXY_AUTH_REQUESTED: + case ERR_PROXY_CONNECTION_FAILED: + case ERR_UNEXPECTED_PROXY_AUTH: + return ERROR_PROXY_AUTHENTICATION; + + default: + return ERROR_UNKNOWN; + } +} + +} diff --git a/WebKit/android/WebCoreSupport/WebViewClientError.h b/WebKit/android/WebCoreSupport/WebViewClientError.h new file mode 100644 index 0000000..847fb01 --- /dev/null +++ b/WebKit/android/WebCoreSupport/WebViewClientError.h @@ -0,0 +1,72 @@ +/* + * 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 WebViewClientError_h +#define WebViewClientError_h + +#include "ChromiumIncludes.h" + +namespace android { + +// This enum must be kept in sync with WebViewClient.java +enum WebViewClientError { + /** Generic error */ + ERROR_UNKNOWN = -1, + /** Server or proxy hostname lookup failed */ + ERROR_HOST_LOOKUP = -2, + /** Unsupported authentication scheme (not basic or digest) */ + ERROR_UNSUPPORTED_AUTH_SCHEME = -3, + /** User authentication failed on server */ + ERROR_AUTHENTICATION = -4, + /** User authentication failed on proxy */ + ERROR_PROXY_AUTHENTICATION = -5, + /** Failed to connect to the server */ + ERROR_CONNECT = -6, + /** Failed to read or write to the server */ + ERROR_IO = -7, + /** Connection timed out */ + ERROR_TIMEOUT = -8, + /** Too many redirects */ + ERROR_REDIRECT_LOOP = -9, + /** Unsupported URI scheme */ + ERROR_UNSUPPORTED_SCHEME = -10, + /** Failed to perform SSL handshake */ + ERROR_FAILED_SSL_HANDSHAKE = -11, + /** Malformed URL */ + ERROR_BAD_URL = -12, + /** Generic file error */ + ERROR_FILE = -13, + /** File not found */ + ERROR_FILE_NOT_FOUND = -14, + /** Too many requests during this load */ + ERROR_TOO_MANY_REQUESTS = -15, +}; + +// Get the closest WebViewClient match to the given Chrome error code. +WebViewClientError ToWebViewClientError(net::Error); + +} // namespace android + +#endif // WebViewClientError_h diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp index 9cd5c79..04db4a9 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -33,6 +33,7 @@ #include "Cache.h" #include "Chrome.h" #include "ChromeClientAndroid.h" +#include "ChromiumLogging.h" #include "ContextMenuClientAndroid.h" #include "DeviceMotionClientAndroid.h" #include "DeviceOrientationClientAndroid.h" @@ -234,7 +235,7 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page* mJavaFrame = new JavaBrowserFrame; mJavaFrame->mObj = env->NewWeakGlobalRef(obj); mJavaFrame->mHistoryList = env->NewWeakGlobalRef(historyList); - mJavaFrame->mInputStreamForAndroidResource = env->GetMethodID(clazz, "inputStreamForAndroidResource", "(Ljava/lang/String;I)Ljava/io/InputStream;"); + mJavaFrame->mInputStreamForAndroidResource = env->GetMethodID(clazz, "inputStreamForAndroidResource", "(Ljava/lang/String;)Ljava/io/InputStream;"); mJavaFrame->mStartLoadingResource = env->GetMethodID(clazz, "startLoadingResource", "(ILjava/lang/String;Ljava/lang/String;Ljava/util/HashMap;[BJIZZZLjava/lang/String;Ljava/lang/String;)Landroid/webkit/LoadListener;"); mJavaFrame->mLoadStarted = env->GetMethodID(clazz, "loadStarted", @@ -382,13 +383,13 @@ private: int m_size; }; -int WebFrame::inputStreamForAndroidResource(const char* url, int type) +int WebFrame::inputStreamForAndroidResource(const char* url) { JNIEnv* env = getJNIEnv(); AutoJObject obj = mJavaFrame->frame(env); jstring jUrlStr = env->NewStringUTF(url); - jobject jInputStream = env->CallObjectMethod(obj.get(), mJavaFrame->mInputStreamForAndroidResource, jUrlStr, type); + jobject jInputStream = env->CallObjectMethod(obj.get(), mJavaFrame->mInputStreamForAndroidResource, jUrlStr); env->DeleteLocalRef(jUrlStr); return (int)jInputStream; @@ -960,6 +961,11 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss { ScriptController::initializeThreading(); +#if USE(CHROME_NETWORK_STACK) + // Initialize chromium logging, needs to be done before any chromium code is called + initChromiumLogging(); +#endif + #ifdef ANDROID_INSTRUMENT #if USE(V8) V8Counters::initCounters(); diff --git a/WebKit/android/jni/WebCoreFrameBridge.h b/WebKit/android/jni/WebCoreFrameBridge.h index 9e3b5db..2d2b571 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.h +++ b/WebKit/android/jni/WebCoreFrameBridge.h @@ -60,7 +60,7 @@ class WebFrame : public WebCoreRefObject { // helper function static WebFrame* getWebFrame(const WebCore::Frame* frame); - int inputStreamForAndroidResource(const char* url, int type); + int inputStreamForAndroidResource(const char* url); virtual PassRefPtr<WebCore::ResourceLoaderAndroid> startLoadingResource(WebCore::ResourceHandle*, const WebCore::ResourceRequest& request, bool mainResource, |
