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

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

Issue 21816002: Add Process.runSync for running processe synchronously. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed Mac OS issue Created 7 years, 4 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 | « no previous file | runtime/bin/io_buffer.cc » ('j') | runtime/bin/io_buffer.cc » ('J')
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 BIN_IO_BUFFER_H_ 5 #ifndef BIN_IO_BUFFER_H_
6 #define BIN_IO_BUFFER_H_ 6 #define BIN_IO_BUFFER_H_
7 7
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 9
10 #include "include/dart_api.h" 10 #include "include/dart_api.h"
11 11
12 12
13 namespace dart { 13 namespace dart {
14 namespace bin { 14 namespace bin {
15 15
16 class IOBuffer { 16 class IOBuffer {
17 public: 17 public:
18 // Allocate an IO buffer dart object (of type Uint8List) backed by 18 // Allocate an IO buffer dart object (of type Uint8List) backed by
19 // an external byte array. 19 // an external byte array.
20 static Dart_Handle Allocate(intptr_t size, uint8_t **buffer); 20 static Dart_Handle Allocate(intptr_t size, uint8_t **buffer);
21 21
22 // Create an IO buffer backed by an external byte array. The buffer must
23 // have been allocated using the new operator and it will be freed using
24 // delete.
25 static Dart_Handle Create(uint8_t *buffer, intptr_t size);
26
22 // Allocate IO buffer storage. 27 // Allocate IO buffer storage.
23 static uint8_t* Allocate(intptr_t size); 28 static uint8_t* Allocate(intptr_t size);
24 29
25 // Function for disposing of IO buffer storage. All backing storage 30 // Function for disposing of IO buffer storage. All backing storage
26 // for IO buffers must be freed using this function. 31 // for IO buffers must be freed using this function.
27 static void Free(void* buffer) { 32 static void Free(void* buffer) {
28 delete[] reinterpret_cast<uint8_t*>(buffer); 33 delete[] reinterpret_cast<uint8_t*>(buffer);
29 } 34 }
30 35
31 // Function for finalizing external byte arrays used as IO buffers. 36 // Function for finalizing external byte arrays used as IO buffers.
32 static void Finalizer(Dart_WeakPersistentHandle handle, void* buffer) { 37 static void Finalizer(Dart_WeakPersistentHandle handle, void* buffer) {
33 Free(buffer); 38 Free(buffer);
34 if (handle != NULL) { 39 if (handle != NULL) {
35 Dart_DeleteWeakPersistentHandle(handle); 40 Dart_DeleteWeakPersistentHandle(handle);
36 } 41 }
37 } 42 }
38 43
39 private: 44 private:
40 DISALLOW_ALLOCATION(); 45 DISALLOW_ALLOCATION();
41 DISALLOW_IMPLICIT_CONSTRUCTORS(IOBuffer); 46 DISALLOW_IMPLICIT_CONSTRUCTORS(IOBuffer);
42 }; 47 };
43 48
44 } // namespace bin 49 } // namespace bin
45 } // namespace dart 50 } // namespace dart
46 51
47 #endif // BIN_IO_BUFFER_H_ 52 #endif // BIN_IO_BUFFER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/io_buffer.cc » ('j') | runtime/bin/io_buffer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698