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

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

Issue 1350183002: EDK: More scoped_ptr -> std::unique_ptr conversions. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: gah 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/shared_buffer_dispatcher_unittest.cc ('k') | mojo/edk/system/transport_data.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 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_TRANSPORT_DATA_H_ 5 #ifndef MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_
6 #define MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ 6 #define MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/aligned_memory.h" 13 #include "base/memory/aligned_memory.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "build/build_config.h"
16 #include "mojo/edk/embedder/platform_handle.h" 14 #include "mojo/edk/embedder/platform_handle.h"
17 #include "mojo/edk/embedder/platform_handle_vector.h" 15 #include "mojo/edk/embedder/platform_handle_vector.h"
18 #include "mojo/edk/system/dispatcher.h" 16 #include "mojo/edk/system/dispatcher.h"
19 #include "mojo/edk/system/system_impl_export.h" 17 #include "mojo/edk/system/system_impl_export.h"
20 #include "mojo/public/cpp/system/macros.h" 18 #include "mojo/public/cpp/system/macros.h"
21 19
22 namespace mojo { 20 namespace mojo {
23 namespace system { 21 namespace system {
24 22
25 class Channel; 23 class Channel;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // The maximum number of platform handles to attach for a single serialized 81 // The maximum number of platform handles to attach for a single serialized
84 // dispatcher. 82 // dispatcher.
85 static const size_t kMaxSerializedDispatcherPlatformHandles = 2; 83 static const size_t kMaxSerializedDispatcherPlatformHandles = 2;
86 84
87 // The maximum possible size of a valid transport data buffer. 85 // The maximum possible size of a valid transport data buffer.
88 static size_t GetMaxBufferSize(); 86 static size_t GetMaxBufferSize();
89 87
90 // The maximum total number of platform handles that may be attached. 88 // The maximum total number of platform handles that may be attached.
91 static size_t GetMaxPlatformHandles(); 89 static size_t GetMaxPlatformHandles();
92 90
93 TransportData(scoped_ptr<DispatcherVector> dispatchers, Channel* channel); 91 TransportData(std::unique_ptr<DispatcherVector> dispatchers,
92 Channel* channel);
94 93
95 // This is used for users of |MessageInTransit|/|TransportData|/|RawChannel| 94 // This is used for users of |MessageInTransit|/|TransportData|/|RawChannel|
96 // that want to simply transport data and platform handles, and not 95 // that want to simply transport data and platform handles, and not
97 // |Dispatcher|s. (|Header| will be present, and zero except for 96 // |Dispatcher|s. (|Header| will be present, and zero except for
98 // |num_platform_handles|, and |platform_handle_table_offset| if necessary.) 97 // |num_platform_handles|, and |platform_handle_table_offset| if necessary.)
99 explicit TransportData( 98 explicit TransportData(
100 embedder::ScopedPlatformHandleVectorPtr platform_handles, 99 embedder::ScopedPlatformHandleVectorPtr platform_handles,
101 size_t serialized_platform_handle_size); 100 size_t serialized_platform_handle_size);
102 101
103 ~TransportData(); 102 ~TransportData();
(...skipping 30 matching lines...) Expand all
134 133
135 // Gets the platform handle table from a (valid) |TransportData| buffer (which 134 // Gets the platform handle table from a (valid) |TransportData| buffer (which
136 // should have been validated using |ValidateBuffer()| first). 135 // should have been validated using |ValidateBuffer()| first).
137 static void GetPlatformHandleTable(const void* transport_data_buffer, 136 static void GetPlatformHandleTable(const void* transport_data_buffer,
138 size_t* num_platform_handles, 137 size_t* num_platform_handles,
139 const void** platform_handle_table); 138 const void** platform_handle_table);
140 139
141 // Deserializes dispatchers from the given (serialized) transport data buffer 140 // Deserializes dispatchers from the given (serialized) transport data buffer
142 // (typically from a |MessageInTransit::View|) and vector of platform handles. 141 // (typically from a |MessageInTransit::View|) and vector of platform handles.
143 // |buffer| should be non-null and |buffer_size| should be nonzero. 142 // |buffer| should be non-null and |buffer_size| should be nonzero.
144 static scoped_ptr<DispatcherVector> DeserializeDispatchers( 143 static std::unique_ptr<DispatcherVector> DeserializeDispatchers(
145 const void* buffer, 144 const void* buffer,
146 size_t buffer_size, 145 size_t buffer_size,
147 embedder::ScopedPlatformHandleVectorPtr platform_handles, 146 embedder::ScopedPlatformHandleVectorPtr platform_handles,
148 Channel* channel); 147 Channel* channel);
149 148
150 private: 149 private:
151 // To allow us to make compile-assertions about |Header|, etc. in the .cc 150 // To allow us to make compile-assertions about |Header|, etc. in the .cc
152 // file. 151 // file.
153 struct PrivateStructForCompileAsserts; 152 struct PrivateStructForCompileAsserts;
154 153
(...skipping 28 matching lines...) Expand all
183 // TODO(vtl): With C++11, change it to a vector of |ScopedPlatformHandle|s. 182 // TODO(vtl): With C++11, change it to a vector of |ScopedPlatformHandle|s.
184 embedder::ScopedPlatformHandleVectorPtr platform_handles_; 183 embedder::ScopedPlatformHandleVectorPtr platform_handles_;
185 184
186 MOJO_DISALLOW_COPY_AND_ASSIGN(TransportData); 185 MOJO_DISALLOW_COPY_AND_ASSIGN(TransportData);
187 }; 186 };
188 187
189 } // namespace system 188 } // namespace system
190 } // namespace mojo 189 } // namespace mojo
191 190
192 #endif // MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_ 191 #endif // MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/shared_buffer_dispatcher_unittest.cc ('k') | mojo/edk/system/transport_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698