Chromium Code Reviews| 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/browser_view_renderer.h" | 8 #include "android_webview/browser/browser_view_renderer.h" |
| 9 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h" | 9 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h" |
| 10 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" | 10 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.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_quota_manager_bridge_impl.h" | 12 #include "android_webview/native/aw_quota_manager_bridge_impl.h" |
| 13 #include "android_webview/native/aw_web_contents_view_delegate.h" | 13 #include "android_webview/native/aw_web_contents_view_delegate.h" |
| 14 #include "android_webview/native/aw_web_preferences_populater_impl.h" | 14 #include "android_webview/native/aw_web_preferences_populater_impl.h" |
| 15 #include "android_webview/native/external_video_surface_container_impl.h" | 15 #include "android_webview/native/external_video_surface_container_impl.h" |
| 16 #include "android_webview/renderer/aw_content_renderer_client.h" | 16 #include "android_webview/renderer/aw_content_renderer_client.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/cpu.h" | 18 #include "base/cpu.h" |
| 19 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
| 20 #include "base/logging.h" | 20 #include "base/logging.h" |
| 21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 22 #include "base/threading/thread_restrictions.h" | 22 #include "base/threading/thread_restrictions.h" |
| 23 #include "content/public/browser/browser_main_runner.h" | 23 #include "content/public/browser/browser_main_runner.h" |
| 24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 26 #include "gpu/command_buffer/client/gl_in_process_context.h" | 26 #include "gpu/command_buffer/client/gl_in_process_context.h" |
| 27 #include "gpu/command_buffer/service/in_process_command_buffer.h" | |
| 28 #include "media/base/media_switches.h" | 27 #include "media/base/media_switches.h" |
| 29 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" | 28 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" |
| 30 | 29 |
| 31 namespace android_webview { | 30 namespace android_webview { |
| 32 | 31 |
| 33 namespace { | 32 namespace { |
| 34 | 33 |
| 35 // TODO(boliu): Remove this global Allow once the underlying issues are | 34 // TODO(boliu): Remove this global Allow once the underlying issues are |
| 36 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below. | 35 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below. |
| 37 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > | 36 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > |
| 38 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; | 37 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; |
| 39 | 38 |
| 40 } | 39 } |
| 41 | 40 |
| 42 AwMainDelegate::AwMainDelegate() | 41 AwMainDelegate::AwMainDelegate() |
| 43 : gpu_memory_buffer_factory_(new GpuMemoryBufferFactoryImpl) { | 42 : gpu_memory_buffer_factory_(new GpuMemoryBufferFactoryImpl) { |
| 44 } | 43 } |
| 45 | 44 |
| 46 AwMainDelegate::~AwMainDelegate() { | 45 AwMainDelegate::~AwMainDelegate() { |
| 47 } | 46 } |
| 48 | 47 |
| 49 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { | 48 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { |
| 50 content::SetContentClient(&content_client_); | 49 content::SetContentClient(&content_client_); |
| 51 | 50 |
| 52 gpu::InProcessCommandBuffer::SetGpuMemoryBufferFactory( | 51 if (!gpu_memory_buffer_factory_.get()->Initialize()) |
| 53 gpu_memory_buffer_factory_.get()); | 52 LOG(WARNING) << "Failed to initialize GpuMemoryBuffer factory"; |
| 54 | 53 |
| 55 BrowserViewRenderer::CalculateTileMemoryPolicy(); | 54 BrowserViewRenderer::CalculateTileMemoryPolicy(); |
| 56 | 55 |
| 57 CommandLine* cl = CommandLine::ForCurrentProcess(); | 56 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 58 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); | 57 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); |
| 59 cl->AppendSwitch(switches::kEnableZeroCopy); | 58 cl->AppendSwitch(switches::kEnableZeroCopy); |
|
boliu
2014/07/24 20:50:24
We can remove this switch if we don't have the fun
no sievers
2014/07/24 20:57:51
Done.
| |
| 60 cl->AppendSwitch(switches::kEnableImplSidePainting); | 59 cl->AppendSwitch(switches::kEnableImplSidePainting); |
| 61 | 60 |
| 62 // WebView uses the Android system's scrollbars and overscroll glow. | 61 // WebView uses the Android system's scrollbars and overscroll glow. |
| 63 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); | 62 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); |
| 64 | 63 |
| 65 // Not yet supported in single-process mode. | 64 // Not yet supported in single-process mode. |
| 66 cl->AppendSwitch(switches::kDisableSharedWorkers); | 65 cl->AppendSwitch(switches::kDisableSharedWorkers); |
| 67 | 66 |
| 68 // File system API not supported (requires some new API; internal bug 6930981) | 67 // File system API not supported (requires some new API; internal bug 6930981) |
| 69 cl->AppendSwitch(switches::kDisableFileSystem); | 68 cl->AppendSwitch(switches::kDisableFileSystem); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 | 147 |
| 149 #if defined(VIDEO_HOLE) | 148 #if defined(VIDEO_HOLE) |
| 150 content::ExternalVideoSurfaceContainer* | 149 content::ExternalVideoSurfaceContainer* |
| 151 AwMainDelegate::CreateExternalVideoSurfaceContainer( | 150 AwMainDelegate::CreateExternalVideoSurfaceContainer( |
| 152 content::WebContents* web_contents) { | 151 content::WebContents* web_contents) { |
| 153 return new ExternalVideoSurfaceContainerImpl(web_contents); | 152 return new ExternalVideoSurfaceContainerImpl(web_contents); |
| 154 } | 153 } |
| 155 #endif | 154 #endif |
| 156 | 155 |
| 157 } // namespace android_webview | 156 } // namespace android_webview |
| OLD | NEW |