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

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

Issue 2224063002: Use persistent memory for receiving metrics from sub-processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 3 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_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_
6 #define CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // BrowserChildProcessHost implementation: 70 // BrowserChildProcessHost implementation:
71 bool Send(IPC::Message* message) override; 71 bool Send(IPC::Message* message) override;
72 void Launch(SandboxedProcessLauncherDelegate* delegate, 72 void Launch(SandboxedProcessLauncherDelegate* delegate,
73 base::CommandLine* cmd_line, 73 base::CommandLine* cmd_line,
74 bool terminate_on_shutdown) override; 74 bool terminate_on_shutdown) override;
75 const ChildProcessData& GetData() const override; 75 const ChildProcessData& GetData() const override;
76 ChildProcessHost* GetHost() const override; 76 ChildProcessHost* GetHost() const override;
77 base::TerminationStatus GetTerminationStatus(bool known_dead, 77 base::TerminationStatus GetTerminationStatus(bool known_dead,
78 int* exit_code) override; 78 int* exit_code) override;
79 std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator()
80 override;
79 void SetName(const base::string16& name) override; 81 void SetName(const base::string16& name) override;
80 void SetHandle(base::ProcessHandle handle) override; 82 void SetHandle(base::ProcessHandle handle) override;
81 83
82 // ChildProcessHostDelegate implementation: 84 // ChildProcessHostDelegate implementation:
83 bool CanShutdown() override; 85 bool CanShutdown() override;
84 void OnChildDisconnected() override; 86 void OnChildDisconnected() override;
85 const base::Process& GetProcess() const override; 87 const base::Process& GetProcess() const override;
86 shell::InterfaceProvider* GetRemoteInterfaces() override; 88 shell::InterfaceProvider* GetRemoteInterfaces() override;
87 bool OnMessageReceived(const IPC::Message& message) override; 89 bool OnMessageReceived(const IPC::Message& message) override;
88 void OnChannelConnected(int32_t peer_pid) override; 90 void OnChannelConnected(int32_t peer_pid) override;
(...skipping 24 matching lines...) Expand all
113 typedef std::list<BrowserChildProcessHostImpl*> BrowserChildProcessList; 115 typedef std::list<BrowserChildProcessHostImpl*> BrowserChildProcessList;
114 private: 116 private:
115 friend class BrowserChildProcessHostIterator; 117 friend class BrowserChildProcessHostIterator;
116 friend class BrowserChildProcessObserver; 118 friend class BrowserChildProcessObserver;
117 119
118 static BrowserChildProcessList* GetIterator(); 120 static BrowserChildProcessList* GetIterator();
119 121
120 static void AddObserver(BrowserChildProcessObserver* observer); 122 static void AddObserver(BrowserChildProcessObserver* observer);
121 static void RemoveObserver(BrowserChildProcessObserver* observer); 123 static void RemoveObserver(BrowserChildProcessObserver* observer);
122 124
125 // Creates the |metrics_allocator_|.
126 void CreateMetricsAllocator();
127
128 // Passes the |metrics_allocator_|, if any, to the managed process. This
129 // requires the process to have been launched and the IPC channel to be
130 // available.
131 void ShareMetricsAllocatorToProcess();
132
123 // ChildProcessLauncher::Client implementation. 133 // ChildProcessLauncher::Client implementation.
124 void OnProcessLaunched() override; 134 void OnProcessLaunched() override;
125 void OnProcessLaunchFailed(int error_code) override; 135 void OnProcessLaunchFailed(int error_code) override;
126 136
127 // Returns true if the process has successfully launched. Must only be called 137 // Returns true if the process has successfully launched. Must only be called
128 // on the IO thread. 138 // on the IO thread.
129 bool IsProcessLaunched() const; 139 bool IsProcessLaunched() const;
130 140
131 static void OnMojoError( 141 static void OnMojoError(
132 base::WeakPtr<BrowserChildProcessHostImpl> process, 142 base::WeakPtr<BrowserChildProcessHostImpl> process,
(...skipping 16 matching lines...) Expand all
149 159
150 PowerMonitorMessageBroadcaster power_monitor_message_broadcaster_; 160 PowerMonitorMessageBroadcaster power_monitor_message_broadcaster_;
151 161
152 #if defined(OS_WIN) 162 #if defined(OS_WIN)
153 // Watches to see if the child process exits before the IPC channel has 163 // Watches to see if the child process exits before the IPC channel has
154 // been connected. Thereafter, its exit is determined by an error on the 164 // been connected. Thereafter, its exit is determined by an error on the
155 // IPC channel. 165 // IPC channel.
156 base::win::ObjectWatcher early_exit_watcher_; 166 base::win::ObjectWatcher early_exit_watcher_;
157 #endif 167 #endif
158 168
169 // The memory allocator, if any, in which the process will write its metrics.
170 std::unique_ptr<base::SharedPersistentMemoryAllocator> metrics_allocator_;
171
159 bool is_channel_connected_; 172 bool is_channel_connected_;
160 bool notify_child_disconnected_; 173 bool notify_child_disconnected_;
161 174
162 base::WeakPtrFactory<BrowserChildProcessHostImpl> weak_factory_; 175 base::WeakPtrFactory<BrowserChildProcessHostImpl> weak_factory_;
163 }; 176 };
164 177
165 } // namespace content 178 } // namespace content
166 179
167 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ 180 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/metrics/subprocess_metrics_provider_unittest.cc ('k') | content/browser/browser_child_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698