From d56fc817d55766a47376a4f688dd868e8846c253 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Tue, 15 Jan 2013 19:12:28 +0000 Subject: [PATCH] Update to Chromium revision 176706. - See crbug.com/167209 for a description of why NSPrincipalClass needs to be specified in helper-Info.plist. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@987 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- CHROMIUM_BUILD_COMPATIBILITY.txt | 2 +- cef.gyp | 3 +- libcef/browser/browser_host_impl.cc | 5 +- libcef/browser/browser_host_impl.h | 5 +- libcef/browser/devtools_delegate.cc | 134 +++++++++++++--------- libcef/browser/devtools_delegate.h | 31 ++++- libcef/browser/sqlite_diagnostics_stub.cc | 10 -- libcef/common/request_impl.cc | 9 ++ libcef/common/values_impl.cc | 2 +- patch/patch.cfg | 5 - patch/patches/content_popups.patch | 31 ----- patch/patches/tools_gyp.patch | 8 +- patch/patches/zlib.patch | 4 +- tests/cefclient/mac/helper-Info.plist | 2 + tools/gyp_cef | 5 +- 15 files changed, 139 insertions(+), 117 deletions(-) delete mode 100644 libcef/browser/sqlite_diagnostics_stub.cc delete mode 100644 patch/patches/content_popups.patch diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 954538a57..49fa2799c 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -17,5 +17,5 @@ { 'chromium_url': 'http://src.chromium.org/svn/trunk/src', - 'chromium_revision': '173683', + 'chromium_revision': '176706', } diff --git a/cef.gyp b/cef.gyp index 697e3f410..94d252280 100644 --- a/cef.gyp +++ b/cef.gyp @@ -656,7 +656,7 @@ 'target_name': 'cef_pak', 'type': 'none', 'dependencies': [ - '<(DEPTH)/content/browser/debugger/devtools_resources.gyp:devtools_resources', + '<(DEPTH)/content/browser/devtools/devtools_resources.gyp:devtools_resources', '<(DEPTH)/content/content_resources.gyp:content_resources', '<(DEPTH)/net/net.gyp:net_resources', '<(DEPTH)/ui/ui.gyp:ui_resources', @@ -851,7 +851,6 @@ 'libcef/browser/scheme_impl.cc', 'libcef/browser/scheme_registration.cc', 'libcef/browser/scheme_registration.h', - 'libcef/browser/sqlite_diagnostics_stub.cc', 'libcef/browser/stream_impl.cc', 'libcef/browser/stream_impl.h', 'libcef/browser/trace_impl.cc', diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index f7bdf15b7..703d94596 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -1608,7 +1608,7 @@ void CefBrowserHostImpl::UpdatePreferredSize(content::WebContents* source, void CefBrowserHostImpl::RequestMediaAccessPermission( content::WebContents* web_contents, - const content::MediaStreamRequest* request, + const content::MediaStreamRequest& request, const content::MediaResponseCallback& callback) { CEF_CURRENTLY_ON_UIT(); @@ -1734,7 +1734,8 @@ void CefBrowserHostImpl::DidFailLoad( OnLoadEnd(frame, validated_url, error_code); } -void CefBrowserHostImpl::PluginCrashed(const FilePath& plugin_path) { +void CefBrowserHostImpl::PluginCrashed(const FilePath& plugin_path, + base::ProcessId plugin_pid) { if (client_.get()) { CefRefPtr handler = client_->GetLoadHandler(); if (handler.get()) diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index 48d9f0761..025b8283e 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -291,7 +291,7 @@ class CefBrowserHostImpl : public CefBrowserHost, const gfx::Size& pref_size) OVERRIDE; virtual void RequestMediaAccessPermission( content::WebContents* web_contents, - const content::MediaStreamRequest* request, + const content::MediaStreamRequest& request, const content::MediaResponseCallback& callback) OVERRIDE; // content::WebContentsObserver methods. @@ -321,7 +321,8 @@ class CefBrowserHostImpl : public CefBrowserHost, int error_code, const string16& error_description, content::RenderViewHost* render_view_host) OVERRIDE; - virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE; + virtual void PluginCrashed(const FilePath& plugin_path, + base::ProcessId plugin_pid) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // Override to provide a thread safe implementation. virtual bool Send(IPC::Message* message) OVERRIDE; diff --git a/libcef/browser/devtools_delegate.cc b/libcef/browser/devtools_delegate.cc index 5244f17c9..85df447b6 100644 --- a/libcef/browser/devtools_delegate.cc +++ b/libcef/browser/devtools_delegate.cc @@ -24,73 +24,99 @@ #include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" -namespace { +// CefDevToolsBindingHandler -class CefDevToolsBindingHandler - : public content::DevToolsHttpHandler::RenderViewHostBinding { - public: - CefDevToolsBindingHandler() { - } +CefDevToolsBindingHandler::CefDevToolsBindingHandler() { +} - virtual std::string GetIdentifier(content::RenderViewHost* rvh) OVERRIDE { - int process_id = rvh->GetProcess()->GetID(); - int routing_id = rvh->GetRoutingID(); +std::string CefDevToolsBindingHandler::GetIdentifier( + content::DevToolsAgentHost* agent_host) { + GarbageCollect(); - if (random_seed_.empty()) { - // Generate a random seed that is used to make identifier guessing more - // difficult. - random_seed_ = base::StringPrintf("%lf|%u", - base::Time::Now().ToDoubleT(), base::RandInt(0, INT_MAX)); - } + const std::string& identifier = + GetIdentifier(agent_host->GetRenderViewHost()); + agents_map_[identifier] = agent_host; + return identifier; +} - // Create a key that combines RVH IDs and the random seed. - std::string key = base::StringPrintf("%d|%d|%s", - process_id, - routing_id, - random_seed_.c_str()); +content::DevToolsAgentHost* CefDevToolsBindingHandler::ForIdentifier( + const std::string& identifier) { + GarbageCollect(); + + // Return the existing agent host, if any. + AgentsMap::const_iterator it = agents_map_.find(identifier); + if (it != agents_map_.end()) + return it->second; - // Return an MD5 hash of the key. - return base::MD5String(key); - } + // Iterate through the existing RVH instances to find a match. + for (content::RenderProcessHost::iterator it( + content::RenderProcessHost::AllHostsIterator()); + !it.IsAtEnd(); it.Advance()) { + content::RenderProcessHost* render_process_host = it.GetCurrentValue(); + DCHECK(render_process_host); - virtual content::RenderViewHost* ForIdentifier( - const std::string& identifier) OVERRIDE { - // Iterate through the existing RVH instances to find a match. - for (content::RenderProcessHost::iterator it( - content::RenderProcessHost::AllHostsIterator()); - !it.IsAtEnd(); it.Advance()) { - content::RenderProcessHost* render_process_host = it.GetCurrentValue(); - DCHECK(render_process_host); + // Ignore processes that don't have a connection, such as crashed contents. + if (!render_process_host->HasConnection()) + continue; - // Ignore processes that don't have a connection, such as crashed - // contents. - if (!render_process_host->HasConnection()) + content::RenderProcessHost::RenderWidgetHostsIterator rwit( + render_process_host->GetRenderWidgetHostsIterator()); + for (; !rwit.IsAtEnd(); rwit.Advance()) { + const content::RenderWidgetHost* widget = rwit.GetCurrentValue(); + DCHECK(widget); + if (!widget || !widget->IsRenderView()) continue; - content::RenderProcessHost::RenderWidgetHostsIterator rwit( - render_process_host->GetRenderWidgetHostsIterator()); - for (; !rwit.IsAtEnd(); rwit.Advance()) { - const content::RenderWidgetHost* widget = rwit.GetCurrentValue(); - DCHECK(widget); - if (!widget || !widget->IsRenderView()) - continue; - - content::RenderViewHost* host = - content::RenderViewHost::From( - const_cast(widget)); - if (GetIdentifier(host) == identifier) - return host; + content::RenderViewHost* host = + content::RenderViewHost::From( + const_cast(widget)); + if (GetIdentifier(host) == identifier) { + // May create a new agent host. + scoped_refptr agent_host( + content::DevToolsAgentHost::GetFor(host)); + agents_map_[identifier] = agent_host; + return agent_host; } } - - return NULL; } - private: - std::string random_seed_; -}; + return NULL; +} -} // namespace +std::string CefDevToolsBindingHandler::GetIdentifier( + content::RenderViewHost* rvh) { + int process_id = rvh->GetProcess()->GetID(); + int routing_id = rvh->GetRoutingID(); + + if (random_seed_.empty()) { + // Generate a random seed that is used to make identifier guessing more + // difficult. + random_seed_ = base::StringPrintf("%lf|%u", + base::Time::Now().ToDoubleT(), base::RandInt(0, INT_MAX)); + } + + // Create a key that combines RVH IDs and the random seed. + std::string key = base::StringPrintf("%d|%d|%s", + process_id, + routing_id, + random_seed_.c_str()); + + // Return an MD5 hash of the key. + return base::MD5String(key); +} + +void CefDevToolsBindingHandler::GarbageCollect() { + AgentsMap::iterator it = agents_map_.begin(); + while (it != agents_map_.end()) { + if (!it->second->GetRenderViewHost()) + agents_map_.erase(it++); + else + ++it; + } +} + + +// CefDevToolsDelegate CefDevToolsDelegate::CefDevToolsDelegate(int port) { devtools_http_handler_ = content::DevToolsHttpHandler::Start( @@ -99,7 +125,7 @@ CefDevToolsDelegate::CefDevToolsDelegate(int port) { this); binding_.reset(new CefDevToolsBindingHandler()); - devtools_http_handler_->SetRenderViewHostBinding(binding_.get()); + devtools_http_handler_->SetDevToolsAgentHostBinding(binding_.get()); } CefDevToolsDelegate::~CefDevToolsDelegate() { diff --git a/libcef/browser/devtools_delegate.h b/libcef/browser/devtools_delegate.h index 2e1167e13..79333c5fe 100644 --- a/libcef/browser/devtools_delegate.h +++ b/libcef/browser/devtools_delegate.h @@ -6,11 +6,13 @@ #define CEF_LIBCEF_BROWSER_DEVTOOLS_DELEGATE_H_ #pragma once +#include #include #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +#include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_http_handler.h" #include "content/public/browser/devtools_http_handler_delegate.h" @@ -18,6 +20,33 @@ namespace content { class RenderViewHost; } +class CefDevToolsBindingHandler + : public content::DevToolsHttpHandler::DevToolsAgentHostBinding { + public: + CefDevToolsBindingHandler(); + + // DevToolsAgentHostBinding overrides. + virtual std::string GetIdentifier( + content::DevToolsAgentHost* agent_host) OVERRIDE; + virtual content::DevToolsAgentHost* ForIdentifier( + const std::string& identifier) OVERRIDE; + + std::string GetIdentifier(content::RenderViewHost* rvh); + + private: + void GarbageCollect(); + + std::string random_seed_; + + // Map of identifier to DevToolsAgentHost. Keeps the DevToolsAgentHost objects + // alive until the associated RVH is disconnected. + typedef std::map > + AgentsMap; + AgentsMap agents_map_; + + DISALLOW_COPY_AND_ASSIGN(CefDevToolsBindingHandler); +}; + class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate { public: explicit CefDevToolsDelegate(int port); @@ -38,7 +67,7 @@ class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate { private: content::DevToolsHttpHandler* devtools_http_handler_; - scoped_ptr binding_; + scoped_ptr binding_; DISALLOW_COPY_AND_ASSIGN(CefDevToolsDelegate); }; diff --git a/libcef/browser/sqlite_diagnostics_stub.cc b/libcef/browser/sqlite_diagnostics_stub.cc deleted file mode 100644 index 128913b69..000000000 --- a/libcef/browser/sqlite_diagnostics_stub.cc +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that can -// be found in the LICENSE file. - -#include "chrome/browser/diagnostics/sqlite_diagnostics.h" - -// Used by SQLitePersistentCookieStore -sql::ErrorDelegate* GetErrorHandlerForCookieDb() { - return NULL; -} diff --git a/libcef/common/request_impl.cc b/libcef/common/request_impl.cc index 3a3e7f33f..5dcc5856f 100644 --- a/libcef/common/request_impl.cc +++ b/libcef/common/request_impl.cc @@ -7,6 +7,7 @@ #include "libcef/common/http_header_utils.h" #include "libcef/common/request_impl.h" +#include "libcef/common/task_runner_impl.h" #include "base/logging.h" #include "net/base/upload_data.h" @@ -43,12 +44,20 @@ class BytesElementReader : public net::UploadBytesElementReader { DISALLOW_COPY_AND_ASSIGN(BytesElementReader); }; +base::TaskRunner* GetFileTaskRunner() { + scoped_refptr task_runner = + CefTaskRunnerImpl::GetTaskRunner(TID_FILE); + DCHECK(task_runner); + return task_runner; +} + // A subclass of net::UploadFileElementReader that keeps the associated // UploadElement alive until the request completes. class FileElementReader : public net::UploadFileElementReader { public: explicit FileElementReader(scoped_ptr element) : net::UploadFileElementReader( + GetFileTaskRunner(), element->file_path(), element->file_range_offset(), element->file_range_length(), diff --git a/libcef/common/values_impl.cc b/libcef/common/values_impl.cc index 34dccfd01..92432183a 100644 --- a/libcef/common/values_impl.cc +++ b/libcef/common/values_impl.cc @@ -120,7 +120,7 @@ CefBinaryValueImpl::CefBinaryValueImpl(char* data, bool copy) : CefValueBase( copy ? base::BinaryValue::CreateWithCopiedBuffer(data, data_size) : - base::BinaryValue::Create(data, data_size), + new base::BinaryValue(scoped_ptr(data), data_size), NULL, kOwnerWillDelete, true, NULL) { } diff --git a/patch/patch.cfg b/patch/patch.cfg index 0f68b1ac1..57158252a 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -31,11 +31,6 @@ patches = [ 'name': 'webkit_451', 'path': '../third_party/WebKit/Source/', }, - { - # http://code.google.com/p/chromium/issues/detail?id=155761 - 'name': 'content_popups', - 'path': '../content/', - }, { # http://code.google.com/p/chromiumembedded/issues/detail?id=364 'name': 'spi_webcore_364', diff --git a/patch/patches/content_popups.patch b/patch/patches/content_popups.patch deleted file mode 100644 index 053e325f9..000000000 --- a/patch/patches/content_popups.patch +++ /dev/null @@ -1,31 +0,0 @@ -Index: browser/web_contents/web_contents_impl.cc -=================================================================== ---- browser/web_contents/web_contents_impl.cc (revision 173683) -+++ browser/web_contents/web_contents_impl.cc (working copy) -@@ -1397,8 +1397,10 @@ - new RenderWidgetHostImpl(this, process, route_id); - created_widgets_.insert(widget_host); - -- RenderWidgetHostViewPort* widget_view = -- RenderWidgetHostViewPort::CreateViewForWidget(widget_host); -+ RenderWidgetHostViewPort* widget_view = RenderWidgetHostViewPort::FromRWHV( -+ view_->CreateViewForPopupWidget(widget_host)); -+ if (!widget_view) -+ widget_view = RenderWidgetHostViewPort::CreateViewForWidget(widget_host); - if (!is_fullscreen) { - // Popups should not get activated. - widget_view->SetPopupType(popup_type); -Index: public/browser/web_contents_view.h -=================================================================== ---- public/browser/web_contents_view.h (revision 173683) -+++ public/browser/web_contents_view.h (working copy) -@@ -38,6 +38,9 @@ - virtual RenderWidgetHostView* CreateViewForWidget( - RenderWidgetHost* render_widget_host) = 0; - -+ virtual RenderWidgetHostView* CreateViewForPopupWidget( -+ RenderWidgetHost* render_widget_host) { return NULL; } -+ - // Returns the native widget that contains the contents of the tab. - virtual gfx::NativeView GetNativeView() const = 0; - diff --git a/patch/patches/tools_gyp.patch b/patch/patches/tools_gyp.patch index de0e92da5..0b06ecaba 100644 --- a/patch/patches/tools_gyp.patch +++ b/patch/patches/tools_gyp.patch @@ -1,14 +1,14 @@ Index: pylib/gyp/input.py =================================================================== ---- pylib/gyp/input.py (revision 1527) +--- pylib/gyp/input.py (revision 1556) +++ pylib/gyp/input.py (working copy) -@@ -851,7 +851,8 @@ +@@ -857,7 +857,8 @@ # that don't load quickly, this can be faster than # @@ -10,4 +10,4 @@ Index: contrib/minizip/unzip.c +// #define NOUNCRYPT #endif - #if defined(USE_SYSTEM_ZLIB) + #include "third_party/zlib/zlib.h" diff --git a/tests/cefclient/mac/helper-Info.plist b/tests/cefclient/mac/helper-Info.plist index ed5abfae9..9211f861a 100644 --- a/tests/cefclient/mac/helper-Info.plist +++ b/tests/cefclient/mac/helper-Info.plist @@ -24,6 +24,8 @@ 10.5.0 LSUIElement 1 + NSPrincipalClass + ClientApplication NSSupportsAutomaticGraphicsSwitching diff --git a/tools/gyp_cef b/tools/gyp_cef index f24dc89e0..4ccdb64e5 100644 --- a/tools/gyp_cef +++ b/tools/gyp_cef @@ -23,10 +23,11 @@ chrome_src = os.path.abspath(os.path.join(cef_dir, os.pardir)) sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) import gyp -# Add paths so that pymod_do_main(grit_info ...) can import files. +# Add paths so that pymod_do_main(...) can import files. sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build')) - +sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit', + 'Source', 'WebCore', 'WebCore.gyp', 'scripts')) # On Windows, Psyco shortens warm runs of build/gyp_chromium by about # 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70