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

Side by Side Diff: third_party/WebKit/Source/core/events/ErrorEvent.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/events/ErrorEvent.h" 31 #include "core/events/ErrorEvent.h"
32 32
33 #include "bindings/core/v8/V8Binding.h" 33 #include "bindings/core/v8/V8Binding.h"
34 #include <memory>
35 #include <v8.h> 34 #include <v8.h>
36 35
37 namespace blink { 36 namespace blink {
38 37
39 ErrorEvent::ErrorEvent() 38 ErrorEvent::ErrorEvent()
40 : m_sanitizedMessage() 39 : m_sanitizedMessage()
41 , m_location(SourceLocation::create(String(), 0, 0, nullptr)) 40 , m_location(SourceLocation::create(String(), 0, 0, nullptr))
42 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent())) 41 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent()))
43 { 42 {
44 } 43 }
45 44
46 ErrorEvent::ErrorEvent(const AtomicString& type, const ErrorEventInit& initializ er) 45 ErrorEvent::ErrorEvent(const AtomicString& type, const ErrorEventInit& initializ er)
47 : Event(type, initializer) 46 : Event(type, initializer)
48 , m_sanitizedMessage() 47 , m_sanitizedMessage()
49 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent())) 48 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent()))
50 { 49 {
51 if (initializer.hasMessage()) 50 if (initializer.hasMessage())
52 m_sanitizedMessage = initializer.message(); 51 m_sanitizedMessage = initializer.message();
53 m_location = SourceLocation::create( 52 m_location = SourceLocation::create(
54 initializer.hasFilename() ? initializer.filename() : String(), 53 initializer.hasFilename() ? initializer.filename() : String(),
55 initializer.hasLineno() ? initializer.lineno() : 0, 54 initializer.hasLineno() ? initializer.lineno() : 0,
56 initializer.hasColno() ? initializer.colno() : 0, 55 initializer.hasColno() ? initializer.colno() : 0,
57 nullptr); 56 nullptr);
58 if (initializer.hasError()) 57 if (initializer.hasError())
59 m_error = initializer.error(); 58 m_error = initializer.error();
60 } 59 }
61 60
62 ErrorEvent::ErrorEvent(const String& message, std::unique_ptr<SourceLocation> lo cation, DOMWrapperWorld* world) 61 ErrorEvent::ErrorEvent(const String& message, PassOwnPtr<SourceLocation> locatio n, DOMWrapperWorld* world)
63 : Event(EventTypeNames::error, false, true) 62 : Event(EventTypeNames::error, false, true)
64 , m_sanitizedMessage(message) 63 , m_sanitizedMessage(message)
65 , m_location(std::move(location)) 64 , m_location(std::move(location))
66 , m_world(world) 65 , m_world(world)
67 { 66 {
68 } 67 }
69 68
70 void ErrorEvent::setUnsanitizedMessage(const String& message) 69 void ErrorEvent::setUnsanitizedMessage(const String& message)
71 { 70 {
72 ASSERT(m_unsanitizedMessage.isEmpty()); 71 ASSERT(m_unsanitizedMessage.isEmpty());
(...skipping 21 matching lines...) Expand all
94 return ScriptValue(); 93 return ScriptValue();
95 return m_error; 94 return m_error;
96 } 95 }
97 96
98 DEFINE_TRACE(ErrorEvent) 97 DEFINE_TRACE(ErrorEvent)
99 { 98 {
100 Event::trace(visitor); 99 Event::trace(visitor);
101 } 100 }
102 101
103 } // namespace blink 102 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/ErrorEvent.h ('k') | third_party/WebKit/Source/core/events/EventFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698