Ensure that the worker pool is running if we intend to use it

BUG=none
R=hpayer@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/170483002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19519 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jochen@chromium.org 2014-02-20 19:32:27 +00:00
parent 1d8997dba7
commit 5275240eba
2 changed files with 4 additions and 2 deletions

View File

@ -50,6 +50,8 @@ class DefaultPlatform : public Platform {
void SetThreadPoolSize(int thread_pool_size);
void EnsureInitialized();
// v8::Platform implementation.
virtual void CallOnBackgroundThread(
Task *task, ExpectedRuntime expected_runtime) V8_OVERRIDE;
@ -59,8 +61,6 @@ class DefaultPlatform : public Platform {
private:
static const int kMaxThreadPoolSize = 4;
void EnsureInitialized();
Mutex lock_;
bool initialized_;
int thread_pool_size_;

View File

@ -82,6 +82,8 @@ bool V8::Initialize(Deserializer* des) {
#ifdef V8_USE_DEFAULT_PLATFORM
DefaultPlatform* platform = static_cast<DefaultPlatform*>(platform_);
platform->SetThreadPoolSize(isolate->max_available_threads());
// We currently only start the threads early, if we know that we'll use them.
if (FLAG_job_based_sweeping) platform->EnsureInitialized();
#endif
return isolate->Init(des);