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

Side by Side Diff: ipc/mojo/scoped_ipc_support.cc

Issue 2074453003: Move ScopedIPCSupport to mojo/edk/embedder and the mojo::edk namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 | « ipc/mojo/scoped_ipc_support.h ('k') | mojo/edk/embedder/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ipc/mojo/scoped_ipc_support.h"
6
7 #include "base/lazy_instance.h"
8 #include "base/logging.h"
9 #include "base/macros.h"
10 #include "mojo/edk/embedder/embedder.h"
11 #include "mojo/edk/embedder/process_delegate.h"
12
13 namespace IPC {
14
15 namespace {
16 class IPCSupportInitializer : public mojo::edk::ProcessDelegate {
17 public:
18 IPCSupportInitializer() {}
19 ~IPCSupportInitializer() override {}
20
21 void Init(scoped_refptr<base::TaskRunner> io_thread_task_runner) {
22 CHECK(!io_thread_task_runner_);
23 CHECK(io_thread_task_runner);
24 io_thread_task_runner_ = io_thread_task_runner;
25
26 mojo::edk::InitIPCSupport(this, io_thread_task_runner_);
27 }
28
29 void ShutDown() {
30 CHECK(io_thread_task_runner_);
31 mojo::edk::ShutdownIPCSupport();
32 }
33
34 private:
35 // mojo::edk::ProcessDelegate:
36 void OnShutdownComplete() override {
37 // TODO(rockot): We should ensure that IO runner shutdown is blocked until
38 // this is called.
39 }
40
41 scoped_refptr<base::TaskRunner> io_thread_task_runner_;
42
43 DISALLOW_COPY_AND_ASSIGN(IPCSupportInitializer);
44 };
45
46 base::LazyInstance<IPCSupportInitializer>::Leaky ipc_support_initializer;
47
48 } // namespace
49
50 ScopedIPCSupport::ScopedIPCSupport(
51 scoped_refptr<base::TaskRunner> io_thread_task_runner) {
52 ipc_support_initializer.Get().Init(io_thread_task_runner);
53 }
54
55 ScopedIPCSupport::~ScopedIPCSupport() {
56 ipc_support_initializer.Get().ShutDown();
57 }
58
59 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/mojo/scoped_ipc_support.h ('k') | mojo/edk/embedder/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698