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

Side by Side Diff: webkit/pending/ExceptionContext.h

Issue 8947: Fix the JSC build.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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
OLDNEW
1 // Copyright 2008, Google Inc. 1 // Copyright 2008, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 29
30 // Javascript exception abstraction 30 // Javascript exception abstraction
31 31
32 #ifndef ExceptionContext_h 32 #ifndef ExceptionContext_h
33 #define ExceptionContext_h 33 #define ExceptionContext_h
34 34
35 #include <wtf/Noncopyable.h> 35 #include <wtf/Noncopyable.h>
36 #include "ScriptController.h" 36 #include "ScriptController.h"
37 37
38 #if USE(JSC) 38 #if USE(JSC)
39 namespace KJS { 39 namespace JSC {
40 class ExecState; 40 class ExecState;
41 } 41 }
42 #endif 42 #endif
43 43
44 44
45 namespace WebCore { 45 namespace WebCore {
46 46
47 class Node; 47 class Node;
48 #if USE(V8) 48 #if USE(V8)
49 class ExceptionCatcher; 49 class ExceptionCatcher;
50 #endif 50 #endif
51 51
52 // Provides context of an exception. This class is an abstraction of JSC's 52 // Provides context of an exception. This class is an abstraction of JSC's
53 // ExecState. In V8, its purpose is to carry along the exceptions captured 53 // ExecState. In V8, its purpose is to carry along the exceptions captured
54 // by the ExceptionCatcher. 54 // by the ExceptionCatcher.
55 class ExceptionContext : Noncopyable { 55 class ExceptionContext : Noncopyable {
56 public: 56 public:
57 ExceptionContext(Node*); 57 ExceptionContext(Node*);
58 #if USE(V8) 58 #if USE(V8)
59 ExceptionContext(); 59 ExceptionContext();
60 #elif USE(JSC) 60 #elif USE(JSC)
61 ExceptionContext(KJS::ExecState* exec) : m_exec(exec) {} 61 ExceptionContext(JSC::ExecState* exec) : m_exec(exec) {}
62 KJS::ExecState* exec() const { return m_exec; } 62 JSC::ExecState* exec() const { return m_exec; }
63 #endif 63 #endif
64 ~ExceptionContext() {} 64 ~ExceptionContext() {}
65 65
66 bool hadException(); 66 bool hadException();
67 JSException exception() const; 67 JSException exception() const;
68 68
69 // Returns a non-exception code object. 69 // Returns a non-exception code object.
70 static JSException noException(); 70 static JSException noException();
71 71
72 private: 72 private:
73 #if USE(V8) 73 #if USE(V8)
74 friend class ExceptionCatcher; 74 friend class ExceptionCatcher;
75 void setException(JSException exception) { m_exception = exception; } 75 void setException(JSException exception) { m_exception = exception; }
76 void setExceptionCatcher(ExceptionCatcher*); 76 void setExceptionCatcher(ExceptionCatcher*);
77 JSException m_exception; 77 JSException m_exception;
78 ExceptionCatcher* m_exceptionCatcher; 78 ExceptionCatcher* m_exceptionCatcher;
79 #elif USE(JSC) 79 #elif USE(JSC)
80 KJS::ExecState* m_exec; 80 JSC::ExecState* m_exec;
81 #endif 81 #endif
82 }; 82 };
83 83
84 #if USE(V8) 84 #if USE(V8)
85 // A wrapper around v8::TryCatch helper in order to facilitate updating 85 // A wrapper around v8::TryCatch helper in order to facilitate updating
86 // ExceptionContext with the latest exceptions that may have occurred. 86 // ExceptionContext with the latest exceptions that may have occurred.
87 class ExceptionCatcher { 87 class ExceptionCatcher {
88 public: 88 public:
89 ExceptionCatcher(ExceptionContext*); 89 ExceptionCatcher(ExceptionContext*);
90 ~ExceptionCatcher(); 90 ~ExceptionCatcher();
91 void updateContext(); 91 void updateContext();
92 void detachContext(); 92 void detachContext();
93 93
94 private: 94 private:
95 ExceptionContext* m_context; 95 ExceptionContext* m_context;
96 v8::TryCatch m_catcher; 96 v8::TryCatch m_catcher;
97 }; 97 };
98 #endif 98 #endif
99 99
100 } // namespace WebCore 100 } // namespace WebCore
101 101
102 #endif // !defined(ExceptionContext_h) 102 #endif // !defined(ExceptionContext_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698