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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 2254543006: Reduce copying in sending service responses. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: dbc, sync Created 4 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
« no previous file with comments | « runtime/platform/text_buffer.cc ('k') | runtime/vm/json_stream.h » ('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) 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
(...skipping 6109 matching lines...) Expand 10 before | Expand all | Expand 10 after
6120 } 6120 }
6121 6121
6122 6122
6123 static bool StreamTraceEvents(Dart_StreamConsumer consumer, 6123 static bool StreamTraceEvents(Dart_StreamConsumer consumer,
6124 void* user_data, 6124 void* user_data,
6125 JSONStream* js) { 6125 JSONStream* js) {
6126 ASSERT(js != NULL); 6126 ASSERT(js != NULL);
6127 // Steal output from JSONStream. 6127 // Steal output from JSONStream.
6128 char* output = NULL; 6128 char* output = NULL;
6129 intptr_t output_length = 0; 6129 intptr_t output_length = 0;
6130 js->Steal(const_cast<const char**>(&output), &output_length); 6130 js->Steal(&output, &output_length);
6131 if (output_length < 3) { 6131 if (output_length < 3) {
6132 // Empty JSON array. 6132 // Empty JSON array.
6133 free(output); 6133 free(output);
6134 return false; 6134 return false;
6135 } 6135 }
6136 // We want to send the JSON array without the leading '[' or trailing ']' 6136 // We want to send the JSON array without the leading '[' or trailing ']'
6137 // characters. 6137 // characters.
6138 ASSERT(output[0] == '['); 6138 ASSERT(output[0] == '[');
6139 ASSERT(output[output_length - 1] == ']'); 6139 ASSERT(output[output_length - 1] == ']');
6140 // Replace the ']' with the null character. 6140 // Replace the ']' with the null character.
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
6580 6580
6581 DART_EXPORT bool Dart_IsPrecompiledRuntime() { 6581 DART_EXPORT bool Dart_IsPrecompiledRuntime() {
6582 #if defined(DART_PRECOMPILED_RUNTIME) 6582 #if defined(DART_PRECOMPILED_RUNTIME)
6583 return true; 6583 return true;
6584 #else 6584 #else
6585 return false; 6585 return false;
6586 #endif 6586 #endif
6587 } 6587 }
6588 6588
6589 } // namespace dart 6589 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/platform/text_buffer.cc ('k') | runtime/vm/json_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698