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/browser/aw_browser_main_parts.h" | 5 #include "android_webview/browser/aw_browser_main_parts.h" |
6 | 6 |
7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
8 #include "android_webview/browser/aw_dev_tools_discovery_provider.h" | 8 #include "android_webview/browser/aw_dev_tools_discovery_provider.h" |
9 #include "android_webview/browser/aw_media_client_android.h" | 9 #include "android_webview/browser/aw_media_client_android.h" |
10 #include "android_webview/browser/aw_result_codes.h" | 10 #include "android_webview/browser/aw_result_codes.h" |
| 11 #include "android_webview/browser/deferred_gpu_command_service.h" |
11 #include "android_webview/common/aw_resource.h" | 12 #include "android_webview/common/aw_resource.h" |
12 #include "base/android/apk_assets.h" | 13 #include "base/android/apk_assets.h" |
13 #include "base/android/build_info.h" | 14 #include "base/android/build_info.h" |
14 #include "base/android/locale_utils.h" | 15 #include "base/android/locale_utils.h" |
15 #include "base/android/memory_pressure_listener_android.h" | 16 #include "base/android/memory_pressure_listener_android.h" |
16 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
17 #include "base/path_service.h" | 18 #include "base/path_service.h" |
18 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
19 #include "content/public/common/content_client.h" | 20 #include "content/public/common/content_client.h" |
20 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 base::FilePath pak_path; | 88 base::FilePath pak_path; |
88 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path); | 89 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path); |
89 LOG(WARNING) << "Cannot load webviewchromium.pak assets from the apk. " | 90 LOG(WARNING) << "Cannot load webviewchromium.pak assets from the apk. " |
90 "Falling back loading it from " << pak_path.MaybeAsASCII(); | 91 "Falling back loading it from " << pak_path.MaybeAsASCII(); |
91 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 92 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
92 pak_path.AppendASCII("webviewchromium.pak"), ui::SCALE_FACTOR_NONE); | 93 pak_path.AppendASCII("webviewchromium.pak"), ui::SCALE_FACTOR_NONE); |
93 } | 94 } |
94 | 95 |
95 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( | 96 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( |
96 base::android::AttachCurrentThread()); | 97 base::android::AttachCurrentThread()); |
| 98 DeferredGpuCommandService::SetInstance(); |
97 | 99 |
98 return content::RESULT_CODE_NORMAL_EXIT; | 100 return content::RESULT_CODE_NORMAL_EXIT; |
99 } | 101 } |
100 | 102 |
101 void AwBrowserMainParts::PreMainMessageLoopRun() { | 103 void AwBrowserMainParts::PreMainMessageLoopRun() { |
102 browser_context_->PreMainMessageLoopRun(); | 104 browser_context_->PreMainMessageLoopRun(); |
103 | 105 |
104 AwDevToolsDiscoveryProvider::Install(); | 106 AwDevToolsDiscoveryProvider::Install(); |
105 | 107 |
106 media::SetMediaClientAndroid( | 108 media::SetMediaClientAndroid( |
107 new AwMediaClientAndroid(AwResource::GetConfigKeySystemUuidMapping())); | 109 new AwMediaClientAndroid(AwResource::GetConfigKeySystemUuidMapping())); |
108 | 110 |
109 gfx::GLSurface::InitializeOneOff(); | 111 gfx::GLSurface::InitializeOneOff(); |
110 | 112 |
111 // This is needed for WebView Classic backwards compatibility | 113 // This is needed for WebView Classic backwards compatibility |
112 // See crbug.com/298495 | 114 // See crbug.com/298495 |
113 content::SetMaxURLChars(20 * 1024 * 1024); | 115 content::SetMaxURLChars(20 * 1024 * 1024); |
114 } | 116 } |
115 | 117 |
116 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { | 118 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { |
117 // Android WebView does not use default MessageLoop. It has its own | 119 // Android WebView does not use default MessageLoop. It has its own |
118 // Android specific MessageLoop. | 120 // Android specific MessageLoop. |
119 return true; | 121 return true; |
120 } | 122 } |
121 | 123 |
122 } // namespace android_webview | 124 } // namespace android_webview |
OLD | NEW |