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

Side by Side Diff: shell/in_process_native_runner.cc

Issue 1174063002: Remove use of MessageLoopProxy (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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
« no previous file with comments | « shell/child_main.cc ('k') | shell/task_runners.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 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 "shell/in_process_native_runner.h" 5 #include "shell/in_process_native_runner.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/thread_task_runner_handle.h"
11 #include "base/threading/platform_thread.h" 11 #include "base/threading/platform_thread.h"
12 #include "shell/native_application_support.h" 12 #include "shell/native_application_support.h"
13 13
14 namespace shell { 14 namespace shell {
15 15
16 InProcessNativeRunner::InProcessNativeRunner(Context* context) 16 InProcessNativeRunner::InProcessNativeRunner(Context* context)
17 : app_library_(nullptr) { 17 : app_library_(nullptr) {
18 } 18 }
19 19
20 InProcessNativeRunner::~InProcessNativeRunner() { 20 InProcessNativeRunner::~InProcessNativeRunner() {
(...skipping 10 matching lines...) Expand all
31 void InProcessNativeRunner::Start( 31 void InProcessNativeRunner::Start(
32 const base::FilePath& app_path, 32 const base::FilePath& app_path,
33 mojo::InterfaceRequest<mojo::Application> application_request, 33 mojo::InterfaceRequest<mojo::Application> application_request,
34 const base::Closure& app_completed_callback) { 34 const base::Closure& app_completed_callback) {
35 app_path_ = app_path; 35 app_path_ = app_path;
36 36
37 DCHECK(!application_request_.is_pending()); 37 DCHECK(!application_request_.is_pending());
38 application_request_ = application_request.Pass(); 38 application_request_ = application_request.Pass();
39 39
40 DCHECK(app_completed_callback_runner_.is_null()); 40 DCHECK(app_completed_callback_runner_.is_null());
41 app_completed_callback_runner_ = 41 app_completed_callback_runner_ = base::Bind(
42 base::Bind(&base::TaskRunner::PostTask, base::MessageLoopProxy::current(), 42 &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(),
43 FROM_HERE, app_completed_callback); 43 FROM_HERE, app_completed_callback);
44 44
45 DCHECK(!thread_); 45 DCHECK(!thread_);
46 std::string thread_name = "app_thread_" + app_path_.BaseName().AsUTF8Unsafe(); 46 std::string thread_name = "app_thread_" + app_path_.BaseName().AsUTF8Unsafe();
47 thread_.reset(new base::DelegateSimpleThread(this, thread_name)); 47 thread_.reset(new base::DelegateSimpleThread(this, thread_name));
48 thread_->Start(); 48 thread_->Start();
49 } 49 }
50 50
51 void InProcessNativeRunner::Run() { 51 void InProcessNativeRunner::Run() {
52 DVLOG(2) << "Loading/running Mojo app in process from library: " 52 DVLOG(2) << "Loading/running Mojo app in process from library: "
53 << app_path_.value() 53 << app_path_.value()
54 << " thread id=" << base::PlatformThread::CurrentId(); 54 << " thread id=" << base::PlatformThread::CurrentId();
55 55
56 // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method! 56 // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method!
57 base::NativeLibrary app_library = LoadNativeApplication(app_path_); 57 base::NativeLibrary app_library = LoadNativeApplication(app_path_);
58 app_library_.Reset(app_library); 58 app_library_.Reset(app_library);
59 RunNativeApplication(app_library, application_request_.Pass()); 59 RunNativeApplication(app_library, application_request_.Pass());
60 app_completed_callback_runner_.Run(); 60 app_completed_callback_runner_.Run();
61 app_completed_callback_runner_.Reset(); 61 app_completed_callback_runner_.Reset();
62 } 62 }
63 63
64 scoped_ptr<NativeRunner> InProcessNativeRunnerFactory::Create( 64 scoped_ptr<NativeRunner> InProcessNativeRunnerFactory::Create(
65 const Options& options) { 65 const Options& options) {
66 return make_scoped_ptr(new InProcessNativeRunner(context_)); 66 return make_scoped_ptr(new InProcessNativeRunner(context_));
67 } 67 }
68 68
69 } // namespace shell 69 } // namespace shell
OLDNEW
« no previous file with comments | « shell/child_main.cc ('k') | shell/task_runners.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698