Title: [165068] trunk/Source/WebCore
Revision
165068
Author
[email protected]
Date
2014-03-04 12:15:38 -0800 (Tue, 04 Mar 2014)

Log Message

Move Source/WebCore/html/track/ code to std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=129666

Reviewed by Eric Carlson.

Replace uses of OwnPtr and PassOwnPtr in code under Source/WebCore/html/track/ with std::unique_ptr.

* html/track/AudioTrack.h:
* html/track/InbandWebVTTTextTrack.cpp:
(WebCore::InbandWebVTTTextTrack::parseWebVTTCueData):
* html/track/InbandWebVTTTextTrack.h:
* html/track/LoadableTextTrack.cpp:
(WebCore::LoadableTextTrack::loadTimerFired):
(WebCore::LoadableTextTrack::newCuesAvailable):
(WebCore::LoadableTextTrack::cueLoadingCompleted):
(WebCore::LoadableTextTrack::newRegionsAvailable):
* html/track/LoadableTextTrack.h:
* html/track/TextTrack.h:
* html/track/TextTrackCue.h:
* html/track/TextTrackRegion.h:
* html/track/VTTCue.cpp:
(WebCore::VTTCue::createWebVTTNodeTree):
(WebCore::VTTCue::markFutureAndPastNodes):
* html/track/VTTCue.h:
* html/track/VideoTrack.h:
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::WebVTTParser):
* html/track/WebVTTParser.h:
* html/track/WebVTTTokenizer.h:
* loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::processNewCueData):
* loader/TextTrackLoader.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (165067 => 165068)


--- trunk/Source/WebCore/ChangeLog	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/ChangeLog	2014-03-04 20:15:38 UTC (rev 165068)
@@ -1,3 +1,38 @@
+2014-03-04  Zan Dobersek  <[email protected]>
+
+        Move Source/WebCore/html/track/ code to std::unique_ptr
+        https://bugs.webkit.org/show_bug.cgi?id=129666
+
+        Reviewed by Eric Carlson.
+
+        Replace uses of OwnPtr and PassOwnPtr in code under Source/WebCore/html/track/ with std::unique_ptr.
+
+        * html/track/AudioTrack.h:
+        * html/track/InbandWebVTTTextTrack.cpp:
+        (WebCore::InbandWebVTTTextTrack::parseWebVTTCueData):
+        * html/track/InbandWebVTTTextTrack.h:
+        * html/track/LoadableTextTrack.cpp:
+        (WebCore::LoadableTextTrack::loadTimerFired):
+        (WebCore::LoadableTextTrack::newCuesAvailable):
+        (WebCore::LoadableTextTrack::cueLoadingCompleted):
+        (WebCore::LoadableTextTrack::newRegionsAvailable):
+        * html/track/LoadableTextTrack.h:
+        * html/track/TextTrack.h:
+        * html/track/TextTrackCue.h:
+        * html/track/TextTrackRegion.h:
+        * html/track/VTTCue.cpp:
+        (WebCore::VTTCue::createWebVTTNodeTree):
+        (WebCore::VTTCue::markFutureAndPastNodes):
+        * html/track/VTTCue.h:
+        * html/track/VideoTrack.h:
+        * html/track/WebVTTParser.cpp:
+        (WebCore::WebVTTParser::WebVTTParser):
+        * html/track/WebVTTParser.h:
+        * html/track/WebVTTTokenizer.h:
+        * loader/TextTrackLoader.cpp:
+        (WebCore::TextTrackLoader::processNewCueData):
+        * loader/TextTrackLoader.h:
+
 2014-03-04  Zalan Bujtas  <[email protected]>
 
         Subpixel rendering: Make border-radius painting device pixel aware.

Modified: trunk/Source/WebCore/html/track/AudioTrack.h (165067 => 165068)


--- trunk/Source/WebCore/html/track/AudioTrack.h	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/AudioTrack.h	2014-03-04 20:15:38 UTC (rev 165068)
@@ -32,7 +32,6 @@
 #include "AudioTrackPrivate.h"
 #include "ExceptionCode.h"
 #include "TrackBase.h"
-#include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 

Modified: trunk/Source/WebCore/html/track/InbandWebVTTTextTrack.cpp (165067 => 165068)


