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

Side by Side Diff: runtime/bin/io_buffer.h

Issue 2480793002: clang-format runtime/bin (Closed)
Patch Set: Created 4 years, 1 month 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 | « runtime/bin/hashmap_test.cc ('k') | runtime/bin/io_buffer.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_BIN_IO_BUFFER_H_ 5 #ifndef RUNTIME_BIN_IO_BUFFER_H_
6 #define RUNTIME_BIN_IO_BUFFER_H_ 6 #define RUNTIME_BIN_IO_BUFFER_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
11 namespace dart { 11 namespace dart {
12 namespace bin { 12 namespace bin {
13 13
14 class IOBuffer { 14 class IOBuffer {
15 public: 15 public:
16 // Allocate an IO buffer dart object (of type Uint8List) backed by 16 // Allocate an IO buffer dart object (of type Uint8List) backed by
17 // an external byte array. 17 // an external byte array.
18 static Dart_Handle Allocate(intptr_t size, uint8_t **buffer); 18 static Dart_Handle Allocate(intptr_t size, uint8_t** buffer);
19 19
20 // Allocate IO buffer storage. 20 // Allocate IO buffer storage.
21 static uint8_t* Allocate(intptr_t size); 21 static uint8_t* Allocate(intptr_t size);
22 22
23 // Function for disposing of IO buffer storage. All backing storage 23 // Function for disposing of IO buffer storage. All backing storage
24 // for IO buffers must be freed using this function. 24 // for IO buffers must be freed using this function.
25 static void Free(void* buffer) { 25 static void Free(void* buffer) {
26 delete[] reinterpret_cast<uint8_t*>(buffer); 26 delete[] reinterpret_cast<uint8_t*>(buffer);
27 } 27 }
28 28
29 // Function for finalizing external byte arrays used as IO buffers. 29 // Function for finalizing external byte arrays used as IO buffers.
30 static void Finalizer(void* isolate_callback_data, 30 static void Finalizer(void* isolate_callback_data,
31 Dart_WeakPersistentHandle handle, 31 Dart_WeakPersistentHandle handle,
32 void* buffer) { 32 void* buffer) {
33 Free(buffer); 33 Free(buffer);
34 } 34 }
35 35
36 private: 36 private:
37 DISALLOW_ALLOCATION(); 37 DISALLOW_ALLOCATION();
38 DISALLOW_IMPLICIT_CONSTRUCTORS(IOBuffer); 38 DISALLOW_IMPLICIT_CONSTRUCTORS(IOBuffer);
39 }; 39 };
40 40
41 } // namespace bin 41 } // namespace bin
42 } // namespace dart 42 } // namespace dart
43 43
44 #endif // RUNTIME_BIN_IO_BUFFER_H_ 44 #endif // RUNTIME_BIN_IO_BUFFER_H_
OLDNEW
« no previous file with comments | « runtime/bin/hashmap_test.cc ('k') | runtime/bin/io_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698