- Revision
- 164422
- Author
- [email protected]
- Date
- 2014-02-20 01:57:03 -0800 (Thu, 20 Feb 2014)
Log Message
Move to using std::unique_ptr for KeyboardEvent, ScriptExecutionContext::PendingException
https://bugs.webkit.org/show_bug.cgi?id=129061
Reviewed by Andreas Kling.
Replace uses of OwnPtr and PassOwnPtr for KeyboardEvent and ScriptExecutionContext::PendingException
classes with std::unique_ptr. ScriptExecutionContext::Task objects are still handled through OwnPtr,
but this will be addressed later.
* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
* dom/KeyboardEvent.h:
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::reportException):
(WebCore::ScriptExecutionContext::publicURLManager):
* dom/ScriptExecutionContext.h:
* dom/ScriptRunner.h: Remove an unnecessary PassOwnPtr header inclusion.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (164421 => 164422)
--- trunk/Source/WebCore/ChangeLog 2014-02-20 09:49:53 UTC (rev 164421)
+++ trunk/Source/WebCore/ChangeLog 2014-02-20 09:57:03 UTC (rev 164422)
@@ -1,5 +1,25 @@
2014-02-20 Zan Dobersek <[email protected]>
+ Move to using std::unique_ptr for KeyboardEvent, ScriptExecutionContext::PendingException
+ https://bugs.webkit.org/show_bug.cgi?id=129061
+
+ Reviewed by Andreas Kling.
+
+ Replace uses of OwnPtr and PassOwnPtr for KeyboardEvent and ScriptExecutionContext::PendingException
+ classes with std::unique_ptr. ScriptExecutionContext::Task objects are still handled through OwnPtr,
+ but this will be addressed later.
+
+ * dom/KeyboardEvent.cpp:
+ (WebCore::KeyboardEvent::KeyboardEvent):
+ * dom/KeyboardEvent.h:
+ * dom/ScriptExecutionContext.cpp:
+ (WebCore::ScriptExecutionContext::reportException):
+ (WebCore::ScriptExecutionContext::publicURLManager):
+ * dom/ScriptExecutionContext.h:
+ * dom/ScriptRunner.h: Remove an unnecessary PassOwnPtr header inclusion.
+
+2014-02-20 Zan Dobersek <[email protected]>
+
Move to using std::unique_ptr for EventListenerMap, EventTarget
https://bugs.webkit.org/show_bug.cgi?id=129062
Modified: trunk/Source/WebCore/dom/KeyboardEvent.cpp (164421 => 164422)
--- trunk/Source/WebCore/dom/KeyboardEvent.cpp 2014-02-20 09:49:53 UTC (rev 164421)
+++ trunk/Source/WebCore/dom/KeyboardEvent.cpp 2014-02-20 09:57:03 UTC (rev 164422)
@@ -108,7 +108,7 @@
KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* view)
: UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()),
true, true, key.timestamp(), view, 0, key.ctrlKey(), key.altKey(), key.shiftKey(), key.metaKey())
- , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key)))
+ , m_keyEvent(std::make_unique<PlatformKeyboardEvent>(key))
, m_keyIdentifier(key.keyIdentifier())
, m_location(keyLocationCode(key))
, m_altGraphKey(false)
Modified: trunk/Source/WebCore/dom/KeyboardEvent.h (164421 => 164422)
--- trunk/Source/WebCore/dom/KeyboardEvent.h 2014-02-20 09:49:53 UTC (rev 164421)
+++ trunk/Source/WebCore/dom/KeyboardEvent.h 2014-02-20 09:57:03 UTC (rev 164422)
@@ -25,6 +25,7 @@
#define KeyboardEvent_h
#include "UIEventWithKeyState.h"
+#include <memory>
#include <wtf/Vector.h>
namespace WebCore {
@@ -113,7 +114,7 @@
KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*);
KeyboardEvent(const AtomicString&, const KeyboardEventInit&);
- OwnPtr<PlatformKeyboardEvent> m_keyEvent;
+ std::unique_ptr<PlatformKeyboardEvent> m_keyEvent;
String m_keyIdentifier;
unsigned m_location;
bool m_altGraphKey : 1;
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (164421 => 164422)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2014-02-20 09:49:53 UTC (rev 164421)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2014-02-20 09:57:03 UTC (rev 164422)
@@ -299,8 +299,8 @@
{
if (m_inDispatchErrorEvent) {
if (!m_pendingExceptions)
- m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException>>());
- m_pendingExceptions->append(adoptPtr(new PendingException(errorMessage, lineNumber, columnNumber, sourceURL, callStack)));
+ m_pendingExceptions = std::make_unique<Vector<std::unique_ptr<PendingException>>>();
+ m_pendingExceptions->append(std::make_unique<PendingException>(errorMessage, lineNumber, columnNumber, sourceURL, callStack));
return;
}
@@ -311,11 +311,9 @@
if (!m_pendingExceptions)
return;
- for (size_t i = 0; i < m_pendingExceptions->size(); i++) {
- PendingException* e = m_pendingExceptions->at(i).get();
- logExceptionToConsole(e->m_errorMessage, e->m_sourceURL, e->m_lineNumber, e->m_columnNumber, e->m_callStack);
- }
- m_pendingExceptions.clear();
+ for (auto& exception : *m_pendingExceptions)
+ logExceptionToConsole(exception->m_errorMessage, exception->m_sourceURL, exception->m_lineNumber, exception->m_columnNumber, exception->m_callStack);
+ m_pendingExceptions.reset();
}
void ScriptExecutionContext::addConsoleMessage(MessageSource source, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* state, unsigned long requestIdentifier)
@@ -363,7 +361,7 @@
PublicURLManager& ScriptExecutionContext::publicURLManager()
{
if (!m_publicURLManager)
- m_publicURLManager = PublicURLManager::create(this);
+ m_publicURLManager = std::make_unique<PublicURLManager>(this);
return *m_publicURLManager;
}
#endif
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (164421 => 164422)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.h 2014-02-20 09:49:53 UTC (rev 164421)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h 2014-02-20 09:57:03 UTC (rev 164422)
@@ -208,7 +208,7 @@
bool m_inDispatchErrorEvent;
class PendingException;
- OwnPtr<Vector<OwnPtr<PendingException>>> m_pendingExceptions;
+ std::unique_ptr<Vector<std::unique_ptr<PendingException>>> m_pendingExceptions;
bool m_activeDOMObjectsAreSuspended;
ActiveDOMObject::ReasonForSuspension m_reasonForSuspendingActiveDOMObjects;
Modified: trunk/Source/WebCore/dom/ScriptRunner.h (164421 => 164422)
--- trunk/Source/WebCore/dom/ScriptRunner.h 2014-02-20 09:49:53 UTC (rev 164421)
+++ trunk/Source/WebCore/dom/ScriptRunner.h 2014-02-20 09:57:03 UTC (rev 164422)
@@ -30,7 +30,6 @@
#include "Timer.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>