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

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

Issue 25646004: Add Dart_PostPriority function to dart_api, and use it in runAsync to schedule immediate events in … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More cleanup Created 7 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
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 "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 const Object& object = Object::Handle(isolate, Api::UnwrapHandle(handle)); 1050 const Object& object = Object::Handle(isolate, Api::UnwrapHandle(handle));
1051 uint8_t* data = NULL; 1051 uint8_t* data = NULL;
1052 MessageWriter writer(&data, &allocator); 1052 MessageWriter writer(&data, &allocator);
1053 writer.WriteMessage(object); 1053 writer.WriteMessage(object);
1054 intptr_t len = writer.BytesWritten(); 1054 intptr_t len = writer.BytesWritten();
1055 return PortMap::PostMessage(new Message( 1055 return PortMap::PostMessage(new Message(
1056 port_id, Message::kIllegalPort, data, len, Message::kNormalPriority)); 1056 port_id, Message::kIllegalPort, data, len, Message::kNormalPriority));
1057 } 1057 }
1058 1058
1059 1059
1060 DART_EXPORT bool Dart_PostPriority(Dart_Port port_id, Dart_Handle handle) {
1061 Isolate* isolate = Isolate::Current();
1062 DARTSCOPE(isolate);
1063 const Object& object = Object::Handle(isolate, Api::UnwrapHandle(handle));
1064 uint8_t* data = NULL;
1065 MessageWriter writer(&data, &allocator);
1066 writer.WriteMessage(object);
1067 intptr_t len = writer.BytesWritten();
1068 return PortMap::PostMessage(new Message(
1069 port_id, Message::kIllegalPort, data, len, Message::kFirstPriority));
1070 }
1071
1072
1060 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) { 1073 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) {
1061 Isolate* isolate = Isolate::Current(); 1074 Isolate* isolate = Isolate::Current();
1062 DARTSCOPE(isolate); 1075 DARTSCOPE(isolate);
1063 CHECK_CALLBACK_STATE(isolate); 1076 CHECK_CALLBACK_STATE(isolate);
1064 return Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id)); 1077 return Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id));
1065 } 1078 }
1066 1079
1067 1080
1068 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id) { 1081 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id) {
1069 Isolate* isolate = Isolate::Current(); 1082 Isolate* isolate = Isolate::Current();
(...skipping 3231 matching lines...) Expand 10 before | Expand all | Expand 10 after
4301 } 4314 }
4302 { 4315 {
4303 NoGCScope no_gc; 4316 NoGCScope no_gc;
4304 RawObject* raw_obj = obj.raw(); 4317 RawObject* raw_obj = obj.raw();
4305 isolate->heap()->SetPeer(raw_obj, peer); 4318 isolate->heap()->SetPeer(raw_obj, peer);
4306 } 4319 }
4307 return Api::Success(); 4320 return Api::Success();
4308 } 4321 }
4309 4322
4310 } // namespace dart 4323 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/event_loop_patch.dart ('k') | runtime/vm/message.h » ('j') | runtime/vm/message.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698