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

Unified Diff: runtime/lib/isolate.cc

Issue 2654443003: Revert "VM: Fix memory leaks during isolate spawning" (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | runtime/vm/datastream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/isolate.cc
diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc
index 992cf503eb5cf8ccc04e494752bf363c24128b85..7e4ce042d807660dfff8dc515453dd960c2d5cdd 100644
--- a/runtime/lib/isolate.cc
+++ b/runtime/lib/isolate.cc
@@ -239,29 +239,18 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnFunction, 10) {
// Get the parent function so that we get the right function name.
func = func.parent_function();
- bool fatal_errors = fatalErrors.IsNull() ? true : fatalErrors.value();
- Dart_Port on_exit_port = onExit.IsNull() ? ILLEGAL_PORT : onExit.Id();
- Dart_Port on_error_port = onError.IsNull() ? ILLEGAL_PORT : onError.Id();
-
- // We first try to serialize the message. In case the message is not
- // serializable this will throw an exception.
- SerializedObjectBuffer message_buffer;
- {
- MessageWriter writer(message_buffer.data_buffer(), &malloc_allocator,
- &malloc_deallocator,
- /* can_send_any_object = */ true,
- message_buffer.data_length());
- writer.WriteMessage(message);
- }
-
const char* utf8_package_root =
packageRoot.IsNull() ? NULL : String2UTF8(packageRoot);
const char* utf8_package_config =
packageConfig.IsNull() ? NULL : String2UTF8(packageConfig);
+ bool fatal_errors = fatalErrors.IsNull() ? true : fatalErrors.value();
+ Dart_Port on_exit_port = onExit.IsNull() ? ILLEGAL_PORT : onExit.Id();
+ Dart_Port on_error_port = onError.IsNull() ? ILLEGAL_PORT : onError.Id();
+
IsolateSpawnState* state = new IsolateSpawnState(
port.Id(), isolate->origin_id(), isolate->init_callback_data(),
- String2UTF8(script_uri), func, &message_buffer,
+ String2UTF8(script_uri), func, message,
isolate->spawn_count_monitor(), isolate->spawn_count(),
utf8_package_root, utf8_package_config, paused.value(), fatal_errors,
on_exit_port, on_error_port);
@@ -361,27 +350,6 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnUri, 12) {
UNREACHABLE();
}
- bool fatal_errors = fatalErrors.IsNull() ? true : fatalErrors.value();
- Dart_Port on_exit_port = onExit.IsNull() ? ILLEGAL_PORT : onExit.Id();
- Dart_Port on_error_port = onError.IsNull() ? ILLEGAL_PORT : onError.Id();
-
- // We first try to serialize the arguments and the message. In case the
- // arguments or the message are not serializable this will throw an exception.
- SerializedObjectBuffer arguments_buffer;
- SerializedObjectBuffer message_buffer;
- {
- MessageWriter writer(
- arguments_buffer.data_buffer(), &malloc_allocator, &malloc_deallocator,
- /* can_send_any_object = */ false, arguments_buffer.data_length());
- writer.WriteMessage(args);
- }
- {
- MessageWriter writer(
- message_buffer.data_buffer(), &malloc_allocator, &malloc_deallocator,
- /* can_send_any_object = */ false, arguments_buffer.data_length());
- writer.WriteMessage(message);
- }
-
// Canonicalize the uri with respect to the current isolate.
const Library& root_lib =
Library::Handle(isolate->object_store()->root_library());
@@ -397,11 +365,15 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnUri, 12) {
const char* utf8_package_config =
packageConfig.IsNull() ? NULL : String2UTF8(packageConfig);
+ bool fatal_errors = fatalErrors.IsNull() ? true : fatalErrors.value();
+ Dart_Port on_exit_port = onExit.IsNull() ? ILLEGAL_PORT : onExit.Id();
+ Dart_Port on_error_port = onError.IsNull() ? ILLEGAL_PORT : onError.Id();
+
IsolateSpawnState* state = new IsolateSpawnState(
port.Id(), isolate->init_callback_data(), canonical_uri,
- utf8_package_root, utf8_package_config, &arguments_buffer,
- &message_buffer, isolate->spawn_count_monitor(), isolate->spawn_count(),
- paused.value(), fatal_errors, on_exit_port, on_error_port);
+ utf8_package_root, utf8_package_config, args, message,
+ isolate->spawn_count_monitor(), isolate->spawn_count(), paused.value(),
+ fatal_errors, on_exit_port, on_error_port);
// If we were passed a value then override the default flags state for
// checked mode.
« no previous file with comments | « no previous file | runtime/vm/datastream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698