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

Side by Side Diff: mojo/edk/embedder/multiprocess_embedder.h

Issue 1532183002: EDK: Split embedder.* into embedder.* and multiprocess_embedder.*. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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 | « mojo/edk/embedder/embedder_unittest.cc ('k') | mojo/edk/embedder/multiprocess_embedder.cc » ('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 2015 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 #ifndef MOJO_EDK_EMBEDDER_EMBEDDER_H_ 5 #ifndef MOJO_EDK_EMBEDDER_MULTIPROCESS_EMBEDDER_H_
6 #define MOJO_EDK_EMBEDDER_EMBEDDER_H_ 6 #define MOJO_EDK_EMBEDDER_MULTIPROCESS_EMBEDDER_H_
7 7
8 #include <functional> 8 #include <functional>
9 #include <memory>
10 #include <string> 9 #include <string>
11 10
12 #include "mojo/edk/embedder/channel_info_forward.h" 11 #include "mojo/edk/embedder/channel_info_forward.h"
13 #include "mojo/edk/embedder/process_type.h" 12 #include "mojo/edk/embedder/process_type.h"
14 #include "mojo/edk/embedder/slave_info.h" 13 #include "mojo/edk/embedder/slave_info.h"
15 #include "mojo/edk/platform/scoped_platform_handle.h" 14 #include "mojo/edk/platform/scoped_platform_handle.h"
16 #include "mojo/edk/platform/task_runner.h" 15 #include "mojo/edk/platform/task_runner.h"
17 #include "mojo/public/cpp/system/message_pipe.h" 16 #include "mojo/public/cpp/system/message_pipe.h"
18 17
19 namespace mojo { 18 namespace mojo {
20 19
21 namespace platform { 20 namespace platform {
22 class PlatformHandleWatcher; 21 class PlatformHandleWatcher;
23 } 22 }
24 23
25 namespace embedder { 24 namespace embedder {
26 25
27 struct Configuration;
28 class PlatformSupport;
29 class ProcessDelegate; 26 class ProcessDelegate;
30 27
31 // Basic configuration/initialization ------------------------------------------
32
33 // |Init()| sets up the basic Mojo system environment, making the |Mojo...()|
34 // functions available and functional. This is never shut down (except in tests
35 // -- see test_embedder.h).
36
37 // Returns the global configuration. In general, you should not need to change
38 // the configuration, but if you do you must do it before calling |Init()|.
39 Configuration* GetConfiguration();
40
41 // Must be called first, or just after setting configuration parameters, to
42 // initialize the (global, singleton) system.
43 void Init(std::unique_ptr<PlatformSupport> platform_support);
44
45 // Basic functions -------------------------------------------------------------
46
47 // The functions in this section are available once |Init()| has been called.
48
49 // Start waiting on the handle asynchronously. On success, |callback| will be
50 // called exactly once, when |handle| satisfies a signal in |signals| or it
51 // becomes known that it will never do so. |callback| will be executed on an
52 // arbitrary thread, so it must not call any Mojo system or embedder functions.
53 MojoResult AsyncWait(MojoHandle handle,
54 MojoHandleSignals signals,
55 const std::function<void(MojoResult)>& callback);
56
57 // Creates a |MojoHandle| that wraps the given |PlatformHandle| (taking
58 // ownership of it). This |MojoHandle| can then, e.g., be passed through message
59 // pipes. Note: This takes ownership (and thus closes) |platform_handle| even on
60 // failure, which is different from what you'd expect from a Mojo API, but it
61 // makes for a more convenient embedder API.
62 MojoResult CreatePlatformHandleWrapper(
63 platform::ScopedPlatformHandle platform_handle,
64 MojoHandle* platform_handle_wrapper_handle);
65
66 // Retrieves the |PlatformHandle| that was wrapped into a |MojoHandle| (using
67 // |CreatePlatformHandleWrapper()| above). Note that the |MojoHandle| must still
68 // be closed separately.
69 MojoResult PassWrappedPlatformHandle(
70 MojoHandle platform_handle_wrapper_handle,
71 platform::ScopedPlatformHandle* platform_handle);
72
73 // Initialialization/shutdown for interprocess communication (IPC) ------------- 28 // Initialialization/shutdown for interprocess communication (IPC) -------------
74 29
75 // |InitIPCSupport()| sets up the subsystem for interprocess communication, 30 // |InitIPCSupport()| sets up the subsystem for interprocess communication,
76 // making the IPC functions (in the following section) available and functional. 31 // making the IPC functions (in the following section) available and functional.
77 // (This may only be done after |Init()|.) 32 // (This may only be done after |Init()|.)
78 // 33 //
79 // This subsystem may be shut down, using |ShutdownIPCSupportOnIOThread()| or 34 // This subsystem may be shut down, using |ShutdownIPCSupportOnIOThread()| or
80 // |ShutdownIPCSupport()|. None of the IPC functions may be called while or 35 // |ShutdownIPCSupport()|. None of the IPC functions may be called while or
81 // after either of these is called. 36 // after either of these is called.
82 37
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 util::RefPtr<platform::TaskRunner>&& did_destroy_channel_runner); 188 util::RefPtr<platform::TaskRunner>&& did_destroy_channel_runner);
234 189
235 // Inform the channel that it will soon be destroyed (doing so is optional). 190 // Inform the channel that it will soon be destroyed (doing so is optional).
236 // This may be called from any thread, but the caller must ensure that this is 191 // This may be called from any thread, but the caller must ensure that this is
237 // called before |DestroyChannel()|. 192 // called before |DestroyChannel()|.
238 void WillDestroyChannelSoon(ChannelInfo* channel_info); 193 void WillDestroyChannelSoon(ChannelInfo* channel_info);
239 194
240 } // namespace embedder 195 } // namespace embedder
241 } // namespace mojo 196 } // namespace mojo
242 197
243 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ 198 #endif // MOJO_EDK_EMBEDDER_MULTIPROCESS_EMBEDDER_H_
OLDNEW
« no previous file with comments | « mojo/edk/embedder/embedder_unittest.cc ('k') | mojo/edk/embedder/multiprocess_embedder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698