Commit 5e60f930 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

Don't include ComputedStyle.h from Node.h

This caused it to be included in about 3400 compilation units. Removing this
dependency reduces the number to about 1000.

Compiling ComputedStyle.h takes almost 6 seconds here (which is worth an
investigation on its own).

Some changes elsewhere were required because of this, because they
inadvertently depended on things included via ComputedStyle.h . Keeping
Blob & co merely forward-declared in IDBValueWrapping.h required some
extra work.

The dependency was introduced here:

https: //codereview.chromium.org/2821193003
Change-Id: I5323c12821ae7e5408f6f5f1fee17222a0acf511
Reviewed-on: https://chromium-review.googlesource.com/543155
Commit-Queue: Morten Stenshorne <mstensho@opera.com>
Reviewed-by: default avatarRune Lillesveen <rune@opera.com>
Reviewed-by: default avatarnainar <nainar@chromium.org>
Reviewed-by: default avatarJoshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#481675}
parent 85241f18
......@@ -7,10 +7,12 @@
#include "core/css/CSSFontFamilyValue.h"
#include "core/css/CSSIdentifierValue.h"
#include "core/css/CSSPrimitiveValueMappings.h"
#include "core/css/CSSProperty.h"
#include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSParserFastPaths.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/CSSPropertyFontUtils.h"
#include "core/layout/LayoutTheme.h"
#include "platform/fonts/FontTraits.h"
namespace blink {
......
......@@ -139,6 +139,25 @@ struct SameSizeAsNode : EventTarget {
void* pointer_;
};
NodeRenderingData::NodeRenderingData(LayoutObject* layout_object,
RefPtr<ComputedStyle> non_attached_style)
: layout_object_(layout_object), non_attached_style_(non_attached_style) {}
NodeRenderingData::~NodeRenderingData() {
CHECK(!layout_object_);
}
void NodeRenderingData::SetNonAttachedStyle(
RefPtr<ComputedStyle> non_attached_style) {
DCHECK_NE(&SharedEmptyData(), this);
non_attached_style_ = non_attached_style;
}
NodeRenderingData& NodeRenderingData::SharedEmptyData() {
DEFINE_STATIC_LOCAL(NodeRenderingData, shared_empty_data, (nullptr, nullptr));
return shared_empty_data;
}
static_assert(sizeof(Node) <= sizeof(SameSizeAsNode), "Node should stay small");
#if DUMP_NODE_STATISTICS
......
......@@ -33,7 +33,6 @@
#include "core/dom/TreeScope.h"
#include "core/editing/EditingBoundary.h"
#include "core/events/EventTarget.h"
#include "core/style/ComputedStyle.h"
#include "core/style/ComputedStyleConstants.h"
#include "platform/bindings/TraceWrapperMember.h"
#include "platform/geometry/LayoutRect.h"
......@@ -44,6 +43,7 @@
namespace blink {
class ComputedStyle;
class ContainerNode;
class Document;
class Element;
......@@ -58,7 +58,6 @@ class EventDispatchHandlingState;
class NodeList;
class NodeListsNodeData;
class NodeOrString;
class NodeRenderingData;
class NodeRareData;
class QualifiedName;
class RegisteredEventListener;
......@@ -106,10 +105,8 @@ class NodeRenderingData {
public:
explicit NodeRenderingData(LayoutObject* layout_object,
RefPtr<ComputedStyle> non_attached_style)
: layout_object_(layout_object),
non_attached_style_(non_attached_style) {}
~NodeRenderingData() { CHECK(!layout_object_); }
RefPtr<ComputedStyle> non_attached_style);
~NodeRenderingData();
LayoutObject* GetLayoutObject() const { return layout_object_; }
void SetLayoutObject(LayoutObject* layout_object) {
......@@ -120,16 +117,9 @@ class NodeRenderingData {
ComputedStyle* GetNonAttachedStyle() const {
return non_attached_style_.Get();
}
void SetNonAttachedStyle(RefPtr<ComputedStyle> non_attached_style) {
DCHECK_NE(&SharedEmptyData(), this);
non_attached_style_ = non_attached_style;
}
void SetNonAttachedStyle(RefPtr<ComputedStyle> non_attached_style);
static NodeRenderingData& SharedEmptyData() {
DEFINE_STATIC_LOCAL(NodeRenderingData, shared_empty_data,
(nullptr, nullptr));
return shared_empty_data;
}
static NodeRenderingData& SharedEmptyData();
bool IsSharedEmptyData() { return this == &SharedEmptyData(); }
private:
......
......@@ -6,6 +6,7 @@
#define WebViewBase_h
#include "core/page/EventWithHitTestResults.h"
#include "platform/graphics/paint/PaintImage.h"
#include "platform/transforms/TransformationMatrix.h"
#include "platform/wtf/RefCounted.h"
#include "public/platform/WebDisplayMode.h"
......
......@@ -8,6 +8,7 @@
#include "core/CoreExport.h"
#include "core/clipboard/DataObject.h"
#include "core/dom/UserGestureIndicator.h"
#include "platform/graphics/paint/PaintImage.h"
#include "platform/wtf/Assertions.h"
#include "public/platform/WebCoalescedInputEvent.h"
#include "public/platform/WebDragData.h"
......
......@@ -75,6 +75,10 @@ IDBValueWrapper::IDBValueWrapper(
#endif // DCHECK_IS_ON()
}
// Explicit destructor in the .cpp file, to move the dependency on the
// BlobDataHandle definition away from the header file.
IDBValueWrapper::~IDBValueWrapper() {}
void IDBValueWrapper::Clone(ScriptState* script_state, ScriptValue* clone) {
#if DCHECK_IS_ON()
DCHECK(!had_exception_) << __FUNCTION__
......@@ -253,4 +257,13 @@ bool IDBValueUnwrapper::ReadVarint(unsigned& value) {
return true;
}
bool IDBValueUnwrapper::Reset() {
#if DCHECK_IS_ON()
blob_handle_.Clear();
current_ = nullptr;
end_ = nullptr;
#endif // DCHECK_IS_ON()
return false;
}
} // namespace blink
......@@ -67,6 +67,7 @@ class MODULES_EXPORT IDBValueWrapper {
v8::Local<v8::Value>,
SerializedScriptValue::SerializeOptions::WasmSerializationPolicy,
ExceptionState&);
~IDBValueWrapper();
// Creates a clone of the serialized value.
//
......@@ -190,14 +191,7 @@ class MODULES_EXPORT IDBValueUnwrapper {
bool ReadVarint(unsigned& value);
// Resets the parsing state.
inline bool Reset() {
#if DCHECK_IS_ON()
blob_handle_.Clear();
current_ = nullptr;
end_ = nullptr;
#endif // DCHECK_IS_ON()
return false;
}
bool Reset();
// Deserialization cursor in the SharedBuffer of the IDBValue being unwrapped.
const uint8_t* current_;
......
......@@ -5,6 +5,7 @@
#include "modules/indexeddb/IDBValueWrapping.h"
#include "bindings/core/v8/V8BindingForTesting.h"
#include "core/fileapi/Blob.h"
#include "modules/indexeddb/IDBValue.h"
#include "platform/wtf/PtrUtil.h"
#include "platform/wtf/RefPtr.h"
......
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