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

Side by Side Diff: chromecast/browser/cast_content_browser_client.cc

Issue 1181953002: Load non-locale .pak files directly from the .apk on Android (rather than extracting on start-up). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@raw-paks
Patch Set: yfriedman review comments Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromecast/browser/cast_content_browser_client.h" 5 #include "chromecast/browser/cast_content_browser_client.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 bool opener_suppressed, 325 bool opener_suppressed,
326 content::ResourceContext* context, 326 content::ResourceContext* context,
327 int render_process_id, 327 int render_process_id,
328 int opener_render_view_id, 328 int opener_render_view_id,
329 int opener_render_frame_id, 329 int opener_render_frame_id,
330 bool* no_javascript_access) { 330 bool* no_javascript_access) {
331 *no_javascript_access = true; 331 *no_javascript_access = true;
332 return false; 332 return false;
333 } 333 }
334 334
335 #if defined(OS_ANDROID)
335 void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 336 void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
336 const base::CommandLine& command_line, 337 const base::CommandLine& command_line,
337 int child_process_id, 338 int child_process_id,
338 content::FileDescriptorInfo* mappings) { 339 FileDescriptorInfo* mappings,
339 #if defined(OS_ANDROID) 340 std::map<int, base::MemoryMappedFile::Region>* regions) {
340 const int flags_open_read = base::File::FLAG_OPEN | base::File::FLAG_READ; 341 mappings->Share(
341 base::FilePath pak_file_path; 342 kAndroidPakDescriptor,
342 CHECK(PathService::Get(FILE_CAST_PAK, &pak_file_path)); 343 base::GlobalDescriptors::GetInstance()->Get(kAndroidPakDescriptor));
343 base::File pak_file(pak_file_path, flags_open_read); 344 regions->insert(std::make_pair(
344 if (!pak_file.IsValid()) { 345 kAndroidPakDescriptor, base::GlobalDescriptors::GetInstance()->GetRegion(
345 NOTREACHED() << "Failed to open file when creating renderer process: " 346 kAndroidPakDescriptor)));
346 << "cast_shell.pak";
347 }
348 mappings->Transfer(kAndroidPakDescriptor,
349 base::ScopedFD(pak_file.TakePlatformFile()));
350 347
351 if (breakpad::IsCrashReporterEnabled()) { 348 if (breakpad::IsCrashReporterEnabled()) {
352 base::File minidump_file( 349 base::File minidump_file(
353 breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( 350 breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile(
354 child_process_id)); 351 child_process_id));
355 if (!minidump_file.IsValid()) { 352 if (!minidump_file.IsValid()) {
356 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " 353 LOG(ERROR) << "Failed to create file for minidump, crash reporting will "
357 << "be disabled for this process."; 354 << "be disabled for this process.";
358 } else { 355 } else {
359 mappings->Transfer(kAndroidMinidumpDescriptor, 356 mappings->Transfer(kAndroidMinidumpDescriptor,
360 base::ScopedFD(minidump_file.TakePlatformFile())); 357 base::ScopedFD(minidump_file.TakePlatformFile()));
361 } 358 }
362 } 359 }
360 }
363 #else 361 #else
362 void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
363 const base::CommandLine& command_line,
364 int child_process_id,
365 FileDescriptorInfo* mappings) {
364 int crash_signal_fd = GetCrashSignalFD(command_line); 366 int crash_signal_fd = GetCrashSignalFD(command_line);
365 if (crash_signal_fd >= 0) { 367 if (crash_signal_fd >= 0) {
366 mappings->Share(kCrashDumpSignal, crash_signal_fd); 368 mappings->Share(kCrashDumpSignal, crash_signal_fd);
367 } 369 }
370 }
368 #endif // defined(OS_ANDROID) 371 #endif // defined(OS_ANDROID)
369 }
370 372
371 #if defined(OS_ANDROID) && defined(VIDEO_HOLE) 373 #if defined(OS_ANDROID) && defined(VIDEO_HOLE)
372 content::ExternalVideoSurfaceContainer* 374 content::ExternalVideoSurfaceContainer*
373 CastContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer( 375 CastContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
374 content::WebContents* web_contents) { 376 content::WebContents* web_contents) {
375 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create( 377 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create(
376 web_contents); 378 web_contents);
377 } 379 }
378 #endif // defined(OS_ANDROID) && defined(VIDEO_HOLE) 380 #endif // defined(OS_ANDROID) && defined(VIDEO_HOLE)
379 381
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 process_type, dumps_path, false /* upload */); 413 process_type, dumps_path, false /* upload */);
412 // StartUploaderThread() even though upload is diferred. 414 // StartUploaderThread() even though upload is diferred.
413 // Breakpad-related memory is freed in the uploader thread. 415 // Breakpad-related memory is freed in the uploader thread.
414 crash_handler->StartUploaderThread(); 416 crash_handler->StartUploaderThread();
415 return crash_handler; 417 return crash_handler;
416 } 418 }
417 #endif // !defined(OS_ANDROID) 419 #endif // !defined(OS_ANDROID)
418 420
419 } // namespace shell 421 } // namespace shell
420 } // namespace chromecast 422 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698