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

Side by Side Diff: mojo/public/cpp/bindings/associated_group_controller.h

Issue 2185723002: Eliminate deferred destruction of AssociatedGroupController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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 unified diff | Download patch
« no previous file with comments | « ipc/ipc_mojo_bootstrap.cc ('k') | mojo/public/cpp/bindings/connector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/ref_counted_delete_on_message_loop.h"
13 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
14 #include "mojo/public/cpp/bindings/interface_id.h" 13 #include "mojo/public/cpp/bindings/interface_id.h"
15 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" 14 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
16 15
17 namespace mojo { 16 namespace mojo {
18 17
19 class AssociatedGroup; 18 class AssociatedGroup;
20 class InterfaceEndpointClient; 19 class InterfaceEndpointClient;
21 class InterfaceEndpointController; 20 class InterfaceEndpointController;
22 21
23 // An internal interface used to manage endpoints within an associated group. 22 // An internal interface used to manage endpoints within an associated group.
24 class AssociatedGroupController : 23 class AssociatedGroupController :
25 public base::RefCountedDeleteOnMessageLoop<AssociatedGroupController> { 24 public base::RefCountedThreadSafe<AssociatedGroupController> {
26 public: 25 public:
27 explicit AssociatedGroupController(
28 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
29
30 // Creates a pair of interface endpoint handles. The method generates a new 26 // Creates a pair of interface endpoint handles. The method generates a new
31 // interface ID and assigns it to the two handles. |local_endpoint| is used 27 // interface ID and assigns it to the two handles. |local_endpoint| is used
32 // locally; while |remote_endpoint| is sent over the message pipe. 28 // locally; while |remote_endpoint| is sent over the message pipe.
33 virtual void CreateEndpointHandlePair( 29 virtual void CreateEndpointHandlePair(
34 ScopedInterfaceEndpointHandle* local_endpoint, 30 ScopedInterfaceEndpointHandle* local_endpoint,
35 ScopedInterfaceEndpointHandle* remote_endpoint) = 0; 31 ScopedInterfaceEndpointHandle* remote_endpoint) = 0;
36 32
37 // Creates an interface endpoint handle from a given interface ID. The handle 33 // Creates an interface endpoint handle from a given interface ID. The handle
38 // is used locally. 34 // is used locally.
39 // Typically, this method is used to (1) create an endpoint handle for the 35 // Typically, this method is used to (1) create an endpoint handle for the
(...skipping 19 matching lines...) Expand all
59 virtual void DetachEndpointClient( 55 virtual void DetachEndpointClient(
60 const ScopedInterfaceEndpointHandle& handle) = 0; 56 const ScopedInterfaceEndpointHandle& handle) = 0;
61 57
62 // Raises an error on the underlying message pipe. It disconnects the pipe 58 // Raises an error on the underlying message pipe. It disconnects the pipe
63 // and notifies all interfaces running on this pipe. 59 // and notifies all interfaces running on this pipe.
64 virtual void RaiseError() = 0; 60 virtual void RaiseError() = 0;
65 61
66 std::unique_ptr<AssociatedGroup> CreateAssociatedGroup(); 62 std::unique_ptr<AssociatedGroup> CreateAssociatedGroup();
67 63
68 protected: 64 protected:
69 friend class base::RefCountedDeleteOnMessageLoop<AssociatedGroupController>; 65 friend class base::RefCountedThreadSafe<AssociatedGroupController>;
70 friend class base::DeleteHelper<AssociatedGroupController>;
71 66
72 // Creates a new ScopedInterfaceEndpointHandle associated with this 67 // Creates a new ScopedInterfaceEndpointHandle associated with this
73 // controller. 68 // controller.
74 ScopedInterfaceEndpointHandle CreateScopedInterfaceEndpointHandle( 69 ScopedInterfaceEndpointHandle CreateScopedInterfaceEndpointHandle(
75 InterfaceId id, 70 InterfaceId id,
76 bool is_local); 71 bool is_local);
77 72
78 virtual ~AssociatedGroupController(); 73 virtual ~AssociatedGroupController();
79
80 DISALLOW_COPY_AND_ASSIGN(AssociatedGroupController);
81 }; 74 };
82 75
83 } // namespace mojo 76 } // namespace mojo
84 77
85 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_ 78 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ipc/ipc_mojo_bootstrap.cc ('k') | mojo/public/cpp/bindings/connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698