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

Side by Side Diff: mojo/public/bindings/allocation_scope.h

Issue 218613010: Mojo: Move mojo/public/bindings/*.h to mojo/public/cpp/bindings/*.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « mojo/mojo_public.gypi ('k') | mojo/public/bindings/array.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_PUBLIC_BINDINGS_ALLOCATION_SCOPE_H_
6 #define MOJO_PUBLIC_BINDINGS_ALLOCATION_SCOPE_H_
7
8 #include "mojo/public/bindings/lib/scratch_buffer.h"
9 #include "mojo/public/cpp/system/macros.h"
10
11 namespace mojo {
12
13 // In order to allocate a Mojom-defined structure or mojo::Array<T> (including
14 // mojo::String), an AllocationScope must first be allocated. Typically,
15 // AllocationScope is placed on the stack before calls to build structs and
16 // arrays. Such structs and arrays are valid so long as the corresponding
17 // AllocationScope remains alive.
18 //
19 // AllocationScope instantiates a Buffer and sets it in thread local storage.
20 // This Buffer instance can be retrieved using Buffer::current().
21 //
22 // EXAMPLE:
23 //
24 // mojo::AllocationScope scope;
25 // mojo::String s = "hello world";
26 // some_interface->SomeMethod(s);
27 //
28 class AllocationScope {
29 public:
30 AllocationScope() {}
31 ~AllocationScope() {}
32
33 Buffer* buffer() { return &buffer_; }
34
35 private:
36 internal::ScratchBuffer buffer_;
37
38 MOJO_DISALLOW_COPY_AND_ASSIGN(AllocationScope);
39 };
40
41 } // namespace mojo
42
43 #endif // MOJO_PUBLIC_BINDINGS_ALLOCATION_SCOPE_H_
OLDNEW
« no previous file with comments | « mojo/mojo_public.gypi ('k') | mojo/public/bindings/array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698