Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: android_webview/lib/main/aw_main_delegate.cc

Issue 14888002: Android WebView Merged-Thread Hardware Draw (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/lib/main/aw_main_delegate.h" 5 #include "android_webview/lib/main/aw_main_delegate.h"
6 6
7 #include "android_webview/browser/aw_content_browser_client.h" 7 #include "android_webview/browser/aw_content_browser_client.h"
8 #include "android_webview/browser/in_process_renderer/in_process_renderer_client .h" 8 #include "android_webview/browser/in_process_renderer/in_process_renderer_client .h"
9 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" 9 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h"
10 #include "android_webview/common/aw_switches.h" 10 #include "android_webview/common/aw_switches.h"
11 #include "android_webview/lib/aw_browser_dependency_factory_impl.h" 11 #include "android_webview/lib/aw_browser_dependency_factory_impl.h"
12 #include "android_webview/native/aw_geolocation_permission_context.h" 12 #include "android_webview/native/aw_geolocation_permission_context.h"
13 #include "android_webview/native/aw_quota_manager_bridge_impl.h" 13 #include "android_webview/native/aw_quota_manager_bridge_impl.h"
14 #include "android_webview/native/aw_web_contents_view_delegate.h" 14 #include "android_webview/native/aw_web_contents_view_delegate.h"
15 #include "android_webview/renderer/aw_content_renderer_client.h" 15 #include "android_webview/renderer/aw_content_renderer_client.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/threading/thread_restrictions.h"
20 #include "content/public/browser/browser_main_runner.h" 21 #include "content/public/browser/browser_main_runner.h"
21 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
22 #include "content/public/common/content_switches.h" 23 #include "content/public/common/content_switches.h"
23 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" 24 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
24 25
25 namespace android_webview { 26 namespace android_webview {
26 27
27 namespace { 28 namespace {
28 29
29 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > 30 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> >
30 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; 31 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER;
31 32
33 base::LazyInstance<scoped_ptr<base::ThreadRestrictions::ScopedAllowIO> >
34 g_allow_io_in_ui_thread = LAZY_INSTANCE_INITIALIZER;
joth 2013/05/09 13:14:39 could you add a comment to remove both these?
35
32 bool UIAndRendererCompositorThreadsNotMerged() { 36 bool UIAndRendererCompositorThreadsNotMerged() {
33 return CommandLine::ForCurrentProcess()->HasSwitch( 37 return CommandLine::ForCurrentProcess()->HasSwitch(
34 switches::kNoMergeUIAndRendererCompositorThreads); 38 switches::kNoMergeUIAndRendererCompositorThreads);
35 } 39 }
36 } 40 }
37 41
38 AwMainDelegate::AwMainDelegate() { 42 AwMainDelegate::AwMainDelegate() {
39 } 43 }
40 44
41 AwMainDelegate::~AwMainDelegate() { 45 AwMainDelegate::~AwMainDelegate() {
(...skipping 30 matching lines...) Expand all
72 if (process_type.empty()) { 76 if (process_type.empty()) {
73 AwBrowserDependencyFactoryImpl::InstallInstance(); 77 AwBrowserDependencyFactoryImpl::InstallInstance();
74 78
75 browser_runner_.reset(content::BrowserMainRunner::Create()); 79 browser_runner_.reset(content::BrowserMainRunner::Create());
76 int exit_code = browser_runner_->Initialize(main_function_params); 80 int exit_code = browser_runner_->Initialize(main_function_params);
77 DCHECK(exit_code < 0); 81 DCHECK(exit_code < 0);
78 82
79 // This is temporary until we remove the browser compositor 83 // This is temporary until we remove the browser compositor
80 if (!UIAndRendererCompositorThreadsNotMerged()) { 84 if (!UIAndRendererCompositorThreadsNotMerged()) {
81 g_allow_wait_in_ui_thread.Get().reset( 85 g_allow_wait_in_ui_thread.Get().reset(
82 new ScopedAllowWaitForLegacyWebViewApi()); 86 new ScopedAllowWaitForLegacyWebViewApi);
87
88 // TODO(boliu): This is a HUGE hack to work around the fact that
89 // cc::WorkerPool joins on worker threads on the UI thread.
90 // See crbug.com/239423.
91 g_allow_io_in_ui_thread.Get().reset(
92 new base::ThreadRestrictions::ScopedAllowIO);
83 } 93 }
84 94
85 // Return 0 so that we do NOT trigger the default behavior. On Android, the 95 // Return 0 so that we do NOT trigger the default behavior. On Android, the
86 // UI message loop is managed by the Java application. 96 // UI message loop is managed by the Java application.
87 return 0; 97 return 0;
88 } 98 }
89 99
90 return -1; 100 return -1;
91 } 101 }
92 102
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 AwBrowserContext* browser_context) { 135 AwBrowserContext* browser_context) {
126 return AwGeolocationPermissionContext::Create(browser_context); 136 return AwGeolocationPermissionContext::Create(browser_context);
127 } 137 }
128 138
129 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( 139 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate(
130 content::WebContents* web_contents) { 140 content::WebContents* web_contents) {
131 return AwWebContentsViewDelegate::Create(web_contents); 141 return AwWebContentsViewDelegate::Create(web_contents);
132 } 142 }
133 143
134 } // namespace android_webview 144 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698