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

Side by Side Diff: Source/bindings/core/v8/ExceptionState.h

Issue 1113523002: Use Local<> instead of Handle<> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 GetterContext, 55 GetterContext,
56 SetterContext, 56 SetterContext,
57 EnumerationContext, 57 EnumerationContext,
58 QueryContext, 58 QueryContext,
59 IndexedGetterContext, 59 IndexedGetterContext,
60 IndexedSetterContext, 60 IndexedSetterContext,
61 IndexedDeletionContext, 61 IndexedDeletionContext,
62 UnknownContext, // FIXME: Remove this once we've flipped over to the new API. 62 UnknownContext, // FIXME: Remove this once we've flipped over to the new API.
63 }; 63 };
64 64
65 ExceptionState(Context context, const char* propertyName, const char* interf aceName, const v8::Handle<v8::Object>& creationContext, v8::Isolate* isolate) 65 ExceptionState(Context context, const char* propertyName, const char* interf aceName, const v8::Local<v8::Object>& creationContext, v8::Isolate* isolate)
66 : m_code(0) 66 : m_code(0)
67 , m_context(context) 67 , m_context(context)
68 , m_propertyName(propertyName) 68 , m_propertyName(propertyName)
69 , m_interfaceName(interfaceName) 69 , m_interfaceName(interfaceName)
70 , m_creationContext(creationContext) 70 , m_creationContext(creationContext)
71 , m_isolate(isolate) { } 71 , m_isolate(isolate) { }
72 72
73 ExceptionState(Context context, const char* interfaceName, const v8::Handle< v8::Object>& creationContext, v8::Isolate* isolate) 73 ExceptionState(Context context, const char* interfaceName, const v8::Local<v 8::Object>& creationContext, v8::Isolate* isolate)
74 : m_code(0) 74 : m_code(0)
75 , m_context(context) 75 , m_context(context)
76 , m_propertyName(0) 76 , m_propertyName(0)
77 , m_interfaceName(interfaceName) 77 , m_interfaceName(interfaceName)
78 , m_creationContext(creationContext) 78 , m_creationContext(creationContext)
79 , m_isolate(isolate) { ASSERT(m_context == ConstructionContext || m_cont ext == EnumerationContext || m_context == IndexedSetterContext || m_context == I ndexedGetterContext || m_context == IndexedDeletionContext); } 79 , m_isolate(isolate) { ASSERT(m_context == ConstructionContext || m_cont ext == EnumerationContext || m_context == IndexedSetterContext || m_context == I ndexedGetterContext || m_context == IndexedDeletionContext); }
80 80
81 virtual void throwDOMException(const ExceptionCode&, const String& message); 81 virtual void throwDOMException(const ExceptionCode&, const String& message);
82 virtual void throwTypeError(const String& message); 82 virtual void throwTypeError(const String& message);
83 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String()); 83 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String());
(...skipping 13 matching lines...) Expand all
97 return true; 97 return true;
98 } 98 }
99 99
100 // This method clears out the exception which |this| has. 100 // This method clears out the exception which |this| has.
101 ScriptPromise reject(ScriptState*); 101 ScriptPromise reject(ScriptState*);
102 102
103 Context context() const { return m_context; } 103 Context context() const { return m_context; }
104 const char* propertyName() const { return m_propertyName; } 104 const char* propertyName() const { return m_propertyName; }
105 const char* interfaceName() const { return m_interfaceName; } 105 const char* interfaceName() const { return m_interfaceName; }
106 106
107 void rethrowV8Exception(v8::Handle<v8::Value> value) 107 void rethrowV8Exception(v8::Local<v8::Value> value)
108 { 108 {
109 setException(value); 109 setException(value);
110 } 110 }
111 111
112 #if ENABLE(ASSERT) 112 #if ENABLE(ASSERT)
113 OnStackObjectChecker& onStackObjectChecker() { return m_onStackObjectChecker ; } 113 OnStackObjectChecker& onStackObjectChecker() { return m_onStackObjectChecker ; }
114 #endif 114 #endif
115 115
116 protected: 116 protected:
117 ExceptionCode m_code; 117 ExceptionCode m_code;
118 Context m_context; 118 Context m_context;
119 String m_message; 119 String m_message;
120 const char* m_propertyName; 120 const char* m_propertyName;
121 const char* m_interfaceName; 121 const char* m_interfaceName;
122 122
123 private: 123 private:
124 void setException(v8::Handle<v8::Value>); 124 void setException(v8::Local<v8::Value>);
125 void throwException(); 125 void throwException();
126 126
127 String addExceptionContext(const String&) const; 127 String addExceptionContext(const String&) const;
128 128
129 ScopedPersistent<v8::Value> m_exception; 129 ScopedPersistent<v8::Value> m_exception;
130 v8::Handle<v8::Object> m_creationContext; 130 v8::Local<v8::Object> m_creationContext;
131 v8::Isolate* m_isolate; 131 v8::Isolate* m_isolate;
132 #if ENABLE(ASSERT) 132 #if ENABLE(ASSERT)
133 OnStackObjectChecker m_onStackObjectChecker; 133 OnStackObjectChecker m_onStackObjectChecker;
134 #endif 134 #endif
135 }; 135 };
136 136
137 // Used if exceptions can/should not be directly thrown. 137 // Used if exceptions can/should not be directly thrown.
138 class CORE_EXPORT NonThrowableExceptionState final : public ExceptionState { 138 class CORE_EXPORT NonThrowableExceptionState final : public ExceptionState {
139 public: 139 public:
140 NonThrowableExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0, v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()) { } 140 NonThrowableExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0, v8::Local<v8::Object>(), v8::Isolate::GetCurrent()) { }
141 virtual void throwDOMException(const ExceptionCode&, const String& message) override; 141 virtual void throwDOMException(const ExceptionCode&, const String& message) override;
142 virtual void throwTypeError(const String& message = String()) override; 142 virtual void throwTypeError(const String& message = String()) override;
143 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String()) override; 143 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String()) override;
144 virtual void throwRangeError(const String& message) override; 144 virtual void throwRangeError(const String& message) override;
145 }; 145 };
146 146
147 // Used if any exceptions thrown are ignorable. 147 // Used if any exceptions thrown are ignorable.
148 class CORE_EXPORT TrackExceptionState final : public ExceptionState { 148 class CORE_EXPORT TrackExceptionState final : public ExceptionState {
149 public: 149 public:
150 TrackExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0, v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()) { } 150 TrackExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0, v8::Local<v8::Object>(), v8::Isolate::GetCurrent()) { }
151 virtual void throwDOMException(const ExceptionCode&, const String& message) override; 151 virtual void throwDOMException(const ExceptionCode&, const String& message) override;
152 virtual void throwTypeError(const String& message = String()) override; 152 virtual void throwTypeError(const String& message = String()) override;
153 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String()) override; 153 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String()) override;
154 virtual void throwRangeError(const String& message) override; 154 virtual void throwRangeError(const String& message) override;
155 }; 155 };
156 156
157 } // namespace blink 157 } // namespace blink
158 158
159 #endif // ExceptionState_h 159 #endif // ExceptionState_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/DictionaryHelperForCore.cpp ('k') | Source/bindings/core/v8/ExceptionState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698