Commit 9d5306cf authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

v8binding: Separate TraceWrapperBase.h from ScriptWrappable.h.

Creates a new header TraceWrapperBase.h and makes ScriptWrappable.h
and TraceWrapperMember.h include TraceWrapperBase.h that defines
TraceWrapperBase class.

Bug: 
Change-Id: I9135b9394ef4a116322d6f9fc1ac97969e4735f3
Reviewed-on: https://chromium-review.googlesource.com/664503Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501603}
parent c66168d9
...@@ -523,6 +523,7 @@ component("platform") { ...@@ -523,6 +523,7 @@ component("platform") {
"bindings/StringResource.cpp", "bindings/StringResource.cpp",
"bindings/StringResource.h", "bindings/StringResource.h",
"bindings/ToV8.h", "bindings/ToV8.h",
"bindings/TraceWrapperBase.h",
"bindings/TraceWrapperMember.h", "bindings/TraceWrapperMember.h",
"bindings/TraceWrapperV8Reference.h", "bindings/TraceWrapperV8Reference.h",
"bindings/V0CustomElementBinding.cpp", "bindings/V0CustomElementBinding.cpp",
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "platform/PlatformExport.h" #include "platform/PlatformExport.h"
#include "platform/bindings/ScriptWrappableVisitor.h" #include "platform/bindings/TraceWrapperBase.h"
#include "platform/bindings/WrapperTypeInfo.h" #include "platform/bindings/WrapperTypeInfo.h"
#include "platform/heap/Handle.h" #include "platform/heap/Handle.h"
#include "platform/wtf/Noncopyable.h" #include "platform/wtf/Noncopyable.h"
...@@ -42,16 +42,6 @@ ...@@ -42,16 +42,6 @@
namespace blink { namespace blink {
class PLATFORM_EXPORT TraceWrapperBase {
WTF_MAKE_NONCOPYABLE(TraceWrapperBase);
public:
TraceWrapperBase() = default;
virtual bool IsScriptWrappable() const { return false; }
DECLARE_VIRTUAL_TRACE_WRAPPERS(){};
};
// ScriptWrappable provides a way to map from/to C++ DOM implementation to/from // ScriptWrappable provides a way to map from/to C++ DOM implementation to/from
// JavaScript object (platform object). ToV8() converts a ScriptWrappable to // JavaScript object (platform object). ToV8() converts a ScriptWrappable to
// a v8::Object and toScriptWrappable() converts a v8::Object back to // a v8::Object and toScriptWrappable() converts a v8::Object back to
......
// Copyright 2017 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 TraceWrapperBase_h
#define TraceWrapperBase_h
#include "platform/bindings/ScriptWrappableVisitor.h"
#include "platform/wtf/Noncopyable.h"
namespace blink {
class PLATFORM_EXPORT TraceWrapperBase {
WTF_MAKE_NONCOPYABLE(TraceWrapperBase);
public:
TraceWrapperBase() = default;
~TraceWrapperBase() = default;
virtual bool IsScriptWrappable() const { return false; }
DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() {}
};
} // namespace blink
#endif // TraceWrapperBase_h
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define TraceWrapperMember_h #define TraceWrapperMember_h
#include "platform/bindings/ScriptWrappableVisitor.h" #include "platform/bindings/ScriptWrappableVisitor.h"
#include "platform/bindings/TraceWrapperBase.h"
#include "platform/heap/HeapAllocator.h" #include "platform/heap/HeapAllocator.h"
namespace blink { namespace blink {
...@@ -20,6 +21,9 @@ class Member; ...@@ -20,6 +21,9 @@ class Member;
template <class T> template <class T>
class TraceWrapperMember : public Member<T> { class TraceWrapperMember : public Member<T> {
DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
// TODO(mlippautz): Enable the following check.
// static_assert(std::is_base_of<TraceWrapperBase, T>::value,
// "T must inherit from TraceWrapperBase");
public: public:
TraceWrapperMember() : Member<T>(nullptr) {} TraceWrapperMember() : Member<T>(nullptr) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment