OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 11 matching lines...) Expand all Loading... |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef DOMError_h | 26 #ifndef DOMError_h |
27 #define DOMError_h | 27 #define DOMError_h |
28 | 28 |
29 #include "bindings/v8/ScriptWrappable.h" | 29 #include "bindings/v8/ScriptWrappable.h" |
30 #include "core/dom/DOMException.h" | 30 #include "core/dom/DOMException.h" |
31 #include "core/dom/ExceptionCode.h" | 31 #include "core/dom/ExceptionCode.h" |
| 32 #include "heap/Handle.h" |
32 #include "wtf/PassRefPtr.h" | 33 #include "wtf/PassRefPtr.h" |
33 #include "wtf/RefCounted.h" | 34 #include "wtf/RefCounted.h" |
34 #include "wtf/text/WTFString.h" | 35 #include "wtf/text/WTFString.h" |
35 | 36 |
36 namespace WebCore { | 37 namespace WebCore { |
37 | 38 |
38 class DOMError : public RefCounted<DOMError>, public ScriptWrappable { | 39 class DOMError : public RefCountedWillBeGarbageCollectedFinalized<DOMError>, pub
lic ScriptWrappable { |
| 40 DECLARE_GC_INFO; |
39 public: | 41 public: |
40 static PassRefPtr<DOMError> create(const String& name) | 42 static PassRefPtrWillBeRawPtr<DOMError> create(const String& name) |
41 { | 43 { |
42 return adoptRef(new DOMError(name)); | 44 return adoptRefWillBeNoop(new DOMError(name)); |
43 } | 45 } |
44 static PassRefPtr<DOMError> create(const String& name, const String& message
) | 46 static PassRefPtrWillBeRawPtr<DOMError> create(const String& name, const Str
ing& message) |
45 { | 47 { |
46 return adoptRef(new DOMError(name, message)); | 48 return adoptRefWillBeNoop(new DOMError(name, message)); |
47 } | 49 } |
48 | 50 |
49 static PassRefPtr<DOMError> create(ExceptionCode ec) | 51 static PassRefPtrWillBeRawPtr<DOMError> create(ExceptionCode ec) |
50 { | 52 { |
51 return adoptRef(new DOMError(DOMException::getErrorName(ec), DOMExceptio
n::getErrorMessage(ec))); | 53 return adoptRefWillBeNoop(new DOMError(DOMException::getErrorName(ec), D
OMException::getErrorMessage(ec))); |
52 } | 54 } |
53 | 55 |
54 static PassRefPtr<DOMError> create(ExceptionCode ec, const String& message) | 56 static PassRefPtrWillBeRawPtr<DOMError> create(ExceptionCode ec, const Strin
g& message) |
55 { | 57 { |
56 return adoptRef(new DOMError(DOMException::getErrorName(ec), message)); | 58 return adoptRefWillBeNoop(new DOMError(DOMException::getErrorName(ec), m
essage)); |
57 } | 59 } |
58 | 60 |
59 const String& name() const { return m_name; } | 61 const String& name() const { return m_name; } |
60 const String& message() const { return m_message; } | 62 const String& message() const { return m_message; } |
61 | 63 |
| 64 void trace(Visitor*) { } |
| 65 |
62 protected: | 66 protected: |
63 explicit DOMError(const String& name); | 67 explicit DOMError(const String& name); |
64 DOMError(const String& name, const String& message); | 68 DOMError(const String& name, const String& message); |
65 | 69 |
66 private: | 70 private: |
67 const String m_name; | 71 const String m_name; |
68 const String m_message; | 72 const String m_message; |
69 }; | 73 }; |
70 | 74 |
71 } // namespace WebCore | 75 } // namespace WebCore |
72 | 76 |
73 #endif // DOMError_h | 77 #endif // DOMError_h |
OLD | NEW |