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

Unified Diff: chrome/browser/conflicts/module_database_impl_win.h

Issue 2576843002: [win] Create ModuleDatabase and ModuleEventSinkImpl. (Closed)
Patch Set: Created 4 years 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: chrome/browser/conflicts/module_database_impl_win.h
diff --git a/chrome/browser/conflicts/module_database_impl_win.h b/chrome/browser/conflicts/module_database_impl_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..e29d45918b5d77ec5846f121ffeb44ec91e232e9
--- /dev/null
+++ b/chrome/browser/conflicts/module_database_impl_win.h
@@ -0,0 +1,53 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_IMPL_WIN_H_
+#define CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_IMPL_WIN_H_
+
+#include "chrome/common/conflicts/module_database_win.mojom.h"
+#include "content/public/common/process_type.h"
+
+class ModuleDatabase;
+
+// Implementation of the mojom::ModuleDatabase interface. This is the endpoint
+// in the browser process. It simply redirects all calls to the singleton
+// ModuleDatabase object.
+class ModuleDatabaseImpl : public mojom::ModuleDatabase {
sky 2016/12/14 21:58:08 optional: I've been encouraging people to use chro
chrisha 2016/12/19 20:15:36 Yeah, I've noticed both. A quick check on cs/ show
+ public:
+ // Creates a service endpoint that forwards notifications from the remote
+ // process to the provided |module_database|. The |module_database| must
+ // outlive this object.
+ explicit ModuleDatabaseImpl(::ModuleDatabase* module_database);
grt (UTC plus 2) 2016/12/15 09:07:12 is it common practice to have colliding names like
chrisha 2016/12/19 20:15:36 I've seen all things. The most common is a mojom::
+ ~ModuleDatabaseImpl() override;
+
+ // Factory function for use with service_manager::InterfaceRegistry. This
+ // creates a concrete implementation of mojom::ModuleDatabase interface in the
+ // current process, for the remote process represented by the provided
+ // |request|.
+ static void Create(::ModuleDatabase* module_database,
sky 2016/12/14 21:58:08 How do you ensure ModuleDatabase outlives this?
chrisha 2016/12/19 20:15:36 My plan was for ModuleDatabase to be a leaky singl
+ mojom::ModuleDatabaseRequest request);
+
+ // mojom::ModuleDatabase implementation:
+ void OnProcessStarted(uint32_t process_id, uint32_t process_type) override;
+ void OnModuleEvent(mojom::ModuleEventPtr module_event) override;
+
+ // Hooked up as the connection error handler, allowing the database to track
+ // the process death. This assumes that the child process maintains a single
+ // persistent connection.
+ void OnProcessEnded();
+
+ // Accessors, for testing.
+ ::ModuleDatabase* module_database() const { return module_database_; }
sky 2016/12/14 21:58:08 Either have this return a const ModuleDatabase* or
chrisha 2016/12/19 20:15:36 I'll drop the accessors entirely and use a friend
+ uint32_t process_id() const { return process_id_; }
+
+ private:
+ // The module database this forwards events to. It must outlive this object.
+ ::ModuleDatabase* module_database_;
+ // The cached process ID of the remote process on the other end of this pipe.
grt (UTC plus 2) 2016/12/15 09:07:12 nit: blank line before this
chrisha 2016/12/19 20:15:36 Done.
+ // This is populated on OnProcessStarted (the first function expected to be
+ // called), and forwarded along to the central database with each call.
+ uint32_t process_id_;
grt (UTC plus 2) 2016/12/15 09:07:12 pid + creation time are needed to uniquely identif
chrisha 2016/12/19 20:15:36 This object is bound in lifetime to the correspond
+};
sky 2016/12/14 21:58:08 DISALLOW...
chrisha 2016/12/19 20:15:36 Done.
+
+#endif // CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_IMPL_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698