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

Side by Side Diff: content/shell/browser/shell_content_browser_client.cc

Issue 184003002: Remove CreatePlatformFile from content shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell_content_browser_client.h" 5 #include "content/shell/browser/shell_content_browser_client.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file.h"
10 #include "base/path_service.h" 11 #include "base/path_service.h"
11 #include "content/public/browser/render_process_host.h" 12 #include "content/public/browser/render_process_host.h"
12 #include "content/public/browser/resource_dispatcher_host.h" 13 #include "content/public/browser/resource_dispatcher_host.h"
13 #include "content/public/browser/storage_partition.h" 14 #include "content/public/browser/storage_partition.h"
14 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
15 #include "content/public/common/url_constants.h" 16 #include "content/public/common/url_constants.h"
16 #include "content/shell/browser/shell.h" 17 #include "content/shell/browser/shell.h"
17 #include "content/shell/browser/shell_browser_context.h" 18 #include "content/shell/browser/shell_browser_context.h"
18 #include "content/shell/browser/shell_browser_main_parts.h" 19 #include "content/shell/browser/shell_browser_main_parts.h"
19 #include "content/shell/browser/shell_devtools_delegate.h" 20 #include "content/shell/browser/shell_devtools_delegate.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 int child_process_id, 280 int child_process_id,
280 std::vector<content::FileDescriptorInfo>* mappings) { 281 std::vector<content::FileDescriptorInfo>* mappings) {
281 #if defined(OS_ANDROID) 282 #if defined(OS_ANDROID)
282 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; 283 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ;
283 base::FilePath pak_file; 284 base::FilePath pak_file;
284 bool r = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file); 285 bool r = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file);
285 CHECK(r); 286 CHECK(r);
286 pak_file = pak_file.Append(FILE_PATH_LITERAL("paks")); 287 pak_file = pak_file.Append(FILE_PATH_LITERAL("paks"));
287 pak_file = pak_file.Append(FILE_PATH_LITERAL("content_shell.pak")); 288 pak_file = pak_file.Append(FILE_PATH_LITERAL("content_shell.pak"));
288 289
289 base::PlatformFile f = 290 base::File f(pak_file, flags);
290 base::CreatePlatformFile(pak_file, flags, NULL, NULL); 291 if (!f.IsValid()) {
291 if (f == base::kInvalidPlatformFileValue) {
292 NOTREACHED() << "Failed to open file when creating renderer process: " 292 NOTREACHED() << "Failed to open file when creating renderer process: "
293 << "content_shell.pak"; 293 << "content_shell.pak";
294 } 294 }
295 mappings->push_back( 295 mappings->push_back(
296 content::FileDescriptorInfo(kShellPakDescriptor, 296 content::FileDescriptorInfo(kShellPakDescriptor,
297 base::FileDescriptor(f, true))); 297 base::FileDescriptor(f.Pass())));
298 298
299 if (breakpad::IsCrashReporterEnabled()) { 299 if (breakpad::IsCrashReporterEnabled()) {
300 f = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( 300 f = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile(
301 child_process_id); 301 child_process_id);
302 if (f == base::kInvalidPlatformFileValue) { 302 if (!f.IsValid()) {
303 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " 303 LOG(ERROR) << "Failed to create file for minidump, crash reporting will "
304 << "be disabled for this process."; 304 << "be disabled for this process.";
305 } else { 305 } else {
306 mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor, 306 mappings->push_back(
307 base::FileDescriptor(f, true))); 307 FileDescriptorInfo(kAndroidMinidumpDescriptor,
308 base::FileDescriptor(f.Pass())));
308 } 309 }
309 } 310 }
310 #else // !defined(OS_ANDROID) 311 #else // !defined(OS_ANDROID)
311 int crash_signal_fd = GetCrashSignalFD(command_line); 312 int crash_signal_fd = GetCrashSignalFD(command_line);
312 if (crash_signal_fd >= 0) { 313 if (crash_signal_fd >= 0) {
313 mappings->push_back(FileDescriptorInfo( 314 mappings->push_back(FileDescriptorInfo(
314 kCrashDumpSignal, base::FileDescriptor(crash_signal_fd, false))); 315 kCrashDumpSignal, base::FileDescriptor(crash_signal_fd, false)));
315 } 316 }
316 #endif // defined(OS_ANDROID) 317 #endif // defined(OS_ANDROID)
317 } 318 }
(...skipping 15 matching lines...) Expand all
333 ShellBrowserContext* 334 ShellBrowserContext*
334 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( 335 ShellContentBrowserClient::ShellBrowserContextForBrowserContext(
335 BrowserContext* content_browser_context) { 336 BrowserContext* content_browser_context) {
336 if (content_browser_context == browser_context()) 337 if (content_browser_context == browser_context())
337 return browser_context(); 338 return browser_context();
338 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); 339 DCHECK_EQ(content_browser_context, off_the_record_browser_context());
339 return off_the_record_browser_context(); 340 return off_the_record_browser_context();
340 } 341 }
341 342
342 } // namespace content 343 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698