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

Side by Side Diff: mojo/shell/child_process_host.h

Issue 1107633002: Improve multi-process debugging. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 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 | « mojo/shell/child_process.cc ('k') | mojo/shell/child_process_host.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 SHELL_CHILD_PROCESS_HOST_H_ 5 #ifndef SHELL_CHILD_PROCESS_HOST_H_
6 #define SHELL_CHILD_PROCESS_HOST_H_ 6 #define SHELL_CHILD_PROCESS_HOST_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/process/process.h" 9 #include "base/process/process.h"
10 #include "mojo/edk/embedder/channel_info_forward.h" 10 #include "mojo/edk/embedder/channel_info_forward.h"
(...skipping 12 matching lines...) Expand all
23 // child process. Currently runs a single app (loaded from the file system). 23 // child process. Currently runs a single app (loaded from the file system).
24 // 24 //
25 // This class is not thread-safe. It should be created/used/destroyed on a 25 // This class is not thread-safe. It should be created/used/destroyed on a
26 // single thread. 26 // single thread.
27 // 27 //
28 // Note: Does not currently work on Windows before Vista. 28 // Note: Does not currently work on Windows before Vista.
29 // Note: After |Start()|, |StartApp| must be called and this object must 29 // Note: After |Start()|, |StartApp| must be called and this object must
30 // remained alive until the |on_app_complete| callback is called. 30 // remained alive until the |on_app_complete| callback is called.
31 class ChildProcessHost { 31 class ChildProcessHost {
32 public: 32 public:
33 explicit ChildProcessHost(Context* context); 33 // |name| is just for debugging ease.
34 ChildProcessHost(Context* context, const std::string& name);
34 virtual ~ChildProcessHost(); 35 virtual ~ChildProcessHost();
35 36
36 // |Start()|s the child process; calls |DidStart()| (on the thread on which 37 // |Start()|s the child process; calls |DidStart()| (on the thread on which
37 // |Start()| was called) when the child has been started (or failed to start). 38 // |Start()| was called) when the child has been started (or failed to start).
38 // After calling |Start()|, this object must not be destroyed until 39 // After calling |Start()|, this object must not be destroyed until
39 // |DidStart()| has been called. 40 // |DidStart()| has been called.
40 // TODO(vtl): Consider using weak pointers and removing this requirement. 41 // TODO(vtl): Consider using weak pointers and removing this requirement.
41 void Start(); 42 void Start();
42 43
43 // Waits for the child process to terminate, and returns its exit code. 44 // Waits for the child process to terminate, and returns its exit code.
(...skipping 14 matching lines...) Expand all
58 59
59 private: 60 private:
60 bool DoLaunch(); 61 bool DoLaunch();
61 62
62 void AppCompleted(int32_t result); 63 void AppCompleted(int32_t result);
63 64
64 // Callback for |embedder::CreateChannel()|. 65 // Callback for |embedder::CreateChannel()|.
65 void DidCreateChannel(embedder::ChannelInfo* channel_info); 66 void DidCreateChannel(embedder::ChannelInfo* channel_info);
66 67
67 Context* const context_; 68 Context* const context_;
69 const std::string name_;
68 base::Process child_process_; 70 base::Process child_process_;
69 embedder::PlatformChannelPair platform_channel_pair_; 71 embedder::PlatformChannelPair platform_channel_pair_;
70 ChildControllerPtr controller_; 72 ChildControllerPtr controller_;
71 embedder::ChannelInfo* channel_info_; 73 embedder::ChannelInfo* channel_info_;
72 ChildController::StartAppCallback on_app_complete_; 74 ChildController::StartAppCallback on_app_complete_;
73 75
74 // Platform-specific "pipe" to the child process. Valid immediately after 76 // Platform-specific "pipe" to the child process. Valid immediately after
75 // creation. 77 // creation.
76 embedder::ScopedPlatformHandle platform_channel_; 78 embedder::ScopedPlatformHandle platform_channel_;
77 79
78 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); 80 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost);
79 }; 81 };
80 82
81 } // namespace shell 83 } // namespace shell
82 } // namespace mojo 84 } // namespace mojo
83 85
84 #endif // SHELL_CHILD_PROCESS_HOST_H_ 86 #endif // SHELL_CHILD_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « mojo/shell/child_process.cc ('k') | mojo/shell/child_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698