| OLD | NEW |
| 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 "base/threading/thread_restrictions.h" |
| 21 #include "cc/base/switches.h" |
| 21 #include "content/public/browser/browser_main_runner.h" | 22 #include "content/public/browser/browser_main_runner.h" |
| 22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
| 24 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | 25 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
| 25 | 26 |
| 26 namespace android_webview { | 27 namespace android_webview { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 // TODO(boliu): Remove these global Allows once the underlying issues | 31 // TODO(boliu): Remove these global Allows once the underlying issues |
| (...skipping 18 matching lines...) Expand all Loading... |
| 49 } | 50 } |
| 50 | 51 |
| 51 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { | 52 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { |
| 52 content::SetContentClient(&content_client_); | 53 content::SetContentClient(&content_client_); |
| 53 | 54 |
| 54 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl | 55 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl |
| 55 ::EnableVirtualizedContext(); | 56 ::EnableVirtualizedContext(); |
| 56 | 57 |
| 57 CommandLine* cl = CommandLine::ForCurrentProcess(); | 58 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 58 | 59 |
| 59 // Temporarily disable merged thread mode until proper hardware init is done. | |
| 60 // Currently hardware draw with incomplete init is making invalid GL calls | |
| 61 // that is crashing in graphics driver on Nexus 7. | |
| 62 if (!cl->HasSwitch("merge-ui-and-compositor-threads")) | |
| 63 cl->AppendSwitch(switches::kNoMergeUIAndRendererCompositorThreads); | |
| 64 | |
| 65 if (UIAndRendererCompositorThreadsNotMerged()) { | 60 if (UIAndRendererCompositorThreadsNotMerged()) { |
| 66 cl->AppendSwitch(switches::kEnableWebViewSynchronousAPIs); | 61 cl->AppendSwitch(switches::kEnableWebViewSynchronousAPIs); |
| 67 } else { | 62 } else { |
| 68 // Set the command line to enable synchronous API compatibility. | 63 // Set the command line to enable synchronous API compatibility. |
| 69 cl->AppendSwitch(switches::kEnableSynchronousRendererCompositor); | 64 cl->AppendSwitch(switches::kEnableSynchronousRendererCompositor); |
| 65 cl->AppendSwitch(switches::kEnableVsyncNotification); |
| 70 } | 66 } |
| 71 return false; | 67 return false; |
| 72 } | 68 } |
| 73 | 69 |
| 74 void AwMainDelegate::PreSandboxStartup() { | 70 void AwMainDelegate::PreSandboxStartup() { |
| 75 // TODO(torne): When we have a separate renderer process, we need to handle | 71 // TODO(torne): When we have a separate renderer process, we need to handle |
| 76 // being passed open FDs for the resource paks here. | 72 // being passed open FDs for the resource paks here. |
| 77 } | 73 } |
| 78 | 74 |
| 79 void AwMainDelegate::SandboxInitialized(const std::string& process_type) { | 75 void AwMainDelegate::SandboxInitialized(const std::string& process_type) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 AwBrowserContext* browser_context) { | 141 AwBrowserContext* browser_context) { |
| 146 return AwGeolocationPermissionContext::Create(browser_context); | 142 return AwGeolocationPermissionContext::Create(browser_context); |
| 147 } | 143 } |
| 148 | 144 |
| 149 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( | 145 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( |
| 150 content::WebContents* web_contents) { | 146 content::WebContents* web_contents) { |
| 151 return AwWebContentsViewDelegate::Create(web_contents); | 147 return AwWebContentsViewDelegate::Create(web_contents); |
| 152 } | 148 } |
| 153 | 149 |
| 154 } // namespace android_webview | 150 } // namespace android_webview |
| OLD | NEW |