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

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

Issue 1777643003: Uses a finalizer to delete zlib filter resources (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments. Fix more problems. Created 4 years, 9 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
« no previous file with comments | « no previous file | runtime/bin/filter.cc » ('j') | runtime/bin/filter.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_FILTER_H_ 5 #ifndef BIN_FILTER_H_
6 #define BIN_FILTER_H_ 6 #define BIN_FILTER_H_
7 7
8 #include "bin/builtin.h" 8 #include "bin/builtin.h"
9 #include "bin/utils.h" 9 #include "bin/utils.h"
10 10
(...skipping 11 matching lines...) Expand all
22 22
23 /** 23 /**
24 * On a successful call to Process, Process will take ownership of data. On 24 * On a successful call to Process, Process will take ownership of data. On
25 * successive calls to either Processed or ~Filter, data will be freed with 25 * successive calls to either Processed or ~Filter, data will be freed with
26 * a delete[] call. 26 * a delete[] call.
27 */ 27 */
28 virtual bool Process(uint8_t* data, intptr_t length) = 0; 28 virtual bool Process(uint8_t* data, intptr_t length) = 0;
29 virtual intptr_t Processed(uint8_t* buffer, intptr_t length, bool finish, 29 virtual intptr_t Processed(uint8_t* buffer, intptr_t length, bool finish,
30 bool end) = 0; 30 bool end) = 0;
31 31
32 static Dart_Handle SetFilterPointerNativeField(Dart_Handle filter, 32 static Dart_Handle SetFilterAndCreateFinalizer(Dart_Handle filter,
33 Filter* filter_pointer); 33 Filter* filter_pointer,
34 static Dart_Handle GetFilterPointerNativeField(Dart_Handle filter, 34 intptr_t filter_size);
35 Filter** filter_pointer); 35 static Dart_Handle GetFilterNativeField(Dart_Handle filter,
36 Filter** filter_pointer);
36 37
37 bool initialized() const { return initialized_; } 38 bool initialized() const { return initialized_; }
38 void set_initialized(bool value) { initialized_ = value; } 39 void set_initialized(bool value) { initialized_ = value; }
39 uint8_t* processed_buffer() { return processed_buffer_; } 40 uint8_t* processed_buffer() { return processed_buffer_; }
40 intptr_t processed_buffer_size() const { return kFilterBufferSize; } 41 intptr_t processed_buffer_size() const { return kFilterBufferSize; }
41 42
42 protected: 43 protected:
43 Filter() : initialized_(false) {} 44 Filter() : initialized_(false) {}
44 45
45 private: 46 private:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 uint8_t* current_buffer_; 104 uint8_t* current_buffer_;
104 z_stream stream_; 105 z_stream stream_;
105 106
106 DISALLOW_COPY_AND_ASSIGN(ZLibInflateFilter); 107 DISALLOW_COPY_AND_ASSIGN(ZLibInflateFilter);
107 }; 108 };
108 109
109 } // namespace bin 110 } // namespace bin
110 } // namespace dart 111 } // namespace dart
111 112
112 #endif // BIN_FILTER_H_ 113 #endif // BIN_FILTER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/filter.cc » ('j') | runtime/bin/filter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698