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

Side by Side Diff: Source/core/xml/XPathValue.h

Issue 937653002: InlinedVisitor: Migrate xml to use inlined tracing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/xml/XPathStep.cpp ('k') | Source/core/xml/XPathValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2005 Frerich Raabe <raabe@kde.org> 2 * Copyright 2005 Frerich Raabe <raabe@kde.org>
3 * Copyright (C) 2006 Apple Computer, Inc. 3 * Copyright (C) 2006 Apple Computer, Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 24 matching lines...) Expand all
35 namespace XPath { 35 namespace XPath {
36 36
37 struct EvaluationContext; 37 struct EvaluationContext;
38 38
39 class ValueData : public RefCountedWillBeGarbageCollectedFinalized<ValueData> { 39 class ValueData : public RefCountedWillBeGarbageCollectedFinalized<ValueData> {
40 public: 40 public:
41 static PassRefPtrWillBeRawPtr<ValueData> create() { return adoptRefWillBeNoo p(new ValueData); } 41 static PassRefPtrWillBeRawPtr<ValueData> create() { return adoptRefWillBeNoo p(new ValueData); }
42 static PassRefPtrWillBeRawPtr<ValueData> create(const NodeSet& nodeSet) { re turn adoptRefWillBeNoop(new ValueData(nodeSet)); } 42 static PassRefPtrWillBeRawPtr<ValueData> create(const NodeSet& nodeSet) { re turn adoptRefWillBeNoop(new ValueData(nodeSet)); }
43 static PassRefPtrWillBeRawPtr<ValueData> create(PassOwnPtrWillBeRawPtr<NodeS et> nodeSet) { return adoptRefWillBeNoop(new ValueData(nodeSet)); } 43 static PassRefPtrWillBeRawPtr<ValueData> create(PassOwnPtrWillBeRawPtr<NodeS et> nodeSet) { return adoptRefWillBeNoop(new ValueData(nodeSet)); }
44 static PassRefPtrWillBeRawPtr<ValueData> create(const String& string) { retu rn adoptRefWillBeNoop(new ValueData(string)); } 44 static PassRefPtrWillBeRawPtr<ValueData> create(const String& string) { retu rn adoptRefWillBeNoop(new ValueData(string)); }
45 void trace(Visitor*); 45 DECLARE_TRACE();
46 NodeSet& nodeSet() { return *m_nodeSet; } 46 NodeSet& nodeSet() { return *m_nodeSet; }
47 47
48 String m_string; 48 String m_string;
49 49
50 private: 50 private:
51 ValueData() : m_nodeSet(NodeSet::create()) { } 51 ValueData() : m_nodeSet(NodeSet::create()) { }
52 explicit ValueData(const NodeSet& nodeSet) : m_nodeSet(NodeSet::create(nodeS et)) { } 52 explicit ValueData(const NodeSet& nodeSet) : m_nodeSet(NodeSet::create(nodeS et)) { }
53 explicit ValueData(PassOwnPtrWillBeRawPtr<NodeSet> nodeSet) : m_nodeSet(node Set) { } 53 explicit ValueData(PassOwnPtrWillBeRawPtr<NodeSet> nodeSet) : m_nodeSet(node Set) { }
54 explicit ValueData(const String& string) : m_string(string), m_nodeSet(NodeS et::create()) { } 54 explicit ValueData(const String& string) : m_string(string), m_nodeSet(NodeS et::create()) { }
55 55
56 OwnPtrWillBeMember<NodeSet> m_nodeSet; 56 OwnPtrWillBeMember<NodeSet> m_nodeSet;
57 }; 57 };
58 58
59 // Copying Value objects makes their data partially shared, so care has to be ta ken when dealing with copies. 59 // Copying Value objects makes their data partially shared, so care has to be ta ken when dealing with copies.
60 class Value { 60 class Value {
61 DISALLOW_ALLOCATION(); 61 DISALLOW_ALLOCATION();
62 public: 62 public:
63 enum Type { NodeSetValue, BooleanValue, NumberValue, StringValue }; 63 enum Type { NodeSetValue, BooleanValue, NumberValue, StringValue };
64 64
65 Value(unsigned value) : m_type(NumberValue), m_bool(false), m_number(value) { } 65 Value(unsigned value) : m_type(NumberValue), m_bool(false), m_number(value) { }
66 Value(unsigned long value) : m_type(NumberValue), m_bool(false), m_number(va lue) { } 66 Value(unsigned long value) : m_type(NumberValue), m_bool(false), m_number(va lue) { }
67 Value(double value) : m_type(NumberValue), m_bool(false), m_number(value) { } 67 Value(double value) : m_type(NumberValue), m_bool(false), m_number(value) { }
68 68
69 Value(const char* value) : m_type(StringValue), m_bool(false), m_number(0), m_data(ValueData::create(value)) { } 69 Value(const char* value) : m_type(StringValue), m_bool(false), m_number(0), m_data(ValueData::create(value)) { }
70 Value(const String& value) : m_type(StringValue), m_bool(false), m_number(0) , m_data(ValueData::create(value)) { } 70 Value(const String& value) : m_type(StringValue), m_bool(false), m_number(0) , m_data(ValueData::create(value)) { }
71 Value(const NodeSet& value) : m_type(NodeSetValue), m_bool(false), m_number( 0), m_data(ValueData::create(value)) { } 71 Value(const NodeSet& value) : m_type(NodeSetValue), m_bool(false), m_number( 0), m_data(ValueData::create(value)) { }
72 Value(Node* value) : m_type(NodeSetValue), m_bool(false), m_number(0), m_dat a(ValueData::create()) { m_data->nodeSet().append(value); } 72 Value(Node* value) : m_type(NodeSetValue), m_bool(false), m_number(0), m_dat a(ValueData::create()) { m_data->nodeSet().append(value); }
73 void trace(Visitor*); 73 DECLARE_TRACE();
74 74
75 // This is needed to safely implement constructing from bool - with normal 75 // This is needed to safely implement constructing from bool - with normal
76 // function overloading, any pointer type would match. 76 // function overloading, any pointer type would match.
77 template<typename T> Value(T); 77 template<typename T> Value(T);
78 78
79 static const struct AdoptTag { } adopt; 79 static const struct AdoptTag { } adopt;
80 Value(PassOwnPtrWillBeRawPtr<NodeSet> value, const AdoptTag&) : m_type(NodeS etValue), m_bool(false), m_number(0), m_data(ValueData::create(value)) { } 80 Value(PassOwnPtrWillBeRawPtr<NodeSet> value, const AdoptTag&) : m_type(NodeS etValue), m_bool(false), m_number(0), m_data(ValueData::create(value)) { }
81 81
82 Type type() const { return m_type; } 82 Type type() const { return m_type; }
83 83
(...skipping 22 matching lines...) Expand all
106 : m_type(BooleanValue) 106 : m_type(BooleanValue)
107 , m_bool(value) 107 , m_bool(value)
108 , m_number(0) 108 , m_number(0)
109 { 109 {
110 } 110 }
111 111
112 } 112 }
113 113
114 } 114 }
115 #endif // XPathValue_h 115 #endif // XPathValue_h
OLDNEW
« no previous file with comments | « Source/core/xml/XPathStep.cpp ('k') | Source/core/xml/XPathValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698