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

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

Issue 2043713004: Mojo: Add NotifyBadMessage API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no bindings 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 | « no previous file | mojo/edk/embedder/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 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 #ifndef MOJO_EDK_EMBEDDER_EMBEDDER_H_ 5 #ifndef MOJO_EDK_EMBEDDER_EMBEDDER_H_
6 #define MOJO_EDK_EMBEDDER_EMBEDDER_H_ 6 #define MOJO_EDK_EMBEDDER_EMBEDDER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 11 matching lines...) Expand all
22 22
23 namespace base { 23 namespace base {
24 class PortProvider; 24 class PortProvider;
25 } 25 }
26 26
27 namespace mojo { 27 namespace mojo {
28 namespace edk { 28 namespace edk {
29 29
30 class ProcessDelegate; 30 class ProcessDelegate;
31 31
32 using ProcessErrorCallback = base::Callback<void(const std::string& error)>;
33
32 // Basic configuration/initialization ------------------------------------------ 34 // Basic configuration/initialization ------------------------------------------
33 35
34 // |Init()| sets up the basic Mojo system environment, making the |Mojo...()| 36 // |Init()| sets up the basic Mojo system environment, making the |Mojo...()|
35 // functions available and functional. This is never shut down (except in tests 37 // functions available and functional. This is never shut down (except in tests
36 // -- see test_embedder.h). 38 // -- see test_embedder.h).
37 39
38 // Allows changing the default max message size. Must be called before Init. 40 // Allows changing the default max message size. Must be called before Init.
39 MOJO_SYSTEM_IMPL_EXPORT void SetMaxMessageSize(size_t bytes); 41 MOJO_SYSTEM_IMPL_EXPORT void SetMaxMessageSize(size_t bytes);
40 42
41 // Called in the parent process for each child process that is launched. 43 // Called in the parent process for each child process that is launched.
42 MOJO_SYSTEM_IMPL_EXPORT void ChildProcessLaunched( 44 MOJO_SYSTEM_IMPL_EXPORT void ChildProcessLaunched(
43 base::ProcessHandle child_process, 45 base::ProcessHandle child_process,
44 ScopedPlatformHandle server_pipe, 46 ScopedPlatformHandle server_pipe,
45 const std::string& child_token); 47 const std::string& child_token);
46 48
49 // Called in the parent process for each child process that is launched.
50 // |process_error_callback| is called if the system becomes aware of some
51 // internal error related to this process, e.g., if the system is notified of a
52 // bad message from this process via the |MojoNotifyBadMessage()| API.
53 MOJO_SYSTEM_IMPL_EXPORT void ChildProcessLaunched(
54 base::ProcessHandle child_process,
55 ScopedPlatformHandle server_pipe,
56 const std::string& child_token,
57 const ProcessErrorCallback& error_callback);
58
47 // Called in the parent process when a child process fails to launch. 59 // Called in the parent process when a child process fails to launch.
48 // Exactly one of ChildProcessLaunched() or ChildProcessLaunchFailed() must be 60 // Exactly one of ChildProcessLaunched() or ChildProcessLaunchFailed() must be
49 // called per child process launch attempt. 61 // called per child process launch attempt.
50 MOJO_SYSTEM_IMPL_EXPORT void ChildProcessLaunchFailed( 62 MOJO_SYSTEM_IMPL_EXPORT void ChildProcessLaunchFailed(
51 const std::string& child_token); 63 const std::string& child_token);
52 64
53 // Should be called as early as possible in the child process with the handle 65 // Should be called as early as possible in the child process with the handle
54 // that the parent received from ChildProcessLaunched. 66 // that the parent received from ChildProcessLaunched.
55 MOJO_SYSTEM_IMPL_EXPORT void SetParentPipeHandle(ScopedPlatformHandle pipe); 67 MOJO_SYSTEM_IMPL_EXPORT void SetParentPipeHandle(ScopedPlatformHandle pipe);
56 68
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 186
175 // Generates a random ASCII token string for use with CreateParentMessagePipe() 187 // Generates a random ASCII token string for use with CreateParentMessagePipe()
176 // and CreateChildMessagePipe() above. The generated token is suitably random so 188 // and CreateChildMessagePipe() above. The generated token is suitably random so
177 // as to not have to worry about collisions with other generated tokens. 189 // as to not have to worry about collisions with other generated tokens.
178 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); 190 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken();
179 191
180 } // namespace edk 192 } // namespace edk
181 } // namespace mojo 193 } // namespace mojo
182 194
183 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ 195 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/embedder/embedder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698