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

Unified Diff: runtime/vm/service.cc

Issue 1310463005: - Ensure that HandleScope is initialized with a thread. (Remove (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/runtime_entry.h ('k') | runtime/vm/service_isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 5c57b1f8ce30c7751ac8c62892872e6ab12ea348..de7c7fe7afed65b6de794f3fe14f56fa9d458862 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -511,9 +511,10 @@ void Service::PostError(const String& method_name,
const Instance& reply_port,
const Instance& id,
const Error& error) {
- Isolate* isolate = Isolate::Current();
+ Thread* thread = Thread::Current();
+ Isolate* isolate = thread->isolate();
StackZone zone(isolate);
- HANDLESCOPE(isolate);
+ HANDLESCOPE(thread);
JSONStream js;
js.Setup(zone.GetZone(), SendPort::Cast(reply_port).Id(),
id, method_name, parameter_keys, parameter_values);
@@ -525,13 +526,15 @@ void Service::PostError(const String& method_name,
void Service::InvokeMethod(Isolate* isolate, const Array& msg) {
+ Thread* thread = Thread::Current();
+ ASSERT(isolate == thread->isolate());
ASSERT(isolate != NULL);
ASSERT(!msg.IsNull());
ASSERT(msg.Length() == 6);
{
StackZone zone(isolate);
- HANDLESCOPE(isolate);
+ HANDLESCOPE(thread);
Instance& reply_port = Instance::Handle(isolate);
Instance& seq = String::Handle(isolate);
@@ -650,9 +653,10 @@ void Service::SendEvent(const char* stream_id,
if (!ServiceIsolate::IsRunning()) {
return;
}
- Isolate* isolate = Isolate::Current();
+ Thread* thread = Thread::Current();
+ Isolate* isolate = thread->isolate();
ASSERT(isolate != NULL);
- HANDLESCOPE(isolate);
+ HANDLESCOPE(thread);
const Array& list = Array::Handle(Array::New(2));
ASSERT(!list.IsNull());
@@ -1478,8 +1482,7 @@ static bool PrintMessage(JSONStream* js, Isolate* isolate, const char* id) {
}
MessageSnapshotReader reader(message->data(),
message->len(),
- isolate,
- Thread::Current()->zone());
+ Thread::Current());
const Object& msg_obj = Object::Handle(reader.ReadObject());
msg_obj.PrintJSON(js);
return true;
@@ -1546,6 +1549,9 @@ static const MethodParameter* get_inbound_references_params[] = {
static bool GetInboundReferences(Isolate* isolate, JSONStream* js) {
+ Thread* thread = Thread::Current();
+ ASSERT(isolate == thread->isolate());
+
const char* target_id = js->LookupParam("targetId");
if (target_id == NULL) {
PrintMissingParamError(js, "targetId");
@@ -1565,7 +1571,7 @@ static bool GetInboundReferences(Isolate* isolate, JSONStream* js) {
Object& obj = Object::Handle(isolate);
ObjectIdRing::LookupResult lookup_result;
{
- HANDLESCOPE(isolate);
+ HANDLESCOPE(thread);
obj = LookupHeapObject(isolate, target_id, &lookup_result);
}
if (obj.raw() == Object::sentinel().raw()) {
@@ -1645,6 +1651,9 @@ static const MethodParameter* get_retaining_path_params[] = {
static bool GetRetainingPath(Isolate* isolate, JSONStream* js) {
+ Thread* thread = Thread::Current();
+ ASSERT(isolate == thread->isolate());
+
const char* target_id = js->LookupParam("targetId");
if (target_id == NULL) {
PrintMissingParamError(js, "targetId");
@@ -1664,7 +1673,7 @@ static bool GetRetainingPath(Isolate* isolate, JSONStream* js) {
Object& obj = Object::Handle(isolate);
ObjectIdRing::LookupResult lookup_result;
{
- HANDLESCOPE(isolate);
+ HANDLESCOPE(thread);
obj = LookupHeapObject(isolate, target_id, &lookup_result);
}
if (obj.raw() == Object::sentinel().raw()) {
« no previous file with comments | « runtime/vm/runtime_entry.h ('k') | runtime/vm/service_isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698