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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 385 |
386 WTF::ArrayBufferContents::initialize(adjustAmountOfExternalAllocatedMemory); | 386 WTF::ArrayBufferContents::initialize(adjustAmountOfExternalAllocatedMemory); |
387 | 387 |
388 DEFINE_STATIC_LOCAL(ArrayBufferAllocator, arrayBufferAllocator, ()); | 388 DEFINE_STATIC_LOCAL(ArrayBufferAllocator, arrayBufferAllocator, ()); |
389 auto v8ExtrasMode = RuntimeEnabledFeatures::experimentalV8ExtrasEnabled() | 389 auto v8ExtrasMode = RuntimeEnabledFeatures::experimentalV8ExtrasEnabled() |
390 ? gin::IsolateHolder::kStableAndExperimentalV8Extras | 390 ? gin::IsolateHolder::kStableAndExperimentalV8Extras |
391 : gin::IsolateHolder::kStableV8Extras; | 391 : gin::IsolateHolder::kStableV8Extras; |
392 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, | 392 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, |
393 v8ExtrasMode, &arrayBufferAllocator); | 393 v8ExtrasMode, &arrayBufferAllocator); |
394 | 394 |
| 395 // NOTE: Some threads (namely utility threads) don't have a scheduler. |
395 WebScheduler* scheduler = Platform::current()->currentThread()->scheduler(); | 396 WebScheduler* scheduler = Platform::current()->currentThread()->scheduler(); |
396 v8::Isolate* isolate = | 397 v8::Isolate* isolate = V8PerIsolateData::initialize( |
397 V8PerIsolateData::initialize(scheduler->timerTaskRunner()); | 398 scheduler ? scheduler->timerTaskRunner() |
| 399 : Platform::current()->currentThread()->getWebTaskRunner()); |
398 | 400 |
399 initializeV8Common(isolate); | 401 initializeV8Common(isolate); |
400 | 402 |
401 isolate->SetOOMErrorHandler(reportOOMErrorInMainThread); | 403 isolate->SetOOMErrorHandler(reportOOMErrorInMainThread); |
402 isolate->SetFatalErrorHandler(reportFatalErrorInMainThread); | 404 isolate->SetFatalErrorHandler(reportFatalErrorInMainThread); |
403 isolate->AddMessageListenerWithErrorLevel( | 405 isolate->AddMessageListenerWithErrorLevel( |
404 messageHandlerInMainThread, | 406 messageHandlerInMainThread, |
405 v8::Isolate::kMessageError | v8::Isolate::kMessageWarning | | 407 v8::Isolate::kMessageError | v8::Isolate::kMessageWarning | |
406 v8::Isolate::kMessageInfo | v8::Isolate::kMessageDebug | | 408 v8::Isolate::kMessageInfo | v8::Isolate::kMessageDebug | |
407 v8::Isolate::kMessageLog); | 409 v8::Isolate::kMessageLog); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 v8::Isolate::kMessageLog); | 518 v8::Isolate::kMessageLog); |
517 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); | 519 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); |
518 | 520 |
519 uint32_t here; | 521 uint32_t here; |
520 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) - | 522 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) - |
521 kWorkerMaxStackSize); | 523 kWorkerMaxStackSize); |
522 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 524 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
523 } | 525 } |
524 | 526 |
525 } // namespace blink | 527 } // namespace blink |
OLD | NEW |