--- trunk/Source/WebCore/html/track/InbandWebVTTTextTrack.cpp	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/InbandWebVTTTextTrack.cpp	2014-03-04 20:15:38 UTC (rev 165068)
@@ -53,7 +53,7 @@
 {
     ASSERT_UNUSED(trackPrivate, trackPrivate == m_private);
     if (!m_webVTTParser)
-        m_webVTTParser = WebVTTParser::create(this, scriptExecutionContext());
+        m_webVTTParser = std::make_unique<WebVTTParser>(static_cast<WebVTTParserClient*>(this), scriptExecutionContext());
     m_webVTTParser->parseBytes(data, length);
 }
 

Modified: trunk/Source/WebCore/html/track/InbandWebVTTTextTrack.h (165067 => 165068)


--- trunk/Source/WebCore/html/track/InbandWebVTTTextTrack.h	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/InbandWebVTTTextTrack.h	2014-03-04 20:15:38 UTC (rev 165068)
@@ -30,6 +30,7 @@
 
 #include "InbandTextTrack.h"
 #include "WebVTTParser.h"
+#include <memory>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
@@ -54,7 +55,7 @@
     virtual void updateGenericCue(InbandTextTrackPrivate*, GenericCueData*) override { ASSERT_NOT_REACHED(); }
     virtual void removeGenericCue(InbandTextTrackPrivate*, GenericCueData*) override { ASSERT_NOT_REACHED(); }
 
-    OwnPtr<WebVTTParser> m_webVTTParser;
+    std::unique_ptr<WebVTTParser> m_webVTTParser;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/track/LoadableTextTrack.cpp (165067 => 165068)


--- trunk/Source/WebCore/html/track/LoadableTextTrack.cpp	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/LoadableTextTrack.cpp	2014-03-04 20:15:38 UTC (rev 165068)
@@ -94,14 +94,14 @@
     // 4. Download: If URL is not the empty string, perform a potentially CORS-enabled fetch of URL, with the
     // mode being the state of the media element's crossorigin content attribute, the origin being the
     // origin of the media element's Document, and the default origin behaviour set to fail.
