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

Side by Side Diff: services/shell/runner/host/in_process_native_runner.cc

Issue 1922043003: Fix crash with --mojo-local-storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | no next file » | 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 "services/shell/runner/host/in_process_native_runner.h" 5 #include "services/shell/runner/host/in_process_native_runner.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/process/process.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
14 #include "base/task_runner.h" 15 #include "base/task_runner.h"
15 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
16 #include "base/threading/platform_thread.h" 17 #include "base/threading/platform_thread.h"
17 #include "mojo/public/cpp/bindings/interface_request.h" 18 #include "mojo/public/cpp/bindings/interface_request.h"
18 #include "services/shell/runner/host/native_application_support.h" 19 #include "services/shell/runner/host/native_application_support.h"
19 #include "services/shell/runner/host/out_of_process_native_runner.h" 20 #include "services/shell/runner/host/out_of_process_native_runner.h"
20 #include "services/shell/runner/init.h" 21 #include "services/shell/runner/init.h"
21 22
22 namespace shell { 23 namespace shell {
(...skipping 28 matching lines...) Expand all
51 &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(), 52 &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(),
52 FROM_HERE, app_completed_callback); 53 FROM_HERE, app_completed_callback);
53 54
54 DCHECK(!thread_); 55 DCHECK(!thread_);
55 std::string thread_name = "mojo:app_thread"; 56 std::string thread_name = "mojo:app_thread";
56 #if defined(OS_WIN) 57 #if defined(OS_WIN)
57 thread_name = base::WideToUTF8(app_path_.BaseName().value()); 58 thread_name = base::WideToUTF8(app_path_.BaseName().value());
58 #endif 59 #endif
59 thread_.reset(new base::DelegateSimpleThread(this, thread_name)); 60 thread_.reset(new base::DelegateSimpleThread(this, thread_name));
60 thread_->Start(); 61 thread_->Start();
61 pid_available_callback.Run(base::kNullProcessId); 62 pid_available_callback.Run(base::Process::Current().Pid());
62 63
63 return client; 64 return client;
64 } 65 }
65 66
66 void InProcessNativeRunner::Run() { 67 void InProcessNativeRunner::Run() {
67 DVLOG(2) << "Loading/running Mojo app in process from library: " 68 DVLOG(2) << "Loading/running Mojo app in process from library: "
68 << app_path_.value() 69 << app_path_.value()
69 << " thread id=" << base::PlatformThread::CurrentId(); 70 << " thread id=" << base::PlatformThread::CurrentId();
70 71
71 // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method! 72 // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method!
(...skipping 13 matching lines...) Expand all
85 const base::FilePath& app_path) { 86 const base::FilePath& app_path) {
86 // Non-Mojo apps are always run in a new process. 87 // Non-Mojo apps are always run in a new process.
87 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) { 88 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) {
88 return base::WrapUnique( 89 return base::WrapUnique(
89 new OutOfProcessNativeRunner(launch_process_runner_, nullptr)); 90 new OutOfProcessNativeRunner(launch_process_runner_, nullptr));
90 } 91 }
91 return base::WrapUnique(new InProcessNativeRunner); 92 return base::WrapUnique(new InProcessNativeRunner);
92 } 93 }
93 94
94 } // namespace shell 95 } // namespace shell
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698