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

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

Issue 2391763004: [Merge M54] Propagate common resources to WebView child process (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « android_webview/common/aw_descriptors.h ('k') | no next file » | 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 <memory> 7 #include <memory>
8 8
9 #include "android_webview/browser/aw_content_browser_client.h" 9 #include "android_webview/browser/aw_content_browser_client.h"
10 #include "android_webview/browser/browser_view_renderer.h" 10 #include "android_webview/browser/browser_view_renderer.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 std::string process_type = 153 std::string process_type =
154 command_line.GetSwitchValueASCII(switches::kProcessType); 154 command_line.GetSwitchValueASCII(switches::kProcessType);
155 int crash_signal_fd = -1; 155 int crash_signal_fd = -1;
156 if (process_type == switches::kRendererProcess) { 156 if (process_type == switches::kRendererProcess) {
157 auto* global_descriptors = base::GlobalDescriptors::GetInstance(); 157 auto* global_descriptors = base::GlobalDescriptors::GetInstance();
158 int pak_fd = global_descriptors->Get(kAndroidWebViewLocalePakDescriptor); 158 int pak_fd = global_descriptors->Get(kAndroidWebViewLocalePakDescriptor);
159 base::MemoryMappedFile::Region pak_region = 159 base::MemoryMappedFile::Region pak_region =
160 global_descriptors->GetRegion(kAndroidWebViewLocalePakDescriptor); 160 global_descriptors->GetRegion(kAndroidWebViewLocalePakDescriptor);
161 ResourceBundle::InitSharedInstanceWithPakFileRegion(base::File(pak_fd), 161 ResourceBundle::InitSharedInstanceWithPakFileRegion(base::File(pak_fd),
162 pak_region); 162 pak_region);
163 pak_fd = global_descriptors->Get(kAndroidWebViewMainPakDescriptor); 163
164 pak_region = 164 std::pair<int, ui::ScaleFactor> extra_paks[] = {
165 global_descriptors->GetRegion(kAndroidWebViewMainPakDescriptor); 165 {kAndroidWebViewMainPakDescriptor, ui::SCALE_FACTOR_NONE},
166 ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( 166 {kAndroidWebView100PercentPakDescriptor, ui::SCALE_FACTOR_100P}};
167 base::File(pak_fd), pak_region, ui::SCALE_FACTOR_NONE); 167
168 for (const auto& pak_info : extra_paks) {
169 pak_fd = global_descriptors->Get(pak_info.first);
170 pak_region = global_descriptors->GetRegion(pak_info.first);
171 ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion(
172 base::File(pak_fd), pak_region, pak_info.second);
173 }
174
168 crash_signal_fd = 175 crash_signal_fd =
169 global_descriptors->Get(kAndroidWebViewCrashSignalDescriptor); 176 global_descriptors->Get(kAndroidWebViewCrashSignalDescriptor);
170 } 177 }
171 if (process_type.empty()) { 178 if (process_type.empty()) {
172 if (command_line.HasSwitch(switches::kSingleProcess)) { 179 if (command_line.HasSwitch(switches::kSingleProcess)) {
173 process_type = breakpad::kWebViewSingleProcessType; 180 process_type = breakpad::kWebViewSingleProcessType;
174 } else { 181 } else {
175 process_type = breakpad::kBrowserProcessType; 182 process_type = breakpad::kBrowserProcessType;
176 } 183 }
177 } 184 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 #if defined(VIDEO_HOLE) 269 #if defined(VIDEO_HOLE)
263 content::ExternalVideoSurfaceContainer* 270 content::ExternalVideoSurfaceContainer*
264 AwMainDelegate::CreateExternalVideoSurfaceContainer( 271 AwMainDelegate::CreateExternalVideoSurfaceContainer(
265 content::WebContents* web_contents) { 272 content::WebContents* web_contents) {
266 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create( 273 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create(
267 web_contents); 274 web_contents);
268 } 275 }
269 #endif 276 #endif
270 277
271 } // namespace android_webview 278 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/common/aw_descriptors.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698