-    m_loader = TextTrackLoader::create(*this, static_cast<ScriptExecutionContext*>(&m_trackElement->document()));
+    m_loader = std::make_unique<TextTrackLoader>(static_cast<TextTrackLoaderClient&>(*this), static_cast<ScriptExecutionContext*>(&m_trackElement->document()));
     if (!m_loader->load(m_url, m_trackElement->mediaElementCrossOriginAttribute()))
         m_trackElement->didCompleteLoad(HTMLTrackElement::Failure);
 }
 
 void LoadableTextTrack::newCuesAvailable(TextTrackLoader* loader)
 {
-    ASSERT_UNUSED(loader, m_loader == loader);
+    ASSERT_UNUSED(loader, m_loader.get() == loader);
 
     Vector<RefPtr<TextTrackCue>> newCues;
     m_loader->getNewCues(newCues);
@@ -120,7 +120,7 @@
 
 void LoadableTextTrack::cueLoadingCompleted(TextTrackLoader* loader, bool loadingFailed)
 {
-    ASSERT_UNUSED(loader, m_loader == loader);
+    ASSERT_UNUSED(loader, m_loader.get() == loader);
 
     if (!m_trackElement)
         return;
@@ -131,7 +131,7 @@
 #if ENABLE(WEBVTT_REGIONS)
 void LoadableTextTrack::newRegionsAvailable(TextTrackLoader* loader)
 {
-    ASSERT_UNUSED(loader, m_loader == loader);
+    ASSERT_UNUSED(loader, m_loader.get() == loader);
 
     Vector<RefPtr<TextTrackRegion>> newRegions;
     m_loader->getNewRegions(newRegions);

Modified: trunk/Source/WebCore/html/track/LoadableTextTrack.h (165067 => 165068)


--- trunk/Source/WebCore/html/track/LoadableTextTrack.h	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/LoadableTextTrack.h	2014-03-04 20:15:38 UTC (rev 165068)
@@ -73,7 +73,7 @@
 
     HTMLTrackElement* m_trackElement;
     Timer<LoadableTextTrack> m_loadTimer;
-    OwnPtr<TextTrackLoader> m_loader;
+    std::unique_ptr<TextTrackLoader> m_loader;
     URL m_url;
     bool m_isDefault;
 };

Modified: trunk/Source/WebCore/html/track/TextTrack.h (165067 => 165068)


--- trunk/Source/WebCore/html/track/TextTrack.h	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/TextTrack.h	2014-03-04 20:15:38 UTC (rev 165068)
@@ -33,7 +33,6 @@
 #include "TextTrackCue.h"
 #include "TrackBase.h"
 #include "VTTCue.h"
-#include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 

Modified: trunk/Source/WebCore/html/track/TextTrackCue.h (165067 => 165068)


--- trunk/Source/WebCore/html/track/TextTrackCue.h	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/TextTrackCue.h	2014-03-04 20:15:38 UTC (rev 165068)
@@ -36,7 +36,6 @@
 
 #include "EventTarget.h"
 #include "HTMLElement.h"
-#include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {

Modified: trunk/Source/WebCore/html/track/TextTrackRegion.h (165067 => 165068)


--- trunk/Source/WebCore/html/track/TextTrackRegion.h	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/TextTrackRegion.h	2014-03-04 20:15:38 UTC (rev 165068)
@@ -35,7 +35,6 @@
 
 #include "FloatPoint.h"
 #include "TextTrack.h"
-#include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {

Modified: trunk/Source/WebCore/html/track/VTTCue.cpp (165067 => 165068)


--- trunk/Source/WebCore/html/track/VTTCue.cpp	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/VTTCue.cpp	2014-03-04 20:15:38 UTC (rev 165068)
@@ -397,7 +397,7 @@
 void VTTCue::createWebVTTNodeTree()
 {
     if (!m_webVTTNodeTree)
-        m_webVTTNodeTree = WebVTTParser::create(0, scriptExecutionContext())->createDocumentFragmentFromCueText(m_content);
+        m_webVTTNodeTree = std::make_unique<WebVTTParser>(nullptr, scriptExecutionContext())->createDocumentFragmentFromCueText(m_content);
 }
 
 void VTTCue::copyWebVTTNodeToDOMTree(ContainerNode* webVTTNode, ContainerNode* parent)
@@ -650,7 +650,7 @@
         if (child->nodeName() == timestampTag) {
             unsigned position = 0;
             String timestamp = child->nodeValue();
-            double currentTimestamp = WebVTTParser::create(0, scriptExecutionContext())->collectTimeStamp(timestamp, &position);
+            double currentTimestamp = std::make_unique<WebVTTParser>(nullptr, scriptExecutionContext())->collectTimeStamp(timestamp, &position);
             ASSERT(currentTimestamp != -1);
             
             if (currentTimestamp > movieTime)

Modified: trunk/Source/WebCore/html/track/VTTCue.h (165067 => 165068)


--- trunk/Source/WebCore/html/track/VTTCue.h	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/VTTCue.h	2014-03-04 20:15:38 UTC (rev 165068)
@@ -37,7 +37,6 @@
 #include "EventTarget.h"
 #include "HTMLElement.h"
 #include "TextTrackCue.h"
-#include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {

Modified: trunk/Source/WebCore/html/track/VideoTrack.h (165067 => 165068)


--- trunk/Source/WebCore/html/track/VideoTrack.h	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/VideoTrack.h	2014-03-04 20:15:38 UTC (rev 165068)
@@ -32,7 +32,6 @@
 #include "ExceptionCode.h"
 #include "TrackBase.h"
 #include "VideoTrackPrivate.h"
-#include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 

Modified: trunk/Source/WebCore/html/track/WebVTTParser.cpp (165067 => 165068)


--- trunk/Source/WebCore/html/track/WebVTTParser.cpp	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/WebVTTParser.cpp	2014-03-04 20:15:38 UTC (rev 165068)
@@ -120,7 +120,7 @@
     , m_state(Initial)
     , m_currentStartTime(0)
     , m_currentEndTime(0)
-    , m_tokenizer(WebVTTTokenizer::create())
+    , m_tokenizer(std::make_unique<WebVTTTokenizer>())
     , m_client(client)
 {
 }

Modified: trunk/Source/WebCore/html/track/WebVTTParser.h (165067 => 165068)


--- trunk/Source/WebCore/html/track/WebVTTParser.h	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/WebVTTParser.h	2014-03-04 20:15:38 UTC (rev 165068)
@@ -38,7 +38,7 @@
 #include "HTMLNames.h"
 #include "TextTrackRegion.h"
 #include "WebVTTTokenizer.h"
-#include <wtf/PassOwnPtr.h>
+#include <memory>
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -110,11 +110,8 @@
         Finished
     };
 
-    static OwnPtr<WebVTTParser> create(WebVTTParserClient* client, ScriptExecutionContext* context)
-    {
-        return adoptPtr(new WebVTTParser(client, context));
-    }
-    
+    WebVTTParser(WebVTTParserClient*, ScriptExecutionContext*);
+
     static inline bool isRecognizedTag(const AtomicString& tagName)
     {
         return tagName == iTag
@@ -158,8 +155,6 @@
     double collectTimeStamp(const String&, unsigned*);
 
 protected:
-    WebVTTParser(WebVTTParserClient*, ScriptExecutionContext*);
-
     ScriptExecutionContext* m_scriptExecutionContext;
     ParseState m_state;
 
@@ -194,7 +189,7 @@
     String m_currentSettings;
     
     WebVTTToken m_token;
-    OwnPtr<WebVTTTokenizer> m_tokenizer;
+    std::unique_ptr<WebVTTTokenizer> m_tokenizer;
 
     RefPtr<ContainerNode> m_currentNode;
 

Modified: trunk/Source/WebCore/html/track/WebVTTTokenizer.h (165067 => 165068)


--- trunk/Source/WebCore/html/track/WebVTTTokenizer.h	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/html/track/WebVTTTokenizer.h	2014-03-04 20:15:38 UTC (rev 165068)
@@ -35,7 +35,6 @@
 
 #include "InputStreamPreprocessor.h"
 #include "WebVTTToken.h"
-#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
@@ -58,7 +57,7 @@
     WTF_MAKE_NONCOPYABLE(WebVTTTokenizer);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static OwnPtr<WebVTTTokenizer> create() { return adoptPtr(new WebVTTTokenizer); }
+    WebVTTTokenizer();
 
     typedef WebVTTTokenizerState State;
 
@@ -99,8 +98,6 @@
     bool shouldSkipNullCharacters() const { return true; }
 
 private:
-    WebVTTTokenizer();
-
     // m_token is owned by the caller. If nextToken is not on the stack,
     // this member might be pointing to unallocated memory.
     WebVTTToken* m_token;

Modified: trunk/Source/WebCore/loader/TextTrackLoader.cpp (165067 => 165068)


--- trunk/Source/WebCore/loader/TextTrackLoader.cpp	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/loader/TextTrackLoader.cpp	2014-03-04 20:15:38 UTC (rev 165068)
@@ -91,7 +91,7 @@
         return;
 
     if (!m_cueParser)
-        m_cueParser = WebVTTParser::create(this, m_scriptExecutionContext);
+        m_cueParser = std::make_unique<WebVTTParser>(static_cast<WebVTTParserClient*>(this), m_scriptExecutionContext);
 
     const char* data;
     unsigned length;

Modified: trunk/Source/WebCore/loader/TextTrackLoader.h (165067 => 165068)


--- trunk/Source/WebCore/loader/TextTrackLoader.h	2014-03-04 20:12:01 UTC (rev 165067)
+++ trunk/Source/WebCore/loader/TextTrackLoader.h	2014-03-04 20:15:38 UTC (rev 165068)
@@ -32,6 +32,7 @@
 #include "CachedResourceHandle.h"
 #include "Timer.h"
 #include "WebVTTParser.h"
+#include <memory>
 #include <wtf/OwnPtr.h>
 
 namespace WebCore {
@@ -56,10 +57,7 @@
     WTF_MAKE_NONCOPYABLE(TextTrackLoader); 
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<TextTrackLoader> create(TextTrackLoaderClient& client, ScriptExecutionContext* context)
-    {
-        return adoptPtr(new TextTrackLoader(client, context));
-    }
+    TextTrackLoader(TextTrackLoaderClient&, ScriptExecutionContext*);
     virtual ~TextTrackLoader();
     
     bool load(const URL&, const String& crossOriginMode);
@@ -81,8 +79,6 @@
 #endif
     virtual void fileFailedToParse() override;
     
-    TextTrackLoader(TextTrackLoaderClient&, ScriptExecutionContext*);
-    
     void processNewCueData(CachedResource*);
     void cueLoadTimerFired(Timer<TextTrackLoader>*);
     void corsPolicyPreventedLoad();
@@ -90,7 +86,7 @@
     enum State { Idle, Loading, Finished, Failed };
     
     TextTrackLoaderClient& m_client;
-    OwnPtr<WebVTTParser> m_cueParser;
+    std::unique_ptr<WebVTTParser> m_cueParser;
     CachedResourceHandle<CachedTextTrack> m_resource;
     ScriptExecutionContext* m_scriptExecutionContext;
     Timer<TextTrackLoader> m_cueLoadTimer;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to