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

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

Issue 8231004: Remaining cleanup (base::Bind): Replacing FileUtilProxy calls with new callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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
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>
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } else { 257 } else {
258 FilePath plugin_dir; 258 FilePath plugin_dir;
259 if (!PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &plugin_dir)) { 259 if (!PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &plugin_dir)) {
260 LOG(ERROR) << "Failed to locate the plugins directory"; 260 LOG(ERROR) << "Failed to locate the plugins directory";
261 delete this; 261 delete this;
262 return; 262 return;
263 } 263 }
264 irt_path = plugin_dir.Append(GetIrtLibraryFilename()); 264 irt_path = plugin_dir.Append(GetIrtLibraryFilename());
265 } 265 }
266 266
267 base::FileUtilProxy::CreateOrOpenCallback callback =
268 base::Bind(&NaClProcessHost::OpenIrtFileDone, weak_factory_.GetWeakPtr());
269 if (!base::FileUtilProxy::CreateOrOpen( 267 if (!base::FileUtilProxy::CreateOrOpen(
270 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 268 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
271 irt_path, 269 irt_path,
272 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, 270 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
273 callback)) { 271 base::Bind(&NaClProcessHost::OpenIrtFileDone,
272 weak_factory_.GetWeakPtr()))) {
274 delete this; 273 delete this;
275 } 274 }
276 } 275 }
277 276
278 void NaClProcessHost::OpenIrtFileDone(base::PlatformFileError error_code, 277 void NaClProcessHost::OpenIrtFileDone(base::PlatformFileError error_code,
279 base::PassPlatformFile file, 278 base::PassPlatformFile file,
280 bool created) { 279 bool created) {
281 std::vector<nacl::FileDescriptor> handles_for_renderer; 280 std::vector<nacl::FileDescriptor> handles_for_renderer;
282 base::ProcessHandle nacl_process_handle; 281 base::ProcessHandle nacl_process_handle;
283 bool have_irt_file = false; 282 bool have_irt_file = false;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 396 }
398 397
399 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { 398 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) {
400 NOTREACHED() << "Invalid message with type = " << msg.type(); 399 NOTREACHED() << "Invalid message with type = " << msg.type();
401 return false; 400 return false;
402 } 401 }
403 402
404 bool NaClProcessHost::CanShutdown() { 403 bool NaClProcessHost::CanShutdown() {
405 return true; 404 return true;
406 } 405 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698