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

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

Issue 206263005: Add debug-printing to file, and remove from test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « pkg/docgen/test/generate_json_test.dart ('k') | no next file » | 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) 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 #include "bin/file.h" 5 #include "bin/file.h"
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/dartutils.h" 8 #include "bin/dartutils.h"
9 #include "bin/io_buffer.h" 9 #include "bin/io_buffer.h"
10 #include "bin/thread.h" 10 #include "bin/thread.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // The buffer object passed in has to be an Int8List or Uint8List object. 249 // The buffer object passed in has to be an Int8List or Uint8List object.
250 // Acquire a direct pointer to the data area of the buffer object. 250 // Acquire a direct pointer to the data area of the buffer object.
251 Dart_TypedData_Type type; 251 Dart_TypedData_Type type;
252 intptr_t length = end - start; 252 intptr_t length = end - start;
253 intptr_t buffer_len = 0; 253 intptr_t buffer_len = 0;
254 void* buffer = NULL; 254 void* buffer = NULL;
255 Dart_Handle result = 255 Dart_Handle result =
256 Dart_TypedDataAcquireData(buffer_obj, &type, &buffer, &buffer_len); 256 Dart_TypedDataAcquireData(buffer_obj, &type, &buffer, &buffer_len);
257 if (Dart_IsError(result)) Dart_PropagateError(result); 257 if (Dart_IsError(result)) Dart_PropagateError(result);
258 258
259 #ifdef DEBUG
260 // TODO(ajohnsen): Remove once issue 17602 is fixed.
261 bool print_debug = true;
262 for (int i = 0; i < length; i++) {
263 if (reinterpret_cast<uint8_t*>(buffer)[i] != 0xf3) {
264 print_debug = false;
265 break;
266 }
267 }
268 if (print_debug) {
269 fprintf(stderr, "WARNING: Data is purely 0x3f in File_WriteFrom\n");
270 fflush(stderr);
271 }
272 #endif
273
259 ASSERT(type == Dart_TypedData_kUint8 || type == Dart_TypedData_kInt8); 274 ASSERT(type == Dart_TypedData_kUint8 || type == Dart_TypedData_kInt8);
260 ASSERT(end <= buffer_len); 275 ASSERT(end <= buffer_len);
261 ASSERT(buffer != NULL); 276 ASSERT(buffer != NULL);
262 277
263 // Write the data out into the file. 278 // Write the data out into the file.
264 int64_t bytes_written = file->Write(reinterpret_cast<void*>(buffer), length); 279 int64_t bytes_written = file->Write(buffer, length);
265 // Release the direct pointer acquired above. 280 // Release the direct pointer acquired above.
266 result = Dart_TypedDataReleaseData(buffer_obj); 281 result = Dart_TypedDataReleaseData(buffer_obj);
267 if (Dart_IsError(result)) Dart_PropagateError(result); 282 if (Dart_IsError(result)) Dart_PropagateError(result);
268 283
269 if (bytes_written != length) { 284 if (bytes_written != length) {
270 Dart_Handle err = DartUtils::NewDartOSError(); 285 Dart_Handle err = DartUtils::NewDartOSError();
271 if (Dart_IsError(err)) Dart_PropagateError(err); 286 if (Dart_IsError(err)) Dart_PropagateError(err);
272 Dart_SetReturnValue(args, err); 287 Dart_SetReturnValue(args, err);
273 } 288 }
274 } 289 }
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 CObjectArray* wrapper = new CObjectArray(CObject::NewArray(2)); 1200 CObjectArray* wrapper = new CObjectArray(CObject::NewArray(2));
1186 wrapper->SetAt(0, new CObjectInt32(CObject::NewInt32(CObject::kSuccess))); 1201 wrapper->SetAt(0, new CObjectInt32(CObject::NewInt32(CObject::kSuccess)));
1187 wrapper->SetAt(1, result); 1202 wrapper->SetAt(1, result);
1188 return wrapper; 1203 return wrapper;
1189 } 1204 }
1190 return CObject::IllegalArgumentError(); 1205 return CObject::IllegalArgumentError();
1191 } 1206 }
1192 1207
1193 } // namespace bin 1208 } // namespace bin
1194 } // namespace dart 1209 } // namespace dart
OLDNEW
« no previous file with comments | « pkg/docgen/test/generate_json_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698