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

Unified Diff: gin/v8_platform.cc

Issue 988483002: Use a joinable background thread instead of worker pool in gin (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gin/public/v8_platform.h ('k') | mojo/tools/roll/update_from_chromium.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/v8_platform.cc
diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc
index ec163ded8d1444a06f18aa0164df754186633f3f..c8ee770b61ce2bf962efc3a7833058196f02d029 100644
--- a/gin/v8_platform.cc
+++ b/gin/v8_platform.cc
@@ -7,7 +7,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/message_loop/message_loop_proxy.h"
-#include "base/threading/worker_pool.h"
+#include "base/threading/thread.h"
#include "gin/per_isolate_data.h"
namespace gin {
@@ -28,10 +28,13 @@ V8Platform::~V8Platform() {}
void V8Platform::CallOnBackgroundThread(
v8::Task* task,
v8::Platform::ExpectedRuntime expected_runtime) {
- base::WorkerPool::PostTask(
+ if (!background_thread_) {
+ background_thread_.reset(new base::Thread("gin_background"));
+ background_thread_->Start();
+ }
+ background_thread_->message_loop_proxy()->PostTask(
FROM_HERE,
- base::Bind(&v8::Task::Run, base::Owned(task)),
- expected_runtime == v8::Platform::kLongRunningTask);
+ base::Bind(&v8::Task::Run, base::Owned(task)));
}
void V8Platform::CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) {
« no previous file with comments | « gin/public/v8_platform.h ('k') | mojo/tools/roll/update_from_chromium.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698