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

Unified Diff: src/libplatform/default-platform.h

Issue 104583003: [platform] Implement a worker pool (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: src/libplatform/default-platform.h
diff --git a/src/default-platform.h b/src/libplatform/default-platform.h
similarity index 77%
rename from src/default-platform.h
rename to src/libplatform/default-platform.h
index fe1bf8e2d64e57349309fdab70c973af2fb99eb9..a2cf38c8c73f753cca3d8637a6e67438bd828218 100644
--- a/src/default-platform.h
+++ b/src/libplatform/default-platform.h
@@ -25,19 +25,28 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef V8_DEFAULT_PLATFORM_H_
-#define V8_DEFAULT_PLATFORM_H_
+#ifndef V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
+#define V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
-#include "v8.h"
+#include "../../include/v8-platform.h"
+// TODO(jochen): We should have our own version of globals.h.
+#include "../globals.h"
namespace v8 {
namespace internal {
+class TaskQueue;
+class Thread;
+class WorkerThread;
+
class DefaultPlatform : public Platform {
public:
DefaultPlatform();
virtual ~DefaultPlatform();
+ // TODO(jochen): This shouldn't be static.
+ static void SetThreadPoolSize(int thread_pool_size);
+
// v8::Platform implementation.
virtual void CallOnBackgroundThread(
Task *task, ExpectedRuntime expected_runtime) V8_OVERRIDE;
@@ -45,6 +54,15 @@ class DefaultPlatform : public Platform {
Task *task) V8_OVERRIDE;
private:
+ void EnsureThreadPoolStarted();
+
+ static const int kMaxThreadPoolSize = 4;
+
+ WorkerThread** thread_pool_;
+ // TODO(jochen): This shouldn't be a static.
+ static int thread_pool_size_;
Hannes Payer (out of office) 2013/12/09 18:50:51 I don't think we can have static members here. Thi
jochen (gone - plz use gerrit) 2013/12/09 19:04:31 there's only one default platform per process.
Hannes Payer (out of office) 2013/12/11 12:07:27 As discussed offline, TSAN will not like that in a
+ TaskQueue* queue_;
+
DISALLOW_COPY_AND_ASSIGN(DefaultPlatform);
};
@@ -52,4 +70,4 @@ class DefaultPlatform : public Platform {
} } // namespace v8::internal
-#endif // V8_DEFAULT_PLATFORM_H_
+#endif // V8_LIBPLATFORM_DEFAULT_PLATFORM_H_

Powered by Google App Engine
This is Rietveld 408576698