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

Side by Side Diff: third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp

Issue 2875773002: Remove V8PerIsolateData::EnsureLiveRoot. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 isolate->SetData(gin::kEmbedderBlink, data); 84 isolate->SetData(gin::kEmbedderBlink, data);
85 return isolate; 85 return isolate;
86 } 86 }
87 87
88 void V8PerIsolateData::EnableIdleTasks( 88 void V8PerIsolateData::EnableIdleTasks(
89 v8::Isolate* isolate, 89 v8::Isolate* isolate,
90 std::unique_ptr<gin::V8IdleTaskRunner> task_runner) { 90 std::unique_ptr<gin::V8IdleTaskRunner> task_runner) {
91 From(isolate)->isolate_holder_.EnableIdleTasks(std::move(task_runner)); 91 From(isolate)->isolate_holder_.EnableIdleTasks(std::move(task_runner));
92 } 92 }
93 93
94 v8::Persistent<v8::Value>& V8PerIsolateData::EnsureLiveRoot() {
95 if (live_root_.IsEmpty())
96 live_root_.Set(GetIsolate(), v8::Null(GetIsolate()));
97 return live_root_.Get();
98 }
99
100 // willBeDestroyed() clear things that should be cleared before 94 // willBeDestroyed() clear things that should be cleared before
101 // ThreadState::detach() gets called. 95 // ThreadState::detach() gets called.
102 void V8PerIsolateData::WillBeDestroyed(v8::Isolate* isolate) { 96 void V8PerIsolateData::WillBeDestroyed(v8::Isolate* isolate) {
103 V8PerIsolateData* data = From(isolate); 97 V8PerIsolateData* data = From(isolate);
104 98
105 data->thread_debugger_.reset(); 99 data->thread_debugger_.reset();
106 // Clear any data that may have handles into the heap, 100 // Clear any data that may have handles into the heap,
107 // prior to calling ThreadState::detach(). 101 // prior to calling ThreadState::detach().
108 data->ClearEndOfScopeTasks(); 102 data->ClearEndOfScopeTasks();
109 103
110 data->active_script_wrappables_.Clear(); 104 data->active_script_wrappables_.Clear();
111 } 105 }
112 106
113 // destroy() clear things that should be cleared after ThreadState::detach() 107 // destroy() clear things that should be cleared after ThreadState::detach()
114 // gets called but before the Isolate exits. 108 // gets called but before the Isolate exits.
115 void V8PerIsolateData::Destroy(v8::Isolate* isolate) { 109 void V8PerIsolateData::Destroy(v8::Isolate* isolate) {
116 isolate->RemoveBeforeCallEnteredCallback(&BeforeCallEnteredCallback); 110 isolate->RemoveBeforeCallEnteredCallback(&BeforeCallEnteredCallback);
117 isolate->RemoveMicrotasksCompletedCallback(&MicrotasksCompletedCallback); 111 isolate->RemoveMicrotasksCompletedCallback(&MicrotasksCompletedCallback);
118 V8PerIsolateData* data = From(isolate); 112 V8PerIsolateData* data = From(isolate);
119 113
120 // Clear everything before exiting the Isolate. 114 // Clear everything before exiting the Isolate.
121 if (data->script_regexp_script_state_) 115 if (data->script_regexp_script_state_)
122 data->script_regexp_script_state_->DisposePerContextData(); 116 data->script_regexp_script_state_->DisposePerContextData();
123 data->live_root_.Clear();
124 data->private_property_.reset(); 117 data->private_property_.reset();
125 data->string_cache_->Dispose(); 118 data->string_cache_->Dispose();
126 data->string_cache_.reset(); 119 data->string_cache_.reset();
127 data->interface_template_map_for_non_main_world_.clear(); 120 data->interface_template_map_for_non_main_world_.clear();
128 data->interface_template_map_for_main_world_.clear(); 121 data->interface_template_map_for_main_world_.clear();
129 data->operation_template_map_for_non_main_world_.clear(); 122 data->operation_template_map_for_non_main_world_.clear();
130 data->operation_template_map_for_main_world_.clear(); 123 data->operation_template_map_for_main_world_.clear();
131 if (IsMainThread()) 124 if (IsMainThread())
132 g_main_thread_per_isolate_data = 0; 125 g_main_thread_per_isolate_data = 0;
133 126
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 ScriptWrappableVisitor* current = CurrentVisitor(); 302 ScriptWrappableVisitor* current = CurrentVisitor();
310 if (current) 303 if (current)
311 current->PerformCleanup(); 304 current->PerformCleanup();
312 305
313 V8PerIsolateData::From(isolate_)->script_wrappable_visitor_.swap( 306 V8PerIsolateData::From(isolate_)->script_wrappable_visitor_.swap(
314 saved_visitor_); 307 saved_visitor_);
315 isolate_->SetEmbedderHeapTracer(CurrentVisitor()); 308 isolate_->SetEmbedderHeapTracer(CurrentVisitor());
316 } 309 }
317 310
318 } // namespace blink 311 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698