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

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

Issue 8588040: Add a mid-sized integration test for the Dart Embedding Api which (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/assert.h" 9 #include "vm/assert.h"
10 #include "vm/bigint_store.h" 10 #include "vm/bigint_store.h"
(...skipping 16 matching lines...) Expand all
27 namespace dart { 27 namespace dart {
28 28
29 DEFINE_FLAG(bool, report_invocation_count, false, 29 DEFINE_FLAG(bool, report_invocation_count, false,
30 "Count function invocations and report."); 30 "Count function invocations and report.");
31 DECLARE_FLAG(bool, generate_gdb_symbols); 31 DECLARE_FLAG(bool, generate_gdb_symbols);
32 32
33 33
34 Isolate::Isolate() 34 Isolate::Isolate()
35 : store_buffer_(), 35 : store_buffer_(),
36 message_queue_(NULL), 36 message_queue_(NULL),
37 create_port_callback_(NULL),
37 post_message_callback_(NULL), 38 post_message_callback_(NULL),
38 close_port_callback_(NULL), 39 close_port_callback_(NULL),
39 active_ports_(0), 40 active_ports_(0),
40 heap_(NULL), 41 heap_(NULL),
41 object_store_(NULL), 42 object_store_(NULL),
42 top_resource_(NULL), 43 top_resource_(NULL),
43 top_context_(Context::null()), 44 top_context_(Context::null()),
44 current_zone_(NULL), 45 current_zone_(NULL),
45 #if defined(DEBUG) 46 #if defined(DEBUG)
46 no_gc_scope_depth_(0), 47 no_gc_scope_depth_(0),
(...skipping 21 matching lines...) Expand all
68 delete heap_; 69 delete heap_;
69 delete object_store_; 70 delete object_store_;
70 // Do not delete stack resources: top_resource_ and current_zone_. 71 // Do not delete stack resources: top_resource_ and current_zone_.
71 delete bigint_store_; 72 delete bigint_store_;
72 delete api_state_; 73 delete api_state_;
73 delete stub_code_; 74 delete stub_code_;
74 delete code_index_table_; 75 delete code_index_table_;
75 } 76 }
76 77
77 78
79 static void StandardCreatePortCallback(Dart_Isolate dart_isolate,
80 Dart_Port port) {
81 // Do nothing.
82 }
83
84
78 static bool StandardPostMessageCallback(Dart_Isolate dart_isolate, 85 static bool StandardPostMessageCallback(Dart_Isolate dart_isolate,
79 Dart_Port dest_port, 86 Dart_Port dest_port,
80 Dart_Port reply_port, 87 Dart_Port reply_port,
81 Dart_Message dart_message) { 88 Dart_Message dart_message) {
82 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); 89 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate);
83 ASSERT(isolate != NULL); 90 ASSERT(isolate != NULL);
84 PortMessage* message = new PortMessage(dest_port, reply_port, dart_message); 91 PortMessage* message = new PortMessage(dest_port, reply_port, dart_message);
85 isolate->message_queue()->Enqueue(message); 92 isolate->message_queue()->Enqueue(message);
86 return true; 93 return true;
87 } 94 }
(...skipping 17 matching lines...) Expand all
105 ASSERT(result != NULL); 112 ASSERT(result != NULL);
106 113
107 // TODO(5411455): For now just set the recently created isolate as 114 // TODO(5411455): For now just set the recently created isolate as
108 // the current isolate. 115 // the current isolate.
109 SetCurrent(result); 116 SetCurrent(result);
110 117
111 // Set up the isolate message queue. 118 // Set up the isolate message queue.
112 MessageQueue* queue = new MessageQueue(); 119 MessageQueue* queue = new MessageQueue();
113 ASSERT(queue != NULL); 120 ASSERT(queue != NULL);
114 result->set_message_queue(queue); 121 result->set_message_queue(queue);
122 result->set_create_port_callback(&StandardCreatePortCallback);
115 result->set_post_message_callback(&StandardPostMessageCallback); 123 result->set_post_message_callback(&StandardPostMessageCallback);
116 result->set_close_port_callback(&StandardClosePortCallback); 124 result->set_close_port_callback(&StandardClosePortCallback);
117 125
118 // Setup the Dart API state. 126 // Setup the Dart API state.
119 ApiState* state = new ApiState(); 127 ApiState* state = new ApiState();
120 ASSERT(state != NULL); 128 ASSERT(state != NULL);
121 result->set_api_state(state); 129 result->set_api_state(state);
122 130
123 // Initialize stack top and limit in case we are running the isolate in the 131 // Initialize stack top and limit in case we are running the isolate in the
124 // main thread. 132 // main thread.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // Visit all objects in the code index table. 297 // Visit all objects in the code index table.
290 if (code_index_table() != NULL) { 298 if (code_index_table() != NULL) {
291 code_index_table()->VisitObjectPointers(visitor); 299 code_index_table()->VisitObjectPointers(visitor);
292 } 300 }
293 301
294 // Visit the top context which is stored in the isolate. 302 // Visit the top context which is stored in the isolate.
295 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_)); 303 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_));
296 } 304 }
297 305
298 } // namespace dart 306 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698