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

Side by Side Diff: mojo/edk/system/endpoint_relayer.h

Issue 1355673003: EDK: Add a MakeUnique and use it somewhere. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_EDK_SYSTEM_ENDPOINT_RELAYER_H_ 5 #ifndef MOJO_EDK_SYSTEM_ENDPOINT_RELAYER_H_
6 #define MOJO_EDK_SYSTEM_ENDPOINT_RELAYER_H_ 6 #define MOJO_EDK_SYSTEM_ENDPOINT_RELAYER_H_
7 7
8 #include <memory>
9
8 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "mojo/edk/system/channel_endpoint_client.h" 11 #include "mojo/edk/system/channel_endpoint_client.h"
11 #include "mojo/edk/system/mutex.h" 12 #include "mojo/edk/system/mutex.h"
12 #include "mojo/edk/system/system_impl_export.h" 13 #include "mojo/edk/system/system_impl_export.h"
13 #include "mojo/public/cpp/system/macros.h" 14 #include "mojo/public/cpp/system/macros.h"
14 15
15 namespace mojo { 16 namespace mojo {
16 namespace system { 17 namespace system {
17 18
18 class ChannelEndpoint; 19 class ChannelEndpoint;
19 20
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 67
67 // Gets the other port number (i.e., 0 -> 1, 1 -> 0). 68 // Gets the other port number (i.e., 0 -> 1, 1 -> 0).
68 static unsigned GetPeerPort(unsigned port); 69 static unsigned GetPeerPort(unsigned port);
69 70
70 // Initialize this object. This must be called before any other method. 71 // Initialize this object. This must be called before any other method.
71 void Init(ChannelEndpoint* endpoint0, 72 void Init(ChannelEndpoint* endpoint0,
72 ChannelEndpoint* endpoint1) MOJO_NOT_THREAD_SAFE; 73 ChannelEndpoint* endpoint1) MOJO_NOT_THREAD_SAFE;
73 74
74 // Sets (or resets) the filter, which can (optionally) handle/filter 75 // Sets (or resets) the filter, which can (optionally) handle/filter
75 // |Type::ENDPOINT_CLIENT| messages (see |Filter| above). 76 // |Type::ENDPOINT_CLIENT| messages (see |Filter| above).
76 void SetFilter(scoped_ptr<Filter> filter); 77 void SetFilter(std::unique_ptr<Filter> filter);
77 78
78 // |ChannelEndpointClient| methods: 79 // |ChannelEndpointClient| methods:
79 bool OnReadMessage(unsigned port, MessageInTransit* message) override; 80 bool OnReadMessage(unsigned port, MessageInTransit* message) override;
80 void OnDetachFromChannel(unsigned port) override; 81 void OnDetachFromChannel(unsigned port) override;
81 82
82 private: 83 private:
83 ~EndpointRelayer() override; 84 ~EndpointRelayer() override;
84 85
85 Mutex mutex_; 86 Mutex mutex_;
86 scoped_refptr<ChannelEndpoint> endpoints_[2] MOJO_GUARDED_BY(mutex_); 87 scoped_refptr<ChannelEndpoint> endpoints_[2] MOJO_GUARDED_BY(mutex_);
87 scoped_ptr<Filter> filter_ MOJO_GUARDED_BY(mutex_); 88 std::unique_ptr<Filter> filter_ MOJO_GUARDED_BY(mutex_);
88 89
89 MOJO_DISALLOW_COPY_AND_ASSIGN(EndpointRelayer); 90 MOJO_DISALLOW_COPY_AND_ASSIGN(EndpointRelayer);
90 }; 91 };
91 92
92 } // namespace system 93 } // namespace system
93 } // namespace mojo 94 } // namespace mojo
94 95
95 #endif // MOJO_EDK_SYSTEM_ENDPOINT_RELAYER_H_ 96 #endif // MOJO_EDK_SYSTEM_ENDPOINT_RELAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698