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

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

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup Created 5 years, 2 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOJO_EDK_SYSTEM_DATA_PIPE_H_
6 #define MOJO_EDK_SYSTEM_DATA_PIPE_H_
7
8 #include "base/compiler_specific.h"
9 #include "mojo/edk/embedder/platform_handle_vector.h"
10 #include "mojo/edk/embedder/scoped_platform_handle.h"
11 #include "mojo/edk/system/system_impl_export.h"
12 #include "mojo/public/c/system/data_pipe.h"
13 #include "mojo/public/c/system/types.h"
14 #include "mojo/public/cpp/system/macros.h"
15
16 namespace mojo {
17 namespace edk {
18 class RawChannel;
19
20 // Shared code between DataPipeConsumerDispatcher and
21 // DataPipeProducerDispatcher.
22 class MOJO_SYSTEM_IMPL_EXPORT DataPipe {
23 public:
24 // The default options for |MojoCreateDataPipe()|. (Real uses should obtain
25 // this via |ValidateCreateOptions()| with a null |in_options|; this is
26 // exposed directly for testing convenience.)
27 static MojoCreateDataPipeOptions GetDefaultCreateOptions();
28
29 // Validates and/or sets default options for |MojoCreateDataPipeOptions|. If
30 // non-null, |in_options| must point to a struct of at least
31 // |in_options->struct_size| bytes. |out_options| must point to a (current)
32 // |MojoCreateDataPipeOptions| and will be entirely overwritten on success (it
33 // may be partly overwritten on failure).
34 static MojoResult ValidateCreateOptions(
35 const MojoCreateDataPipeOptions* in_options,
36 MojoCreateDataPipeOptions* out_options);
37
38 // Helper methods used by DataPipeConsumerDispatcher and
39 // DataPipeProducerDispatcher for serialization and deserialization.
40 static void StartSerialize(bool have_channel_handle,
41 bool have_shared_memory,
42 size_t* max_size,
43 size_t* max_platform_handles);
44 static void EndSerialize(const MojoCreateDataPipeOptions& options,
45 ScopedPlatformHandle channel_handle,
46 ScopedPlatformHandle shared_memory_handle,
47 size_t shared_memory_size,
48 void* destination,
49 size_t* actual_size,
50 PlatformHandleVector* platform_handles);
51 static ScopedPlatformHandle Deserialize(
52 const void* source,
53 size_t size,
54 PlatformHandleVector* platform_handles,
55 MojoCreateDataPipeOptions* options,
56 ScopedPlatformHandle* shared_memory_handle,
57 size_t* shared_memory_size);
58 };
59
60 } // namespace edk
61 } // namespace mojo
62
63 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698