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

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

Issue 26763004: Vector stores Expression object as OwnPtr instead of raw pointer in XPath. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change XPathGrammar.y also Created 7 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org>
3 * Copyright (C) 2006, 2009 Apple Inc. 3 * Copyright (C) 2006, 2009 Apple 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 class Expression : public ParseNode { 56 class Expression : public ParseNode {
57 WTF_MAKE_NONCOPYABLE(Expression); WTF_MAKE_FAST_ALLOCATED; 57 WTF_MAKE_NONCOPYABLE(Expression); WTF_MAKE_FAST_ALLOCATED;
58 public: 58 public:
59 static EvaluationContext& evaluationContext(); 59 static EvaluationContext& evaluationContext();
60 60
61 Expression(); 61 Expression();
62 virtual ~Expression(); 62 virtual ~Expression();
63 63
64 virtual Value evaluate() const = 0; 64 virtual Value evaluate() const = 0;
65 65
66 void addSubExpression(Expression* expr) 66 void addSubExpression(PassOwnPtr<Expression> expr)
67 { 67 {
68 m_subExpressions.append(expr);
69 m_isContextNodeSensitive |= expr->m_isContextNodeSensitive; 68 m_isContextNodeSensitive |= expr->m_isContextNodeSensitive;
70 m_isContextPositionSensitive |= expr->m_isContextPositionSensiti ve; 69 m_isContextPositionSensitive |= expr->m_isContextPositionSensiti ve;
71 m_isContextSizeSensitive |= expr->m_isContextSizeSensitive; 70 m_isContextSizeSensitive |= expr->m_isContextSizeSensitive;
71 m_subExpressions.append(expr);
72 } 72 }
73 73
74 bool isContextNodeSensitive() const { return m_isContextNodeSensitiv e; } 74 bool isContextNodeSensitive() const { return m_isContextNodeSensitiv e; }
75 bool isContextPositionSensitive() const { return m_isContextPosition Sensitive; } 75 bool isContextPositionSensitive() const { return m_isContextPosition Sensitive; }
76 bool isContextSizeSensitive() const { return m_isContextSizeSensitiv e; } 76 bool isContextSizeSensitive() const { return m_isContextSizeSensitiv e; }
77 void setIsContextNodeSensitive(bool value) { m_isContextNodeSensitiv e = value; } 77 void setIsContextNodeSensitive(bool value) { m_isContextNodeSensitiv e = value; }
78 void setIsContextPositionSensitive(bool value) { m_isContextPosition Sensitive = value; } 78 void setIsContextPositionSensitive(bool value) { m_isContextPosition Sensitive = value; }
79 void setIsContextSizeSensitive(bool value) { m_isContextSizeSensitiv e = value; } 79 void setIsContextSizeSensitive(bool value) { m_isContextSizeSensitiv e = value; }
80 80
81 virtual Value::Type resultType() const = 0; 81 virtual Value::Type resultType() const = 0;
82 82
83 protected: 83 protected:
84 unsigned subExprCount() const { return m_subExpressions.size(); } 84 unsigned subExprCount() const { return m_subExpressions.size(); }
85 Expression* subExpr(unsigned i) { return m_subExpressions[i]; } 85 Expression* subExpr(unsigned i) { return m_subExpressions[i].get(); }
86 const Expression* subExpr(unsigned i) const { return m_subExpression s[i]; } 86 const Expression* subExpr(unsigned i) const { return m_subExpression s[i].get(); }
87 87
88 private: 88 private:
89 Vector<Expression*> m_subExpressions; 89 Vector<OwnPtr<Expression> > m_subExpressions;
90 90
91 // Evaluation details that can be used for optimization. 91 // Evaluation details that can be used for optimization.
92 bool m_isContextNodeSensitive; 92 bool m_isContextNodeSensitive;
93 bool m_isContextPositionSensitive; 93 bool m_isContextPositionSensitive;
94 bool m_isContextSizeSensitive; 94 bool m_isContextSizeSensitive;
95 }; 95 };
96 96
97 } 97 }
98 98
99 } 99 }
100 100
101 #endif // EXPRESSION_H 101 #endif // EXPRESSION_H
OLDNEW
« no previous file with comments | « no previous file | Source/core/xml/XPathExpressionNode.cpp » ('j') | Source/core/xml/XPathFunctions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698