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

Side by Side Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 8311010: base::Bind: Convert FileUtilProxy::CreateOrOpenCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/nacl_host/nacl_process_host.h ('k') | webkit/blob/blob_url_request_job.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/nacl_host/nacl_process_host.h" 7 #include "chrome/browser/nacl_host/nacl_process_host.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <fcntl.h> 10 #include <fcntl.h>
11 #endif 11 #endif
12 12
13 #include "base/bind.h"
13 #include "base/command_line.h" 14 #include "base/command_line.h"
14 #include "base/path_service.h" 15 #include "base/path_service.h"
15 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
16 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
17 #include "base/win/windows_version.h" 18 #include "base/win/windows_version.h"
18 #include "chrome/common/chrome_paths.h" 19 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/logging_chrome.h" 21 #include "chrome/common/logging_chrome.h"
21 #include "chrome/common/nacl_cmd_line.h" 22 #include "chrome/common/nacl_cmd_line.h"
22 #include "chrome/common/nacl_messages.h" 23 #include "chrome/common/nacl_messages.h"
(...skipping 26 matching lines...) Expand all
49 struct NaClProcessHost::NaClInternal { 50 struct NaClProcessHost::NaClInternal {
50 std::vector<nacl::Handle> sockets_for_renderer; 51 std::vector<nacl::Handle> sockets_for_renderer;
51 std::vector<nacl::Handle> sockets_for_sel_ldr; 52 std::vector<nacl::Handle> sockets_for_sel_ldr;
52 }; 53 };
53 54
54 NaClProcessHost::NaClProcessHost(const std::wstring& url) 55 NaClProcessHost::NaClProcessHost(const std::wstring& url)
55 : BrowserChildProcessHost(NACL_LOADER_PROCESS), 56 : BrowserChildProcessHost(NACL_LOADER_PROCESS),
56 reply_msg_(NULL), 57 reply_msg_(NULL),
57 internal_(new NaClInternal()), 58 internal_(new NaClInternal()),
58 running_on_wow64_(false), 59 running_on_wow64_(false),
59 ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) { 60 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
60 set_name(WideToUTF16Hack(url)); 61 set_name(WideToUTF16Hack(url));
61 #if defined(OS_WIN) 62 #if defined(OS_WIN)
62 running_on_wow64_ = (base::win::OSInfo::GetInstance()->wow64_status() == 63 running_on_wow64_ = (base::win::OSInfo::GetInstance()->wow64_status() ==
63 base::win::OSInfo::WOW64_ENABLED); 64 base::win::OSInfo::WOW64_ENABLED);
64 #endif 65 #endif
65 } 66 }
66 67
67 NaClProcessHost::~NaClProcessHost() { 68 NaClProcessHost::~NaClProcessHost() {
68 // nacl::Close() is not available at link time if DISABLE_NACL is 69 // nacl::Close() is not available at link time if DISABLE_NACL is
69 // defined, but we still compile a bunch of other code from this 70 // defined, but we still compile a bunch of other code from this
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } else { 257 } else {
257 FilePath plugin_dir; 258 FilePath plugin_dir;
258 if (!PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &plugin_dir)) { 259 if (!PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &plugin_dir)) {
259 LOG(ERROR) << "Failed to locate the plugins directory"; 260 LOG(ERROR) << "Failed to locate the plugins directory";
260 delete this; 261 delete this;
261 return; 262 return;
262 } 263 }
263 irt_path = plugin_dir.Append(GetIrtLibraryFilename()); 264 irt_path = plugin_dir.Append(GetIrtLibraryFilename());
264 } 265 }
265 266
266 base::FileUtilProxy::CreateOrOpenCallback* callback = 267 base::FileUtilProxy::CreateOrOpenCallback callback =
267 callback_factory_.NewCallback(&NaClProcessHost::OpenIrtFileDone); 268 base::Bind(&NaClProcessHost::OpenIrtFileDone, weak_factory_.GetWeakPtr());
268 if (!base::FileUtilProxy::CreateOrOpen( 269 if (!base::FileUtilProxy::CreateOrOpen(
269 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 270 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
270 irt_path, 271 irt_path,
271 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, 272 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
272 callback)) { 273 callback)) {
273 delete this; 274 delete this;
274 } 275 }
275 } 276 }
276 277
277 void NaClProcessHost::OpenIrtFileDone(base::PlatformFileError error_code, 278 void NaClProcessHost::OpenIrtFileDone(base::PlatformFileError error_code,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 } 397 }
397 398
398 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { 399 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) {
399 NOTREACHED() << "Invalid message with type = " << msg.type(); 400 NOTREACHED() << "Invalid message with type = " << msg.type();
400 return false; 401 return false;
401 } 402 }
402 403
403 bool NaClProcessHost::CanShutdown() { 404 bool NaClProcessHost::CanShutdown() {
404 return true; 405 return true;
405 } 406 }
OLDNEW
« no previous file with comments | « chrome/browser/nacl_host/nacl_process_host.h ('k') | webkit/blob/blob_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698