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

Side by Side Diff: mojo/edk/embedder/embedder.cc

Issue 1642453002: [mojo-edk] Fix shutdown with old EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | mojo/edk/embedder/embedder_internal.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 "mojo/edk/embedder/embedder.h" 5 #include "mojo/edk/embedder/embedder.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 11 matching lines...) Expand all
22 22
23 namespace mojo { 23 namespace mojo {
24 namespace edk { 24 namespace edk {
25 25
26 class Core; 26 class Core;
27 class PlatformSupport; 27 class PlatformSupport;
28 28
29 namespace internal { 29 namespace internal {
30 30
31 Core* g_core; 31 Core* g_core;
32 base::TaskRunner* g_io_thread_task_runner;
33 PlatformSupport* g_platform_support; 32 PlatformSupport* g_platform_support;
34 ProcessDelegate* g_process_delegate; 33 ProcessDelegate* g_process_delegate;
35 34
36 // This is used to help negotiate message pipe connections over arbitrary 35 // This is used to help negotiate message pipe connections over arbitrary
37 // platform channels. The embedder needs to know which end of the pipe it's on 36 // platform channels. The embedder needs to know which end of the pipe it's on
38 // so it can do the right thing. 37 // so it can do the right thing.
39 // 38 //
40 // TODO: Remove this when people stop using mojo::embedder::CreateChannel() 39 // TODO: Remove this when people stop using mojo::embedder::CreateChannel()
41 // and thus mojo::edk::CreateMessagePipe(ScopedPlatformHandle). 40 // and thus mojo::edk::CreateMessagePipe(ScopedPlatformHandle).
42 bool g_is_parent_process = true; 41 bool g_is_parent_process = true;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 93
95 MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle, 94 MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle,
96 ScopedPlatformHandle* platform_handle) { 95 ScopedPlatformHandle* platform_handle) {
97 return internal::g_core->PassWrappedPlatformHandle( 96 return internal::g_core->PassWrappedPlatformHandle(
98 platform_handle_wrapper_handle, platform_handle); 97 platform_handle_wrapper_handle, platform_handle);
99 } 98 }
100 99
101 void InitIPCSupport(ProcessDelegate* process_delegate, 100 void InitIPCSupport(ProcessDelegate* process_delegate,
102 scoped_refptr<base::TaskRunner> io_thread_task_runner) { 101 scoped_refptr<base::TaskRunner> io_thread_task_runner) {
103 CHECK(internal::g_core); 102 CHECK(internal::g_core);
104 CHECK(!internal::g_io_thread_task_runner);
105 internal::g_io_thread_task_runner = io_thread_task_runner.get();
106 internal::g_io_thread_task_runner->AddRef();
107
108 internal::g_core->SetIOTaskRunner(io_thread_task_runner); 103 internal::g_core->SetIOTaskRunner(io_thread_task_runner);
109 internal::g_process_delegate = process_delegate; 104 internal::g_process_delegate = process_delegate;
110 } 105 }
111 106
112 void ShutdownIPCSupportOnIOThread() { 107 void ShutdownIPCSupportOnIOThread() {
113 } 108 }
114 109
115 void ShutdownIPCSupport() { 110 void ShutdownIPCSupport() {
116 CHECK(internal::g_process_delegate); 111 CHECK(internal::g_process_delegate);
117 CHECK(internal::g_core); 112 CHECK(internal::g_core);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 149 }
155 150
156 std::string GenerateRandomToken() { 151 std::string GenerateRandomToken() {
157 char random_bytes[16]; 152 char random_bytes[16];
158 crypto::RandBytes(random_bytes, 16); 153 crypto::RandBytes(random_bytes, 16);
159 return base::HexEncode(random_bytes, 16); 154 return base::HexEncode(random_bytes, 16);
160 } 155 }
161 156
162 } // namespace edk 157 } // namespace edk
163 } // namespace mojo 158 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/embedder/embedder_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698