[webkit-changes] cvs commit: WebCore/khtml/misc shared.h

Darin darin at opensource.apple.com
Tue Aug 30 16:56:16 PDT 2005


darin       05/08/30 16:56:16

  Modified:    .        ChangeLog
               kjs      function.cpp function.h function_object.cpp
                        internal.cpp internal.h nodes.h nodes2string.cpp
                        shared_ptr.h
               .        ChangeLog
               khtml/misc shared.h
  Added:       ForwardingHeaders/kjs shared_ptr.h
  Log:
  JavaScriptCore:
  
          Reviewed by John Sullivan.
  
          - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4758
            unify SharedPtr in WebCore and JavaScriptCore
  
          * kjs/shared_ptr.h: Updated namespace to KXMLCore instead of kxhmlcore.
          Made a few small improvements to use local variables a bit more and added
          an "operator int" to reduce the chance that we'll convert a SharedPtr to
          an int by accident. Also made the == operators normal functions rather than
          friend functions, added a couple of comemnts.
  
          * kjs/function.h: Updated for namespace change.
          * kjs/function.cpp: Ditto.
          * kjs/function_object.cpp: Ditto.
          * kjs/internal.h: Ditto.
          * kjs/internal.cpp: Ditto.
          * kjs/nodes.h: Ditto.
          * kjs/nodes2string.cpp: Ditto.
  
  WebCore:
  
          Reviewed by John Sullivan.
  
          - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4758
            unify SharedPtr in WebCore and JavaScriptCore
  
          * ForwardingHeaders/kjs/shared_ptr.h: Added.
          * khtml/misc/shared.h: Removed SharedPtr, and instead included <kjs/shared_ptr.h>
          and did some using statements to import the template into the khtml namespace.
  
  Revision  Changes    Path
  1.810     +21 -0     JavaScriptCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
  retrieving revision 1.809
  retrieving revision 1.810
  diff -u -r1.809 -r1.810
  --- ChangeLog	26 Aug 2005 23:46:25 -0000	1.809
  +++ ChangeLog	30 Aug 2005 23:56:13 -0000	1.810
  @@ -1,3 +1,24 @@
  +2005-08-30  Darin Adler  <darin at apple.com>
  +
  +        Reviewed by John Sullivan.
  +
  +        - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4758
  +          unify SharedPtr in WebCore and JavaScriptCore
  +
  +        * kjs/shared_ptr.h: Updated namespace to KXMLCore instead of kxhmlcore.
  +        Made a few small improvements to use local variables a bit more and added
  +        an "operator int" to reduce the chance that we'll convert a SharedPtr to
  +        an int by accident. Also made the == operators normal functions rather than
  +        friend functions, added a couple of comemnts.
  +
  +        * kjs/function.h: Updated for namespace change.
  +        * kjs/function.cpp: Ditto.
  +        * kjs/function_object.cpp: Ditto.
  +        * kjs/internal.h: Ditto.
  +        * kjs/internal.cpp: Ditto.
  +        * kjs/nodes.h: Ditto.
  +        * kjs/nodes2string.cpp: Ditto.
  +
   2005-08-26  Maciej Stachowiak  <mjs at apple.com>
   
           Reviewed by John.
  
  
  
  1.55      +1 -1      JavaScriptCore/kjs/function.cpp
  
  Index: function.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/function.cpp,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- function.cpp	26 Aug 2005 23:42:17 -0000	1.54
  +++ function.cpp	30 Aug 2005 23:56:13 -0000	1.55
  @@ -43,7 +43,7 @@
   #include <unicode/uchar.h>
   #endif
   
  -using namespace kxmlcore;
  +using namespace KXMLCore;
   
   namespace KJS {
   
  
  
  
  1.33      +1 -1      JavaScriptCore/kjs/function.h
  
  Index: function.h
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/function.h,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- function.h	26 Aug 2005 23:42:17 -0000	1.32
  +++ function.h	30 Aug 2005 23:56:13 -0000	1.33
  @@ -82,7 +82,7 @@
   
       virtual Completion execute(ExecState *exec);
       CodeType codeType() const { return FunctionCode; }
  -    kxmlcore::SharedPtr<FunctionBodyNode> body;
  +    KXMLCore::SharedPtr<FunctionBodyNode> body;
   
       virtual const ClassInfo *classInfo() const { return &info; }
       static const ClassInfo info;
  
  
  
  1.31      +1 -1      JavaScriptCore/kjs/function_object.cpp
  
  Index: function_object.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/function_object.cpp,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- function_object.cpp	26 Aug 2005 23:42:17 -0000	1.30
  +++ function_object.cpp	30 Aug 2005 23:56:14 -0000	1.31
  @@ -34,7 +34,7 @@
   #include <string.h>
   
   using namespace KJS;
  -using namespace kxmlcore;
  +using namespace KXMLCore;
   
   // ------------------------------ FunctionPrototypeImp -------------------------
   
  
  
  
  1.67      +1 -1      JavaScriptCore/kjs/internal.cpp
  
  Index: internal.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/internal.cpp,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- internal.cpp	26 Aug 2005 23:46:27 -0000	1.66
  +++ internal.cpp	30 Aug 2005 23:56:14 -0000	1.67
  @@ -53,7 +53,7 @@
   
   extern int kjsyyparse();
   
  -using namespace kxmlcore;
  +using namespace KXMLCore;
   
   namespace KJS {
   
  
  
  
  1.37      +1 -1      JavaScriptCore/kjs/internal.h
  
  Index: internal.h
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/internal.h,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- internal.h	26 Aug 2005 23:46:27 -0000	1.36
  +++ internal.h	30 Aug 2005 23:56:14 -0000	1.37
  @@ -196,7 +196,7 @@
      */
     class Parser {
     public:
  -    static kxmlcore::SharedPtr<ProgramNode> parse(const UString &sourceURL, int startingLineNumber,
  +    static KXMLCore::SharedPtr<ProgramNode> parse(const UString &sourceURL, int startingLineNumber,
                                                     const UChar *code, unsigned int length, int *sourceId = 0,
                                                     int *errLine = 0, UString *errMsg = 0);
       static void accept(ProgramNode *prog);
  
  
  
  1.30      +109 -109  JavaScriptCore/kjs/nodes.h
  
  Index: nodes.h
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/nodes.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- nodes.h	26 Aug 2005 23:46:27 -0000	1.29
  +++ nodes.h	30 Aug 2005 23:56:14 -0000	1.30
  @@ -204,7 +204,7 @@
       virtual Reference evaluateReference(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> group;
  +    KXMLCore::SharedPtr<Node> group;
     };
   
     class ElementNode : public Node {
  @@ -217,9 +217,9 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       friend class ArrayNode;
  -    kxmlcore::SharedPtr<ElementNode> list;
  +    KXMLCore::SharedPtr<ElementNode> list;
       int elision;
  -    kxmlcore::SharedPtr<Node> node;
  +    KXMLCore::SharedPtr<Node> node;
     };
   
     class ArrayNode : public Node {
  @@ -232,7 +232,7 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<ElementNode> element;
  +    KXMLCore::SharedPtr<ElementNode> element;
       int elision;
       bool opt;
     };
  @@ -248,9 +248,9 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       friend class ObjectLiteralNode;
  -    kxmlcore::SharedPtr<PropertyNode> name;
  -    kxmlcore::SharedPtr<Node> assign;
  -    kxmlcore::SharedPtr<PropertyValueNode> list;
  +    KXMLCore::SharedPtr<PropertyNode> name;
  +    KXMLCore::SharedPtr<Node> assign;
  +    KXMLCore::SharedPtr<PropertyValueNode> list;
     };
   
     class ObjectLiteralNode : public Node {
  @@ -260,7 +260,7 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<PropertyValueNode> list;
  +    KXMLCore::SharedPtr<PropertyValueNode> list;
     };
   
     class PropertyNode : public Node {
  @@ -281,8 +281,8 @@
       virtual Reference evaluateReference(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr1;
  -    kxmlcore::SharedPtr<Node> expr2;
  +    KXMLCore::SharedPtr<Node> expr1;
  +    KXMLCore::SharedPtr<Node> expr2;
     };
   
     class DotAccessorNode : public Node {
  @@ -292,7 +292,7 @@
       virtual Reference evaluateReference(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
       Identifier ident;
     };
   
  @@ -307,8 +307,8 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       friend class ArgumentsNode;
  -    kxmlcore::SharedPtr<ArgumentListNode> list;
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<ArgumentListNode> list;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class ArgumentsNode : public Node {
  @@ -320,7 +320,7 @@
       List evaluateList(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<ArgumentListNode> list;
  +    KXMLCore::SharedPtr<ArgumentListNode> list;
     };
   
     class NewExprNode : public Node {
  @@ -330,8 +330,8 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  -    kxmlcore::SharedPtr<ArgumentsNode> args;
  +    KXMLCore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<ArgumentsNode> args;
     };
   
     class FunctionCallValueNode : public Node {
  @@ -340,8 +340,8 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  -    kxmlcore::SharedPtr<ArgumentsNode> args;
  +    KXMLCore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<ArgumentsNode> args;
     };
   
     class FunctionCallResolveNode : public Node {
  @@ -351,7 +351,7 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       Identifier ident;
  -    kxmlcore::SharedPtr<ArgumentsNode> args;
  +    KXMLCore::SharedPtr<ArgumentsNode> args;
     };
   
     class FunctionCallBracketNode : public Node {
  @@ -360,9 +360,9 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     protected:
  -    kxmlcore::SharedPtr<Node> base;
  -    kxmlcore::SharedPtr<Node> subscript;
  -    kxmlcore::SharedPtr<ArgumentsNode> args;
  +    KXMLCore::SharedPtr<Node> base;
  +    KXMLCore::SharedPtr<Node> subscript;
  +    KXMLCore::SharedPtr<ArgumentsNode> args;
     };
   
     class FunctionCallParenBracketNode : public FunctionCallBracketNode {
  @@ -377,9 +377,9 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     protected:
  -    kxmlcore::SharedPtr<Node> base;
  +    KXMLCore::SharedPtr<Node> base;
       Identifier ident;
  -    kxmlcore::SharedPtr<ArgumentsNode> args;
  +    KXMLCore::SharedPtr<ArgumentsNode> args;
     };
   
     class FunctionCallParenDotNode : public FunctionCallDotNode {
  @@ -394,7 +394,7 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
       Operator oper;
     };
   
  @@ -404,7 +404,7 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class VoidNode : public Node {
  @@ -413,7 +413,7 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class TypeOfNode : public Node {
  @@ -422,7 +422,7 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class PrefixNode : public Node {
  @@ -432,7 +432,7 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       Operator oper;
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class UnaryPlusNode : public Node {
  @@ -441,7 +441,7 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class NegateNode : public Node {
  @@ -450,7 +450,7 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class BitwiseNotNode : public Node {
  @@ -459,7 +459,7 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class LogicalNotNode : public Node {
  @@ -468,7 +468,7 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class MultNode : public Node {
  @@ -477,8 +477,8 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> term1;
  -    kxmlcore::SharedPtr<Node> term2;
  +    KXMLCore::SharedPtr<Node> term1;
  +    KXMLCore::SharedPtr<Node> term2;
       char oper;
     };
   
  @@ -488,8 +488,8 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> term1;
  -    kxmlcore::SharedPtr<Node> term2;
  +    KXMLCore::SharedPtr<Node> term1;
  +    KXMLCore::SharedPtr<Node> term2;
       char oper;
     };
   
  @@ -500,8 +500,8 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> term1;
  -    kxmlcore::SharedPtr<Node> term2;
  +    KXMLCore::SharedPtr<Node> term1;
  +    KXMLCore::SharedPtr<Node> term2;
       Operator oper;
     };
   
  @@ -512,8 +512,8 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr1;
  -    kxmlcore::SharedPtr<Node> expr2;
  +    KXMLCore::SharedPtr<Node> expr1;
  +    KXMLCore::SharedPtr<Node> expr2;
       Operator oper;
     };
   
  @@ -524,8 +524,8 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr1;
  -    kxmlcore::SharedPtr<Node> expr2;
  +    KXMLCore::SharedPtr<Node> expr1;
  +    KXMLCore::SharedPtr<Node> expr2;
       Operator oper;
     };
   
  @@ -536,8 +536,8 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr1;
  -    kxmlcore::SharedPtr<Node> expr2;
  +    KXMLCore::SharedPtr<Node> expr1;
  +    KXMLCore::SharedPtr<Node> expr2;
       Operator oper;
     };
   
  @@ -551,8 +551,8 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr1;
  -    kxmlcore::SharedPtr<Node> expr2;
  +    KXMLCore::SharedPtr<Node> expr1;
  +    KXMLCore::SharedPtr<Node> expr2;
       Operator oper;
     };
   
  @@ -566,9 +566,9 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> logical;
  -    kxmlcore::SharedPtr<Node> expr1;
  -    kxmlcore::SharedPtr<Node> expr2;
  +    KXMLCore::SharedPtr<Node> logical;
  +    KXMLCore::SharedPtr<Node> expr1;
  +    KXMLCore::SharedPtr<Node> expr2;
     };
   
     class AssignResolveNode : public Node {
  @@ -580,7 +580,7 @@
     protected:
       Identifier m_ident;
       Operator m_oper;
  -    kxmlcore::SharedPtr<Node> m_right;
  +    KXMLCore::SharedPtr<Node> m_right;
     };
   
     class AssignBracketNode : public Node {
  @@ -590,10 +590,10 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     protected:
  -    kxmlcore::SharedPtr<Node> m_base;
  -    kxmlcore::SharedPtr<Node> m_subscript;
  +    KXMLCore::SharedPtr<Node> m_base;
  +    KXMLCore::SharedPtr<Node> m_subscript;
       Operator m_oper;
  -    kxmlcore::SharedPtr<Node> m_right;
  +    KXMLCore::SharedPtr<Node> m_right;
     };
   
     class AssignDotNode : public Node {
  @@ -603,10 +603,10 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     protected:
  -    kxmlcore::SharedPtr<Node> m_base;
  +    KXMLCore::SharedPtr<Node> m_base;
       Identifier m_ident;
       Operator m_oper;
  -    kxmlcore::SharedPtr<Node> m_right;
  +    KXMLCore::SharedPtr<Node> m_right;
     };
   
     class CommaNode : public Node {
  @@ -615,8 +615,8 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr1;
  -    kxmlcore::SharedPtr<Node> expr2;
  +    KXMLCore::SharedPtr<Node> expr1;
  +    KXMLCore::SharedPtr<Node> expr2;
     };
   
     class StatListNode : public StatementNode {
  @@ -629,8 +629,8 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       friend class CaseClauseNode;
  -    kxmlcore::SharedPtr<StatementNode> statement;
  -    kxmlcore::SharedPtr<StatListNode> list;
  +    KXMLCore::SharedPtr<StatementNode> statement;
  +    KXMLCore::SharedPtr<StatListNode> list;
     };
   
     class AssignExprNode : public Node {
  @@ -639,7 +639,7 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class VarDeclNode : public Node {
  @@ -652,7 +652,7 @@
     private:
       Type varType;
       Identifier ident;
  -    kxmlcore::SharedPtr<AssignExprNode> init;
  +    KXMLCore::SharedPtr<AssignExprNode> init;
     };
   
     class VarDeclListNode : public Node {
  @@ -667,8 +667,8 @@
     private:
       friend class ForNode;
       friend class VarStatementNode;
  -    kxmlcore::SharedPtr<VarDeclListNode> list;
  -    kxmlcore::SharedPtr<VarDeclNode> var;
  +    KXMLCore::SharedPtr<VarDeclListNode> list;
  +    KXMLCore::SharedPtr<VarDeclNode> var;
     };
   
     class VarStatementNode : public StatementNode {
  @@ -678,7 +678,7 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<VarDeclListNode> list;
  +    KXMLCore::SharedPtr<VarDeclListNode> list;
     };
   
     class BlockNode : public StatementNode {
  @@ -688,7 +688,7 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     protected:
  -    kxmlcore::SharedPtr<SourceElementsNode> source;
  +    KXMLCore::SharedPtr<SourceElementsNode> source;
     };
   
     class EmptyStatementNode : public StatementNode {
  @@ -704,7 +704,7 @@
       virtual Completion execute(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class IfNode : public StatementNode {
  @@ -715,9 +715,9 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  -    kxmlcore::SharedPtr<StatementNode> statement1;
  -    kxmlcore::SharedPtr<StatementNode> statement2;
  +    KXMLCore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<StatementNode> statement1;
  +    KXMLCore::SharedPtr<StatementNode> statement2;
     };
   
     class DoWhileNode : public StatementNode {
  @@ -727,8 +727,8 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<StatementNode> statement;
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<StatementNode> statement;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class WhileNode : public StatementNode {
  @@ -738,8 +738,8 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  -    kxmlcore::SharedPtr<StatementNode> statement;
  +    KXMLCore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<StatementNode> statement;
     };
   
     class ForNode : public StatementNode {
  @@ -752,10 +752,10 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr1;
  -    kxmlcore::SharedPtr<Node> expr2;
  -    kxmlcore::SharedPtr<Node> expr3;
  -    kxmlcore::SharedPtr<StatementNode> statement;
  +    KXMLCore::SharedPtr<Node> expr1;
  +    KXMLCore::SharedPtr<Node> expr2;
  +    KXMLCore::SharedPtr<Node> expr3;
  +    KXMLCore::SharedPtr<StatementNode> statement;
     };
   
     class ForInNode : public StatementNode {
  @@ -767,11 +767,11 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       Identifier ident;
  -    kxmlcore::SharedPtr<AssignExprNode> init;
  -    kxmlcore::SharedPtr<Node> lexpr;
  -    kxmlcore::SharedPtr<Node> expr;
  -    kxmlcore::SharedPtr<VarDeclNode> varDecl;
  -    kxmlcore::SharedPtr<StatementNode> statement;
  +    KXMLCore::SharedPtr<AssignExprNode> init;
  +    KXMLCore::SharedPtr<Node> lexpr;
  +    KXMLCore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<VarDeclNode> varDecl;
  +    KXMLCore::SharedPtr<StatementNode> statement;
     };
   
     class ContinueNode : public StatementNode {
  @@ -800,7 +800,7 @@
       virtual Completion execute(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> value;
  +    KXMLCore::SharedPtr<Node> value;
     };
   
     class WithNode : public StatementNode {
  @@ -810,8 +810,8 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  -    kxmlcore::SharedPtr<StatementNode> statement;
  +    KXMLCore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<StatementNode> statement;
     };
   
     class CaseClauseNode : public Node {
  @@ -824,8 +824,8 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  -    kxmlcore::SharedPtr<StatListNode> list;
  +    KXMLCore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<StatListNode> list;
     };
   
     class ClauseListNode : public Node {
  @@ -841,8 +841,8 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       friend class CaseBlockNode;
  -    kxmlcore::SharedPtr<CaseClauseNode> cl;
  -    kxmlcore::SharedPtr<ClauseListNode> nx;
  +    KXMLCore::SharedPtr<CaseClauseNode> cl;
  +    KXMLCore::SharedPtr<ClauseListNode> nx;
     };
   
     class CaseBlockNode : public Node {
  @@ -853,9 +853,9 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<ClauseListNode> list1;
  -    kxmlcore::SharedPtr<CaseClauseNode> def;
  -    kxmlcore::SharedPtr<ClauseListNode> list2;
  +    KXMLCore::SharedPtr<ClauseListNode> list1;
  +    KXMLCore::SharedPtr<CaseClauseNode> def;
  +    KXMLCore::SharedPtr<ClauseListNode> list2;
     };
   
     class SwitchNode : public StatementNode {
  @@ -865,8 +865,8 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  -    kxmlcore::SharedPtr<CaseBlockNode> block;
  +    KXMLCore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<CaseBlockNode> block;
     };
   
     class LabelNode : public StatementNode {
  @@ -877,7 +877,7 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       Identifier label;
  -    kxmlcore::SharedPtr<StatementNode> statement;
  +    KXMLCore::SharedPtr<StatementNode> statement;
     };
   
     class ThrowNode : public StatementNode {
  @@ -886,7 +886,7 @@
       virtual Completion execute(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<Node> expr;
  +    KXMLCore::SharedPtr<Node> expr;
     };
   
     class CatchNode : public StatementNode {
  @@ -898,7 +898,7 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       Identifier ident;
  -    kxmlcore::SharedPtr<StatementNode> block;
  +    KXMLCore::SharedPtr<StatementNode> block;
     };
   
     class FinallyNode : public StatementNode {
  @@ -908,7 +908,7 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<StatementNode> block;
  +    KXMLCore::SharedPtr<StatementNode> block;
     };
   
     class TryNode : public StatementNode {
  @@ -923,9 +923,9 @@
       virtual void processVarDecls(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<StatementNode> block;
  -    kxmlcore::SharedPtr<CatchNode> _catch;
  -    kxmlcore::SharedPtr<FinallyNode> _final;
  +    KXMLCore::SharedPtr<StatementNode> block;
  +    KXMLCore::SharedPtr<CatchNode> _catch;
  +    KXMLCore::SharedPtr<FinallyNode> _final;
     };
   
     class ParameterNode : public Node {
  @@ -942,7 +942,7 @@
       friend class FuncDeclNode;
       friend class FuncExprNode;
       Identifier id;
  -    kxmlcore::SharedPtr<ParameterNode> next;
  +    KXMLCore::SharedPtr<ParameterNode> next;
     };
   
     // inherited by ProgramNode
  @@ -964,8 +964,8 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       Identifier ident;
  -    kxmlcore::SharedPtr<ParameterNode> param;
  -    kxmlcore::SharedPtr<FunctionBodyNode> body;
  +    KXMLCore::SharedPtr<ParameterNode> param;
  +    KXMLCore::SharedPtr<FunctionBodyNode> body;
     };
   
     class FuncExprNode : public Node {
  @@ -976,8 +976,8 @@
       ValueImp *evaluate(ExecState *exec);
       virtual void streamTo(SourceStream &s) const;
     private:
  -    kxmlcore::SharedPtr<ParameterNode> param;
  -    kxmlcore::SharedPtr<FunctionBodyNode> body;
  +    KXMLCore::SharedPtr<ParameterNode> param;
  +    KXMLCore::SharedPtr<FunctionBodyNode> body;
     };
   
     // A linked list of source element nodes
  @@ -993,8 +993,8 @@
       virtual void streamTo(SourceStream &s) const;
     private:
       friend class BlockNode;
  -    kxmlcore::SharedPtr<StatementNode> element; // 'this' element
  -    kxmlcore::SharedPtr<SourceElementsNode> elements; // pointer to next
  +    KXMLCore::SharedPtr<StatementNode> element; // 'this' element
  +    KXMLCore::SharedPtr<SourceElementsNode> elements; // pointer to next
     };
   
     class ProgramNode : public FunctionBodyNode {
  
  
  
  1.16      +1 -1      JavaScriptCore/kjs/nodes2string.cpp
  
  Index: nodes2string.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/nodes2string.cpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- nodes2string.cpp	26 Aug 2005 23:42:17 -0000	1.15
  +++ nodes2string.cpp	30 Aug 2005 23:56:14 -0000	1.16
  @@ -23,7 +23,7 @@
   
   #include "nodes.h"
   
  -using namespace kxmlcore;
  +using KXMLCore::SharedPtr;
   
   namespace KJS {
     /**
  
  
  
  1.2       +42 -35    JavaScriptCore/kjs/shared_ptr.h
  
  Index: shared_ptr.h
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/shared_ptr.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- shared_ptr.h	26 Aug 2005 23:42:17 -0000	1.1
  +++ shared_ptr.h	30 Aug 2005 23:56:14 -0000	1.2
  @@ -23,65 +23,72 @@
   #ifndef KXMLCORE_SHARED_PTR_H
   #define KXMLCORE_SHARED_PTR_H
   
  -namespace kxmlcore {
  +namespace KXMLCore {
   
  +// FIXME: Change template name to RefPtr?
   template <class T> class SharedPtr
   {
   public:
  -    SharedPtr() : m_ptr(0) {}
  -    explicit SharedPtr(T *ptr) : m_ptr(ptr) { if (m_ptr) m_ptr->ref(); }
  -    SharedPtr(const SharedPtr &o) : m_ptr(o.m_ptr) { if (m_ptr) m_ptr->ref(); }
  -    ~SharedPtr() { if (m_ptr) m_ptr->deref(); }
  -
  -    template <class U> explicit SharedPtr(SharedPtr<U> o)  : m_ptr(o.get()) { if (m_ptr) m_ptr->ref(); }
  -	
  -    bool isNull() const { return m_ptr == 0; }
  -    bool notNull() const { return m_ptr != 0; }
  -
  -    void reset() { if (m_ptr) m_ptr->deref(); m_ptr = 0; }
  -    void reset(T *o) { if (o) o->ref(); if (m_ptr) m_ptr->deref(); m_ptr = o; }
  +    SharedPtr() : m_ptr(NULL) {}
  +    SharedPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }
  +    SharedPtr(const SharedPtr &o) : m_ptr(o.m_ptr) { if (T *ptr = m_ptr) ptr->ref(); }
  +    ~SharedPtr() { if (T *ptr = m_ptr) ptr->deref(); }
  +
  +    template <class U> SharedPtr(const SharedPtr<U> &o) : m_ptr(o.get()) { if (T *ptr = m_ptr) ptr->ref(); }
  +
  +    // FIXME: Deprecate in favor of operators below, then remove?
  +    bool isNull() const { return m_ptr == NULL; }
  +    bool notNull() const { return m_ptr != NULL; }
  +
  +    // FIXME: Deprecate in favor of operator=, then remove?
  +    void reset() { if (T *ptr = m_ptr) ptr->deref(); m_ptr = NULL; }
  +    void reset(T *o) { if (o) o->ref(); if (T *ptr = m_ptr) ptr->deref(); m_ptr = o; }
       
  -    T * get() const { return m_ptr; }
  +    T *get() const { return m_ptr; }
  +
       T &operator*() const { return *m_ptr; }
       T *operator->() const { return m_ptr; }
   
  -    bool operator!() const { return m_ptr == 0; }
  -    operator bool() const { return m_ptr != 0; }
  -
  -    inline friend bool operator==(const SharedPtr &a, const SharedPtr &b) { return a.m_ptr == b.m_ptr; }
  -    inline friend bool operator==(const SharedPtr &a, const T *b) { return a.m_ptr == b; }
  -    inline friend bool operator==(const T *a, const SharedPtr &b) { return a == b.m_ptr; }
  +    bool operator!() const { return m_ptr == NULL; }
  +    operator bool() const { return m_ptr != NULL; }
   
       SharedPtr &operator=(const SharedPtr &);
       SharedPtr &operator=(T *);
   
   private:
  -    T* m_ptr;
  +    T *m_ptr;
  +
  +    operator int() const; // deliberately not implemented; helps prevent operator bool from converting to int accidentally
   };
   
   template <class T> SharedPtr<T> &SharedPtr<T>::operator=(const SharedPtr<T> &o) 
   {
  -    if (o.m_ptr) 
  -        o.m_ptr->ref();
  -    if (m_ptr)
  -        m_ptr->deref();
  -    m_ptr = o.m_ptr;
  +    T *optr = o.m_ptr;
  +    if (optr)
  +        optr->ref();
  +    if (T *ptr = m_ptr)
  +        ptr->deref();
  +    m_ptr = optr;
       return *this;
   }
   
  -template <class T> inline SharedPtr<T> &SharedPtr<T>::operator=(T *ptr) 
  +template <class T> inline SharedPtr<T> &SharedPtr<T>::operator=(T *optr)
   {
  -    if (ptr) 
  -        ptr->ref();
  -    if (m_ptr)
  -        m_ptr->deref();
  -    m_ptr = ptr;
  +    if (optr)
  +        optr->ref();
  +    if (T *ptr = m_ptr)
  +        ptr->deref();
  +    m_ptr = optr;
       return *this;
   }
   
  -template <class T> inline bool operator!=(const SharedPtr<T> &a, const SharedPtr<T> &b) { return !(a==b); }
  -template <class T> inline bool operator!=(const SharedPtr<T> &a, const T *b) { return !(a == b); }
  -template <class T> inline bool operator!=(const T *a, const SharedPtr<T> &b) { return !(a == b); }
  +template <class T> inline bool operator==(const SharedPtr<T> &a, const SharedPtr<T> &b) { return a.get() == b.get(); }
  +template <class T> inline bool operator==(const SharedPtr<T> &a, const T *b) { return a.get() == b; }
  +template <class T> inline bool operator==(const T *a, const SharedPtr<T> &b) { return a == b.get(); }
  +
  +template <class T> inline bool operator!=(const SharedPtr<T> &a, const SharedPtr<T> &b) { return a.get() != b.get(); }
  +template <class T> inline bool operator!=(const SharedPtr<T> &a, const T *b) { return a.get() != b; }
  +template <class T> inline bool operator!=(const T *a, const SharedPtr<T> &b) { return a != b.get(); }
   
   template <class T, class U> inline SharedPtr<T> static_pointer_cast(const SharedPtr<U> &p) { return SharedPtr<T>(static_cast<T *>(p.get())); }
   template <class T, class U> inline SharedPtr<T> const_pointer_cast(const SharedPtr<U> &p) { return SharedPtr<T>(const_cast<T *>(p.get())); }
  
  
  
  1.45      +11 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- ChangeLog	30 Aug 2005 22:59:31 -0000	1.44
  +++ ChangeLog	30 Aug 2005 23:56:15 -0000	1.45
  @@ -1,3 +1,14 @@
  +2005-08-30  Darin Adler  <darin at apple.com>
  +
  +        Reviewed by John Sullivan.
  +
  +        - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4758
  +          unify SharedPtr in WebCore and JavaScriptCore
  +
  +        * ForwardingHeaders/kjs/shared_ptr.h: Added.
  +        * khtml/misc/shared.h: Removed SharedPtr, and instead included <kjs/shared_ptr.h>
  +        and did some using statements to import the template into the khtml namespace.
  +
   2005-08-30  David Hyatt  <hyatt at apple.com>
   
   	Fix for bugzilla bug 4573, make sure click() fires CLICK and not KHTML_CLICK,
  
  
  
  1.1                  WebCore/ForwardingHeaders/kjs/shared_ptr.h
  
  Index: shared_ptr.h
  ===================================================================
  #import <JavaScriptCore/shared_ptr.h>
  
  
  
  1.7       +5 -46     WebCore/khtml/misc/shared.h
  
  Index: shared.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/misc/shared.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- shared.h	10 May 2005 21:59:14 -0000	1.6
  +++ shared.h	30 Aug 2005 23:56:15 -0000	1.7
  @@ -1,6 +1,8 @@
   #ifndef SHARED_H
   #define SHARED_H
   
  +#include <kjs/shared_ptr.h>
  +
   namespace khtml {
   
   template<class type> class Shared
  @@ -60,52 +62,9 @@
       TreeShared &operator=(const TreeShared &);
   };
   
  -template <class T> class SharedPtr
  -{
  -public:
  -    SharedPtr() : m_ptr(0) {}
  -    explicit SharedPtr(T *ptr) : m_ptr(ptr) { if (m_ptr) m_ptr->ref(); }
  -    SharedPtr(const SharedPtr &o) : m_ptr(o.m_ptr) { if (m_ptr) m_ptr->ref(); }
  -    ~SharedPtr() { if (m_ptr) m_ptr->deref(); }
  -	
  -    bool isNull() const { return m_ptr == 0; }
  -    bool notNull() const { return m_ptr != 0; }
  -
  -    void reset() { if (m_ptr) m_ptr->deref(); m_ptr = 0; }
  -    void reset(T *o) { if (o) o->ref(); if (m_ptr) m_ptr->deref(); m_ptr = o; }
  -    
  -    T * get() const { return m_ptr; }
  -    T &operator*() const { return *m_ptr; }
  -    T *operator->() const { return m_ptr; }
  -
  -    bool operator!() const { return m_ptr == 0; }
  -
  -    inline friend bool operator==(const SharedPtr &a, const SharedPtr &b) { return a.m_ptr == b.m_ptr; }
  -    inline friend bool operator==(const SharedPtr &a, const T *b) { return a.m_ptr == b; }
  -    inline friend bool operator==(const T *a, const SharedPtr &b) { return a == b.m_ptr; }
  -
  -    SharedPtr &operator=(const SharedPtr &);
  -
  -private:
  -    T* m_ptr;
  -};
  -
  -template <class T> SharedPtr<T> &SharedPtr<T>::operator=(const SharedPtr<T> &o) 
  -{
  -    if (o.m_ptr) 
  -        o.m_ptr->ref();
  -    if (m_ptr)
  -        m_ptr->deref();
  -    m_ptr = o.m_ptr;
  -    return *this;
  -}
  -
  -template <class T> inline bool operator!=(const SharedPtr<T> &a, const SharedPtr<T> &b) { return !(a==b); }
  -template <class T> inline bool operator!=(const SharedPtr<T> &a, const T *b) { return !(a == b); }
  -template <class T> inline bool operator!=(const T *a, const SharedPtr<T> &b) { return !(a == b); }
  -
  -template <class T, class U> inline SharedPtr<T> static_pointer_cast(const SharedPtr<U> &p) { return SharedPtr<T>(static_cast<T *>(p.get())); }
  -template <class T, class U> inline SharedPtr<T> const_pointer_cast(const SharedPtr<U> &p) { return SharedPtr<T>(const_cast<T *>(p.get())); }
  +using KXMLCore::SharedPtr;
  +using KXMLCore::static_pointer_cast;
  +using KXMLCore::const_pointer_cast;
   
   }
   
  
  
  



More information about the webkit-changes mailing list