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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp

Issue 2703183002: Factor out gin::IsolateHolder's constructor
Patch Set: fix WorkerBackingThread Created 3 years, 10 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 | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h » ('j') | 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 : gin::IsolateHolder::kStableV8Extras; 390 : gin::IsolateHolder::kStableV8Extras;
391 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, 391 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
392 v8ExtrasMode, &arrayBufferAllocator); 392 v8ExtrasMode, &arrayBufferAllocator);
393 393
394 // NOTE: Some threads (namely utility threads) don't have a scheduler. 394 // NOTE: Some threads (namely utility threads) don't have a scheduler.
395 WebScheduler* scheduler = Platform::current()->currentThread()->scheduler(); 395 WebScheduler* scheduler = Platform::current()->currentThread()->scheduler();
396 // When timer task runner is used for PerIsolateData, GC tasks are getting 396 // When timer task runner is used for PerIsolateData, GC tasks are getting
397 // throttled and memory usage goes up. For now we're using loading task queue 397 // throttled and memory usage goes up. For now we're using loading task queue
398 // to prevent this. 398 // to prevent this.
399 // TODO(altimin): Consider switching to timerTaskRunner here. 399 // TODO(altimin): Consider switching to timerTaskRunner here.
400 v8::Isolate* isolate = V8PerIsolateData::initialize( 400
401 WebTaskRunner* taskRunner =
401 scheduler ? scheduler->loadingTaskRunner() 402 scheduler ? scheduler->loadingTaskRunner()
402 : Platform::current()->currentThread()->getWebTaskRunner()); 403 : Platform::current()->currentThread()->getWebTaskRunner();
404 std::unique_ptr<gin::IsolateHolder> isolateHolder(
405 WTF::makeUnique<gin::IsolateHolder>(
406 taskRunner ? taskRunner->toSingleThreadTaskRunner() : nullptr,
407 gin::IsolateHolder::kSingleThread,
408 isMainThread() ? gin::IsolateHolder::kDisallowAtomicsWait
409 : gin::IsolateHolder::kAllowAtomicsWait));
410 v8::Isolate* isolate = V8PerIsolateData::initialize(std::move(isolateHolder));
403 411
404 initializeV8Common(isolate); 412 initializeV8Common(isolate);
405 413
406 isolate->SetOOMErrorHandler(reportOOMErrorInMainThread); 414 isolate->SetOOMErrorHandler(reportOOMErrorInMainThread);
407 isolate->SetFatalErrorHandler(reportFatalErrorInMainThread); 415 isolate->SetFatalErrorHandler(reportFatalErrorInMainThread);
408 isolate->AddMessageListenerWithErrorLevel( 416 isolate->AddMessageListenerWithErrorLevel(
409 messageHandlerInMainThread, 417 messageHandlerInMainThread,
410 v8::Isolate::kMessageError | v8::Isolate::kMessageWarning | 418 v8::Isolate::kMessageError | v8::Isolate::kMessageWarning |
411 v8::Isolate::kMessageInfo | v8::Isolate::kMessageDebug | 419 v8::Isolate::kMessageInfo | v8::Isolate::kMessageDebug |
412 v8::Isolate::kMessageLog); 420 v8::Isolate::kMessageLog);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 v8::Isolate::kMessageLog); 522 v8::Isolate::kMessageLog);
515 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); 523 isolate->SetFatalErrorHandler(reportFatalErrorInWorker);
516 524
517 uint32_t here; 525 uint32_t here;
518 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) - 526 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) -
519 kWorkerMaxStackSize); 527 kWorkerMaxStackSize);
520 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); 528 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker);
521 } 529 }
522 530
523 } // namespace blink 531 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698