| OLD | NEW |
| 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 Loading... |
| 325 int opener_render_view_id, | 325 int opener_render_view_id, |
| 326 int opener_render_frame_id, | 326 int opener_render_frame_id, |
| 327 bool* no_javascript_access) { | 327 bool* no_javascript_access) { |
| 328 *no_javascript_access = true; | 328 *no_javascript_access = true; |
| 329 return false; | 329 return false; |
| 330 } | 330 } |
| 331 | 331 |
| 332 void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 332 void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
| 333 const base::CommandLine& command_line, | 333 const base::CommandLine& command_line, |
| 334 int child_process_id, | 334 int child_process_id, |
| 335 content::FileDescriptorInfo* mappings) { | 335 FileDescriptorInfo* mappings |
| 336 #if defined(OS_ANDROID) | 336 #if defined(OS_ANDROID) |
| 337 const int flags_open_read = base::File::FLAG_OPEN | base::File::FLAG_READ; | 337 , std::map<int, base::MemoryMappedFile::Region>* regions |
| 338 base::FilePath pak_file_path; | 338 #endif |
| 339 CHECK(PathService::Get(FILE_CAST_PAK, &pak_file_path)); | 339 ) { |
| 340 base::File pak_file(pak_file_path, flags_open_read); | 340 #if defined(OS_ANDROID) |
| 341 if (!pak_file.IsValid()) { | 341 mappings->Share( |
| 342 NOTREACHED() << "Failed to open file when creating renderer process: " | 342 kAndroidPakDescriptor, |
| 343 << "cast_shell.pak"; | 343 base::GlobalDescriptors::GetInstance()->Get(kAndroidPakDescriptor)); |
| 344 } | 344 regions->insert(std::make_pair( |
| 345 mappings->Transfer(kAndroidPakDescriptor, | 345 kAndroidPakDescriptor, base::GlobalDescriptors::GetInstance()->GetRegion( |
| 346 base::ScopedFD(pak_file.TakePlatformFile())); | 346 kAndroidPakDescriptor))); |
| 347 | 347 |
| 348 if (breakpad::IsCrashReporterEnabled()) { | 348 if (breakpad::IsCrashReporterEnabled()) { |
| 349 base::File minidump_file( | 349 base::File minidump_file( |
| 350 breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( | 350 breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( |
| 351 child_process_id)); | 351 child_process_id)); |
| 352 if (!minidump_file.IsValid()) { | 352 if (!minidump_file.IsValid()) { |
| 353 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " | 353 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " |
| 354 << "be disabled for this process."; | 354 << "be disabled for this process."; |
| 355 } else { | 355 } else { |
| 356 mappings->Transfer(kAndroidMinidumpDescriptor, | 356 mappings->Transfer(kAndroidMinidumpDescriptor, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 process_type, dumps_path, false /* upload */); | 408 process_type, dumps_path, false /* upload */); |
| 409 // StartUploaderThread() even though upload is diferred. | 409 // StartUploaderThread() even though upload is diferred. |
| 410 // Breakpad-related memory is freed in the uploader thread. | 410 // Breakpad-related memory is freed in the uploader thread. |
| 411 crash_handler->StartUploaderThread(); | 411 crash_handler->StartUploaderThread(); |
| 412 return crash_handler; | 412 return crash_handler; |
| 413 } | 413 } |
| 414 #endif // !defined(OS_ANDROID) | 414 #endif // !defined(OS_ANDROID) |
| 415 | 415 |
| 416 } // namespace shell | 416 } // namespace shell |
| 417 } // namespace chromecast | 417 } // namespace chromecast |
| OLD | NEW |