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

Side by Side Diff: src/libplatform/default-platform.h

Issue 358363002: Move platform abstraction to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ 5 #ifndef V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
6 #define V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ 6 #define V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "include/v8-platform.h" 10 #include "include/v8-platform.h"
11 #include "src/base/macros.h" 11 #include "src/base/macros.h"
12 #include "src/base/platform/mutex.h"
12 #include "src/libplatform/task-queue.h" 13 #include "src/libplatform/task-queue.h"
13 #include "src/platform/mutex.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18 class TaskQueue; 18 class TaskQueue;
19 class Thread; 19 class Thread;
20 class WorkerThread; 20 class WorkerThread;
21 21
22 class DefaultPlatform : public Platform { 22 class DefaultPlatform : public Platform {
23 public: 23 public:
24 DefaultPlatform(); 24 DefaultPlatform();
25 virtual ~DefaultPlatform(); 25 virtual ~DefaultPlatform();
26 26
27 void SetThreadPoolSize(int thread_pool_size); 27 void SetThreadPoolSize(int thread_pool_size);
28 28
29 void EnsureInitialized(); 29 void EnsureInitialized();
30 30
31 // v8::Platform implementation. 31 // v8::Platform implementation.
32 virtual void CallOnBackgroundThread( 32 virtual void CallOnBackgroundThread(
33 Task *task, ExpectedRuntime expected_runtime) V8_OVERRIDE; 33 Task *task, ExpectedRuntime expected_runtime) V8_OVERRIDE;
34 virtual void CallOnForegroundThread(v8::Isolate *isolate, 34 virtual void CallOnForegroundThread(v8::Isolate *isolate,
35 Task *task) V8_OVERRIDE; 35 Task *task) V8_OVERRIDE;
36 36
37 private: 37 private:
38 static const int kMaxThreadPoolSize; 38 static const int kMaxThreadPoolSize;
39 39
40 Mutex lock_; 40 base::Mutex lock_;
41 bool initialized_; 41 bool initialized_;
42 int thread_pool_size_; 42 int thread_pool_size_;
43 std::vector<WorkerThread*> thread_pool_; 43 std::vector<WorkerThread*> thread_pool_;
44 TaskQueue queue_; 44 TaskQueue queue_;
45 45
46 DISALLOW_COPY_AND_ASSIGN(DefaultPlatform); 46 DISALLOW_COPY_AND_ASSIGN(DefaultPlatform);
47 }; 47 };
48 48
49 49
50 } } // namespace v8::internal 50 } } // namespace v8::internal
51 51
52 52
53 #endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_ 53 #endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698