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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_child_process_host_impl.h
diff --git a/content/browser/browser_child_process_host_impl.h b/content/browser/browser_child_process_host_impl.h
index 082fdf6e193507030dabc263b2aa3b37de2b7f59..f83be3c730c67e7ecd1587365eecc674ded3ea5c 100644
--- a/content/browser/browser_child_process_host_impl.h
+++ b/content/browser/browser_child_process_host_impl.h
@@ -15,6 +15,7 @@
#include "base/memory/weak_ptr.h"
#include "base/process/process.h"
#include "base/single_thread_task_runner.h"
+#include "base/strings/string_piece.h"
#include "base/synchronization/waitable_event_watcher.h"
#include "build/build_config.h"
#include "content/browser/child_process_launcher.h"
@@ -54,7 +55,9 @@ class CONTENT_EXPORT BrowserChildProcessHostImpl
public:
BrowserChildProcessHostImpl(content::ProcessType process_type,
BrowserChildProcessHostDelegate* delegate,
- const std::string& mojo_child_token);
+ const std::string& mojo_child_token,
+ size_t shared_metrics_memory_size,
+ base::StringPiece shared_metrics_name);
~BrowserChildProcessHostImpl() override;
// Terminates all child processes and deletes each BrowserChildProcessHost
@@ -75,6 +78,8 @@ class CONTENT_EXPORT BrowserChildProcessHostImpl
ChildProcessHost* GetHost() const override;
base::TerminationStatus GetTerminationStatus(bool known_dead,
int* exit_code) override;
+ std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator()
+ override;
void SetName(const base::string16& name) override;
void SetHandle(base::ProcessHandle handle) override;
shell::InterfaceProvider* GetRemoteInterfaces() override;
@@ -115,6 +120,11 @@ class CONTENT_EXPORT BrowserChildProcessHostImpl
static void AddObserver(BrowserChildProcessObserver* observer);
static void RemoveObserver(BrowserChildProcessObserver* observer);
+ // Passes the |metrics_allocator_|, if any, to the managed process. This
+ // requires the process to have been launched and the RPC channel to be
+ // available.
+ void ShareMetricsAllocatorToProcess();
+
// ChildProcessLauncher::Client implementation.
void OnProcessLaunched() override;
void OnProcessLaunchFailed(int error_code) override;
@@ -149,6 +159,9 @@ class CONTENT_EXPORT BrowserChildProcessHostImpl
base::win::ObjectWatcher early_exit_watcher_;
#endif
+ // The memory allocator, if any, in which the process will write its metrics.
+ std::unique_ptr<base::SharedPersistentMemoryAllocator> metrics_allocator_;
+
bool is_channel_connected_;
bool notify_child_disconnected_;

Powered by Google App Engine
This is Rietveld 408576698