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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ExceptionState.h

Issue 2715073002: Devirtualize ExceptionState's helper throwing methods.
Patch Set: . Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/ExceptionState.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ExceptionState.h b/third_party/WebKit/Source/bindings/core/v8/ExceptionState.h
index c1628c187509d3eb8bfa7b874dca565552f371bb..d426914a23d67d067a25aca6b18b67682077ddbc 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ExceptionState.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ExceptionState.h
@@ -104,18 +104,22 @@ class CORE_EXPORT ExceptionState {
}
}
+ virtual bool shouldThrow() const;
+
+ // const char* versions to avoid code bloat from inlined temporary Strings.
void throwDOMException(ExceptionCode, const char* message);
void throwRangeError(const char* message);
void throwSecurityError(const char* sanitizedMessage,
const char* unsanitizedMessage = nullptr);
void throwTypeError(const char* message);
- virtual void throwDOMException(ExceptionCode, const String& message);
- virtual void throwRangeError(const String& message);
- virtual void throwSecurityError(const String& sanitizedMessage,
- const String& unsanitizedMessage = String());
- virtual void throwTypeError(const String& message);
- virtual void rethrowV8Exception(v8::Local<v8::Value>);
+ void throwDOMException(ExceptionCode, const String& message);
+ void throwRangeError(const String& message);
+ void throwSecurityError(const String& sanitizedMessage,
+ const String& unsanitizedMessage = String());
+ void throwTypeError(const String& message);
+
+ void rethrowV8Exception(v8::Local<v8::Value>);
bool hadException() const { return m_code; }
void clearException();
@@ -146,7 +150,6 @@ class CORE_EXPORT ExceptionState {
void setException(ExceptionCode, const String&, v8::Local<v8::Value>);
- private:
ExceptionCode m_code;
ContextType m_context;
String m_message;
@@ -165,14 +168,11 @@ class CORE_EXPORT NonThrowableExceptionState final : public ExceptionState {
NonThrowableExceptionState();
NonThrowableExceptionState(const char*, int);
- void throwDOMException(ExceptionCode, const String& message) override;
- void throwTypeError(const String& message) override;
- void throwSecurityError(const String& sanitizedMessage,
- const String& unsanitizedMessage) override;
- void throwRangeError(const String& message) override;
- void rethrowV8Exception(v8::Local<v8::Value>) override;
ExceptionState& returnThis() { return *this; }
+ // ExceptionState overrides:
+ bool shouldThrow() const override;
+
private:
const char* m_file;
const int m_line;
@@ -201,19 +201,12 @@ class CORE_EXPORT DummyExceptionStateForTesting final : public ExceptionState {
ExceptionState::UnknownContext,
nullptr,
nullptr) {}
- ~DummyExceptionStateForTesting() {
- // Prevent the base class throw an exception.
- if (hadException()) {
- clearException();
- }
- }
- void throwDOMException(ExceptionCode, const String& message) override;
- void throwTypeError(const String& message) override;
- void throwSecurityError(const String& sanitizedMessage,
- const String& unsanitizedMessage) override;
- void throwRangeError(const String& message) override;
- void rethrowV8Exception(v8::Local<v8::Value>) override;
+ ~DummyExceptionStateForTesting() {}
+
ExceptionState& returnThis() { return *this; }
+
+ // ExceptionState overrides:
+ bool shouldThrow() const override;
};
// Syntax sugar for DummyExceptionStateForTesting.
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698