Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 } | 284 } |
| 285 return false; | 285 return false; |
| 286 } | 286 } |
| 287 | 287 |
| 288 static void initializeV8Common(v8::Isolate* isolate) | 288 static void initializeV8Common(v8::Isolate* isolate) |
| 289 { | 289 { |
| 290 isolate->AddGCPrologueCallback(V8GCController::gcPrologue); | 290 isolate->AddGCPrologueCallback(V8GCController::gcPrologue); |
| 291 isolate->AddGCEpilogueCallback(V8GCController::gcEpilogue); | 291 isolate->AddGCEpilogueCallback(V8GCController::gcEpilogue); |
| 292 if (RuntimeEnabledFeatures::traceWrappablesEnabled()) { | 292 if (RuntimeEnabledFeatures::traceWrappablesEnabled()) { |
| 293 ScriptWrappableVisitor* visitor = new ScriptWrappableVisitor(isolate); | 293 ScriptWrappableVisitor* visitor = new ScriptWrappableVisitor(isolate); |
| 294 V8PerIsolateData::from(isolate)->setScriptWrappableVisitor(visitor); | |
| 294 isolate->SetEmbedderHeapTracer(visitor); | 295 isolate->SetEmbedderHeapTracer(visitor); |
|
haraken
2016/06/03 12:32:06
unique_ptr<ScriptWrappableVisitor> visitor = new .
| |
| 295 } | 296 } |
| 296 | 297 |
| 297 v8::Debug::SetLiveEditEnabled(isolate, false); | 298 v8::Debug::SetLiveEditEnabled(isolate, false); |
| 298 | 299 |
| 299 isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kScoped); | 300 isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kScoped); |
| 300 } | 301 } |
| 301 | 302 |
| 302 namespace { | 303 namespace { |
| 303 | 304 |
| 304 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 305 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 ThreadState::mainThreadState()->addInterruptor(adoptPtr(new V8IsolateInterru ptor(isolate))); | 365 ThreadState::mainThreadState()->addInterruptor(adoptPtr(new V8IsolateInterru ptor(isolate))); |
| 365 ThreadState::mainThreadState()->registerTraceDOMWrappers(isolate, V8GCContro ller::traceDOMWrappers); | 366 ThreadState::mainThreadState()->registerTraceDOMWrappers(isolate, V8GCContro ller::traceDOMWrappers); |
| 366 | 367 |
| 367 V8PerIsolateData::from(isolate)->setThreadDebugger(adoptPtr(new MainThreadDe bugger(isolate))); | 368 V8PerIsolateData::from(isolate)->setThreadDebugger(adoptPtr(new MainThreadDe bugger(isolate))); |
| 368 } | 369 } |
| 369 | 370 |
| 370 void V8Initializer::shutdownMainThread() | 371 void V8Initializer::shutdownMainThread() |
| 371 { | 372 { |
| 372 ASSERT(isMainThread()); | 373 ASSERT(isMainThread()); |
| 373 v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate(); | 374 v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate(); |
| 375 isolate->SetEmbedderHeapTracer(nullptr); | |
| 374 V8PerIsolateData::willBeDestroyed(isolate); | 376 V8PerIsolateData::willBeDestroyed(isolate); |
| 375 V8PerIsolateData::destroy(isolate); | 377 V8PerIsolateData::destroy(isolate); |
| 376 } | 378 } |
| 377 | 379 |
| 378 static void reportFatalErrorInWorker(const char* location, const char* message) | 380 static void reportFatalErrorInWorker(const char* location, const char* message) |
| 379 { | 381 { |
| 380 // FIXME: We temporarily deal with V8 internal error situations such as out- of-memory by crashing the worker. | 382 // FIXME: We temporarily deal with V8 internal error situations such as out- of-memory by crashing the worker. |
| 381 CRASH(); | 383 CRASH(); |
| 382 } | 384 } |
| 383 | 385 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 | 428 |
| 427 isolate->AddMessageListener(messageHandlerInWorker); | 429 isolate->AddMessageListener(messageHandlerInWorker); |
| 428 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); | 430 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); |
| 429 | 431 |
| 430 uint32_t here; | 432 uint32_t here; |
| 431 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); | 433 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); |
| 432 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 434 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
| 433 } | 435 } |
| 434 | 436 |
| 435 } // namespace blink | 437 } // namespace blink |
| OLD | NEW |