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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_IMPL_WIN_H_
6 #define CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_IMPL_WIN_H_
7
8 #include "chrome/common/conflicts/module_database_win.mojom.h"
9 #include "content/public/common/process_type.h"
10
11 class ModuleDatabase;
12
13 // Implementation of the mojom::ModuleDatabase interface. This is the endpoint
14 // in the browser process. It simply redirects all calls to the singleton
15 // ModuleDatabase object.
16 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
17 public:
18 // Creates a service endpoint that forwards notifications from the remote
19 // process to the provided |module_database|. The |module_database| must
20 // outlive this object.
21 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::
22 ~ModuleDatabaseImpl() override;
23
24 // Factory function for use with service_manager::InterfaceRegistry. This
25 // creates a concrete implementation of mojom::ModuleDatabase interface in the
26 // current process, for the remote process represented by the provided
27 // |request|.
28 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
29 mojom::ModuleDatabaseRequest request);
30
31 // mojom::ModuleDatabase implementation:
32 void OnProcessStarted(uint32_t process_id, uint32_t process_type) override;
33 void OnModuleEvent(mojom::ModuleEventPtr module_event) override;
34
35 // Hooked up as the connection error handler, allowing the database to track
36 // the process death. This assumes that the child process maintains a single
37 // persistent connection.
38 void OnProcessEnded();
39
40 // Accessors, for testing.
41 ::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
42 uint32_t process_id() const { return process_id_; }
43
44 private:
45 // The module database this forwards events to. It must outlive this object.
46 ::ModuleDatabase* module_database_;
47 // 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.
48 // This is populated on OnProcessStarted (the first function expected to be
49 // called), and forwarded along to the central database with each call.
50 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
51 };
sky 2016/12/14 21:58:08 DISALLOW...
chrisha 2016/12/19 20:15:36 Done.
52
53 #endif // CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_IMPL_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698