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

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

Issue 1353683005: EDK: Convert remaining scoped_ptr -> std::unique_ptr in //mojo/edk/system. (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
« no previous file with comments | « mojo/edk/system/proxy_message_pipe_endpoint.cc ('k') | mojo/edk/system/raw_channel.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_RAW_CHANNEL_H_ 5 #ifndef MOJO_EDK_SYSTEM_RAW_CHANNEL_H_
6 #define MOJO_EDK_SYSTEM_RAW_CHANNEL_H_ 6 #define MOJO_EDK_SYSTEM_RAW_CHANNEL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
13 #include "mojo/edk/embedder/platform_handle_vector.h" 12 #include "mojo/edk/embedder/platform_handle_vector.h"
14 #include "mojo/edk/embedder/scoped_platform_handle.h" 13 #include "mojo/edk/embedder/scoped_platform_handle.h"
15 #include "mojo/edk/system/message_in_transit.h" 14 #include "mojo/edk/system/message_in_transit.h"
16 #include "mojo/edk/system/message_in_transit_queue.h" 15 #include "mojo/edk/system/message_in_transit_queue.h"
17 #include "mojo/edk/system/mutex.h" 16 #include "mojo/edk/system/mutex.h"
18 #include "mojo/edk/system/system_impl_export.h" 17 #include "mojo/edk/system/system_impl_export.h"
19 #include "mojo/edk/system/thread_annotations.h" 18 #include "mojo/edk/system/thread_annotations.h"
20 #include "mojo/public/cpp/system/macros.h" 19 #include "mojo/public/cpp/system/macros.h"
21 20
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // will no longer be used after |Shutdown()|. 94 // will no longer be used after |Shutdown()|.
96 void Init(Delegate* delegate) MOJO_NOT_THREAD_SAFE; 95 void Init(Delegate* delegate) MOJO_NOT_THREAD_SAFE;
97 96
98 // This must be called (on the I/O thread) before this object is destroyed. 97 // This must be called (on the I/O thread) before this object is destroyed.
99 void Shutdown() MOJO_NOT_THREAD_SAFE; 98 void Shutdown() MOJO_NOT_THREAD_SAFE;
100 99
101 // Writes the given message (or schedules it to be written). |message| must 100 // Writes the given message (or schedules it to be written). |message| must
102 // have no |Dispatcher|s still attached (i.e., 101 // have no |Dispatcher|s still attached (i.e.,
103 // |SerializeAndCloseDispatchers()| should have been called). This method is 102 // |SerializeAndCloseDispatchers()| should have been called). This method is
104 // thread-safe and may be called from any thread. Returns true on success. 103 // thread-safe and may be called from any thread. Returns true on success.
105 bool WriteMessage(scoped_ptr<MessageInTransit> message); 104 bool WriteMessage(std::unique_ptr<MessageInTransit> message);
106 105
107 // Returns true if the write buffer is empty (i.e., all messages written using 106 // Returns true if the write buffer is empty (i.e., all messages written using
108 // |WriteMessage()| have actually been sent. 107 // |WriteMessage()| have actually been sent.
109 // TODO(vtl): We should really also notify our delegate when the write buffer 108 // TODO(vtl): We should really also notify our delegate when the write buffer
110 // becomes empty (or something like that). 109 // becomes empty (or something like that).
111 bool IsWriteBufferEmpty(); 110 bool IsWriteBufferEmpty();
112 111
113 // Returns the amount of space needed in the |MessageInTransit|'s 112 // Returns the amount of space needed in the |MessageInTransit|'s
114 // |TransportData|'s "platform handle table" per platform handle (to be 113 // |TransportData|'s "platform handle table" per platform handle (to be
115 // attached to a message). (This amount may be zero.) 114 // attached to a message). (This amount may be zero.)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 ReadBuffer* read_buffer() { return read_buffer_.get(); } 218 ReadBuffer* read_buffer() { return read_buffer_.get(); }
220 219
221 WriteBuffer* write_buffer_no_lock() 220 WriteBuffer* write_buffer_no_lock()
222 MOJO_EXCLUSIVE_LOCKS_REQUIRED(write_mutex_) { 221 MOJO_EXCLUSIVE_LOCKS_REQUIRED(write_mutex_) {
223 return write_buffer_.get(); 222 return write_buffer_.get();
224 } 223 }
225 224
226 // Adds |message| to the write message queue. Implementation subclasses may 225 // Adds |message| to the write message queue. Implementation subclasses may
227 // override this to add any additional "control" messages needed. This is 226 // override this to add any additional "control" messages needed. This is
228 // called (on any thread). 227 // called (on any thread).
229 virtual void EnqueueMessageNoLock(scoped_ptr<MessageInTransit> message) 228 virtual void EnqueueMessageNoLock(std::unique_ptr<MessageInTransit> message)
230 MOJO_EXCLUSIVE_LOCKS_REQUIRED(write_mutex_); 229 MOJO_EXCLUSIVE_LOCKS_REQUIRED(write_mutex_);
231 230
232 // Handles any control messages targeted to the |RawChannel| (or 231 // Handles any control messages targeted to the |RawChannel| (or
233 // implementation subclass). Implementation subclasses may override this to 232 // implementation subclass). Implementation subclasses may override this to
234 // handle any implementation-specific control messages, but should call 233 // handle any implementation-specific control messages, but should call
235 // |RawChannel::OnReadMessageForRawChannel()| for any remaining messages. 234 // |RawChannel::OnReadMessageForRawChannel()| for any remaining messages.
236 // Returns true on success and false on error (e.g., invalid control message). 235 // Returns true on success and false on error (e.g., invalid control message).
237 // This is only called on the I/O thread. 236 // This is only called on the I/O thread.
238 virtual bool OnReadMessageForRawChannel( 237 virtual bool OnReadMessageForRawChannel(
239 const MessageInTransit::View& message_view); 238 const MessageInTransit::View& message_view);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 base::WeakPtrFactory<RawChannel> weak_ptr_factory_ 329 base::WeakPtrFactory<RawChannel> weak_ptr_factory_
331 MOJO_GUARDED_BY(write_mutex_); 330 MOJO_GUARDED_BY(write_mutex_);
332 331
333 MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannel); 332 MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannel);
334 }; 333 };
335 334
336 } // namespace system 335 } // namespace system
337 } // namespace mojo 336 } // namespace mojo
338 337
339 #endif // MOJO_EDK_SYSTEM_RAW_CHANNEL_H_ 338 #endif // MOJO_EDK_SYSTEM_RAW_CHANNEL_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/proxy_message_pipe_endpoint.cc ('k') | mojo/edk/system/raw_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698