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/gpu_memory_buffer_factory_impl.h" | 8 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h" |
9 #include "android_webview/browser/in_process_view_renderer.h" | 9 #include "android_webview/browser/in_process_view_renderer.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_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/native/aw_web_preferences_populater_impl.h" | 15 #include "android_webview/native/aw_web_preferences_populater_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/lazy_instance.h" | 18 #include "base/lazy_instance.h" |
19 #include "base/logging.h" | 19 #include "base/logging.h" |
20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
21 #include "base/threading/thread_restrictions.h" | 21 #include "base/threading/thread_restrictions.h" |
22 #include "cc/base/switches.h" | 22 #include "cc/base/switches.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 "content/public/common/url_utils.h" | |
26 #include "gpu/command_buffer/client/gl_in_process_context.h" | 27 #include "gpu/command_buffer/client/gl_in_process_context.h" |
27 #include "gpu/command_buffer/service/in_process_command_buffer.h" | 28 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
28 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" | 29 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" |
29 | 30 |
30 namespace android_webview { | 31 namespace android_webview { |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 // TODO(boliu): Remove this global Allow once the underlying issues are | 35 // TODO(boliu): Remove this global Allow once the underlying issues are |
35 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below. | 36 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below. |
36 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > | 37 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > |
37 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; | 38 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; |
38 | 39 |
39 } | 40 } |
40 | 41 |
41 AwMainDelegate::AwMainDelegate() | 42 AwMainDelegate::AwMainDelegate() |
42 : gpu_memory_buffer_factory_(new GpuMemoryBufferFactoryImpl) { | 43 : gpu_memory_buffer_factory_(new GpuMemoryBufferFactoryImpl) { |
43 } | 44 } |
44 | 45 |
45 AwMainDelegate::~AwMainDelegate() { | 46 AwMainDelegate::~AwMainDelegate() { |
46 } | 47 } |
47 | 48 |
48 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { | 49 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { |
49 content::SetContentClient(&content_client_); | 50 content::SetContentClient(&content_client_); |
51 content::SetMaxURLChars(20 * 1024 * 1024); | |
boliu
2013/12/10 21:35:44
Comment on why we need this.
Kristian Monsen
2013/12/10 21:42:07
Done.
| |
50 | 52 |
51 gpu::InProcessCommandBuffer::SetGpuMemoryBufferFactory( | 53 gpu::InProcessCommandBuffer::SetGpuMemoryBufferFactory( |
52 gpu_memory_buffer_factory_.get()); | 54 gpu_memory_buffer_factory_.get()); |
53 gpu::InProcessCommandBuffer::EnableVirtualizedContext(); | 55 gpu::InProcessCommandBuffer::EnableVirtualizedContext(); |
54 | 56 |
55 InProcessViewRenderer::CalculateTileMemoryPolicy(); | 57 InProcessViewRenderer::CalculateTileMemoryPolicy(); |
56 | 58 |
57 CommandLine* cl = CommandLine::ForCurrentProcess(); | 59 CommandLine* cl = CommandLine::ForCurrentProcess(); |
58 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); | 60 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); |
59 cl->AppendSwitch(cc::switches::kEnableMapImage); | 61 cl->AppendSwitch(cc::switches::kEnableMapImage); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( | 145 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( |
144 content::WebContents* web_contents) { | 146 content::WebContents* web_contents) { |
145 return AwWebContentsViewDelegate::Create(web_contents); | 147 return AwWebContentsViewDelegate::Create(web_contents); |
146 } | 148 } |
147 | 149 |
148 AwWebPreferencesPopulater* AwMainDelegate::CreateWebPreferencesPopulater() { | 150 AwWebPreferencesPopulater* AwMainDelegate::CreateWebPreferencesPopulater() { |
149 return new AwWebPreferencesPopulaterImpl(); | 151 return new AwWebPreferencesPopulaterImpl(); |
150 } | 152 } |
151 | 153 |
152 } // namespace android_webview | 154 } // namespace android_webview |
OLD | NEW |