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

Side by Side Diff: content/browser/child_process_launcher.h

Issue 2365273004: Initial implementation for sharing field trial state (win) (Closed)
Patch Set: Write unit test for BrowserChildProcessHostImpl Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ 5 #ifndef CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_
6 #define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ 6 #define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_
7 7
8 #include "base/files/scoped_file.h" 8 #include "base/files/scoped_file.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // ready. Deleting this object before the process is created is safe, since 69 // ready. Deleting this object before the process is created is safe, since
70 // the callback won't be called. If the process is still running by the time 70 // the callback won't be called. If the process is still running by the time
71 // this object destructs, it will be terminated. 71 // this object destructs, it will be terminated.
72 // Takes ownership of cmd_line. 72 // Takes ownership of cmd_line.
73 // 73 //
74 // If |process_error_callback| is provided, it will be called if a Mojo error 74 // If |process_error_callback| is provided, it will be called if a Mojo error
75 // is encountered when processing messages from the child process. This 75 // is encountered when processing messages from the child process. This
76 // callback must be safe to call from any thread. 76 // callback must be safe to call from any thread.
77 ChildProcessLauncher( 77 ChildProcessLauncher(
78 SandboxedProcessLauncherDelegate* delegate, 78 SandboxedProcessLauncherDelegate* delegate,
79 #if defined(OS_WIN)
80 HANDLE field_trial_handle,
81 #endif
79 base::CommandLine* cmd_line, 82 base::CommandLine* cmd_line,
80 int child_process_id, 83 int child_process_id,
81 Client* client, 84 Client* client,
82 const std::string& mojo_child_token, 85 const std::string& mojo_child_token,
83 const mojo::edk::ProcessErrorCallback& process_error_callback, 86 const mojo::edk::ProcessErrorCallback& process_error_callback,
84 bool terminate_on_shutdown = true); 87 bool terminate_on_shutdown = true);
85 ~ChildProcessLauncher(); 88 ~ChildProcessLauncher();
86 89
87 // True if the process is being launched and so the handle isn't available. 90 // True if the process is being launched and so the handle isn't available.
88 bool IsStarting(); 91 bool IsStarting();
(...skipping 19 matching lines...) Expand all
108 // this after the process has started. 111 // this after the process has started.
109 void SetProcessBackgrounded(bool background); 112 void SetProcessBackgrounded(bool background);
110 113
111 // Replaces the ChildProcessLauncher::Client for testing purposes. Returns the 114 // Replaces the ChildProcessLauncher::Client for testing purposes. Returns the
112 // previous client. 115 // previous client.
113 Client* ReplaceClientForTest(Client* client); 116 Client* ReplaceClientForTest(Client* client);
114 117
115 private: 118 private:
116 // Posts a task to the launcher thread to do the actual work. 119 // Posts a task to the launcher thread to do the actual work.
117 void Launch(SandboxedProcessLauncherDelegate* delegate, 120 void Launch(SandboxedProcessLauncherDelegate* delegate,
121 #if defined(OS_WIN)
122 HANDLE field_trial_handle,
123 #endif
118 base::CommandLine* cmd_line, 124 base::CommandLine* cmd_line,
119 int child_process_id); 125 int child_process_id);
120 126
121 void UpdateTerminationStatus(bool known_dead); 127 void UpdateTerminationStatus(bool known_dead);
122 128
123 // This is always called on the client thread after an attempt 129 // This is always called on the client thread after an attempt
124 // to launch the child process on the launcher thread. 130 // to launch the child process on the launcher thread.
125 // It makes sure we always perform the necessary cleanup if the 131 // It makes sure we always perform the necessary cleanup if the
126 // client went away. 132 // client went away.
127 static void DidLaunch(base::WeakPtr<ChildProcessLauncher> instance, 133 static void DidLaunch(base::WeakPtr<ChildProcessLauncher> instance,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const std::string mojo_child_token_; 166 const std::string mojo_child_token_;
161 167
162 base::WeakPtrFactory<ChildProcessLauncher> weak_factory_; 168 base::WeakPtrFactory<ChildProcessLauncher> weak_factory_;
163 169
164 DISALLOW_COPY_AND_ASSIGN(ChildProcessLauncher); 170 DISALLOW_COPY_AND_ASSIGN(ChildProcessLauncher);
165 }; 171 };
166 172
167 } // namespace content 173 } // namespace content
168 174
169 #endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ 175 #endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698