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

Side by Side Diff: Source/bindings/v8/SerializedScriptValue.cpp

Issue 189513012: DOMDataStore should be cleared when shutting down worker threads (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 2326
2327 SerializedScriptValue::SerializedScriptValue() 2327 SerializedScriptValue::SerializedScriptValue()
2328 : m_externallyAllocatedMemory(0) 2328 : m_externallyAllocatedMemory(0)
2329 { 2329 {
2330 } 2330 }
2331 2331
2332 static void neuterArrayBufferInAllWorlds(ArrayBuffer* object) 2332 static void neuterArrayBufferInAllWorlds(ArrayBuffer* object)
2333 { 2333 {
2334 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 2334 v8::Isolate* isolate = v8::Isolate::GetCurrent();
2335 if (isMainThread()) { 2335 if (isMainThread()) {
2336 Vector<RefPtr<DOMWrapperWorld> > worlds; 2336 Vector<DOMWrapperWorld*> worlds;
2337 DOMWrapperWorld::allWorldsInMainThread(worlds); 2337 DOMWrapperWorld::allWorldsInMainThread(worlds);
2338 for (size_t i = 0; i < worlds.size(); i++) { 2338 for (size_t i = 0; i < worlds.size(); i++) {
2339 v8::Handle<v8::Object> wrapper = worlds[i]->domDataStore().get<V8Arr ayBuffer>(object, isolate); 2339 v8::Handle<v8::Object> wrapper = worlds[i]->domDataStore().get<V8Arr ayBuffer>(object, isolate);
2340 if (!wrapper.IsEmpty()) { 2340 if (!wrapper.IsEmpty()) {
2341 ASSERT(wrapper->IsArrayBuffer()); 2341 ASSERT(wrapper->IsArrayBuffer());
2342 v8::Handle<v8::ArrayBuffer>::Cast(wrapper)->Neuter(); 2342 v8::Handle<v8::ArrayBuffer>::Cast(wrapper)->Neuter();
2343 } 2343 }
2344 } 2344 }
2345 } else { 2345 } else {
2346 v8::Handle<v8::Object> wrapper = WorkerScriptController::controllerForCo ntext(isolate)->world()->domDataStore().get<V8ArrayBuffer>(object, isolate); 2346 v8::Handle<v8::Object> wrapper = WorkerScriptController::controllerForCo ntext(isolate)->world()->domDataStore().get<V8ArrayBuffer>(object, isolate);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 // If the allocated memory was not registered before, then this class is lik ely 2510 // If the allocated memory was not registered before, then this class is lik ely
2511 // used in a context other then Worker's onmessage environment and the prese nce of 2511 // used in a context other then Worker's onmessage environment and the prese nce of
2512 // current v8 context is not guaranteed. Avoid calling v8 then. 2512 // current v8 context is not guaranteed. Avoid calling v8 then.
2513 if (m_externallyAllocatedMemory) { 2513 if (m_externallyAllocatedMemory) {
2514 ASSERT(v8::Isolate::GetCurrent()); 2514 ASSERT(v8::Isolate::GetCurrent());
2515 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory); 2515 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory);
2516 } 2516 }
2517 } 2517 }
2518 2518
2519 } // namespace WebCore 2519 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698