diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-04 21:09:16 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-04 21:09:16 +0000 |
commit | b64e521a4734417c33bd6758296c8eb7c3a8fe3f (patch) | |
tree | e500819946c5313dd86f5315c5eed537619dd440 /gin/public | |
parent | 4df54e8c095bd239b8f7c3786440a4878d2eb509 (diff) | |
download | chromium_src-b64e521a4734417c33bd6758296c8eb7c3a8fe3f.zip chromium_src-b64e521a4734417c33bd6758296c8eb7c3a8fe3f.tar.gz chromium_src-b64e521a4734417c33bd6758296c8eb7c3a8fe3f.tar.bz2 |
[gin] Add a v8::Platform implementation to allow for v8 posting tasks
This currently has no effect unless concurrent sweeping and job based
sweeping is turned on in v8.
BUG=v8:3015
R=abarth@chromium.org,dcarney@chromium.org
Review URL: https://codereview.chromium.org/225413004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gin/public')
-rw-r--r-- | gin/public/v8_platform.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gin/public/v8_platform.h b/gin/public/v8_platform.h new file mode 100644 index 0000000..2df0f84 --- /dev/null +++ b/gin/public/v8_platform.h @@ -0,0 +1,38 @@ +// 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 "gin/gin_export.h" +#include "v8/include/v8-platform.h" + +namespace gin { + +// A v8::Platform implementation to use with gin. +class GIN_EXPORT V8Platform : public NON_EXPORTED_BASE(v8::Platform) { + public: + static V8Platform* Get(); + + // v8::Platform implementation. + virtual void CallOnBackgroundThread( + v8::Task* task, + v8::Platform::ExpectedRuntime expected_runtime) OVERRIDE; + virtual void CallOnForegroundThread(v8::Isolate* isolate, + v8::Task* task) OVERRIDE; + private: + friend struct base::DefaultLazyInstanceTraits<V8Platform>; + + V8Platform(); + virtual ~V8Platform(); + + DISALLOW_COPY_AND_ASSIGN(V8Platform); +}; + +} // namespace gin + +#endif // GIN_PUBLIC_V8_PLATFORM_H_ |