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

Side by Side Diff: gin/v8_platform.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « gin/per_isolate_data.cc ('k') | gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #include "gin/public/v8_platform.h" 5 #include "gin/public/v8_platform.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
11 #include "gin/per_isolate_data.h" 10 #include "gin/per_isolate_data.h"
12 11
13 namespace gin { 12 namespace gin {
14 13
15 namespace { 14 namespace {
16 15
17 base::LazyInstance<V8Platform>::Leaky g_v8_platform = LAZY_INSTANCE_INITIALIZER; 16 base::LazyInstance<V8Platform>::Leaky g_v8_platform = LAZY_INSTANCE_INITIALIZER;
18 17
19 } // namespace 18 } // namespace
20 19
21 // static 20 // static
22 V8Platform* V8Platform::Get() { return g_v8_platform.Pointer(); } 21 V8Platform* V8Platform::Get() { return g_v8_platform.Pointer(); }
23 22
24 V8Platform::V8Platform() {} 23 V8Platform::V8Platform() {}
25 24
26 V8Platform::~V8Platform() {} 25 V8Platform::~V8Platform() {}
27 26
28 void V8Platform::CallOnBackgroundThread( 27 void V8Platform::CallOnBackgroundThread(
29 v8::Task* task, 28 v8::Task* task,
30 v8::Platform::ExpectedRuntime expected_runtime) { 29 v8::Platform::ExpectedRuntime expected_runtime) {
31 if (!background_thread_) { 30 if (!background_thread_) {
32 background_thread_.reset(new base::Thread("gin_background")); 31 background_thread_.reset(new base::Thread("gin_background"));
33 background_thread_->Start(); 32 background_thread_->Start();
34 } 33 }
35 background_thread_->message_loop_proxy()->PostTask( 34 background_thread_->task_runner()->PostTask(
36 FROM_HERE, 35 FROM_HERE, base::Bind(&v8::Task::Run, base::Owned(task)));
37 base::Bind(&v8::Task::Run, base::Owned(task)));
38 } 36 }
39 37
40 void V8Platform::CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) { 38 void V8Platform::CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) {
41 PerIsolateData::From(isolate)->message_loop_proxy()->PostTask( 39 PerIsolateData::From(isolate)->task_runner()->PostTask(
42 FROM_HERE, base::Bind(&v8::Task::Run, base::Owned(task))); 40 FROM_HERE, base::Bind(&v8::Task::Run, base::Owned(task)));
43 } 41 }
44 42
45 double V8Platform::MonotonicallyIncreasingTime() { 43 double V8Platform::MonotonicallyIncreasingTime() {
46 return base::TimeTicks::Now().ToInternalValue() / 44 return base::TimeTicks::Now().ToInternalValue() /
47 static_cast<double>(base::Time::kMicrosecondsPerSecond); 45 static_cast<double>(base::Time::kMicrosecondsPerSecond);
48 } 46 }
49 47
50 } // namespace gin 48 } // namespace gin
OLDNEW
« no previous file with comments | « gin/per_isolate_data.cc ('k') | gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698