Make apps grid view scroll vertically in experimental app list.
[chromium-blink-merge.git] / gin / v8_platform.cc
blobd50ff24f8bf49d7aa2c947e6f4bb20a1cbaee6ab
1 // Copyright 2014 The Chromium 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 #include "gin/public/v8_platform.h"
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/threading/worker_pool.h"
11 #include "gin/per_isolate_data.h"
13 namespace gin {
15 namespace {
17 base::LazyInstance<V8Platform>::Leaky g_v8_platform = LAZY_INSTANCE_INITIALIZER;
19 } // namespace
21 // static
22 V8Platform* V8Platform::Get() { return g_v8_platform.Pointer(); }
24 V8Platform::V8Platform() {}
26 V8Platform::~V8Platform() {}
28 void V8Platform::CallOnBackgroundThread(
29 v8::Task* task,
30 v8::Platform::ExpectedRuntime expected_runtime) {
31 base::WorkerPool::PostTask(
32 FROM_HERE,
33 base::Bind(&v8::Task::Run, base::Owned(task)),
34 expected_runtime == v8::Platform::kLongRunningTask);
37 void V8Platform::CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) {
38 PerIsolateData::From(isolate)->message_loop_proxy()->PostTask(
39 FROM_HERE, base::Bind(&v8::Task::Run, base::Owned(task)));
42 } // namespace gin