1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
6 #define V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
12 #include "include/v8-platform.h"
13 #include "src/base/macros.h"
14 #include "src/base/platform/mutex.h"
15 #include "src/libplatform/task-queue.h"
24 class DefaultPlatform : public Platform {
27 virtual ~DefaultPlatform();
29 void SetThreadPoolSize(int thread_pool_size);
31 void EnsureInitialized();
33 bool PumpMessageLoop(v8::Isolate* isolate);
35 // v8::Platform implementation.
36 virtual void CallOnBackgroundThread(
37 Task* task, ExpectedRuntime expected_runtime) OVERRIDE;
38 virtual void CallOnForegroundThread(v8::Isolate* isolate,
42 static const int kMaxThreadPoolSize;
46 int thread_pool_size_;
47 std::vector<WorkerThread*> thread_pool_;
49 std::map<v8::Isolate*, std::queue<Task*> > main_thread_queue_;
51 DISALLOW_COPY_AND_ASSIGN(DefaultPlatform);
55 } } // namespace v8::platform
58 #endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_