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

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

Issue 11198034: Introduce (private) ZLibFilter to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/filter.h ('k') | runtime/bin/filter.dart » ('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 (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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #include "bin/filter.h"
6 #include "bin/dartutils.h"
7
8 #include "include/dart_api.h"
9
10 static const int kFilterPointerNativeField = 0;
11
12
13 void FUNCTION_NAME(Filter_CreateZLIB)(Dart_NativeArguments args) {
14 Dart_EnterScope();
15 Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0);
16 Filter* filter = new ZLibFilter();
17 if (!filter->Init() ||
18 Dart_IsError(Filter::SetFilterPointerNativeField(filter_obj, filter))) {
19 OSError os_error(-1, "Failed to create ZLib filter", OSError::kUnknown);
20 Dart_Handle err = DartUtils::NewDartOSError(&os_error);
21 Dart_SetReturnValue(args, err);
22 } else {
23 Dart_SetReturnValue(args, Dart_True());
24 }
25 Dart_ExitScope();
26 }
27
28
29 void FUNCTION_NAME(Filter_Process)(Dart_NativeArguments args) {
30 Dart_EnterScope();
31 Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0);
32 Filter* filter;
33 if (Dart_IsError(Filter::GetFilterPointerNativeField(filter_obj, &filter))) {
34 OSError os_error(-1, "Failed to get ZLib filter", OSError::kUnknown);
35 Dart_Handle err = DartUtils::NewDartOSError(&os_error);
36 Dart_SetReturnValue(args, err);
37 } else {
38 Dart_SetReturnValue(args, Dart_True());
39 }
40 Dart_ExitScope();
41 }
42
43
44 Dart_Handle Filter::SetFilterPointerNativeField(Dart_Handle filter,
45 Filter* filter_pointer) {
46 return Dart_SetNativeInstanceField(filter,
47 kFilterPointerNativeField,
48 (intptr_t)filter_pointer);
49 }
50
51
52 Dart_Handle Filter::GetFilterPointerNativeField(Dart_Handle filter,
53 Filter** filter_pointer) {
54 return Dart_GetNativeInstanceField(
55 filter,
56 kFilterPointerNativeField,
57 reinterpret_cast<intptr_t*>(filter_pointer));
58 }
59
60
61 ZLibFilter::~ZLibFilter() {
62 // FIXME: Change to ::End to be able to return status value?
63 }
64
65
66 bool ZLibFilter::Init() {
67 return true;
68 }
69
70
71 uint8_t* ZLibFilter::Process(uint8_t* data,
72 intptr_t length,
73 intptr_t& outputLength) {
74 return 0;
75 }
76
OLDNEW
« no previous file with comments | « runtime/bin/filter.h ('k') | runtime/bin/filter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698