OLD | NEW |
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 24 matching lines...) Expand all Loading... |
35 #include "wtf/Assertions.h" | 35 #include "wtf/Assertions.h" |
36 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
37 #include <v8.h> | 37 #include <v8.h> |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 class ExceptionState; | 41 class ExceptionState; |
42 | 42 |
43 typedef int ExceptionCode; | 43 typedef int ExceptionCode; |
44 | 44 |
45 class IgnorableExceptionState FINAL : public ExceptionState { | 45 class IgnorableExceptionState final : public ExceptionState { |
46 public: | 46 public: |
47 IgnorableExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0,
0, v8::Handle<v8::Object>(), 0) { } | 47 IgnorableExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0,
0, v8::Handle<v8::Object>(), 0) { } |
48 ExceptionState& returnThis() { return *this; } | 48 ExceptionState& returnThis() { return *this; } |
49 virtual void throwDOMException(const ExceptionCode&, const String& message =
String()) OVERRIDE { } | 49 virtual void throwDOMException(const ExceptionCode&, const String& message =
String()) override { } |
50 virtual void throwTypeError(const String& message = String()) OVERRIDE { } | 50 virtual void throwTypeError(const String& message = String()) override { } |
51 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) OVERRIDE { } | 51 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) override { } |
52 }; | 52 }; |
53 | 53 |
54 #define IGNORE_EXCEPTION (::blink::IgnorableExceptionState().returnThis()) | 54 #define IGNORE_EXCEPTION (::blink::IgnorableExceptionState().returnThis()) |
55 | 55 |
56 #if ENABLE(ASSERT) | 56 #if ENABLE(ASSERT) |
57 | 57 |
58 class NoExceptionStateAssertionChecker FINAL : public ExceptionState { | 58 class NoExceptionStateAssertionChecker final : public ExceptionState { |
59 public: | 59 public: |
60 NoExceptionStateAssertionChecker(const char* file, int line); | 60 NoExceptionStateAssertionChecker(const char* file, int line); |
61 ExceptionState& returnThis() { return *this; } | 61 ExceptionState& returnThis() { return *this; } |
62 virtual void throwDOMException(const ExceptionCode&, const String& message =
String()) OVERRIDE; | 62 virtual void throwDOMException(const ExceptionCode&, const String& message =
String()) override; |
63 virtual void throwTypeError(const String& message = String()) OVERRIDE; | 63 virtual void throwTypeError(const String& message = String()) override; |
64 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) OVERRIDE; | 64 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) override; |
65 | 65 |
66 private: | 66 private: |
67 const char* m_file; | 67 const char* m_file; |
68 int m_line; | 68 int m_line; |
69 }; | 69 }; |
70 | 70 |
71 #define ASSERT_NO_EXCEPTION (::blink::NoExceptionStateAssertionChecker(__FILE__,
__LINE__).returnThis()) | 71 #define ASSERT_NO_EXCEPTION (::blink::NoExceptionStateAssertionChecker(__FILE__,
__LINE__).returnThis()) |
72 | 72 |
73 #else | 73 #else |
74 | 74 |
75 #define ASSERT_NO_EXCEPTION (::blink::IgnorableExceptionState().returnThis()) | 75 #define ASSERT_NO_EXCEPTION (::blink::IgnorableExceptionState().returnThis()) |
76 | 76 |
77 #endif | 77 #endif |
78 | 78 |
79 } // namespace blink | 79 } // namespace blink |
80 | 80 |
81 #endif // ExceptionStatePlaceholder_h | 81 #endif // ExceptionStatePlaceholder_h |
OLD | NEW |