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

Side by Side Diff: mojo/system/shared_buffer_dispatcher.cc

Issue 320343002: Mojo: Make default Options directly accessible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 #include "mojo/system/shared_buffer_dispatcher.h" 5 #include "mojo/system/shared_buffer_dispatcher.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "mojo/public/c/system/macros.h" 11 #include "mojo/public/c/system/macros.h"
12 #include "mojo/system/constants.h" 12 #include "mojo/system/constants.h"
13 #include "mojo/system/memory.h" 13 #include "mojo/system/memory.h"
14 #include "mojo/system/options_validation.h" 14 #include "mojo/system/options_validation.h"
15 #include "mojo/system/raw_shared_buffer.h" 15 #include "mojo/system/raw_shared_buffer.h"
16 16
17 namespace mojo { 17 namespace mojo {
18 namespace system { 18 namespace system {
19 19
20 namespace { 20 namespace {
21 21
22 struct SerializedSharedBufferDispatcher { 22 struct SerializedSharedBufferDispatcher {
23 size_t num_bytes; 23 size_t num_bytes;
24 size_t platform_handle_index; 24 size_t platform_handle_index;
25 }; 25 };
26 26
27 } // namespace 27 } // namespace
28 28
29 // static 29 // static
30 const MojoCreateSharedBufferOptions
31 SharedBufferDispatcher::kDefaultCreateOptions = {
32 static_cast<uint32_t>(sizeof(MojoCreateSharedBufferOptions)),
33 MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE
34 };
35
36 // static
30 MojoResult SharedBufferDispatcher::ValidateCreateOptions( 37 MojoResult SharedBufferDispatcher::ValidateCreateOptions(
31 const MojoCreateSharedBufferOptions* in_options, 38 const MojoCreateSharedBufferOptions* in_options,
32 MojoCreateSharedBufferOptions* out_options) { 39 MojoCreateSharedBufferOptions* out_options) {
33 const MojoCreateSharedBufferOptionsFlags kKnownFlags = 40 const MojoCreateSharedBufferOptionsFlags kKnownFlags =
34 MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE; 41 MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE;
35 static const MojoCreateSharedBufferOptions kDefaultOptions = {
36 static_cast<uint32_t>(sizeof(MojoCreateSharedBufferOptions)),
37 MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE
38 };
39 42
40 *out_options = kDefaultOptions; 43 *out_options = kDefaultCreateOptions;
41 if (!in_options) 44 if (!in_options)
42 return MOJO_RESULT_OK; 45 return MOJO_RESULT_OK;
43 46
44 MojoResult result = 47 MojoResult result =
45 ValidateOptionsStructPointerSizeAndFlags<MojoCreateSharedBufferOptions>( 48 ValidateOptionsStructPointerSizeAndFlags<MojoCreateSharedBufferOptions>(
46 in_options, kKnownFlags, out_options); 49 in_options, kKnownFlags, out_options);
47 if (result != MOJO_RESULT_OK) 50 if (result != MOJO_RESULT_OK)
48 return result; 51 return result;
49 52
50 // Checks for fields beyond |flags|: 53 // Checks for fields beyond |flags|:
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 return MOJO_WAIT_FLAG_NONE; 268 return MOJO_WAIT_FLAG_NONE;
266 } 269 }
267 270
268 MojoWaitFlags SharedBufferDispatcher::SatisfiableFlagsNoLock() const { 271 MojoWaitFlags SharedBufferDispatcher::SatisfiableFlagsNoLock() const {
269 // TODO(vtl): Add transferrable flag. 272 // TODO(vtl): Add transferrable flag.
270 return MOJO_WAIT_FLAG_NONE; 273 return MOJO_WAIT_FLAG_NONE;
271 } 274 }
272 275
273 } // namespace system 276 } // namespace system
274 } // namespace mojo 277 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/shared_buffer_dispatcher.h ('k') | mojo/system/shared_buffer_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698