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

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

Issue 1012333002: Keep zone cached in SnapshotReader to allow removing ZoneHandle(Isolate*) interface. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 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 | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/service_test.cc » ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 "vm/service_isolate.h" 5 #include "vm/service_isolate.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 Isolate* service_isolate_; 198 Isolate* service_isolate_;
199 }; 199 };
200 200
201 201
202 202
203 class ServiceIsolateNatives : public AllStatic { 203 class ServiceIsolateNatives : public AllStatic {
204 public: 204 public:
205 static void SendIsolateServiceMessage(Dart_NativeArguments args) { 205 static void SendIsolateServiceMessage(Dart_NativeArguments args) {
206 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 206 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
207 Isolate* isolate = arguments->isolate(); 207 Isolate* isolate = arguments->isolate();
208 StackZone zone(isolate); 208 StackZone stack_zone(isolate);
209 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT.
209 HANDLESCOPE(isolate); 210 HANDLESCOPE(isolate);
210 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, sp, arguments->NativeArgAt(0)); 211 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, sp, arguments->NativeArgAt(0));
211 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(1)); 212 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(1));
212 213
213 // Set the type of the OOB message. 214 // Set the type of the OOB message.
214 message.SetAt(0, Smi::Handle(isolate, Smi::New(Message::kServiceOOBMsg))); 215 message.SetAt(0, Smi::Handle(isolate, Smi::New(Message::kServiceOOBMsg)));
215 216
216 // Serialize message. 217 // Serialize message.
217 uint8_t* data = NULL; 218 uint8_t* data = NULL;
218 MessageWriter writer(&data, &allocator, false); 219 MessageWriter writer(&data, &allocator, false);
219 writer.WriteMessage(message); 220 writer.WriteMessage(message);
220 221
221 // TODO(turnidge): Throw an exception when the return value is false? 222 // TODO(turnidge): Throw an exception when the return value is false?
222 bool result = PortMap::PostMessage( 223 bool result = PortMap::PostMessage(
223 new Message(sp.Id(), data, writer.BytesWritten(), 224 new Message(sp.Id(), data, writer.BytesWritten(),
224 Message::kOOBPriority)); 225 Message::kOOBPriority));
225 arguments->SetReturn(Bool::Get(result)); 226 arguments->SetReturn(Bool::Get(result));
226 } 227 }
227 228
228 static void SendRootServiceMessage(Dart_NativeArguments args) { 229 static void SendRootServiceMessage(Dart_NativeArguments args) {
229 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 230 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
230 Isolate* isolate = arguments->isolate(); 231 Isolate* isolate = arguments->isolate();
231 StackZone zone(isolate); 232 StackZone stack_zone(isolate);
233 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT.
232 HANDLESCOPE(isolate); 234 HANDLESCOPE(isolate);
233 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(0)); 235 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(0));
234 Service::HandleRootMessage(message); 236 Service::HandleRootMessage(message);
235 } 237 }
236 238
237 static void SetEventMask(Dart_NativeArguments args) { 239 static void SetEventMask(Dart_NativeArguments args) {
238 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 240 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
239 Isolate* isolate = arguments->isolate(); 241 Isolate* isolate = arguments->isolate();
240 StackZone zone(isolate); 242 StackZone stack_zone(isolate);
243 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT.
241 HANDLESCOPE(isolate); 244 HANDLESCOPE(isolate);
242 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(0)); 245 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(0));
243 Service::SetEventMask(mask.AsTruncatedUint32Value()); 246 Service::SetEventMask(mask.AsTruncatedUint32Value());
244 } 247 }
245 248
246 static void OnStart(Dart_NativeArguments args) { 249 static void OnStart(Dart_NativeArguments args) {
247 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 250 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
248 Isolate* isolate = arguments->isolate(); 251 Isolate* isolate = arguments->isolate();
249 StackZone zone(isolate); 252 StackZone zone(isolate);
250 HANDLESCOPE(isolate); 253 HANDLESCOPE(isolate);
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 return result; 682 return result;
680 } 683 }
681 Dart_Handle source = GetSource(url_string); 684 Dart_Handle source = GetSource(url_string);
682 if (Dart_IsError(source)) { 685 if (Dart_IsError(source)) {
683 return source; 686 return source;
684 } 687 }
685 return Dart_LoadSource(library, url, source, 0, 0); 688 return Dart_LoadSource(library, url, source, 0, 0);
686 } 689 }
687 690
688 } // namespace dart 691 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/service_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698