Title: [165177] trunk/Source/WebCore
Revision
165177
Author
[email protected]
Date
2014-03-06 01:02:33 -0800 (Thu, 06 Mar 2014)

Log Message

Move to using std::unique_ptr for KeyboardEvent, ScriptExecutionContext::PendingException
https://bugs.webkit.org/show_bug.cgi?id=129061

Reviewed by Eric Carlson.

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):
* dom/ScriptExecutionContext.h:
* dom/ScriptRunner.h: Remove an unnecessary PassOwnPtr header inclusion.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (165176 => 165177)


--- trunk/Source/WebCore/ChangeLog	2014-03-06 08:55:09 UTC (rev 165176)
+++ trunk/Source/WebCore/ChangeLog	2014-03-06 09:02:33 UTC (rev 165177)
@@ -1,3 +1,22 @@
+2014-03-06  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 Eric Carlson.
+
+        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):
+        * dom/ScriptExecutionContext.h:
+        * dom/ScriptRunner.h: Remove an unnecessary PassOwnPtr header inclusion.
+
 2014-03-06  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r165175.

Modified: trunk/Source/WebCore/dom/KeyboardEvent.cpp (165176 => 165177)


--- trunk/Source/WebCore/dom/KeyboardEvent.cpp	2014-03-06 08:55:09 UTC (rev 165176)
+++ trunk/Source/WebCore/dom/KeyboardEvent.cpp	2014-03-06 09:02:33 UTC (rev 165177)
@@ -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 (165176 => 165177)


--- trunk/Source/WebCore/dom/KeyboardEvent.h	2014-03-06 08:55:09 UTC (rev 165176)
+++ trunk/Source/WebCore/dom/KeyboardEvent.h	2014-03-06 09:02:33 UTC (rev 165177)
@@ -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 (165176 => 165177)


--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp	2014-03-06 08:55:09 UTC (rev 165176)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp	2014-03-06 09:02:33 UTC (rev 165177)
@@ -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();
+    std::unique_ptr<Vector<std::unique_ptr<PendingException>>> pendingExceptions = std::move(m_pendingExceptions);
+    for (auto& exception : *pendingExceptions)
+        logExceptionToConsole(exception->m_errorMessage, exception->m_sourceURL, exception->m_lineNumber, exception->m_columnNumber, exception->m_callStack);
 }
 
 void ScriptExecutionContext::addConsoleMessage(MessageSource source, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* state, unsigned long requestIdentifier)

Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (165176 => 165177)


--- trunk/Source/WebCore/dom/ScriptExecutionContext.h	2014-03-06 08:55:09 UTC (rev 165176)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h	2014-03-06 09:02:33 UTC (rev 165177)
@@ -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 (165176 => 165177)


--- trunk/Source/WebCore/dom/ScriptRunner.h	2014-03-06 08:55:09 UTC (rev 165176)
+++ trunk/Source/WebCore/dom/ScriptRunner.h	2014-03-06 09:02:33 UTC (rev 165177)
@@ -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>
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to