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

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

Issue 16796002: Delete the browser-compositor webview render mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« no previous file with comments | « android_webview/common/renderer_picture_map.cc ('k') | android_webview/native/aw_contents.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/scoped_allow_wait_for_legacy_web_view_api.h" 8 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h"
9 #include "android_webview/common/aw_switches.h"
10 #include "android_webview/lib/aw_browser_dependency_factory_impl.h" 9 #include "android_webview/lib/aw_browser_dependency_factory_impl.h"
11 #include "android_webview/native/aw_geolocation_permission_context.h" 10 #include "android_webview/native/aw_geolocation_permission_context.h"
12 #include "android_webview/native/aw_quota_manager_bridge_impl.h" 11 #include "android_webview/native/aw_quota_manager_bridge_impl.h"
13 #include "android_webview/native/aw_web_contents_view_delegate.h" 12 #include "android_webview/native/aw_web_contents_view_delegate.h"
14 #include "android_webview/renderer/aw_content_renderer_client.h" 13 #include "android_webview/renderer/aw_content_renderer_client.h"
15 #include "base/command_line.h" 14 #include "base/command_line.h"
16 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
17 #include "base/logging.h" 16 #include "base/logging.h"
18 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
19 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
20 #include "cc/base/switches.h" 19 #include "cc/base/switches.h"
21 #include "content/public/browser/browser_main_runner.h" 20 #include "content/public/browser/browser_main_runner.h"
22 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
23 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
24 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" 23 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h"
25 24
26 namespace android_webview { 25 namespace android_webview {
27 26
28 namespace { 27 namespace {
29 28
30 // TODO(boliu): Remove these global Allows once the underlying issues are 29 // TODO(boliu): Remove ths global Allow once the underlying issues are
boliu 2013/06/11 22:57:44 typo: this
31 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below. 30 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below.
32
33 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > 31 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> >
34 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; 32 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER;
35 33
36 base::LazyInstance<scoped_ptr<base::ThreadRestrictions::ScopedAllowIO> >
37 g_allow_io_in_ui_thread = LAZY_INSTANCE_INITIALIZER;
38
39 bool UIAndRendererCompositorThreadsNotMerged() {
40 return CommandLine::ForCurrentProcess()->HasSwitch(
41 switches::kNoMergeUIAndRendererCompositorThreads);
42 }
43 } 34 }
44 35
45 AwMainDelegate::AwMainDelegate() { 36 AwMainDelegate::AwMainDelegate() {
46 } 37 }
47 38
48 AwMainDelegate::~AwMainDelegate() { 39 AwMainDelegate::~AwMainDelegate() {
49 } 40 }
50 41
51 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { 42 bool AwMainDelegate::BasicStartupComplete(int* exit_code) {
52 content::SetContentClient(&content_client_); 43 content::SetContentClient(&content_client_);
53 44
54 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl 45 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl
55 ::EnableVirtualizedContext(); 46 ::EnableVirtualizedContext();
56 47
57 CommandLine* cl = CommandLine::ForCurrentProcess(); 48 CommandLine* cl = CommandLine::ForCurrentProcess();
58 if (UIAndRendererCompositorThreadsNotMerged()) { 49 cl->AppendSwitch(switches::kEnableBeginFrameScheduling);
59 cl->AppendSwitch(cc::switches::kEnableCompositorFrameMessage); 50 if (!cl->HasSwitch("disable-map-image"))
60 cl->AppendSwitch(switches::kEnableWebViewSynchronousAPIs); 51 cl->AppendSwitch(cc::switches::kUseMapImage);
61 } else {
62 cl->AppendSwitch(switches::kEnableBeginFrameScheduling);
63 if (!cl->HasSwitch("disable-map-image"))
64 cl->AppendSwitch(cc::switches::kUseMapImage);
65 }
66 52
67 // WebView uses the existing Android View edge effect for overscroll glow. 53 // WebView uses the existing Android View edge effect for overscroll glow.
68 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); 54 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect);
69 55
70 return false; 56 return false;
71 } 57 }
72 58
73 void AwMainDelegate::PreSandboxStartup() { 59 void AwMainDelegate::PreSandboxStartup() {
74 // TODO(torne): When we have a separate renderer process, we need to handle 60 // TODO(torne): When we have a separate renderer process, we need to handle
75 // being passed open FDs for the resource paks here. 61 // being passed open FDs for the resource paks here.
76 } 62 }
77 63
78 void AwMainDelegate::SandboxInitialized(const std::string& process_type) { 64 void AwMainDelegate::SandboxInitialized(const std::string& process_type) {
79 // TODO(torne): Adjust linux OOM score here. 65 // TODO(torne): Adjust linux OOM score here.
80 } 66 }
81 67
82 int AwMainDelegate::RunProcess( 68 int AwMainDelegate::RunProcess(
83 const std::string& process_type, 69 const std::string& process_type,
84 const content::MainFunctionParams& main_function_params) { 70 const content::MainFunctionParams& main_function_params) {
85 if (process_type.empty()) { 71 if (process_type.empty()) {
86 AwBrowserDependencyFactoryImpl::InstallInstance(); 72 AwBrowserDependencyFactoryImpl::InstallInstance();
87 73
88 browser_runner_.reset(content::BrowserMainRunner::Create()); 74 browser_runner_.reset(content::BrowserMainRunner::Create());
89 int exit_code = browser_runner_->Initialize(main_function_params); 75 int exit_code = browser_runner_->Initialize(main_function_params);
90 DCHECK(exit_code < 0); 76 DCHECK(exit_code < 0);
91 77
92 if (!UIAndRendererCompositorThreadsNotMerged()) { 78 g_allow_wait_in_ui_thread.Get().reset(
93 // This is temporary until we remove the browser compositor 79 new ScopedAllowWaitForLegacyWebViewApi);
94 g_allow_wait_in_ui_thread.Get().reset(
95 new ScopedAllowWaitForLegacyWebViewApi);
96
97 // TODO(boliu): This is a HUGE hack to work around the fact that
98 // cc::WorkerPool joins on worker threads on the UI thread.
99 // See crbug.com/239423.
100 g_allow_io_in_ui_thread.Get().reset(
101 new base::ThreadRestrictions::ScopedAllowIO);
102 }
103 80
104 // Return 0 so that we do NOT trigger the default behavior. On Android, the 81 // Return 0 so that we do NOT trigger the default behavior. On Android, the
105 // UI message loop is managed by the Java application. 82 // UI message loop is managed by the Java application.
106 return 0; 83 return 0;
107 } 84 }
108 85
109 return -1; 86 return -1;
110 } 87 }
111 88
112 void AwMainDelegate::ProcessExiting(const std::string& process_type) { 89 void AwMainDelegate::ProcessExiting(const std::string& process_type) {
(...skipping 24 matching lines...) Expand all
137 AwBrowserContext* browser_context) { 114 AwBrowserContext* browser_context) {
138 return AwGeolocationPermissionContext::Create(browser_context); 115 return AwGeolocationPermissionContext::Create(browser_context);
139 } 116 }
140 117
141 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( 118 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate(
142 content::WebContents* web_contents) { 119 content::WebContents* web_contents) {
143 return AwWebContentsViewDelegate::Create(web_contents); 120 return AwWebContentsViewDelegate::Create(web_contents);
144 } 121 }
145 122
146 } // namespace android_webview 123 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/common/renderer_picture_map.cc ('k') | android_webview/native/aw_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698