| // Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #ifndef GIN_PUBLIC_V8_PLATFORM_H_ |
| #define GIN_PUBLIC_V8_PLATFORM_H_ |
| #include "base/basictypes.h" |
| #include "base/compiler_specific.h" |
| #include "base/lazy_instance.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "gin/gin_export.h" |
| #include "v8/include/v8-platform.h" |
| // A v8::Platform implementation to use with gin. |
| class GIN_EXPORT V8Platform : public NON_EXPORTED_BASE(v8::Platform) { |
| static V8Platform* Get(); |
| // v8::Platform implementation. |
| void CallOnBackgroundThread( |
| v8::Platform::ExpectedRuntime expected_runtime) override; |
| void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override; |
| double MonotonicallyIncreasingTime() override; |
| friend struct base::DefaultLazyInstanceTraits<V8Platform>; |
| scoped_ptr<base::Thread> background_thread_; |
| DISALLOW_COPY_AND_ASSIGN(V8Platform); |
| #endif // GIN_PUBLIC_V8_PLATFORM_H_ |