diff --git a/chrome/VERSION b/chrome/VERSION index f2040b0..c0c34e2 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=53 MINOR=0 -BUILD=2772 +BUILD=2773 PATCH=0
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index a1b8c7f4..9621e07 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -8466.0.0 \ No newline at end of file +8469.0.0 \ No newline at end of file
diff --git a/media/mojo/clients/mojo_demuxer_stream_impl.h b/media/mojo/clients/mojo_demuxer_stream_impl.h index 0d37948..49d97b7 100644 --- a/media/mojo/clients/mojo_demuxer_stream_impl.h +++ b/media/mojo/clients/mojo_demuxer_stream_impl.h
@@ -9,7 +9,7 @@ #include "base/memory/weak_ptr.h" #include "media/base/demuxer_stream.h" #include "media/mojo/interfaces/demuxer_stream.mojom.h" -#include "mojo/public/cpp/bindings/strong_binding.h" +#include "mojo/public/cpp/bindings/binding.h" namespace media { class DemuxerStream; @@ -31,12 +31,18 @@ void Read(const ReadCallback& callback) override; void EnableBitstreamConverter() override; + // Sets an error handler that will be called if a connection error occurs on + // the bound message pipe. + void set_connection_error_handler(const mojo::Closure& error_handler) { + binding_.set_connection_error_handler(error_handler); + } + private: void OnBufferReady(const ReadCallback& callback, media::DemuxerStream::Status status, const scoped_refptr<media::DecoderBuffer>& buffer); - mojo::StrongBinding<mojom::DemuxerStream> binding_; + mojo::Binding<mojom::DemuxerStream> binding_; // See constructor. We do not own |stream_|. media::DemuxerStream* stream_;
diff --git a/media/mojo/clients/mojo_renderer_impl.cc b/media/mojo/clients/mojo_renderer_impl.cc index c0e2891..a3a0047a 100644 --- a/media/mojo/clients/mojo_renderer_impl.cc +++ b/media/mojo/clients/mojo_renderer_impl.cc
@@ -63,12 +63,28 @@ demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO); mojom::DemuxerStreamPtr audio_stream; - if (audio) - new MojoDemuxerStreamImpl(audio, GetProxy(&audio_stream)); + if (audio) { + audio_stream_.reset( + new MojoDemuxerStreamImpl(audio, GetProxy(&audio_stream))); + // Using base::Unretained(this) is safe because |this| owns + // |audio_stream_|, and the error handler can't be invoked once + // |audio_stream_| is destroyed. + audio_stream_->set_connection_error_handler( + base::Bind(&MojoRendererImpl::OnDemuxerStreamConnectionError, + base::Unretained(this), DemuxerStream::AUDIO)); + } mojom::DemuxerStreamPtr video_stream; - if (video) - new MojoDemuxerStreamImpl(video, GetProxy(&video_stream)); + if (video) { + video_stream_.reset( + new MojoDemuxerStreamImpl(video, GetProxy(&video_stream))); + // Using base::Unretained(this) is safe because |this| owns + // |video_stream_|, and the error handler can't be invoked once + // |video_stream_| is destroyed. + video_stream_->set_connection_error_handler( + base::Bind(&MojoRendererImpl::OnDemuxerStreamConnectionError, + base::Unretained(this), DemuxerStream::VIDEO)); + } BindRemoteRendererIfNeeded(); @@ -235,6 +251,20 @@ client_->OnError(PIPELINE_ERROR_DECODE); } +void MojoRendererImpl::OnDemuxerStreamConnectionError( + DemuxerStream::Type type) { + DVLOG(1) << __FUNCTION__ << ": " << type; + DCHECK(task_runner_->BelongsToCurrentThread()); + + if (type == DemuxerStream::AUDIO) { + audio_stream_.reset(); + } else if (type == DemuxerStream::VIDEO) { + video_stream_.reset(); + } else { + NOTREACHED() << "Unexpected demuxer stream type: " << type; + } +} + void MojoRendererImpl::BindRemoteRendererIfNeeded() { DVLOG(2) << __FUNCTION__; DCHECK(task_runner_->BelongsToCurrentThread());
diff --git a/media/mojo/clients/mojo_renderer_impl.h b/media/mojo/clients/mojo_renderer_impl.h index 7ad7b11..f37733c 100644 --- a/media/mojo/clients/mojo_renderer_impl.h +++ b/media/mojo/clients/mojo_renderer_impl.h
@@ -8,6 +8,7 @@ #include <stdint.h> #include "base/macros.h" +#include "media/base/demuxer_stream.h" #include "media/base/renderer.h" #include "media/mojo/interfaces/renderer.mojom.h" #include "mojo/public/cpp/bindings/binding.h" @@ -19,6 +20,7 @@ namespace media { class DemuxerStreamProvider; +class MojoDemuxerStreamImpl; class VideoOverlayFactory; class VideoRendererSink; @@ -73,6 +75,9 @@ // Callback for connection error on |remote_renderer_|. void OnConnectionError(); + // Callback for connection error on |audio_stream_| and |video_stream_|. + void OnDemuxerStreamConnectionError(DemuxerStream::Type type); + // Callbacks for |remote_renderer_| methods. void OnInitialized(media::RendererClient* client, bool success); void OnFlushed(); @@ -99,6 +104,15 @@ // Client of |this| renderer passed in Initialize. media::RendererClient* client_ = nullptr; + // Mojo demuxer streams. + // Owned by MojoRendererImpl instead of remote mojom::Renderer + // becuase these demuxer streams need to be destroyed as soon as |this| is + // destroyed. The local demuxer streams returned by DemuxerStreamProvider + // cannot be used after |this| is destroyed. + // TODO(alokp): Add tests for MojoDemuxerStreamImpl. + std::unique_ptr<MojoDemuxerStreamImpl> audio_stream_; + std::unique_ptr<MojoDemuxerStreamImpl> video_stream_; + // This class is constructed on one thread and used exclusively on another // thread. This member is used to safely pass the RendererPtr from one thread // to another. It is set in the constructor and is consumed in Initialize().
diff --git a/media/test/data/test-25fps.vp9.md5 b/media/test/data/test-25fps.vp9.md5 index c2267be..146e249a 100644 --- a/media/test/data/test-25fps.vp9.md5 +++ b/media/test/data/test-25fps.vp9.md5
@@ -3,6 +3,8 @@ # ARM - MediaTek d9ce7c0ca4dd16e350e6df78f5d13a2e +# Intel - Haswell +9dc9c009b062f98691a6151e322c7df2 # Intel - Broadwell f85e57dadd517b171109580a6ebd9b34 #Intel - SKL
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cues-sorted-before-dispatch-expected.txt b/third_party/WebKit/LayoutTests/media/track/track-cues-sorted-before-dispatch-expected.txt deleted file mode 100644 index 907c88a9..0000000 --- a/third_party/WebKit/LayoutTests/media/track/track-cues-sorted-before-dispatch-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -Tests that all events events are triggered in chronological order. - -EVENT(canplaythrough) -EXPECTED (testTrack.track.cues.length == '8') OK -RUN(video.play()) -EVENT(ended) -Cue event: enter id: 1 time: 5.1 -Cue event: enter id: 3 time: 5.1 -Cue event: enter id: 2 time: 5.1 -Cue event: enter id: 4 time: 5.1 -Cue event: exit id: 2 time: 5.101 -Cue event: exit id: 4 time: 5.101 -Cue event: enter id: 5 time: 5.3 -Cue event: exit id: 3 time: 5.301 -Cue event: exit id: 1 time: 5.8 -Cue event: exit id: 5 time: 5.8 -Cue event: enter id: 6 time: 5.99 -Cue event: exit id: 6 time: 5.993 -Cue event: enter id: 7 time: 5.994 -Cue event: exit id: 7 time: 5.998 -END OF TEST -
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cues-sorted-before-dispatch.html b/third_party/WebKit/LayoutTests/media/track/track-cues-sorted-before-dispatch.html index 8c6df18..e602ee1 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-cues-sorted-before-dispatch.html +++ b/third_party/WebKit/LayoutTests/media/track/track-cues-sorted-before-dispatch.html
@@ -1,91 +1,48 @@ <!DOCTYPE html> -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<title>Tests that all events are triggered in chronological order.</title> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../media-file.js"></script> +<video> + <track src="captions-webvtt/sorted-dispatch.vtt" default> +</video> +<script> +async_test(function(t) { + var video = document.querySelector("video"); + video.src = findMediaFile("video", "../content/test"); + var track = document.querySelector("track"); - <script src=../media-file.js></script> - <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 - (Please avoid writing new tests using video-test.js) --> - <script src=../video-test.js></script> - <script> - var videoCanPlayThrough = false; - var trackLoaded = false; + track.onload = t.step_func(function() { + var cues = track.track.cues; + assert_equals(cues.length, 8); - var currentCue; - var testTrack; + for (var i = 0; i < cues.length; ++i) { + cues[i].onenter = t.step_func(cueEnteredOrExited); + cues[i].onexit = t.step_func(cueEnteredOrExited); + } - var dispatchedEvents = []; + video.play(); + }); - function runTests() - { - if (!trackLoaded || !videoCanPlayThrough) - return; + var cueTimings = []; + function cueEnteredOrExited(event) { + var currentCue = event.target; - testTrack = document.getElementById("testTrack"); - testExpected("testTrack.track.cues.length", 8); + if (event.type == "exit") + cueTimings.push(currentCue.endTime); + else + cueTimings.push(currentCue.startTime); + } - for (var i = 0; i < testTrack.track.cues.length; ++i) { - testTrack.track.cues[i].addEventListener('enter', cueEnteredOrExited); - testTrack.track.cues[i].addEventListener('exit', cueEnteredOrExited); - } + video.onended = t.step_func_done(function() { + assert_equals(cueTimings.length, 14); + var time = 0; + for (var i = 0; i < cueTimings.length; ++i) { + assert_less_than_equal(time, cueTimings[i], "cueTimings[" + i + "]"); + time = cueTimings[i]; + } + }); - run("video.play()"); - } - - function cueEnteredOrExited(event) - { - currentCue = event.target; - - var eventObj = {}; - - eventObj.time = currentCue.startTime; - if (event.type == 'exit') - eventObj.time = currentCue.endTime; - - eventObj.type = event.type; - eventObj.cue = currentCue; - - dispatchedEvents.push(eventObj); - } - - function loaded() - { - trackLoaded = true; - runTests(); - } - - function bodyLoaded() - { - findMediaElement(); - video.src = findMediaFile("video", "../content/test"); - } - - function logEndTest() - { - for (var i = 0; i < dispatchedEvents.length; ++i) { - consoleWrite("Cue event: " + dispatchedEvents[i].type + - " id: " + dispatchedEvents[i].cue.id + - " time: " + dispatchedEvents[i].time); - } - - endTest(); - } - - waitForEvent('ended', logEndTest); - - waitForEventOnce('canplaythrough', function() { - video.currentTime = 5.00; - videoCanPlayThrough = true; - - runTests(); - }); - - </script> - </head> - <body onload="bodyLoaded()"> - <p>Tests that all events events are triggered in chronological order.</p> - <video controls> - <track id="testTrack" src="captions-webvtt/sorted-dispatch.vtt" onload="loaded()" default> - </video> - </body> -</html> + video.currentTime = 5; +}); +</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-delete-during-setup-expected.txt b/third_party/WebKit/LayoutTests/media/track/track-delete-during-setup-expected.txt deleted file mode 100644 index 75f353c0..0000000 --- a/third_party/WebKit/LayoutTests/media/track/track-delete-during-setup-expected.txt +++ /dev/null
@@ -1,7 +0,0 @@ -> - -EXPECTED (track1.readyState == '0') OK -EXPECTED (track1.track.mode == 'disabled') OK - -END OF TEST -
diff --git a/third_party/WebKit/LayoutTests/media/track/track-delete-during-setup.html b/third_party/WebKit/LayoutTests/media/track/track-delete-during-setup.html index ba497bd4..ac71340d 100644 --- a/third_party/WebKit/LayoutTests/media/track/track-delete-during-setup.html +++ b/third_party/WebKit/LayoutTests/media/track/track-delete-during-setup.html
@@ -1,54 +1,36 @@ - > +<!DOCTYPE html> +<title>Tests track deletion during setup.</title> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../media-file.js"></script> +<script> +// This should not be necessary, but due to crbug.com/372245 style +// gets dirtied during layout in LayoutTextTrackContainer which +// causes assertions to fail when Document::scrollingElement is +// queried during compositing update (a valid request). +internals.settings.setCompositorWorkerEnabled(false); +</script> +<video> + <track src="captions-webvtt/metadata.vtt"> +</video> +<script> +async_test(function(t) { + var video = document.querySelector("video"); + var track = document.querySelector("track"); + setTimeout(function() { + video.parentNode.removeChild(video); + }, 61); - <script> - if (window.internals) - { - // This should not be necessary, but due to crbug.com/372245 style - // gets dirtied during layout in LayoutTextTrackContainer which - // causes assertions to fail when Document::scrollingElement is - // queried during compositing update (a valid request). - window.internals.settings.setCompositorWorkerEnabled(false); - } - </script> - <script src=../media-file.js></script> -<script></script> -<script></script> -<script>setTimeout("try { var v = document.querySelector('video'); v.parentNode.removeChild(v); } catch(e) {}", 61);</script> -<meta> -<!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 - (Please avoid writing new tests using video-test.js) --> -<script src=../video-test.js></script> - <script> + track.onload = t.step_func(function() { + var track2 = document.createElement("track"); + video.appendChild(track2); + setTimeout(function() { t.done(); }, 100); + }); - { - } + assert_equals(track.readyState, HTMLTrackElement.NONE); + assert_equals(track.track.mode, "disabled"); + track.track.mode = "hidden"; - function metadataTrackLoaded() - { - track2 = document.createElement('track'); - video.appendChild(track2); - setTimeout("endTest()", 100); - } - - function canplaythrough() - { - track1.track.mode = "hidden"; - setTimeout("endTest()", 100); - } - - function start() - { - consoleWrite("<feOffset>"); - findMediaElement(); - - track1 = document.querySelectorAll('track')[0]; - testExpected("track1.readyState", HTMLTrackElement.NONE); - testExpected("track1.track.mode", "disabled"); - - video.src = findMediaFile("video", "../content/test"); - consoleWrite(""); - } - </script> - <body onload="start()"> -<command><aside><kbd><video oncanplaythrough="canplaythrough()" > - <track src="captions-webvtt/metadata.vtt" onload="metadataTrackLoaded()"> + video.src = findMediaFile("video", "../content/test"); +}); +</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-expected.txt b/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-expected.txt deleted file mode 100644 index 32ee4e3..0000000 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-expected.txt +++ /dev/null
@@ -1,10 +0,0 @@ -Test currentTime values when setting while HAVE_NOTHING. - - -EXPECTED (video.currentTime == '0') OK -EXPECTED (video.currentTime == '1') OK -EVENT(loadedmetadata) -EXPECTED (video.currentTime == '1') OK -EVENT(seeked) -END OF TEST -
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-media-fragment-uri-expected.txt b/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-media-fragment-uri-expected.txt deleted file mode 100644 index 247f01e58..0000000 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-media-fragment-uri-expected.txt +++ /dev/null
@@ -1,6 +0,0 @@ -EXPECTED (video.currentTime == '0') OK -EVENT(loadedmetadata) -EXPECTED (video.currentTime == '1') OK -EVENT(seeked) -END OF TEST -
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-media-fragment-uri.html b/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-media-fragment-uri.html index 870bd6a6..453517d 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-media-fragment-uri.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata-media-fragment-uri.html
@@ -1,27 +1,20 @@ <!DOCTYPE html> -<html> - <head> - <title>Test currentTime values when setting while HAVE_NOTHING for media fragment URI.</title> - </head> - <body> - <video id="video"></video> - <script src=media-file.js></script> - <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 - (Please avoid writing new tests using video-test.js) --> - <script src=video-test.js></script> - <script> - video = document.getElementById('video'); +<title>Test currentTime values when setting while readystate is HAVE_NOTHING for media fragment URI.</title> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> +<script src="media-file.js"></script> +<video></video> +<script> +async_test(function(t) { + var video = document.querySelector("video"); + video.src = findMediaFile("video", "content/test") + "#t=2"; + assert_equals(video.currentTime, 0); + video.currentTime = 1; - video.src = findMediaFile("video", "content/test") + "#t=2"; - testExpected("video.currentTime", 0); - video.currentTime = 1; + video.onloadedmetadata = t.step_func(function() { + assert_equals(video.currentTime, 1); + }); - waitForEvent('loadedmetadata', function() - { - testExpected("video.currentTime", 1); - }); - - waitForEventAndEnd('seeked'); - </script> - </body> -</html> + video.onseeked = t.step_func_done(); +}); +</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata.html b/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata.html index 2d10b85..4bea570 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime-before-have-metadata.html
@@ -1,34 +1,21 @@ <!DOCTYPE html> -<html> - <head> - <script src=media-file.js></script> - <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 - (Please avoid writing new tests using video-test.js) --> - <script src=video-test.js></script> - <script> - function onWindowLoad(e) - { - video = document.getElementById('video'); +<title>Test currentTime values when setting while readystate is HAVE_NOTHING.</title> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> +<script src="media-file.js"></script> +<video></video> +<script> +async_test(function(t) { + var video = document.querySelector("video"); + video.src = findMediaFile("video", "content/test"); + assert_equals(video.currentTime, 0); + video.currentTime = 1; + assert_equals(video.currentTime, 1); - video.src = findMediaFile("video", "content/test"); - testExpected("video.currentTime", 0); - video.currentTime = 1; - testExpected("video.currentTime", 1); + video.onloadedmetadata = t.step_func(function() { + assert_equals(video.currentTime, 1); + }); - waitForEvent('loadedmetadata', function() - { - testExpected("video.currentTime", 1); - }); - - waitForEventAndEnd('seeked'); - } - - window.addEventListener('load', onWindowLoad, false); - </script> - </head> - <body> - <video controls id="video"></video> - <p>Test currentTime values when setting while HAVE_NOTHING.</p> - <br/> - </body> -</html> + video.onseeked = t.step_func_done(); +}); +</script> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-delay-expected.txt b/third_party/WebKit/LayoutTests/media/video-currentTime-delay-expected.txt deleted file mode 100644 index 58f18cda..0000000 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-delay-expected.txt +++ /dev/null
@@ -1,10 +0,0 @@ -Test a delay in playing the movie results in a canPlay event. - -EVENT(canplaythrough) -EXPECTED (video.currentTime == '0') OK -RUN(video.currentTime = video.duration - 0.2) -EVENT(seeked) -RUN(video.play()) -EVENT(ended) -END OF TEST -
diff --git a/third_party/WebKit/LayoutTests/media/video-currentTime-delay.html b/third_party/WebKit/LayoutTests/media/video-currentTime-delay.html index 2307eec1..be0fff4 100644 --- a/third_party/WebKit/LayoutTests/media/video-currentTime-delay.html +++ b/third_party/WebKit/LayoutTests/media/video-currentTime-delay.html
@@ -1,32 +1,26 @@ -<html> -<body> +<!DOCTYPE html> +<title>Test, a delay in playing the movie still results in an "ended" event.</title> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> +<script src="media-file.js"></script> +<video></video> +<script> +async_test(function(t) { + var video = document.querySelector("video"); - <video controls></video> - - <p>Test a delay in playing the movie results in a canPlay event.</p> - - <script src=media-file.js></script> - <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 - (Please avoid writing new tests using video-test.js) --> - <script src=video-test.js></script> - <script> - waitForEventOnce('canplaythrough', - function () { - waitForEventAndEnd('ended'); - - testExpected("video.currentTime", 0); - run("video.currentTime = video.duration - 0.2"); + video.oncanplaythrough = t.step_func(function() { + video.oncanplaythrough = null; + assert_equals(video.currentTime, 0); + video.currentTime = video.duration - 0.2; }); - waitForEvent('seeked', - function () { + video.onseeked = t.step_func(function () { setTimeout(function() { - run("video.play()"); + video.play(); }, 400); }); + video.onended = t.step_func_done(); video.src = findMediaFile("video", "content/test"); - </script> - -</body> -</html> +}); +</script> \ No newline at end of file
diff --git a/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.h b/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.h index 2ad759d..c3335ddc 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.h +++ b/third_party/WebKit/Source/bindings/core/v8/ActiveDOMCallback.h
@@ -33,7 +33,6 @@ #include "core/CoreExport.h" #include "core/dom/ContextLifecycleObserver.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h b/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h index ef7959d..ee01896 100644 --- a/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h +++ b/third_party/WebKit/Source/bindings/core/v8/CallbackPromiseAdapter.h
@@ -33,10 +33,8 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "public/platform/WebCallbacks.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/TypeTraits.h" - #include <memory> namespace blink { @@ -50,7 +48,7 @@ // called trivial WebType holder is used. For example, // CallbackPromiseAdapter<bool, void> is a subclass of // WebCallbacks<bool, void>. -// - If a WebType is OwnPtr<T>, its corresponding type parameter on +// - If a WebType is std::unique_ptr<T>, its corresponding type parameter on // WebCallbacks is std::unique_ptr<T>, because WebCallbacks must be exposed to // Chromium. // @@ -64,9 +62,9 @@ // Example: // class MyClass { // public: -// using WebType = OwnPtr<WebMyClass>; +// using WebType = std::unique_ptr<WebMyClass>; // static PassRefPtr<MyClass> take(ScriptPromiseResolver* resolver, -// PassOwnPtr<WebMyClass> webInstance) +// std::unique_ptr<WebMyClass> webInstance) // { // return MyClass::create(webInstance); // } @@ -82,20 +80,20 @@ // } // ... // }; -// OwnPtr<WebCallbacks<std::unique_ptr<WebMyClass>, const WebMyErrorClass&>> -// callbacks = adoptPtr(new CallbackPromiseAdapter<MyClass, MyErrorClass>( +// std::unique_ptr<WebCallbacks<std::unique_ptr<WebMyClass>, const WebMyErrorClass&>> +// callbacks = wrapUnique(new CallbackPromiseAdapter<MyClass, MyErrorClass>( // resolver)); // ... // -// OwnPtr<WebCallbacks<bool, const WebMyErrorClass&>> callbacks2 = -// adoptPtr(new CallbackPromiseAdapter<bool, MyErrorClass>(resolver)); +// std::unique_ptr<WebCallbacks<bool, const WebMyErrorClass&>> callbacks2 = +// wrapUnique(new CallbackPromiseAdapter<bool, MyErrorClass>(resolver)); // ... // // // In order to implement the above exceptions, we have template classes below. // OnSuccess and OnError provide onSuccess and onError implementation, and there // are utility templates that provide -// - OwnPtr - WebPassOwnPtr translation ([Web]PassType[Impl], adopt, pass), +// - std::unique_ptr - WebPassOwnPtr translation ([Web]PassType[Impl], adopt, pass), // - trivial WebType holder (TrivialWebTypeHolder). namespace internal { @@ -125,24 +123,24 @@ using Type = T; }; template <typename T> - struct PassTypeImpl<OwnPtr<T>> { - using Type = PassOwnPtr<T>; + struct PassTypeImpl<std::unique_ptr<T>> { + using Type = std::unique_ptr<T>; }; template <typename T> struct WebPassTypeImpl { using Type = T; }; template <typename T> - struct WebPassTypeImpl<OwnPtr<T>> { + struct WebPassTypeImpl<std::unique_ptr<T>> { using Type = std::unique_ptr<T>; }; template <typename T> using PassType = typename PassTypeImpl<T>::Type; template <typename T> using WebPassType = typename WebPassTypeImpl<T>::Type; template <typename T> static T& adopt(T& x) { return x; } template <typename T> - static PassOwnPtr<T> adopt(std::unique_ptr<T>& x) { return adoptPtr(x.release()); } + static std::unique_ptr<T> adopt(std::unique_ptr<T>& x) { return std::move(x); } template <typename T> static PassType<T> pass(T& x) { return x; } - template <typename T> static PassOwnPtr<T> pass(OwnPtr<T>& x) { return std::move(x); } + template <typename T> static std::unique_ptr<T> pass(std::unique_ptr<T>& x) { return std::move(x); } template <typename S, typename T> class Base : public WebCallbacks<WebPassType<typename S::WebType>, WebPassType<typename T::WebType>> {
diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h b/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h index 0798125..23eab6a 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h +++ b/third_party/WebKit/Source/bindings/core/v8/DOMDataStore.h
@@ -37,8 +37,9 @@ #include "bindings/core/v8/WrapperTypeInfo.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" +#include <memory> #include <v8.h> namespace blink { @@ -52,7 +53,7 @@ DOMDataStore(v8::Isolate* isolate, bool isMainWorld) : m_isMainWorld(isMainWorld) // We never use |m_wrapperMap| when it's the main world. - , m_wrapperMap(adoptPtr( + , m_wrapperMap(wrapUnique( isMainWorld ? nullptr : new DOMWrapperMap<ScriptWrappable>(isolate))) { } @@ -216,7 +217,7 @@ } bool m_isMainWorld; - OwnPtr<DOMWrapperMap<ScriptWrappable>> m_wrapperMap; + std::unique_ptr<DOMWrapperMap<ScriptWrappable>> m_wrapperMap; }; template<>
diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp index ee0a071..40a6326e 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp
@@ -40,7 +40,9 @@ #include "bindings/core/v8/WrapperTypeInfo.h" #include "core/dom/ExecutionContext.h" #include "wtf/HashTraits.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { @@ -69,9 +71,9 @@ template<typename T> class DOMObjectHolder : public DOMObjectHolderBase { public: - static PassOwnPtr<DOMObjectHolder<T>> create(v8::Isolate* isolate, T* object, v8::Local<v8::Value> wrapper) + static std::unique_ptr<DOMObjectHolder<T>> create(v8::Isolate* isolate, T* object, v8::Local<v8::Value> wrapper) { - return adoptPtr(new DOMObjectHolder(isolate, object, wrapper)); + return wrapUnique(new DOMObjectHolder(isolate, object, wrapper)); } private: @@ -94,7 +96,7 @@ DOMWrapperWorld::DOMWrapperWorld(v8::Isolate* isolate, int worldId, int extensionGroup) : m_worldId(worldId) , m_extensionGroup(extensionGroup) - , m_domDataStore(adoptPtr(new DOMDataStore(isolate, isMainWorld()))) + , m_domDataStore(wrapUnique(new DOMDataStore(isolate, isMainWorld()))) { } @@ -305,7 +307,7 @@ template void DOMWrapperWorld::registerDOMObjectHolder(v8::Isolate*, ScriptFunction*, v8::Local<v8::Value>); -void DOMWrapperWorld::registerDOMObjectHolderInternal(PassOwnPtr<DOMObjectHolderBase> holderBase) +void DOMWrapperWorld::registerDOMObjectHolderInternal(std::unique_ptr<DOMObjectHolderBase> holderBase) { ASSERT(!m_domObjectHolders.contains(holderBase.get())); holderBase->setWorld(this);
diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h index 6fa14ed..ae73701 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h +++ b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.h
@@ -37,6 +37,7 @@ #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" +#include <memory> #include <v8.h> namespace blink { @@ -123,15 +124,15 @@ DOMWrapperWorld(v8::Isolate*, int worldId, int extensionGroup); static void weakCallbackForDOMObjectHolder(const v8::WeakCallbackInfo<DOMObjectHolderBase>&); - void registerDOMObjectHolderInternal(PassOwnPtr<DOMObjectHolderBase>); + void registerDOMObjectHolderInternal(std::unique_ptr<DOMObjectHolderBase>); void unregisterDOMObjectHolder(DOMObjectHolderBase*); static unsigned isolatedWorldCount; const int m_worldId; const int m_extensionGroup; - OwnPtr<DOMDataStore> m_domDataStore; - HashSet<OwnPtr<DOMObjectHolderBase>> m_domObjectHolders; + std::unique_ptr<DOMDataStore> m_domDataStore; + HashSet<std::unique_ptr<DOMObjectHolderBase>> m_domObjectHolders; }; } // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/DocumentWriteEvaluator.h b/third_party/WebKit/Source/bindings/core/v8/DocumentWriteEvaluator.h index b7f1914..1dffc3e 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DocumentWriteEvaluator.h +++ b/third_party/WebKit/Source/bindings/core/v8/DocumentWriteEvaluator.h
@@ -11,6 +11,8 @@ #include "core/html/parser/CompactHTMLToken.h" #include "core/html/parser/HTMLToken.h" #include "core/html/parser/HTMLTokenizer.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -26,9 +28,9 @@ // For unit testing. DocumentWriteEvaluator(const String& pathName, const String& hostName, const String& protocol, const String& userAgent); - static PassOwnPtr<DocumentWriteEvaluator> create(const Document& document) + static std::unique_ptr<DocumentWriteEvaluator> create(const Document& document) { - return adoptPtr(new DocumentWriteEvaluator(document)); + return wrapUnique(new DocumentWriteEvaluator(document)); } virtual ~DocumentWriteEvaluator();
diff --git a/third_party/WebKit/Source/bindings/core/v8/Microtask.h b/third_party/WebKit/Source/bindings/core/v8/Microtask.h index 2a686dc..c27774f 100644 --- a/third_party/WebKit/Source/bindings/core/v8/Microtask.h +++ b/third_party/WebKit/Source/bindings/core/v8/Microtask.h
@@ -35,7 +35,6 @@ #include "public/platform/WebTaskRunner.h" #include "wtf/Allocator.h" #include "wtf/Functional.h" -#include "wtf/PassOwnPtr.h" #include <v8.h> namespace blink {
diff --git a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp index 2661227..b06ec4f 100644 --- a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp
@@ -19,6 +19,8 @@ #include "public/platform/WebTaskRunner.h" #include "public/platform/WebThread.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -26,9 +28,9 @@ class RejectedPromises::Message final { public: - static PassOwnPtr<Message> create(ScriptState* scriptState, v8::Local<v8::Promise> promise, v8::Local<v8::Value> exception, const String& errorMessage, PassOwnPtr<SourceLocation> location, AccessControlStatus corsStatus) + static std::unique_ptr<Message> create(ScriptState* scriptState, v8::Local<v8::Promise> promise, v8::Local<v8::Value> exception, const String& errorMessage, std::unique_ptr<SourceLocation> location, AccessControlStatus corsStatus) { - return adoptPtr(new Message(scriptState, promise, exception, errorMessage, std::move(location), corsStatus)); + return wrapUnique(new Message(scriptState, promise, exception, errorMessage, std::move(location), corsStatus)); } bool isCollected() @@ -145,7 +147,7 @@ } private: - Message(ScriptState* scriptState, v8::Local<v8::Promise> promise, v8::Local<v8::Value> exception, const String& errorMessage, PassOwnPtr<SourceLocation> location, AccessControlStatus corsStatus) + Message(ScriptState* scriptState, v8::Local<v8::Promise> promise, v8::Local<v8::Value> exception, const String& errorMessage, std::unique_ptr<SourceLocation> location, AccessControlStatus corsStatus) : m_scriptState(scriptState) , m_promise(scriptState->isolate(), promise) , m_exception(scriptState->isolate(), exception) @@ -175,7 +177,7 @@ ScopedPersistent<v8::Value> m_exception; String m_errorMessage; String m_resourceName; - OwnPtr<SourceLocation> m_location; + std::unique_ptr<SourceLocation> m_location; unsigned m_consoleMessageId; bool m_collected; bool m_shouldLogToConsole; @@ -190,7 +192,7 @@ { } -void RejectedPromises::rejectedWithNoHandler(ScriptState* scriptState, v8::PromiseRejectMessage data, const String& errorMessage, PassOwnPtr<SourceLocation> location, AccessControlStatus corsStatus) +void RejectedPromises::rejectedWithNoHandler(ScriptState* scriptState, v8::PromiseRejectMessage data, const String& errorMessage, std::unique_ptr<SourceLocation> location, AccessControlStatus corsStatus) { m_queue.append(Message::create(scriptState, data.GetPromise(), data.GetValue(), errorMessage, std::move(location), corsStatus)); } @@ -207,19 +209,19 @@ // Then look it up in the reported errors. for (size_t i = 0; i < m_reportedAsErrors.size(); ++i) { - OwnPtr<Message>& message = m_reportedAsErrors.at(i); + std::unique_ptr<Message>& message = m_reportedAsErrors.at(i); if (!message->isCollected() && message->hasPromise(data.GetPromise())) { message->makePromiseStrong(); - Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTask(BLINK_FROM_HERE, bind(&RejectedPromises::revokeNow, this, passed(std::move(message)))); + Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTask(BLINK_FROM_HERE, WTF::bind(&RejectedPromises::revokeNow, this, passed(std::move(message)))); m_reportedAsErrors.remove(i); return; } } } -PassOwnPtr<RejectedPromises::MessageQueue> RejectedPromises::createMessageQueue() +std::unique_ptr<RejectedPromises::MessageQueue> RejectedPromises::createMessageQueue() { - return adoptPtr(new MessageQueue()); + return wrapUnique(new MessageQueue()); } void RejectedPromises::dispose() @@ -227,7 +229,7 @@ if (m_queue.isEmpty()) return; - OwnPtr<MessageQueue> queue = createMessageQueue(); + std::unique_ptr<MessageQueue> queue = createMessageQueue(); queue->swap(m_queue); processQueueNow(std::move(queue)); } @@ -237,12 +239,12 @@ if (m_queue.isEmpty()) return; - OwnPtr<MessageQueue> queue = createMessageQueue(); + std::unique_ptr<MessageQueue> queue = createMessageQueue(); queue->swap(m_queue); - Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTask(BLINK_FROM_HERE, bind(&RejectedPromises::processQueueNow, PassRefPtr<RejectedPromises>(this), passed(std::move(queue)))); + Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTask(BLINK_FROM_HERE, WTF::bind(&RejectedPromises::processQueueNow, PassRefPtr<RejectedPromises>(this), passed(std::move(queue)))); } -void RejectedPromises::processQueueNow(PassOwnPtr<MessageQueue> queue) +void RejectedPromises::processQueueNow(std::unique_ptr<MessageQueue> queue) { // Remove collected handlers. for (size_t i = 0; i < m_reportedAsErrors.size();) { @@ -253,7 +255,7 @@ } while (!queue->isEmpty()) { - OwnPtr<Message> message = queue->takeFirst(); + std::unique_ptr<Message> message = queue->takeFirst(); if (message->isCollected()) continue; if (!message->hasHandler()) { @@ -266,7 +268,7 @@ } } -void RejectedPromises::revokeNow(PassOwnPtr<Message> message) +void RejectedPromises::revokeNow(std::unique_ptr<Message> message) { message->revoke(); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h index 5fd0239f..add3226 100644 --- a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h +++ b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h
@@ -11,6 +11,7 @@ #include "wtf/Forward.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" +#include <memory> namespace v8 { class PromiseRejectMessage; @@ -31,7 +32,7 @@ ~RejectedPromises(); void dispose(); - void rejectedWithNoHandler(ScriptState*, v8::PromiseRejectMessage, const String& errorMessage, PassOwnPtr<SourceLocation>, AccessControlStatus); + void rejectedWithNoHandler(ScriptState*, v8::PromiseRejectMessage, const String& errorMessage, std::unique_ptr<SourceLocation>, AccessControlStatus); void handlerAdded(v8::PromiseRejectMessage); void processQueue(); @@ -41,14 +42,14 @@ RejectedPromises(); - using MessageQueue = Deque<OwnPtr<Message>>; - PassOwnPtr<MessageQueue> createMessageQueue(); + using MessageQueue = Deque<std::unique_ptr<Message>>; + std::unique_ptr<MessageQueue> createMessageQueue(); - void processQueueNow(PassOwnPtr<MessageQueue>); - void revokeNow(PassOwnPtr<Message>); + void processQueueNow(std::unique_ptr<MessageQueue>); + void revokeNow(std::unique_ptr<Message>); MessageQueue m_queue; - Vector<OwnPtr<Message>> m_reportedAsErrors; + Vector<std::unique_ptr<Message>> m_reportedAsErrors; }; } // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h b/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h index 83b87cd..c1d44ec 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h
@@ -33,6 +33,7 @@ #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include <memory> #include <v8.h> namespace blink { @@ -92,7 +93,7 @@ m_handle.Reset(isolate, handle); } - // Note: This is clear in the OwnPtr sense, not the v8::Handle sense. + // Note: This is clear in the std::unique_ptr sense, not the v8::Handle sense. void clear() { m_handle.Reset();
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp index ad130a9..7c23a8f1 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.cpp
@@ -9,6 +9,8 @@ #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8HiddenValue.h" #include "core/dom/ExecutionContext.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -81,7 +83,7 @@ v8::HandleScope handleScope(m_isolate); size_t i = 0; while (i < m_wrappers.size()) { - const OwnPtr<ScopedPersistent<v8::Object>>& persistent = m_wrappers[i]; + const std::unique_ptr<ScopedPersistent<v8::Object>>& persistent = m_wrappers[i]; if (persistent->isEmpty()) { // wrapper has died. // Since v8 GC can run during the iteration and clear the reference, @@ -129,7 +131,7 @@ v8::Local<v8::Context> context = scriptState->context(); size_t i = 0; while (i < m_wrappers.size()) { - const OwnPtr<ScopedPersistent<v8::Object>>& persistent = m_wrappers[i]; + const std::unique_ptr<ScopedPersistent<v8::Object>>& persistent = m_wrappers[i]; if (persistent->isEmpty()) { // wrapper has died. // Since v8 GC can run during the iteration and clear the reference, @@ -144,7 +146,7 @@ ++i; } v8::Local<v8::Object> wrapper = holder(m_isolate, context->Global()); - OwnPtr<ScopedPersistent<v8::Object>> weakPersistent = adoptPtr(new ScopedPersistent<v8::Object>); + std::unique_ptr<ScopedPersistent<v8::Object>> weakPersistent = wrapUnique(new ScopedPersistent<v8::Object>); weakPersistent->set(m_isolate, wrapper); weakPersistent->setWeak(weakPersistent.get(), &clearHandle); m_wrappers.append(std::move(weakPersistent));
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.h b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.h index 2aa2cdc..4b0a07f2 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.h
@@ -11,9 +11,9 @@ #include "core/CoreExport.h" #include "core/dom/ContextLifecycleObserver.h" #include "wtf/Compiler.h" -#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" +#include <memory> #include <v8.h> namespace blink { @@ -63,7 +63,7 @@ NEVER_INLINE void resetBase(); private: - typedef Vector<OwnPtr<ScopedPersistent<v8::Object>>> WeakPersistentSet; + typedef Vector<std::unique_ptr<ScopedPersistent<v8::Object>>> WeakPersistentSet; void resolveOrRejectInternal(v8::Local<v8::Promise::Resolver>); v8::Local<v8::Object> ensureHolderWrapper(ScriptState*);
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp index b39a29e3..1cc2e7f 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
@@ -18,10 +18,9 @@ #include "core/testing/GarbageCollectedScriptWrappable.h" #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> #include <v8.h> using namespace blink; @@ -144,7 +143,7 @@ } private: - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; RefPtr<ScriptState> m_otherScriptState; };
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp index 10a1cf5..e1f7e55 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp
@@ -11,6 +11,7 @@ #include "core/dom/Document.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> #include <v8.h> namespace blink { @@ -62,7 +63,7 @@ v8::MicrotasksScope::PerformCheckpoint(isolate()); } - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; ScriptState* getScriptState() const { return ScriptState::forMainWorld(&m_pageHolder->frame()); } ExecutionContext* getExecutionContext() const { return &m_pageHolder->document(); } v8::Isolate* isolate() const { return getScriptState()->isolate(); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptState.h b/third_party/WebKit/Source/bindings/core/v8/ScriptState.h index b5555e2..58d48a9 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptState.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptState.h
@@ -9,6 +9,7 @@ #include "bindings/core/v8/V8PerContextData.h" #include "core/CoreExport.h" #include "wtf/RefCounted.h" +#include <memory> #include <v8-debug.h> #include <v8.h> @@ -115,11 +116,11 @@ // This RefPtr doesn't cause a cycle because all persistent handles that DOMWrapperWorld holds are weak. RefPtr<DOMWrapperWorld> m_world; - // This OwnPtr causes a cycle: - // V8PerContextData --(Persistent)--> v8::Context --(RefPtr)--> ScriptState --(OwnPtr)--> V8PerContextData - // So you must explicitly clear the OwnPtr by calling disposePerContextData() + // This std::unique_ptr causes a cycle: + // V8PerContextData --(Persistent)--> v8::Context --(RefPtr)--> ScriptState --(std::unique_ptr)--> V8PerContextData + // So you must explicitly clear the std::unique_ptr by calling disposePerContextData() // once you no longer need V8PerContextData. Otherwise, the v8::Context will leak. - OwnPtr<V8PerContextData> m_perContextData; + std::unique_ptr<V8PerContextData> m_perContextData; #if ENABLE(ASSERT) bool m_globalObjectDetached;
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp index 642cb5c..d286f91 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
@@ -18,7 +18,9 @@ #include "platform/TraceEvent.h" #include "public/platform/WebScheduler.h" #include "wtf/Deque.h" +#include "wtf/PtrUtil.h" #include "wtf/text/TextEncodingRegistry.h" +#include <memory> namespace blink { @@ -179,7 +181,7 @@ , m_queueTailPosition(0) , m_bookmarkPosition(0) , m_lengthOfBOM(0) - , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone())) + , m_loadingTaskRunner(wrapUnique(loadingTaskRunner->clone())) { } @@ -387,7 +389,7 @@ // m_queueLeadPosition references with a mutex. size_t m_lengthOfBOM; // Used by both threads; guarded by m_mutex. - OwnPtr<WebTaskRunner> m_loadingTaskRunner; + std::unique_ptr<WebTaskRunner> m_loadingTaskRunner; }; size_t ScriptStreamer::s_smallScriptThreshold = 30 * 1024; @@ -500,7 +502,7 @@ const char* data = 0; size_t length = resource->resourceBuffer()->getSomeData(data, static_cast<size_t>(0)); - OwnPtr<TextResourceDecoder> decoder(TextResourceDecoder::create("application/javascript", resource->encoding())); + std::unique_ptr<TextResourceDecoder> decoder(TextResourceDecoder::create("application/javascript", resource->encoding())); lengthOfBOM = decoder->checkForBOM(data, length); // Maybe the encoding changed because we saw the BOM; get the encoding @@ -533,10 +535,10 @@ ASSERT(!m_source); m_stream = new SourceStream(m_loadingTaskRunner.get()); // m_source takes ownership of m_stream. - m_source = adoptPtr(new v8::ScriptCompiler::StreamedSource(m_stream, m_encoding)); + m_source = wrapUnique(new v8::ScriptCompiler::StreamedSource(m_stream, m_encoding)); ScriptState::Scope scope(m_scriptState.get()); - OwnPtr<v8::ScriptCompiler::ScriptStreamingTask> scriptStreamingTask(adoptPtr(v8::ScriptCompiler::StartStreamingScript(m_scriptState->isolate(), m_source.get(), m_compileOptions))); + std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask> scriptStreamingTask(wrapUnique(v8::ScriptCompiler::StartStreamingScript(m_scriptState->isolate(), m_source.get(), m_compileOptions))); if (!scriptStreamingTask) { // V8 cannot stream the script. suppressStreaming(); @@ -589,7 +591,7 @@ , m_scriptURLString(m_resource->url().copy().getString()) , m_scriptResourceIdentifier(m_resource->identifier()) , m_encoding(v8::ScriptCompiler::StreamedSource::TWO_BYTE) // Unfortunately there's no dummy encoding value in the enum; let's use one we don't stream. - , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone())) + , m_loadingTaskRunner(wrapUnique(loadingTaskRunner->clone())) { }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h index bf02e5b7..ac2e4e1 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.h
@@ -9,7 +9,7 @@ #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" #include "wtf/text/WTFString.h" - +#include <memory> #include <v8.h> namespace blink { @@ -120,7 +120,7 @@ bool m_detached; SourceStream* m_stream; - OwnPtr<v8::ScriptCompiler::StreamedSource> m_source; + std::unique_ptr<v8::ScriptCompiler::StreamedSource> m_source; bool m_loadingFinished; // Whether loading from the network is done. // Whether the V8 side processing is done. Will be used by the main thread // and the streamer thread; guarded by m_mutex. @@ -151,7 +151,7 @@ // Encoding of the streamed script. Saved for sanity checking purposes. v8::ScriptCompiler::StreamedSource::Encoding m_encoding; - OwnPtr<WebTaskRunner> m_loadingTaskRunner; + std::unique_ptr<WebTaskRunner> m_loadingTaskRunner; }; } // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp index 755bc90..f2227688 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
@@ -18,6 +18,7 @@ #include "public/platform/Platform.h" #include "public/platform/WebScheduler.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> #include <v8.h> namespace blink { @@ -84,7 +85,7 @@ } WebTaskRunner* m_loadingTaskRunner; // NOT OWNED - OwnPtr<Settings> m_settings; + std::unique_ptr<Settings> m_settings; // The Resource and PendingScript where we stream from. These don't really // fetch any data outside the test; the test controls the data by calling // ScriptResource::appendData.
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.cpp index f6f1fed2..0eec3d3 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.cpp
@@ -10,6 +10,8 @@ #include "public/platform/Platform.h" #include "public/platform/WebTaskRunner.h" #include "public/platform/WebTraceLocation.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -72,11 +74,11 @@ WebThread& ScriptStreamerThread::platformThread() { if (!isRunning()) - m_thread = adoptPtr(Platform::current()->createThread("ScriptStreamerThread")); + m_thread = wrapUnique(Platform::current()->createThread("ScriptStreamerThread")); return *m_thread; } -void ScriptStreamerThread::runScriptStreamingTask(PassOwnPtr<v8::ScriptCompiler::ScriptStreamingTask> task, ScriptStreamer* streamer) +void ScriptStreamerThread::runScriptStreamingTask(std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask> task, ScriptStreamer* streamer) { TRACE_EVENT1("v8,devtools.timeline", "v8.parseOnBackground", "data", InspectorParseScriptEvent::data(streamer->scriptResourceIdentifier(), streamer->scriptURLString())); // Running the task can and will block: SourceStream::GetSomeData will get
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.h b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.h index 65a5dfbc..9eb13bc 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerThread.h
@@ -9,9 +9,7 @@ #include "platform/TaskSynchronizer.h" #include "public/platform/WebThread.h" #include "wtf/Functional.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" - +#include <memory> #include <v8.h> namespace blink { @@ -37,7 +35,7 @@ void taskDone(); - static void runScriptStreamingTask(PassOwnPtr<v8::ScriptCompiler::ScriptStreamingTask>, ScriptStreamer*); + static void runScriptStreamingTask(std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask>, ScriptStreamer*); private: ScriptStreamerThread() @@ -52,7 +50,7 @@ // At the moment, we only use one thread, so we can only stream one script // at a time. FIXME: Use a thread pool and stream multiple scripts. - OwnPtr<WebThread> m_thread; + std::unique_ptr<WebThread> m_thread; bool m_runningTask; mutable Mutex m_mutex; // Guards m_runningTask. };
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp index bafbf8f..e6e90663 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp
@@ -29,6 +29,7 @@ #include "wtf/DateMath.h" #include "wtf/text/StringHash.h" #include "wtf/text/StringUTF8Adaptor.h" +#include <memory> // FIXME: consider crashing in debug mode on deserialization errors // NOTE: be sure to change wireFormatVersion as necessary! @@ -1106,7 +1107,7 @@ m_writer.writeTransferredImageBitmap(index); } else { greyObject(object); - OwnPtr<uint8_t[]> pixelData = imageBitmap->copyBitmapData(PremultiplyAlpha); + std::unique_ptr<uint8_t[]> pixelData = imageBitmap->copyBitmapData(PremultiplyAlpha); m_writer.writeImageBitmap(imageBitmap->width(), imageBitmap->height(), pixelData.get(), imageBitmap->width() * imageBitmap->height() * 4); } return nullptr;
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp index 407a22ef..b2c7ce23 100644 --- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
@@ -52,9 +52,11 @@ #include "platform/heap/Handle.h" #include "wtf/Assertions.h" #include "wtf/ByteOrder.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/StringHash.h" +#include <memory> namespace blink { @@ -176,7 +178,7 @@ } } - OwnPtr<ImageBitmapContentsArray> contents = adoptPtr(new ImageBitmapContentsArray); + std::unique_ptr<ImageBitmapContentsArray> contents = wrapUnique(new ImageBitmapContentsArray); HeapHashSet<Member<ImageBitmap>> visited; for (size_t i = 0; i < imageBitmaps.size(); ++i) { if (visited.contains(imageBitmaps[i])) @@ -221,7 +223,7 @@ } } - OwnPtr<ArrayBufferContentsArray> contents = adoptPtr(new ArrayBufferContentsArray(arrayBuffers.size())); + std::unique_ptr<ArrayBufferContentsArray> contents = wrapUnique(new ArrayBufferContentsArray(arrayBuffers.size())); HeapHashSet<Member<DOMArrayBufferBase>> visited; for (size_t i = 0; i < arrayBuffers.size(); ++i) {
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h index c3261ae..5fbefc2 100644 --- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h +++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
@@ -36,14 +36,10 @@ #include "core/CoreExport.h" #include "wtf/HashMap.h" #include "wtf/ThreadSafeRefCounted.h" +#include "wtf/typed_arrays/ArrayBufferContents.h" +#include <memory> #include <v8.h> -namespace WTF { - -class ArrayBufferContents; - -} - namespace blink { class BlobDataHandle; @@ -131,8 +127,8 @@ private: String m_data; - OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray; - OwnPtr<ImageBitmapContentsArray> m_imageBitmapContentsArray; + std::unique_ptr<ArrayBufferContentsArray> m_arrayBufferContentsArray; + std::unique_ptr<ImageBitmapContentsArray> m_imageBitmapContentsArray; BlobDataHandleMap m_blobDataHandles; intptr_t m_externallyAllocatedMemory;
diff --git a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp index 4195437..61a7f42 100644 --- a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp
@@ -15,6 +15,8 @@ #include "platform/ScriptForbiddenScope.h" #include "platform/TracedValue.h" #include "platform/v8_inspector/public/V8Debugger.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -38,7 +40,7 @@ } // static -PassOwnPtr<SourceLocation> SourceLocation::capture(const String& url, unsigned lineNumber, unsigned columnNumber) +std::unique_ptr<SourceLocation> SourceLocation::capture(const String& url, unsigned lineNumber, unsigned columnNumber) { std::unique_ptr<V8StackTrace> stackTrace = captureStackTrace(false); if (stackTrace && !stackTrace->isEmpty()) @@ -47,7 +49,7 @@ } // static -PassOwnPtr<SourceLocation> SourceLocation::capture(ExecutionContext* executionContext) +std::unique_ptr<SourceLocation> SourceLocation::capture(ExecutionContext* executionContext) { std::unique_ptr<V8StackTrace> stackTrace = captureStackTrace(false); if (stackTrace && !stackTrace->isEmpty()) @@ -67,7 +69,7 @@ } // static -PassOwnPtr<SourceLocation> SourceLocation::fromMessage(v8::Isolate* isolate, v8::Local<v8::Message> message, ExecutionContext* executionContext) +std::unique_ptr<SourceLocation> SourceLocation::fromMessage(v8::Isolate* isolate, v8::Local<v8::Message> message, ExecutionContext* executionContext) { v8::Local<v8::StackTrace> stack = message->GetStackTrace(); std::unique_ptr<V8StackTrace> stackTrace = nullptr; @@ -98,23 +100,23 @@ } // static -PassOwnPtr<SourceLocation> SourceLocation::create(const String& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace, int scriptId) +std::unique_ptr<SourceLocation> SourceLocation::create(const String& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace, int scriptId) { - return adoptPtr(new SourceLocation(url, lineNumber, columnNumber, std::move(stackTrace), scriptId)); + return wrapUnique(new SourceLocation(url, lineNumber, columnNumber, std::move(stackTrace), scriptId)); } // static -PassOwnPtr<SourceLocation> SourceLocation::createFromNonEmptyV8StackTrace(std::unique_ptr<V8StackTrace> stackTrace, int scriptId) +std::unique_ptr<SourceLocation> SourceLocation::createFromNonEmptyV8StackTrace(std::unique_ptr<V8StackTrace> stackTrace, int scriptId) { // Retrieve the data before passing the ownership to SourceLocation. const String& url = stackTrace->topSourceURL(); unsigned lineNumber = stackTrace->topLineNumber(); unsigned columnNumber = stackTrace->topColumnNumber(); - return adoptPtr(new SourceLocation(url, lineNumber, columnNumber, std::move(stackTrace), scriptId)); + return wrapUnique(new SourceLocation(url, lineNumber, columnNumber, std::move(stackTrace), scriptId)); } // static -PassOwnPtr<SourceLocation> SourceLocation::fromFunction(v8::Local<v8::Function> function) +std::unique_ptr<SourceLocation> SourceLocation::fromFunction(v8::Local<v8::Function> function) { if (!function.IsEmpty()) return SourceLocation::create(toCoreStringWithUndefinedOrNullCheck(function->GetScriptOrigin().ResourceName()), function->GetScriptLineNumber() + 1, function->GetScriptColumnNumber() + 1, nullptr, function->ScriptId()); @@ -122,7 +124,7 @@ } // static -PassOwnPtr<SourceLocation> SourceLocation::captureWithFullStackTrace() +std::unique_ptr<SourceLocation> SourceLocation::captureWithFullStackTrace() { std::unique_ptr<V8StackTrace> stackTrace = captureStackTrace(true); if (stackTrace && !stackTrace->isEmpty()) @@ -158,14 +160,14 @@ value->endArray(); } -PassOwnPtr<SourceLocation> SourceLocation::clone() const +std::unique_ptr<SourceLocation> SourceLocation::clone() const { - return adoptPtr(new SourceLocation(m_url, m_lineNumber, m_columnNumber, m_stackTrace ? m_stackTrace->clone() : nullptr, m_scriptId)); + return wrapUnique(new SourceLocation(m_url, m_lineNumber, m_columnNumber, m_stackTrace ? m_stackTrace->clone() : nullptr, m_scriptId)); } -PassOwnPtr<SourceLocation> SourceLocation::isolatedCopy() const +std::unique_ptr<SourceLocation> SourceLocation::isolatedCopy() const { - return adoptPtr(new SourceLocation(m_url.isolatedCopy(), m_lineNumber, m_columnNumber, m_stackTrace ? m_stackTrace->isolatedCopy() : nullptr, m_scriptId)); + return wrapUnique(new SourceLocation(m_url.isolatedCopy(), m_lineNumber, m_columnNumber, m_stackTrace ? m_stackTrace->isolatedCopy() : nullptr, m_scriptId)); } std::unique_ptr<protocol::Runtime::StackTrace> SourceLocation::buildInspectorObject() const
diff --git a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h index d5b6baf..5581621 100644 --- a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h +++ b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.h
@@ -9,8 +9,8 @@ #include "platform/CrossThreadCopier.h" #include "platform/v8_inspector/public/V8StackTrace.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -23,19 +23,19 @@ class CORE_EXPORT SourceLocation { public: // Zero lineNumber and columnNumber mean unknown. Captures current stack trace. - static PassOwnPtr<SourceLocation> capture(const String& url, unsigned lineNumber, unsigned columnNumber); + static std::unique_ptr<SourceLocation> capture(const String& url, unsigned lineNumber, unsigned columnNumber); // Shortcut when location is unknown. Tries to capture call stack or parsing location if available. - static PassOwnPtr<SourceLocation> capture(ExecutionContext* = nullptr); + static std::unique_ptr<SourceLocation> capture(ExecutionContext* = nullptr); - static PassOwnPtr<SourceLocation> fromMessage(v8::Isolate*, v8::Local<v8::Message>, ExecutionContext*); + static std::unique_ptr<SourceLocation> fromMessage(v8::Isolate*, v8::Local<v8::Message>, ExecutionContext*); - static PassOwnPtr<SourceLocation> fromFunction(v8::Local<v8::Function>); + static std::unique_ptr<SourceLocation> fromFunction(v8::Local<v8::Function>); // Forces full stack trace. - static PassOwnPtr<SourceLocation> captureWithFullStackTrace(); + static std::unique_ptr<SourceLocation> captureWithFullStackTrace(); - static PassOwnPtr<SourceLocation> create(const String& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId = 0); + static std::unique_ptr<SourceLocation> create(const String& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId = 0); ~SourceLocation(); bool isUnknown() const { return m_url.isNull() && !m_scriptId && !m_lineNumber; } @@ -44,8 +44,8 @@ unsigned columnNumber() const { return m_columnNumber; } int scriptId() const { return m_scriptId; } - PassOwnPtr<SourceLocation> clone() const; - PassOwnPtr<SourceLocation> isolatedCopy() const; // Safe to pass between threads. + std::unique_ptr<SourceLocation> clone() const; + std::unique_ptr<SourceLocation> isolatedCopy() const; // Safe to pass between threads. // No-op when stack trace is unknown. void toTracedValue(TracedValue*, const char* name) const; @@ -58,7 +58,7 @@ private: SourceLocation(const String& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId); - static PassOwnPtr<SourceLocation> createFromNonEmptyV8StackTrace(std::unique_ptr<V8StackTrace>, int scriptId); + static std::unique_ptr<SourceLocation> createFromNonEmptyV8StackTrace(std::unique_ptr<V8StackTrace>, int scriptId); String m_url; unsigned m_lineNumber; @@ -68,9 +68,9 @@ }; template <> -struct CrossThreadCopier<PassOwnPtr<SourceLocation>> { - using Type = PassOwnPtr<SourceLocation>; - static Type copy(PassOwnPtr<SourceLocation> location) +struct CrossThreadCopier<std::unique_ptr<SourceLocation>> { + using Type = std::unique_ptr<SourceLocation>; + static Type copy(std::unique_ptr<SourceLocation> location) { return location ? location->isolatedCopy() : nullptr; }
diff --git a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.cpp b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.cpp index 91dcdd93..518a119 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.cpp
@@ -30,11 +30,14 @@ #include "bindings/core/v8/V0CustomElementBinding.h" +#include "wtf/PtrUtil.h" +#include <memory> + namespace blink { -PassOwnPtr<V0CustomElementBinding> V0CustomElementBinding::create(v8::Isolate* isolate, v8::Local<v8::Object> prototype) +std::unique_ptr<V0CustomElementBinding> V0CustomElementBinding::create(v8::Isolate* isolate, v8::Local<v8::Object> prototype) { - return adoptPtr(new V0CustomElementBinding(isolate, prototype)); + return wrapUnique(new V0CustomElementBinding(isolate, prototype)); } V0CustomElementBinding::V0CustomElementBinding(v8::Isolate* isolate, v8::Local<v8::Object> prototype)
diff --git a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.h b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.h index 2f5ef1c..ff26119d 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.h +++ b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementBinding.h
@@ -33,7 +33,7 @@ #include "bindings/core/v8/ScopedPersistent.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" +#include <memory> #include <v8.h> namespace blink { @@ -41,7 +41,7 @@ class V0CustomElementBinding { USING_FAST_MALLOC(V0CustomElementBinding); public: - static PassOwnPtr<V0CustomElementBinding> create(v8::Isolate*, v8::Local<v8::Object> prototype); + static std::unique_ptr<V0CustomElementBinding> create(v8::Isolate*, v8::Local<v8::Object> prototype); ~V0CustomElementBinding(); private:
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.h b/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.h index bc2810b..564634a 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.h
@@ -9,8 +9,6 @@ #include "bindings/core/v8/ScriptState.h" #include "wtf/Allocator.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" - #include <v8.h> namespace blink { @@ -47,7 +45,7 @@ ~V8TestingScope(); private: - OwnPtr<DummyPageHolder> m_holder; + std::unique_ptr<DummyPageHolder> m_holder; v8::HandleScope m_handleScope; v8::Local<v8::Context> m_context; v8::Context::Scope m_contextScope;
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp b/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp index 26b67a52..ffeb8a0 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp
@@ -8,11 +8,12 @@ #include "platform/weborigin/KURL.h" #include "wtf/HashMap.h" #include "wtf/text/StringHash.h" +#include <memory> namespace blink { -typedef HashMap<String, OwnPtr<V8DOMActivityLogger>> DOMActivityLoggerMapForMainWorld; -typedef HashMap<int, OwnPtr<V8DOMActivityLogger>, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> DOMActivityLoggerMapForIsolatedWorld; +typedef HashMap<String, std::unique_ptr<V8DOMActivityLogger>> DOMActivityLoggerMapForMainWorld; +typedef HashMap<int, std::unique_ptr<V8DOMActivityLogger>, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> DOMActivityLoggerMapForIsolatedWorld; static DOMActivityLoggerMapForMainWorld& domActivityLoggersForMainWorld() { @@ -28,7 +29,7 @@ return map; } -void V8DOMActivityLogger::setActivityLogger(int worldId, const String& extensionId, PassOwnPtr<V8DOMActivityLogger> logger) +void V8DOMActivityLogger::setActivityLogger(int worldId, const String& extensionId, std::unique_ptr<V8DOMActivityLogger> logger) { if (worldId) domActivityLoggersForIsolatedWorld().set(worldId, std::move(logger));
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.h b/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.h index de76eca..5c79314 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.h
@@ -32,8 +32,8 @@ #define V8DOMActivityLogger_h #include "core/CoreExport.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> #include <v8.h> namespace blink { @@ -61,7 +61,7 @@ // extensions and their activity loggers in the main world, we require an // extension ID. Otherwise, extension activities may be logged under // a wrong extension ID. - static void setActivityLogger(int worldId, const String&, PassOwnPtr<V8DOMActivityLogger>); + static void setActivityLogger(int worldId, const String&, std::unique_ptr<V8DOMActivityLogger>); static V8DOMActivityLogger* activityLogger(int worldId, const String& extensionId); static V8DOMActivityLogger* activityLogger(int worldId, const KURL&);
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8HiddenValue.h b/third_party/WebKit/Source/bindings/core/v8/V8HiddenValue.h index b9bb81f..d86fa3a 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8HiddenValue.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8HiddenValue.h
@@ -9,7 +9,8 @@ #include "bindings/core/v8/ScriptPromiseProperties.h" #include "core/CoreExport.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> #include <v8.h> namespace blink { @@ -61,7 +62,7 @@ USING_FAST_MALLOC(V8HiddenValue); WTF_MAKE_NONCOPYABLE(V8HiddenValue); public: - static PassOwnPtr<V8HiddenValue> create() { return adoptPtr(new V8HiddenValue()); } + static std::unique_ptr<V8HiddenValue> create() { return wrapUnique(new V8HiddenValue()); } #define V8_DECLARE_METHOD(name) static v8::Local<v8::String> name(v8::Isolate* isolate); V8_HIDDEN_VALUES(V8_DECLARE_METHOD);
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h b/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h index d4718d4..6aebe28d 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8IdleTaskRunner.h
@@ -33,7 +33,8 @@ #include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -41,14 +42,14 @@ USING_FAST_MALLOC(V8IdleTaskAdapter); WTF_MAKE_NONCOPYABLE(V8IdleTaskAdapter); public: - V8IdleTaskAdapter(v8::IdleTask* task) : m_task(adoptPtr(task)) { } + V8IdleTaskAdapter(v8::IdleTask* task) : m_task(wrapUnique(task)) { } ~V8IdleTaskAdapter() override { } void run(double delaySeconds) override { m_task->Run(delaySeconds); } private: - OwnPtr<v8::IdleTask> m_task; + std::unique_ptr<v8::IdleTask> m_task; }; class V8IdleTaskRunner : public gin::V8IdleTaskRunner {
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp index 1cd98091..0c28189 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -58,9 +58,11 @@ #include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "wtf/AddressSanitizer.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" #include "wtf/typed_arrays/ArrayBufferContents.h" +#include <memory> #include <v8-debug.h> #include <v8-profiler.h> @@ -123,7 +125,7 @@ return; ExecutionContext* context = scriptState->getExecutionContext(); - OwnPtr<SourceLocation> location = SourceLocation::fromMessage(isolate, message, context); + std::unique_ptr<SourceLocation> location = SourceLocation::fromMessage(isolate, message, context); AccessControlStatus accessControlStatus = NotSharableCrossOrigin; if (message->IsOpaque()) @@ -202,7 +204,7 @@ String errorMessage; AccessControlStatus corsStatus = NotSharableCrossOrigin; - OwnPtr<SourceLocation> location; + std::unique_ptr<SourceLocation> location; v8::Local<v8::Message> message = v8::Exception::CreateMessage(isolate, exception); if (!message.IsEmpty()) { @@ -362,7 +364,7 @@ if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) { WebScheduler* scheduler = Platform::current()->currentThread()->scheduler(); - V8PerIsolateData::enableIdleTasks(isolate, adoptPtr(new V8IdleTaskRunner(scheduler))); + V8PerIsolateData::enableIdleTasks(isolate, wrapUnique(new V8IdleTaskRunner(scheduler))); } isolate->SetPromiseRejectCallback(promiseRejectHandlerInMainThread); @@ -371,7 +373,7 @@ profiler->SetWrapperClassInfoProvider(WrapperTypeInfo::NodeClassId, &RetainedDOMInfo::createRetainedDOMInfo); ASSERT(ThreadState::mainThreadState()); - ThreadState::mainThreadState()->addInterruptor(adoptPtr(new V8IsolateInterruptor(isolate))); + ThreadState::mainThreadState()->addInterruptor(wrapUnique(new V8IsolateInterruptor(isolate))); if (RuntimeEnabledFeatures::traceWrappablesEnabled()) { ThreadState::mainThreadState()->registerTraceDOMWrappers(isolate, V8GCController::traceDOMWrappers, @@ -382,7 +384,7 @@ nullptr); } - V8PerIsolateData::from(isolate)->setThreadDebugger(adoptPtr(new MainThreadDebugger(isolate))); + V8PerIsolateData::from(isolate)->setThreadDebugger(wrapUnique(new MainThreadDebugger(isolate))); } void V8Initializer::shutdownMainThread() @@ -417,7 +419,7 @@ perIsolateData->setReportingException(true); ExecutionContext* context = scriptState->getExecutionContext(); - OwnPtr<SourceLocation> location = SourceLocation::fromMessage(isolate, message, context); + std::unique_ptr<SourceLocation> location = SourceLocation::fromMessage(isolate, message, context); ErrorEvent* event = ErrorEvent::create(toCoreStringWithNullCheck(message->Get()), std::move(location), &scriptState->world()); AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin;
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp index 4bf774c..d34f3786 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp
@@ -34,8 +34,9 @@ #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8ObjectConstructor.h" #include "core/inspector/InstanceCounters.h" +#include "wtf/PtrUtil.h" #include "wtf/StringExtras.h" - +#include <memory> #include <stdlib.h> namespace blink { @@ -44,7 +45,7 @@ : m_isolate(context->GetIsolate()) , m_wrapperBoilerplates(m_isolate) , m_constructorMap(m_isolate) - , m_contextHolder(adoptPtr(new gin::ContextHolder(m_isolate))) + , m_contextHolder(wrapUnique(new gin::ContextHolder(m_isolate))) , m_context(m_isolate, context) , m_activityLogger(0) , m_compiledPrivateScript(m_isolate) @@ -67,9 +68,9 @@ InstanceCounters::decrementCounter(InstanceCounters::V8PerContextDataCounter); } -PassOwnPtr<V8PerContextData> V8PerContextData::create(v8::Local<v8::Context> context) +std::unique_ptr<V8PerContextData> V8PerContextData::create(v8::Local<v8::Context> context) { - return adoptPtr(new V8PerContextData(context)); + return wrapUnique(new V8PerContextData(context)); } V8PerContextData* V8PerContextData::from(v8::Local<v8::Context> context) @@ -145,7 +146,7 @@ return prototypeValue.As<v8::Object>(); } -void V8PerContextData::addCustomElementBinding(PassOwnPtr<V0CustomElementBinding> binding) +void V8PerContextData::addCustomElementBinding(std::unique_ptr<V0CustomElementBinding> binding) { m_customElementBindings.append(std::move(binding)); }
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h index 0b97318..7352b64d 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h
@@ -40,10 +40,10 @@ #include "gin/public/gin_embedders.h" #include "wtf/Allocator.h" #include "wtf/HashMap.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/AtomicStringHash.h" +#include <memory> #include <v8.h> namespace blink { @@ -59,7 +59,7 @@ USING_FAST_MALLOC(V8PerContextData); WTF_MAKE_NONCOPYABLE(V8PerContextData); public: - static PassOwnPtr<V8PerContextData> create(v8::Local<v8::Context>); + static std::unique_ptr<V8PerContextData> create(v8::Local<v8::Context>); static V8PerContextData* from(v8::Local<v8::Context>); @@ -84,7 +84,7 @@ v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*); - void addCustomElementBinding(PassOwnPtr<V0CustomElementBinding>); + void addCustomElementBinding(std::unique_ptr<V0CustomElementBinding>); V8DOMActivityLogger* activityLogger() const { return m_activityLogger; } void setActivityLogger(V8DOMActivityLogger* activityLogger) { m_activityLogger = activityLogger; } @@ -108,12 +108,12 @@ typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak> ConstructorMap; ConstructorMap m_constructorMap; - OwnPtr<gin::ContextHolder> m_contextHolder; + std::unique_ptr<gin::ContextHolder> m_contextHolder; ScopedPersistent<v8::Context> m_context; ScopedPersistent<v8::Value> m_errorPrototype; - typedef Vector<OwnPtr<V0CustomElementBinding>> V0CustomElementBindingList; + typedef Vector<std::unique_ptr<V0CustomElementBinding>> V0CustomElementBindingList; V0CustomElementBindingList m_customElementBindings; // This is owned by a static hash map in V8DOMActivityLogger.
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp index 9596c370..baeb5c3 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
@@ -37,6 +37,7 @@ #include "platform/ScriptForbiddenScope.h" #include "public/platform/Platform.h" #include "wtf/LeakAnnotations.h" +#include "wtf/PtrUtil.h" #include <memory> namespace blink { @@ -54,8 +55,8 @@ } V8PerIsolateData::V8PerIsolateData() - : m_isolateHolder(adoptPtr(new gin::IsolateHolder())) - , m_stringCache(adoptPtr(new StringCache(isolate()))) + : m_isolateHolder(wrapUnique(new gin::IsolateHolder())) + , m_stringCache(wrapUnique(new StringCache(isolate()))) , m_hiddenValue(V8HiddenValue::create()) , m_privateProperty(V8PrivateProperty::create()) , m_constructorMode(ConstructorMode::CreateNewObject) @@ -90,9 +91,9 @@ return isolate; } -void V8PerIsolateData::enableIdleTasks(v8::Isolate* isolate, PassOwnPtr<gin::V8IdleTaskRunner> taskRunner) +void V8PerIsolateData::enableIdleTasks(v8::Isolate* isolate, std::unique_ptr<gin::V8IdleTaskRunner> taskRunner) { - from(isolate)->m_isolateHolder->EnableIdleTasks(std::unique_ptr<gin::V8IdleTaskRunner>(taskRunner.leakPtr())); + from(isolate)->m_isolateHolder->EnableIdleTasks(std::unique_ptr<gin::V8IdleTaskRunner>(taskRunner.release())); } void V8PerIsolateData::useCounterCallback(v8::Isolate* isolate, v8::Isolate::UseCounterFeature feature) @@ -346,14 +347,14 @@ return v8::Local<v8::Object>::Cast(value)->FindInstanceInPrototypeChain(templ); } -void V8PerIsolateData::addEndOfScopeTask(PassOwnPtr<EndOfScopeTask> task) +void V8PerIsolateData::addEndOfScopeTask(std::unique_ptr<EndOfScopeTask> task) { m_endOfScopeTasks.append(std::move(task)); } void V8PerIsolateData::runEndOfScopeTasks() { - Vector<OwnPtr<EndOfScopeTask>> tasks; + Vector<std::unique_ptr<EndOfScopeTask>> tasks; tasks.swap(m_endOfScopeTasks); for (const auto& task : tasks) task->run(); @@ -365,7 +366,7 @@ m_endOfScopeTasks.clear(); } -void V8PerIsolateData::setThreadDebugger(PassOwnPtr<ThreadDebugger> threadDebugger) +void V8PerIsolateData::setThreadDebugger(std::unique_ptr<ThreadDebugger> threadDebugger) { ASSERT(!m_threadDebugger); m_threadDebugger = std::move(threadDebugger);
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h index 35f921e..009e4db 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h
@@ -37,8 +37,8 @@ #include "platform/heap/Handle.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" +#include <memory> #include <v8.h> namespace blink { @@ -101,7 +101,7 @@ static void destroy(v8::Isolate*); static v8::Isolate* mainThreadIsolate(); - static void enableIdleTasks(v8::Isolate*, PassOwnPtr<gin::V8IdleTaskRunner>); + static void enableIdleTasks(v8::Isolate*, std::unique_ptr<gin::V8IdleTaskRunner>); v8::Isolate* isolate() { return m_isolateHolder->isolate(); } @@ -136,11 +136,11 @@ // to C++ from script, after executing a script task (e.g. callback, // event) or microtasks (e.g. promise). This is explicitly needed for // Indexed DB transactions per spec, but should in general be avoided. - void addEndOfScopeTask(PassOwnPtr<EndOfScopeTask>); + void addEndOfScopeTask(std::unique_ptr<EndOfScopeTask>); void runEndOfScopeTasks(); void clearEndOfScopeTasks(); - void setThreadDebugger(PassOwnPtr<ThreadDebugger>); + void setThreadDebugger(std::unique_ptr<ThreadDebugger>); ThreadDebugger* threadDebugger(); using ActiveScriptWrappableSet = HeapHashSet<WeakMember<ActiveScriptWrappable>>; @@ -162,7 +162,7 @@ bool hasInstance(const WrapperTypeInfo* untrusted, v8::Local<v8::Value>, V8FunctionTemplateMap&); v8::Local<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v8::Local<v8::Value>, V8FunctionTemplateMap&); - OwnPtr<gin::IsolateHolder> m_isolateHolder; + std::unique_ptr<gin::IsolateHolder> m_isolateHolder; // m_interfaceTemplateMapFor{,Non}MainWorld holds function templates for // the inerface objects. @@ -173,8 +173,8 @@ V8FunctionTemplateMap m_operationTemplateMapForMainWorld; V8FunctionTemplateMap m_operationTemplateMapForNonMainWorld; - OwnPtr<StringCache> m_stringCache; - OwnPtr<V8HiddenValue> m_hiddenValue; + std::unique_ptr<StringCache> m_stringCache; + std::unique_ptr<V8HiddenValue> m_hiddenValue; std::unique_ptr<V8PrivateProperty> m_privateProperty; ScopedPersistent<v8::Value> m_liveRoot; RefPtr<ScriptState> m_scriptRegexpScriptState; @@ -188,8 +188,8 @@ bool m_isHandlingRecursionLevelError; bool m_isReportingException; - Vector<OwnPtr<EndOfScopeTask>> m_endOfScopeTasks; - OwnPtr<ThreadDebugger> m_threadDebugger; + Vector<std::unique_ptr<EndOfScopeTask>> m_endOfScopeTasks; + std::unique_ptr<ThreadDebugger> m_threadDebugger; Persistent<ActiveScriptWrappableSet> m_activeScriptWrappables; std::unique_ptr<ScriptWrappableVisitor> m_scriptWrappableVisitor;
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp index c5f51b2..b0da31f 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp
@@ -38,7 +38,7 @@ #include "bindings/core/v8/V8HiddenValue.h" #include "bindings/core/v8/V8PerContextData.h" #include "core/dom/ExecutionContext.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -123,7 +123,7 @@ { } -bool V8V0CustomElementLifecycleCallbacks::setBinding(PassOwnPtr<V0CustomElementBinding> binding) +bool V8V0CustomElementLifecycleCallbacks::setBinding(std::unique_ptr<V0CustomElementBinding> binding) { V8PerContextData* perContextData = creationContextData(); if (!perContextData)
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h index 6acc290..b610dff6 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h
@@ -35,8 +35,8 @@ #include "bindings/core/v8/ScriptState.h" #include "core/dom/ContextLifecycleObserver.h" #include "core/dom/custom/V0CustomElementLifecycleCallbacks.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include <memory> #include <v8.h> namespace blink { @@ -52,7 +52,7 @@ ~V8V0CustomElementLifecycleCallbacks() override; - bool setBinding(PassOwnPtr<V0CustomElementBinding>); + bool setBinding(std::unique_ptr<V0CustomElementBinding>); DECLARE_VIRTUAL_TRACE();
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp index 849eeed1..319fe22 100644 --- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp
@@ -62,7 +62,6 @@ #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/Platform.h" #include "wtf/Assertions.h" -#include "wtf/OwnPtr.h" #include "wtf/StringExtras.h" #include "wtf/text/CString.h" #include <algorithm>
diff --git a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp index 8223a91e..af04d355 100644 --- a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp
@@ -51,6 +51,7 @@ #include "core/workers/WorkerThread.h" #include "platform/heap/ThreadState.h" #include "public/platform/Platform.h" +#include <memory> #include <v8.h> namespace blink { @@ -79,7 +80,7 @@ bool hadException; String errorMessage; - OwnPtr<SourceLocation> m_location; + std::unique_ptr<SourceLocation> m_location; ScriptValue exception; Member<ErrorEvent> m_errorEventFromImportedScript;
diff --git a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h index 4da92c9..e2c8914 100644 --- a/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h +++ b/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h
@@ -38,7 +38,6 @@ #include "core/CoreExport.h" #include "platform/text/CompressibleString.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/text/TextPosition.h" #include <v8.h>
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8DocumentCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8DocumentCustom.cpp index fc4c3d7..045d989 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8DocumentCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8DocumentCustom.cpp
@@ -43,9 +43,10 @@ #include "core/html/HTMLAllCollection.h" #include "core/html/HTMLCollection.h" #include "core/html/HTMLIFrameElement.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { @@ -76,7 +77,7 @@ return; } // Wrap up the arguments and call the function. - OwnPtr<v8::Local<v8::Value>[]> params = adoptArrayPtr(new v8::Local<v8::Value>[info.Length()]); + std::unique_ptr<v8::Local<v8::Value>[]> params = wrapArrayUnique(new v8::Local<v8::Value>[info.Length()]); for (int i = 0; i < info.Length(); i++) params[i] = info[i];
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp index 4439850f..b277398 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp
@@ -34,8 +34,8 @@ #include "bindings/core/v8/V8HTMLEmbedElement.h" #include "bindings/core/v8/V8HTMLObjectElement.h" #include "core/frame/UseCounter.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -146,7 +146,7 @@ if (instance.IsEmpty()) return; - WTF::OwnPtr<v8::Local<v8::Value>[] > arguments = adoptArrayPtr(new v8::Local<v8::Value>[info.Length()]); + std::unique_ptr<v8::Local<v8::Value>[] > arguments = wrapArrayUnique(new v8::Local<v8::Value>[info.Length()]); for (int i = 0; i < info.Length(); ++i) arguments[i] = info[i];
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp index f85adae9..730dd279 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp
@@ -62,7 +62,6 @@ #include "core/loader/FrameLoaderClient.h" #include "platform/LayoutTestSupport.h" #include "wtf/Assertions.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp b/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp index d65e406..0c6a6d58 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp
@@ -14,6 +14,8 @@ #include "public/platform/Platform.h" #include "public/platform/WebRTCCertificate.h" #include "public/platform/WebRTCCertificateGenerator.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -443,7 +445,7 @@ if (!readWebCoreString(&pemCertificate)) return false; - OwnPtr<WebRTCCertificateGenerator> certificateGenerator = adoptPtr( + std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator = wrapUnique( Platform::current()->createRTCCertificateGenerator()); std::unique_ptr<WebRTCCertificate> certificate(
diff --git a/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl index cef5ab8..56f373113 100644 --- a/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl
@@ -3,8 +3,10 @@ #include "{{namespace}}Names.h" +#include "wtf/PtrUtil.h" #include "wtf/StaticConstructors.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { namespace {{namespace}}Names { @@ -22,9 +24,9 @@ {% endfor %} -PassOwnPtr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags() +std::unique_ptr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags() { - OwnPtr<const {{namespace}}QualifiedName*[]> tags = adoptArrayPtr(new const {{namespace}}QualifiedName*[{{namespace}}TagsCount]); + std::unique_ptr<const {{namespace}}QualifiedName*[]> tags = wrapArrayUnique(new const {{namespace}}QualifiedName*[{{namespace}}TagsCount]); for (size_t i = 0; i < {{namespace}}TagsCount; i++) tags[i] = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagStorage) + i; return tags; @@ -40,9 +42,9 @@ {% endfor %} {% if namespace != 'HTML' %} -PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs() +std::unique_ptr<const QualifiedName*[]> get{{namespace}}Attrs() { - OwnPtr<const QualifiedName*[]> attrs = adoptArrayPtr(new const QualifiedName*[{{namespace}}AttrsCount]); + std::unique_ptr<const QualifiedName*[]> attrs = wrapArrayUnique(new const QualifiedName*[{{namespace}}AttrsCount]); for (size_t i = 0; i < {{namespace}}AttrsCount; i++) attrs[i] = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage) + i; return attrs;
diff --git a/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl index 21de2b62..d9368d2 100644 --- a/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl
@@ -8,7 +8,7 @@ #include "core/CoreExport.h" {% endif %} #include "core/dom/QualifiedName.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -32,12 +32,12 @@ {% if tags %} const unsigned {{namespace}}TagsCount = {{tags|count}}; -{{symbol_export}}PassOwnPtr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags(); +{{symbol_export}}std::unique_ptr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags(); {% endif %} const unsigned {{namespace}}AttrsCount = {{attrs|count}}; {% if namespace != 'HTML' %} -PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs(); +std::unique_ptr<const QualifiedName*[]> get{{namespace}}Attrs(); {% endif %} void init();
diff --git a/third_party/WebKit/Source/core/animation/Animation.cpp b/third_party/WebKit/Source/core/animation/Animation.cpp index 14cbc42..9cd519a2b 100644 --- a/third_party/WebKit/Source/core/animation/Animation.cpp +++ b/third_party/WebKit/Source/core/animation/Animation.cpp
@@ -45,6 +45,7 @@ #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -293,7 +294,7 @@ createCompositorPlayer(); if (maybeStartAnimationOnCompositor()) - m_compositorState = adoptPtr(new CompositorState(*this)); + m_compositorState = wrapUnique(new CompositorState(*this)); else cancelIncompatibleAnimationsOnCompositor(); }
diff --git a/third_party/WebKit/Source/core/animation/Animation.h b/third_party/WebKit/Source/core/animation/Animation.h index 5cfc053..24d45f9 100644 --- a/third_party/WebKit/Source/core/animation/Animation.h +++ b/third_party/WebKit/Source/core/animation/Animation.h
@@ -45,6 +45,7 @@ #include "platform/animation/CompositorAnimationPlayerClient.h" #include "platform/heap/Handle.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -294,11 +295,11 @@ // This mirrors the known compositor state. It is created when a compositor // animation is started. Updated once the start time is known and each time // modifications are pushed to the compositor. - OwnPtr<CompositorState> m_compositorState; + std::unique_ptr<CompositorState> m_compositorState; bool m_compositorPending; int m_compositorGroup; - OwnPtr<CompositorAnimationPlayer> m_compositorPlayer; + std::unique_ptr<CompositorAnimationPlayer> m_compositorPlayer; bool m_currentTimePending; bool m_stateIsBeingUpdated;
diff --git a/third_party/WebKit/Source/core/animation/AnimationClock.h b/third_party/WebKit/Source/core/animation/AnimationClock.h index 0b05963..b1416eb 100644 --- a/third_party/WebKit/Source/core/animation/AnimationClock.h +++ b/third_party/WebKit/Source/core/animation/AnimationClock.h
@@ -35,7 +35,6 @@ #include "wtf/Allocator.h" #include "wtf/CurrentTime.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include <limits> namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp b/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp index 9eaddbc..fa657ca 100644 --- a/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationClockTest.cpp
@@ -31,7 +31,6 @@ #include "core/animation/AnimationClock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp b/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp index e272e35..ef7b9bf7 100644 --- a/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationInputHelpersTest.cpp
@@ -9,6 +9,7 @@ #include "core/testing/DummyPageHolder.h" #include "platform/animation/TimingFunction.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -52,7 +53,7 @@ ThreadHeap::collectAllGarbage(); } - OwnPtr<DummyPageHolder> pageHolder; + std::unique_ptr<DummyPageHolder> pageHolder; Persistent<Document> document; TrackExceptionState exceptionState; };
diff --git a/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp b/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp index bdccc72d..c7ddd8b 100644 --- a/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationStackTest.cpp
@@ -13,6 +13,7 @@ #include "core/animation/animatable/AnimatableDouble.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -79,7 +80,7 @@ return toLegacyStyleInterpolation(interpolation).currentValue().get(); } - OwnPtr<DummyPageHolder> pageHolder; + std::unique_ptr<DummyPageHolder> pageHolder; Persistent<Document> document; Persistent<AnimationTimeline> timeline; Persistent<Element> element;
diff --git a/third_party/WebKit/Source/core/animation/AnimationTest.cpp b/third_party/WebKit/Source/core/animation/AnimationTest.cpp index 15b7bae8..0b8a59e 100644 --- a/third_party/WebKit/Source/core/animation/AnimationTest.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationTest.cpp
@@ -40,6 +40,7 @@ #include "core/testing/DummyPageHolder.h" #include "platform/weborigin/KURL.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -88,7 +89,7 @@ Persistent<AnimationTimeline> timeline; Persistent<Animation> animation; TrackExceptionState exceptionState; - OwnPtr<DummyPageHolder> pageHolder; + std::unique_ptr<DummyPageHolder> pageHolder; }; TEST_F(AnimationAnimationTest, InitialState)
diff --git a/third_party/WebKit/Source/core/animation/AnimationTimeline.cpp b/third_party/WebKit/Source/core/animation/AnimationTimeline.cpp index f3820aca..e753bba 100644 --- a/third_party/WebKit/Source/core/animation/AnimationTimeline.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationTimeline.cpp
@@ -41,6 +41,7 @@ #include "platform/animation/CompositorAnimationTimeline.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" +#include "wtf/PtrUtil.h" #include <algorithm> namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/AnimationTimeline.h b/third_party/WebKit/Source/core/animation/AnimationTimeline.h index 4dc8e86..caddbf3 100644 --- a/third_party/WebKit/Source/core/animation/AnimationTimeline.h +++ b/third_party/WebKit/Source/core/animation/AnimationTimeline.h
@@ -41,6 +41,7 @@ #include "platform/heap/Handle.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -123,7 +124,7 @@ Member<PlatformTiming> m_timing; double m_lastCurrentTimeInternal; - OwnPtr<CompositorAnimationTimeline> m_compositorTimeline; + std::unique_ptr<CompositorAnimationTimeline> m_compositorTimeline; class AnimationTimelineTiming final : public PlatformTiming { public:
diff --git a/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp b/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp index 7e39d16..e3912b3 100644 --- a/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp +++ b/third_party/WebKit/Source/core/animation/AnimationTimelineTest.cpp
@@ -42,6 +42,7 @@ #include "platform/weborigin/KURL.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -87,7 +88,7 @@ timeline->scheduleNextService(); } - OwnPtr<DummyPageHolder> pageHolder; + std::unique_ptr<DummyPageHolder> pageHolder; Persistent<Document> document; Persistent<Element> element; Persistent<AnimationTimeline> timeline;
diff --git a/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp index 8a1975bf..5501da5b 100644 --- a/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp
@@ -9,6 +9,7 @@ #include "core/css/CSSBasicShapeValues.h" #include "core/css/resolver/StyleResolverState.h" #include "core/style/BasicShapes.h" +#include <memory> namespace blink { @@ -72,25 +73,25 @@ namespace { -PassOwnPtr<InterpolableValue> unwrap(InterpolationValue&& value) +std::unique_ptr<InterpolableValue> unwrap(InterpolationValue&& value) { ASSERT(value.interpolableValue); return std::move(value.interpolableValue); } -PassOwnPtr<InterpolableValue> convertCSSCoordinate(const CSSValue* coordinate) +std::unique_ptr<InterpolableValue> convertCSSCoordinate(const CSSValue* coordinate) { if (coordinate) return unwrap(CSSPositionAxisListInterpolationType::convertPositionAxisCSSValue(*coordinate)); return unwrap(CSSLengthInterpolationType::maybeConvertLength(Length(50, Percent), 1)); } -PassOwnPtr<InterpolableValue> convertCoordinate(const BasicShapeCenterCoordinate& coordinate, double zoom) +std::unique_ptr<InterpolableValue> convertCoordinate(const BasicShapeCenterCoordinate& coordinate, double zoom) { return unwrap(CSSLengthInterpolationType::maybeConvertLength(coordinate.computedLength(), zoom)); } -PassOwnPtr<InterpolableValue> createNeutralInterpolableCoordinate() +std::unique_ptr<InterpolableValue> createNeutralInterpolableCoordinate() { return CSSLengthInterpolationType::createNeutralInterpolableValue(); } @@ -102,21 +103,21 @@ CSSLengthInterpolationType::resolveInterpolableLength(interpolableValue, nullptr, conversionData)); } -PassOwnPtr<InterpolableValue> convertCSSRadius(const CSSPrimitiveValue* radius) +std::unique_ptr<InterpolableValue> convertCSSRadius(const CSSPrimitiveValue* radius) { if (!radius || radius->isValueID()) return nullptr; return unwrap(CSSLengthInterpolationType::maybeConvertCSSValue(*radius)); } -PassOwnPtr<InterpolableValue> convertRadius(const BasicShapeRadius& radius, double zoom) +std::unique_ptr<InterpolableValue> convertRadius(const BasicShapeRadius& radius, double zoom) { if (radius.type() != BasicShapeRadius::Value) return nullptr; return unwrap(CSSLengthInterpolationType::maybeConvertLength(radius.value(), zoom)); } -PassOwnPtr<InterpolableValue> createNeutralInterpolableRadius() +std::unique_ptr<InterpolableValue> createNeutralInterpolableRadius() { return CSSLengthInterpolationType::createNeutralInterpolableValue(); } @@ -126,24 +127,24 @@ return BasicShapeRadius(CSSLengthInterpolationType::resolveInterpolableLength(interpolableValue, nullptr, conversionData, ValueRangeNonNegative)); } -PassOwnPtr<InterpolableValue> convertCSSLength(const CSSValue* length) +std::unique_ptr<InterpolableValue> convertCSSLength(const CSSValue* length) { if (!length) return CSSLengthInterpolationType::createNeutralInterpolableValue(); return unwrap(CSSLengthInterpolationType::maybeConvertCSSValue(*length)); } -PassOwnPtr<InterpolableValue> convertLength(const Length& length, double zoom) +std::unique_ptr<InterpolableValue> convertLength(const Length& length, double zoom) { return unwrap(CSSLengthInterpolationType::maybeConvertLength(length, zoom)); } -PassOwnPtr<InterpolableValue> convertCSSBorderRadiusWidth(const CSSValuePair* pair) +std::unique_ptr<InterpolableValue> convertCSSBorderRadiusWidth(const CSSValuePair* pair) { return convertCSSLength(pair ? &pair->first() : nullptr); } -PassOwnPtr<InterpolableValue> convertCSSBorderRadiusHeight(const CSSValuePair* pair) +std::unique_ptr<InterpolableValue> convertCSSBorderRadiusHeight(const CSSValuePair* pair) { return convertCSSLength(pair ? &pair->second() : nullptr); } @@ -166,11 +167,11 @@ InterpolationValue convertCSSValue(const CSSBasicShapeCircleValue& circle) { - OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); list->set(CircleCenterXIndex, convertCSSCoordinate(circle.centerX())); list->set(CircleCenterYIndex, convertCSSCoordinate(circle.centerY())); - OwnPtr<InterpolableValue> radius; + std::unique_ptr<InterpolableValue> radius; if (!(radius = convertCSSRadius(circle.radius()))) return nullptr; list->set(CircleRadiusIndex, std::move(radius)); @@ -180,11 +181,11 @@ InterpolationValue convertBasicShape(const BasicShapeCircle& circle, double zoom) { - OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); list->set(CircleCenterXIndex, convertCoordinate(circle.centerX(), zoom)); list->set(CircleCenterYIndex, convertCoordinate(circle.centerY(), zoom)); - OwnPtr<InterpolableValue> radius; + std::unique_ptr<InterpolableValue> radius; if (!(radius = convertRadius(circle.radius(), zoom))) return nullptr; list->set(CircleRadiusIndex, std::move(radius)); @@ -192,9 +193,9 @@ return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::create(BasicShape::BasicShapeCircleType)); } -PassOwnPtr<InterpolableValue> createNeutralValue() +std::unique_ptr<InterpolableValue> createNeutralValue() { - OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(CircleComponentIndexCount); list->set(CircleCenterXIndex, createNeutralInterpolableCoordinate()); list->set(CircleCenterYIndex, createNeutralInterpolableCoordinate()); list->set(CircleRadiusIndex, createNeutralInterpolableRadius()); @@ -225,11 +226,11 @@ InterpolationValue convertCSSValue(const CSSBasicShapeEllipseValue& ellipse) { - OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); list->set(EllipseCenterXIndex, convertCSSCoordinate(ellipse.centerX())); list->set(EllipseCenterYIndex, convertCSSCoordinate(ellipse.centerY())); - OwnPtr<InterpolableValue> radius; + std::unique_ptr<InterpolableValue> radius; if (!(radius = convertCSSRadius(ellipse.radiusX()))) return nullptr; list->set(EllipseRadiusXIndex, std::move(radius)); @@ -242,11 +243,11 @@ InterpolationValue convertBasicShape(const BasicShapeEllipse& ellipse, double zoom) { - OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); list->set(EllipseCenterXIndex, convertCoordinate(ellipse.centerX(), zoom)); list->set(EllipseCenterYIndex, convertCoordinate(ellipse.centerY(), zoom)); - OwnPtr<InterpolableValue> radius; + std::unique_ptr<InterpolableValue> radius; if (!(radius = convertRadius(ellipse.radiusX(), zoom))) return nullptr; list->set(EllipseRadiusXIndex, std::move(radius)); @@ -257,9 +258,9 @@ return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::create(BasicShape::BasicShapeEllipseType)); } -PassOwnPtr<InterpolableValue> createNeutralValue() +std::unique_ptr<InterpolableValue> createNeutralValue() { - OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(EllipseComponentIndexCount); list->set(EllipseCenterXIndex, createNeutralInterpolableCoordinate()); list->set(EllipseCenterYIndex, createNeutralInterpolableCoordinate()); list->set(EllipseRadiusXIndex, createNeutralInterpolableRadius()); @@ -300,7 +301,7 @@ InterpolationValue convertCSSValue(const CSSBasicShapeInsetValue& inset) { - OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); list->set(InsetTopIndex, convertCSSLength(inset.top())); list->set(InsetRightIndex, convertCSSLength(inset.right())); list->set(InsetBottomIndex, convertCSSLength(inset.bottom())); @@ -319,7 +320,7 @@ InterpolationValue convertBasicShape(const BasicShapeInset& inset, double zoom) { - OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); list->set(InsetTopIndex, convertLength(inset.top(), zoom)); list->set(InsetRightIndex, convertLength(inset.right(), zoom)); list->set(InsetBottomIndex, convertLength(inset.bottom(), zoom)); @@ -336,9 +337,9 @@ return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::create(BasicShape::BasicShapeInsetType)); } -PassOwnPtr<InterpolableValue> createNeutralValue() +std::unique_ptr<InterpolableValue> createNeutralValue() { - OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(InsetComponentIndexCount); list->set(InsetTopIndex, CSSLengthInterpolationType::createNeutralInterpolableValue()); list->set(InsetRightIndex, CSSLengthInterpolationType::createNeutralInterpolableValue()); list->set(InsetBottomIndex, CSSLengthInterpolationType::createNeutralInterpolableValue()); @@ -378,7 +379,7 @@ InterpolationValue convertCSSValue(const CSSBasicShapePolygonValue& polygon) { size_t size = polygon.values().size(); - OwnPtr<InterpolableList> list = InterpolableList::create(size); + std::unique_ptr<InterpolableList> list = InterpolableList::create(size); for (size_t i = 0; i < size; i++) list->set(i, convertCSSLength(polygon.values()[i].get())); return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::createPolygon(polygon.getWindRule(), size)); @@ -387,15 +388,15 @@ InterpolationValue convertBasicShape(const BasicShapePolygon& polygon, double zoom) { size_t size = polygon.values().size(); - OwnPtr<InterpolableList> list = InterpolableList::create(size); + std::unique_ptr<InterpolableList> list = InterpolableList::create(size); for (size_t i = 0; i < size; i++) list->set(i, convertLength(polygon.values()[i], zoom)); return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::createPolygon(polygon.getWindRule(), size)); } -PassOwnPtr<InterpolableValue> createNeutralValue(const BasicShapeNonInterpolableValue& nonInterpolableValue) +std::unique_ptr<InterpolableValue> createNeutralValue(const BasicShapeNonInterpolableValue& nonInterpolableValue) { - OwnPtr<InterpolableList> list = InterpolableList::create(nonInterpolableValue.size()); + std::unique_ptr<InterpolableList> list = InterpolableList::create(nonInterpolableValue.size()); for (size_t i = 0; i < nonInterpolableValue.size(); i++) list->set(i, CSSLengthInterpolationType::createNeutralInterpolableValue()); return std::move(list); @@ -453,7 +454,7 @@ } } -PassOwnPtr<InterpolableValue> BasicShapeInterpolationFunctions::createNeutralValue(const NonInterpolableValue& untypedNonInterpolableValue) +std::unique_ptr<InterpolableValue> BasicShapeInterpolationFunctions::createNeutralValue(const NonInterpolableValue& untypedNonInterpolableValue) { const BasicShapeNonInterpolableValue& nonInterpolableValue = toBasicShapeNonInterpolableValue(untypedNonInterpolableValue); switch (nonInterpolableValue.type()) {
diff --git a/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.h index 6dfcf411..c1d8431 100644 --- a/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.h
@@ -6,6 +6,7 @@ #define BasicShapeInterpolationFunctions_h #include "core/animation/InterpolationValue.h" +#include <memory> namespace blink { @@ -17,7 +18,7 @@ InterpolationValue maybeConvertCSSValue(const CSSValue&); InterpolationValue maybeConvertBasicShape(const BasicShape*, double zoom); -PassOwnPtr<InterpolableValue> createNeutralValue(const NonInterpolableValue&); +std::unique_ptr<InterpolableValue> createNeutralValue(const NonInterpolableValue&); bool shapesAreCompatible(const NonInterpolableValue&, const NonInterpolableValue&); PassRefPtr<BasicShape> createBasicShape(const InterpolableValue&, const NonInterpolableValue&, const CSSToLengthConversionData&);
diff --git a/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp index 71790836..4ac573a 100644 --- a/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp
@@ -10,6 +10,8 @@ #include "core/css/resolver/StyleResolverState.h" #include "core/style/BasicShapes.h" #include "core/style/DataEquivalency.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -17,9 +19,9 @@ class UnderlyingCompatibilityChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<UnderlyingCompatibilityChecker> create(PassRefPtr<NonInterpolableValue> underlyingNonInterpolableValue) + static std::unique_ptr<UnderlyingCompatibilityChecker> create(PassRefPtr<NonInterpolableValue> underlyingNonInterpolableValue) { - return adoptPtr(new UnderlyingCompatibilityChecker(underlyingNonInterpolableValue)); + return wrapUnique(new UnderlyingCompatibilityChecker(underlyingNonInterpolableValue)); } private: @@ -37,9 +39,9 @@ class InheritedShapeChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<InheritedShapeChecker> create(CSSPropertyID property, PassRefPtr<BasicShape> inheritedShape) + static std::unique_ptr<InheritedShapeChecker> create(CSSPropertyID property, PassRefPtr<BasicShape> inheritedShape) { - return adoptPtr(new InheritedShapeChecker(property, inheritedShape)); + return wrapUnique(new InheritedShapeChecker(property, inheritedShape)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp index e3247cc..3ff1615 100644 --- a/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp
@@ -8,6 +8,8 @@ #include "core/animation/CSSLengthInterpolationType.h" #include "core/css/CSSQuadValue.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -84,9 +86,9 @@ class UnderlyingSideNumbersChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<UnderlyingSideNumbersChecker> create(const SideNumbers& underlyingSideNumbers) + static std::unique_ptr<UnderlyingSideNumbersChecker> create(const SideNumbers& underlyingSideNumbers) { - return adoptPtr(new UnderlyingSideNumbersChecker(underlyingSideNumbers)); + return wrapUnique(new UnderlyingSideNumbersChecker(underlyingSideNumbers)); } static SideNumbers getUnderlyingSideNumbers(const InterpolationValue& underlying) @@ -109,9 +111,9 @@ class InheritedSideNumbersChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<InheritedSideNumbersChecker> create(CSSPropertyID property, const SideNumbers& inheritedSideNumbers) + static std::unique_ptr<InheritedSideNumbersChecker> create(CSSPropertyID property, const SideNumbers& inheritedSideNumbers) { - return adoptPtr(new InheritedSideNumbersChecker(property, inheritedSideNumbers)); + return wrapUnique(new InheritedSideNumbersChecker(property, inheritedSideNumbers)); } private: @@ -131,7 +133,7 @@ InterpolationValue convertBorderImageLengthBox(const BorderImageLengthBox& box, double zoom) { - OwnPtr<InterpolableList> list = InterpolableList::create(SideIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(SideIndexCount); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(SideIndexCount); const BorderImageLength* sides[SideIndexCount] = {}; sides[SideTop] = &box.top(); @@ -191,7 +193,7 @@ return nullptr; const CSSQuadValue& quad = toCSSQuadValue(value); - OwnPtr<InterpolableList> list = InterpolableList::create(SideIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(SideIndexCount); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(SideIndexCount); const CSSPrimitiveValue* sides[SideIndexCount] = {}; sides[SideTop] = quad.top();
diff --git a/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp index 898dd59..f3d3a35 100644 --- a/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp
@@ -7,6 +7,8 @@ #include "core/animation/CSSLengthInterpolationType.h" #include "core/css/CSSQuadValue.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -63,9 +65,9 @@ class ParentAutosChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<ParentAutosChecker> create(const ClipAutos& parentAutos) + static std::unique_ptr<ParentAutosChecker> create(const ClipAutos& parentAutos) { - return adoptPtr(new ParentAutosChecker(parentAutos)); + return wrapUnique(new ParentAutosChecker(parentAutos)); } private: @@ -111,9 +113,9 @@ public: ~UnderlyingAutosChecker() final {} - static PassOwnPtr<UnderlyingAutosChecker> create(const ClipAutos& underlyingAutos) + static std::unique_ptr<UnderlyingAutosChecker> create(const ClipAutos& underlyingAutos) { - return adoptPtr(new UnderlyingAutosChecker(underlyingAutos)); + return wrapUnique(new UnderlyingAutosChecker(underlyingAutos)); } static ClipAutos getUnderlyingAutos(const InterpolationValue& underlying) @@ -144,7 +146,7 @@ ClipComponentIndexCount, }; -static PassOwnPtr<InterpolableValue> convertClipComponent(const Length& length, double zoom) +static std::unique_ptr<InterpolableValue> convertClipComponent(const Length& length, double zoom) { if (length.isAuto()) return InterpolableList::create(0); @@ -153,7 +155,7 @@ static InterpolationValue createClipValue(const LengthBox& clip, double zoom) { - OwnPtr<InterpolableList> list = InterpolableList::create(ClipComponentIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(ClipComponentIndexCount); list->set(ClipTop, convertClipComponent(clip.top(), zoom)); list->set(ClipRight, convertClipComponent(clip.right(), zoom)); list->set(ClipBottom, convertClipComponent(clip.bottom(), zoom)); @@ -194,7 +196,7 @@ return value.getValueID() == CSSValueAuto; } -static PassOwnPtr<InterpolableValue> convertClipComponent(const CSSPrimitiveValue& length) +static std::unique_ptr<InterpolableValue> convertClipComponent(const CSSPrimitiveValue& length) { if (isCSSAuto(length)) return InterpolableList::create(0); @@ -206,7 +208,7 @@ if (!value.isQuadValue()) return nullptr; const CSSQuadValue& quad = toCSSQuadValue(value); - OwnPtr<InterpolableList> list = InterpolableList::create(ClipComponentIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(ClipComponentIndexCount); list->set(ClipTop, convertClipComponent(*quad.top())); list->set(ClipRight, convertClipComponent(*quad.right())); list->set(ClipBottom, convertClipComponent(*quad.bottom()));
diff --git a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp index 19c50847..06264b1 100644 --- a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp
@@ -8,6 +8,8 @@ #include "core/css/CSSColorValue.h" #include "core/css/resolver/StyleResolverState.h" #include "core/layout/LayoutTheme.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -23,18 +25,18 @@ InterpolableColorIndexCount, }; -static PassOwnPtr<InterpolableValue> createInterpolableColorForIndex(InterpolableColorIndex index) +static std::unique_ptr<InterpolableValue> createInterpolableColorForIndex(InterpolableColorIndex index) { ASSERT(index < InterpolableColorIndexCount); - OwnPtr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount); for (int i = 0; i < InterpolableColorIndexCount; i++) list->set(i, InterpolableNumber::create(i == index)); return std::move(list); } -PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const Color& color) +std::unique_ptr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const Color& color) { - OwnPtr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(InterpolableColorIndexCount); list->set(Red, InterpolableNumber::create(color.red() * color.alpha())); list->set(Green, InterpolableNumber::create(color.green() * color.alpha())); list->set(Blue, InterpolableNumber::create(color.blue() * color.alpha())); @@ -46,7 +48,7 @@ return std::move(list); } -PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(CSSValueID keyword) +std::unique_ptr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(CSSValueID keyword) { switch (keyword) { case CSSValueCurrentcolor: @@ -65,14 +67,14 @@ } } -PassOwnPtr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const StyleColor& color) +std::unique_ptr<InterpolableValue> CSSColorInterpolationType::createInterpolableColor(const StyleColor& color) { if (color.isCurrentColor()) return createInterpolableColorForIndex(Currentcolor); return createInterpolableColor(color.getColor()); } -PassOwnPtr<InterpolableValue> CSSColorInterpolationType::maybeCreateInterpolableColor(const CSSValue& value) +std::unique_ptr<InterpolableValue> CSSColorInterpolationType::maybeCreateInterpolableColor(const CSSValue& value) { if (value.isColorValue()) return createInterpolableColor(toCSSColorValue(value).value()); @@ -135,9 +137,9 @@ class ParentColorChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<ParentColorChecker> create(CSSPropertyID property, const StyleColor& color) + static std::unique_ptr<ParentColorChecker> create(CSSPropertyID property, const StyleColor& color) { - return adoptPtr(new ParentColorChecker(property, color)); + return wrapUnique(new ParentColorChecker(property, color)); } private: @@ -187,10 +189,10 @@ if (cssProperty() == CSSPropertyColor && value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueCurrentcolor) return maybeConvertInherit(state, conversionCheckers); - OwnPtr<InterpolableValue> interpolableColor = maybeCreateInterpolableColor(value); + std::unique_ptr<InterpolableValue> interpolableColor = maybeCreateInterpolableColor(value); if (!interpolableColor) return nullptr; - OwnPtr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount); + std::unique_ptr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount); colorPair->set(Unvisited, interpolableColor->clone()); colorPair->set(Visited, std::move(interpolableColor)); return InterpolationValue(std::move(colorPair)); @@ -198,7 +200,7 @@ InterpolationValue CSSColorInterpolationType::convertStyleColorPair(const StyleColor& unvisitedColor, const StyleColor& visitedColor) const { - OwnPtr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount); + std::unique_ptr<InterpolableList> colorPair = InterpolableList::create(InterpolableColorPairIndexCount); colorPair->set(Unvisited, createInterpolableColor(unvisitedColor)); colorPair->set(Visited, createInterpolableColor(visitedColor)); return InterpolationValue(std::move(colorPair));
diff --git a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h index 02f60d8..23c64f43 100644 --- a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h
@@ -8,6 +8,7 @@ #include "core/CSSValueKeywords.h" #include "core/animation/CSSInterpolationType.h" #include "platform/graphics/Color.h" +#include <memory> namespace blink { @@ -22,10 +23,10 @@ InterpolationValue maybeConvertUnderlyingValue(const InterpolationEnvironment&) const final; void apply(const InterpolableValue&, const NonInterpolableValue*, InterpolationEnvironment&) const final; - static PassOwnPtr<InterpolableValue> createInterpolableColor(const Color&); - static PassOwnPtr<InterpolableValue> createInterpolableColor(CSSValueID); - static PassOwnPtr<InterpolableValue> createInterpolableColor(const StyleColor&); - static PassOwnPtr<InterpolableValue> maybeCreateInterpolableColor(const CSSValue&); + static std::unique_ptr<InterpolableValue> createInterpolableColor(const Color&); + static std::unique_ptr<InterpolableValue> createInterpolableColor(CSSValueID); + static std::unique_ptr<InterpolableValue> createInterpolableColor(const StyleColor&); + static std::unique_ptr<InterpolableValue> maybeCreateInterpolableColor(const CSSValue&); static Color resolveInterpolableColor(const InterpolableValue& interpolableColor, const StyleResolverState&, bool isVisited = false, bool isTextDecoration = false); private:
diff --git a/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp index 7ddefa2..7e28a0e 100644 --- a/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp
@@ -9,6 +9,8 @@ #include "core/animation/ListInterpolationFunctions.h" #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -16,9 +18,9 @@ class UnderlyingFilterListChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<UnderlyingFilterListChecker> create(PassRefPtr<NonInterpolableList> nonInterpolableList) + static std::unique_ptr<UnderlyingFilterListChecker> create(PassRefPtr<NonInterpolableList> nonInterpolableList) { - return adoptPtr(new UnderlyingFilterListChecker(nonInterpolableList)); + return wrapUnique(new UnderlyingFilterListChecker(nonInterpolableList)); } bool isValid(const InterpolationEnvironment&, const InterpolationValue& underlying) const final @@ -43,9 +45,9 @@ class InheritedFilterListChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<InheritedFilterListChecker> create(CSSPropertyID property, const FilterOperations& filterOperations) + static std::unique_ptr<InheritedFilterListChecker> create(CSSPropertyID property, const FilterOperations& filterOperations) { - return adoptPtr(new InheritedFilterListChecker(property, filterOperations)); + return wrapUnique(new InheritedFilterListChecker(property, filterOperations)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue&) const final @@ -67,7 +69,7 @@ InterpolationValue convertFilterList(const FilterOperations& filterOperations, double zoom) { size_t length = filterOperations.size(); - OwnPtr<InterpolableList> interpolableList = InterpolableList::create(length); + std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(length); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(length); for (size_t i = 0; i < length; i++) { InterpolationValue filterResult = FilterInterpolationFunctions::maybeConvertFilter(*filterOperations.operations()[i], zoom); @@ -111,7 +113,7 @@ const CSSValueList& list = toCSSValueList(value); size_t length = list.length(); - OwnPtr<InterpolableList> interpolableList = InterpolableList::create(length); + std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(length); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(length); for (size_t i = 0; i < length; i++) { InterpolationValue itemResult = FilterInterpolationFunctions::maybeConvertCSSFilter(list.item(i)); @@ -151,7 +153,7 @@ size_t longerLength = toNonInterpolableList(*longer.nonInterpolableValue).length(); InterpolableList& shorterInterpolableList = toInterpolableList(*shorter.interpolableValue); const NonInterpolableList& longerNonInterpolableList = toNonInterpolableList(*longer.nonInterpolableValue); - OwnPtr<InterpolableList> extendedInterpolableList = InterpolableList::create(longerLength); + std::unique_ptr<InterpolableList> extendedInterpolableList = InterpolableList::create(longerLength); for (size_t i = 0; i < longerLength; i++) { if (i < shorterLength) extendedInterpolableList->set(i, std::move(shorterInterpolableList.getMutable(i))); @@ -188,7 +190,7 @@ if (length <= underlyingLength) return; - OwnPtr<InterpolableList> extendedInterpolableList = InterpolableList::create(length); + std::unique_ptr<InterpolableList> extendedInterpolableList = InterpolableList::create(length); for (size_t i = 0; i < length; i++) { if (i < underlyingLength) extendedInterpolableList->set(i, std::move(underlyingInterpolableList.getMutable(i)));
diff --git a/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp index b409ffc..5499639 100644 --- a/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp
@@ -9,6 +9,8 @@ #include "core/css/resolver/StyleResolverState.h" #include "platform/LengthFunctions.h" #include "platform/fonts/FontDescription.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -16,9 +18,9 @@ class IsMonospaceChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<IsMonospaceChecker> create(bool isMonospace) + static std::unique_ptr<IsMonospaceChecker> create(bool isMonospace) { - return adoptPtr(new IsMonospaceChecker(isMonospace)); + return wrapUnique(new IsMonospaceChecker(isMonospace)); } private: IsMonospaceChecker(bool isMonospace) @@ -35,9 +37,9 @@ class InheritedFontSizeChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<InheritedFontSizeChecker> create(const FontDescription::Size& inheritedFontSize) + static std::unique_ptr<InheritedFontSizeChecker> create(const FontDescription::Size& inheritedFontSize) { - return adoptPtr(new InheritedFontSizeChecker(inheritedFontSize)); + return wrapUnique(new InheritedFontSizeChecker(inheritedFontSize)); } private: @@ -97,7 +99,7 @@ InterpolationValue CSSFontSizeInterpolationType::maybeConvertValue(const CSSValue& value, const StyleResolverState& state, ConversionCheckers& conversionCheckers) const { - OwnPtr<InterpolableValue> result = CSSLengthInterpolationType::maybeConvertCSSValue(value).interpolableValue; + std::unique_ptr<InterpolableValue> result = CSSLengthInterpolationType::maybeConvertCSSValue(value).interpolableValue; if (result) return InterpolationValue(std::move(result));
diff --git a/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp index cbc644c..9fa8de3 100644 --- a/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp
@@ -6,6 +6,8 @@ #include "core/css/CSSPrimitiveValueMappings.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -57,9 +59,9 @@ class ParentFontWeightChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<ParentFontWeightChecker> create(FontWeight fontWeight) + static std::unique_ptr<ParentFontWeightChecker> create(FontWeight fontWeight) { - return adoptPtr(new ParentFontWeightChecker(fontWeight)); + return wrapUnique(new ParentFontWeightChecker(fontWeight)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp index 60a9a0a3..415a388 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp
@@ -9,6 +9,8 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/resolver/StyleResolverState.h" #include "core/style/StyleImage.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -113,9 +115,9 @@ public: ~UnderlyingImageChecker() final {} - static PassOwnPtr<UnderlyingImageChecker> create(const InterpolationValue& underlying) + static std::unique_ptr<UnderlyingImageChecker> create(const InterpolationValue& underlying) { - return adoptPtr(new UnderlyingImageChecker(underlying)); + return wrapUnique(new UnderlyingImageChecker(underlying)); } private: @@ -151,9 +153,9 @@ public: ~ParentImageChecker() final {} - static PassOwnPtr<ParentImageChecker> create(CSSPropertyID property, StyleImage* inheritedImage) + static std::unique_ptr<ParentImageChecker> create(CSSPropertyID property, StyleImage* inheritedImage) { - return adoptPtr(new ParentImageChecker(property, inheritedImage)); + return wrapUnique(new ParentImageChecker(property, inheritedImage)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp index d18b6ee..90c0168b 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp
@@ -10,6 +10,8 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -17,9 +19,9 @@ public: ~UnderlyingImageListChecker() final {} - static PassOwnPtr<UnderlyingImageListChecker> create(const InterpolationValue& underlying) + static std::unique_ptr<UnderlyingImageListChecker> create(const InterpolationValue& underlying) { - return adoptPtr(new UnderlyingImageListChecker(underlying)); + return wrapUnique(new UnderlyingImageListChecker(underlying)); } private: @@ -62,9 +64,9 @@ public: ~ParentImageListChecker() final {} - static PassOwnPtr<ParentImageListChecker> create(CSSPropertyID property, const StyleImageList& inheritedImageList) + static std::unique_ptr<ParentImageListChecker> create(CSSPropertyID property, const StyleImageList& inheritedImageList) { - return adoptPtr(new ParentImageListChecker(property, inheritedImageList)); + return wrapUnique(new ParentImageListChecker(property, inheritedImageList)); } private: @@ -108,7 +110,7 @@ const CSSValueList& valueList = tempList ? *tempList : toCSSValueList(value); const size_t length = valueList.length(); - OwnPtr<InterpolableList> interpolableList = InterpolableList::create(length); + std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(length); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(length); for (size_t i = 0; i < length; i++) { InterpolationValue component = CSSImageInterpolationType::maybeConvertCSSValue(valueList.item(i), false);
diff --git a/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp index 76890c03..1a6aff64 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp
@@ -8,6 +8,8 @@ #include "core/animation/ImageSlicePropertyFunctions.h" #include "core/css/CSSBorderImageSliceValue.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -82,9 +84,9 @@ class UnderlyingSliceTypesChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<UnderlyingSliceTypesChecker> create(const SliceTypes& underlyingTypes) + static std::unique_ptr<UnderlyingSliceTypesChecker> create(const SliceTypes& underlyingTypes) { - return adoptPtr(new UnderlyingSliceTypesChecker(underlyingTypes)); + return wrapUnique(new UnderlyingSliceTypesChecker(underlyingTypes)); } static SliceTypes getUnderlyingSliceTypes(const InterpolationValue& underlying) @@ -107,9 +109,9 @@ class InheritedSliceTypesChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<InheritedSliceTypesChecker> create(CSSPropertyID property, const SliceTypes& inheritedTypes) + static std::unique_ptr<InheritedSliceTypesChecker> create(CSSPropertyID property, const SliceTypes& inheritedTypes) { - return adoptPtr(new InheritedSliceTypesChecker(property, inheritedTypes)); + return wrapUnique(new InheritedSliceTypesChecker(property, inheritedTypes)); } private: @@ -129,7 +131,7 @@ InterpolationValue convertImageSlice(const ImageSlice& slice, double zoom) { - OwnPtr<InterpolableList> list = InterpolableList::create(SideIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(SideIndexCount); const Length* sides[SideIndexCount] = {}; sides[SideTop] = &slice.slices.top(); sides[SideRight] = &slice.slices.right(); @@ -176,7 +178,7 @@ return nullptr; const CSSBorderImageSliceValue& slice = toCSSBorderImageSliceValue(value); - OwnPtr<InterpolableList> list = InterpolableList::create(SideIndexCount); + std::unique_ptr<InterpolableList> list = InterpolableList::create(SideIndexCount); const CSSPrimitiveValue* sides[SideIndexCount]; sides[SideTop] = slice.slices().top(); sides[SideRight] = slice.slices().right();
diff --git a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp index 0778f77..a5041dc 100644 --- a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
@@ -10,14 +10,16 @@ #include "core/css/resolver/CSSVariableResolver.h" #include "core/css/resolver/StyleResolverState.h" #include "platform/RuntimeEnabledFeatures.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { class ResolvedVariableChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<ResolvedVariableChecker> create(CSSPropertyID property, const CSSVariableReferenceValue* variableReference, const CSSValue* resolvedValue) + static std::unique_ptr<ResolvedVariableChecker> create(CSSPropertyID property, const CSSVariableReferenceValue* variableReference, const CSSValue* resolvedValue) { - return adoptPtr(new ResolvedVariableChecker(property, variableReference, resolvedValue)); + return wrapUnique(new ResolvedVariableChecker(property, variableReference, resolvedValue)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp index 8296f3ff..15ed438 100644 --- a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp
@@ -9,6 +9,8 @@ #include "core/css/CSSCalculationValue.h" #include "core/css/resolver/StyleBuilder.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -52,16 +54,16 @@ return LengthPropertyFunctions::isZoomedLength(cssProperty()) ? style.effectiveZoom() : 1; } -PassOwnPtr<InterpolableValue> CSSLengthInterpolationType::createInterpolablePixels(double pixels) +std::unique_ptr<InterpolableValue> CSSLengthInterpolationType::createInterpolablePixels(double pixels) { - OwnPtr<InterpolableList> interpolableList = createNeutralInterpolableValue(); + std::unique_ptr<InterpolableList> interpolableList = createNeutralInterpolableValue(); interpolableList->set(CSSPrimitiveValue::UnitTypePixels, InterpolableNumber::create(pixels)); return std::move(interpolableList); } InterpolationValue CSSLengthInterpolationType::createInterpolablePercent(double percent) { - OwnPtr<InterpolableList> interpolableList = createNeutralInterpolableValue(); + std::unique_ptr<InterpolableList> interpolableList = createNeutralInterpolableValue(); interpolableList->set(CSSPrimitiveValue::UnitTypePercentage, InterpolableNumber::create(percent)); return InterpolationValue(std::move(interpolableList), CSSLengthNonInterpolableValue::create(true)); } @@ -72,17 +74,17 @@ return nullptr; PixelsAndPercent pixelsAndPercent = length.getPixelsAndPercent(); - OwnPtr<InterpolableList> values = createNeutralInterpolableValue(); + std::unique_ptr<InterpolableList> values = createNeutralInterpolableValue(); values->set(CSSPrimitiveValue::UnitTypePixels, InterpolableNumber::create(pixelsAndPercent.pixels / zoom)); values->set(CSSPrimitiveValue::UnitTypePercentage, InterpolableNumber::create(pixelsAndPercent.percent)); return InterpolationValue(std::move(values), CSSLengthNonInterpolableValue::create(length.hasPercent())); } -PassOwnPtr<InterpolableList> CSSLengthInterpolationType::createNeutralInterpolableValue() +std::unique_ptr<InterpolableList> CSSLengthInterpolationType::createNeutralInterpolableValue() { const size_t length = CSSPrimitiveValue::LengthUnitTypeCount; - OwnPtr<InterpolableList> values = InterpolableList::create(length); + std::unique_ptr<InterpolableList> values = InterpolableList::create(length); for (size_t i = 0; i < length; i++) values->set(i, InterpolableNumber::create(0)); return values; @@ -102,7 +104,7 @@ } void CSSLengthInterpolationType::composite( - OwnPtr<InterpolableValue>& underlyingInterpolableValue, + std::unique_ptr<InterpolableValue>& underlyingInterpolableValue, RefPtr<NonInterpolableValue>& underlyingNonInterpolableValue, double underlyingFraction, const InterpolableValue& interpolableValue, @@ -136,7 +138,7 @@ CSSLengthArray lengthArray; primitiveValue.accumulateLengthArray(lengthArray); - OwnPtr<InterpolableList> values = InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount); + std::unique_ptr<InterpolableList> values = InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount); for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) values->set(i, InterpolableNumber::create(lengthArray.values[i])); @@ -146,9 +148,9 @@ class ParentLengthChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<ParentLengthChecker> create(CSSPropertyID property, const Length& length) + static std::unique_ptr<ParentLengthChecker> create(CSSPropertyID property, const Length& length) { - return adoptPtr(new ParentLengthChecker(property, length)); + return wrapUnique(new ParentLengthChecker(property, length)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h index 84f9b94..2537a204 100644 --- a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h
@@ -7,6 +7,7 @@ #include "core/animation/CSSInterpolationType.h" #include "core/animation/LengthPropertyFunctions.h" +#include <memory> namespace blink { @@ -22,14 +23,14 @@ void apply(const InterpolableValue&, const NonInterpolableValue*, InterpolationEnvironment&) const final; static Length resolveInterpolableLength(const InterpolableValue&, const NonInterpolableValue*, const CSSToLengthConversionData&, ValueRange = ValueRangeAll); - static PassOwnPtr<InterpolableValue> createInterpolablePixels(double pixels); + static std::unique_ptr<InterpolableValue> createInterpolablePixels(double pixels); static InterpolationValue createInterpolablePercent(double percent); static InterpolationValue maybeConvertCSSValue(const CSSValue&); static InterpolationValue maybeConvertLength(const Length&, float zoom); - static PassOwnPtr<InterpolableList> createNeutralInterpolableValue(); + static std::unique_ptr<InterpolableList> createNeutralInterpolableValue(); static PairwiseInterpolationValue staticMergeSingleConversions(InterpolationValue&& start, InterpolationValue&& end); static bool nonInterpolableValuesAreCompatible(const NonInterpolableValue*, const NonInterpolableValue*); - static void composite(OwnPtr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); + static void composite(std::unique_ptr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); static void subtractFromOneHundredPercent(InterpolationValue& result); private:
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp index 8e38df9..e9822d6 100644 --- a/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp
@@ -11,6 +11,8 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -55,9 +57,9 @@ public: ~ParentLengthListChecker() final {} - static PassOwnPtr<ParentLengthListChecker> create(CSSPropertyID property, const Vector<Length>& inheritedLengthList) + static std::unique_ptr<ParentLengthListChecker> create(CSSPropertyID property, const Vector<Length>& inheritedLengthList) { - return adoptPtr(new ParentLengthListChecker(property, inheritedLengthList)); + return wrapUnique(new ParentLengthListChecker(property, inheritedLengthList)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSMotionRotationInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSMotionRotationInterpolationType.cpp index 4f50495..3a55984 100644 --- a/third_party/WebKit/Source/core/animation/CSSMotionRotationInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSMotionRotationInterpolationType.cpp
@@ -6,6 +6,8 @@ #include "core/css/resolver/StyleBuilderConverter.h" #include "core/style/StyleMotionRotation.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -37,9 +39,9 @@ class UnderlyingRotationTypeChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<UnderlyingRotationTypeChecker> create(MotionRotationType underlyingRotationType) + static std::unique_ptr<UnderlyingRotationTypeChecker> create(MotionRotationType underlyingRotationType) { - return adoptPtr(new UnderlyingRotationTypeChecker(underlyingRotationType)); + return wrapUnique(new UnderlyingRotationTypeChecker(underlyingRotationType)); } bool isValid(const InterpolationEnvironment&, const InterpolationValue& underlying) const final @@ -57,9 +59,9 @@ class InheritedRotationTypeChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<InheritedRotationTypeChecker> create(MotionRotationType inheritedRotationType) + static std::unique_ptr<InheritedRotationTypeChecker> create(MotionRotationType inheritedRotationType) { - return adoptPtr(new InheritedRotationTypeChecker(inheritedRotationType)); + return wrapUnique(new InheritedRotationTypeChecker(inheritedRotationType)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final
diff --git a/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp index 1d759e0..b2df15d 100644 --- a/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp
@@ -7,14 +7,16 @@ #include "core/animation/NumberPropertyFunctions.h" #include "core/css/resolver/StyleBuilder.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { class ParentNumberChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<ParentNumberChecker> create(CSSPropertyID property, double number) + static std::unique_ptr<ParentNumberChecker> create(CSSPropertyID property, double number) { - return adoptPtr(new ParentNumberChecker(property, number)); + return wrapUnique(new ParentNumberChecker(property, number)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp index 33fb0e1..63b49383 100644 --- a/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp
@@ -7,6 +7,8 @@ #include "core/animation/CSSColorInterpolationType.h" #include "core/animation/PaintPropertyFunctions.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -25,13 +27,13 @@ class ParentPaintChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<ParentPaintChecker> create(CSSPropertyID property, const StyleColor& color) + static std::unique_ptr<ParentPaintChecker> create(CSSPropertyID property, const StyleColor& color) { - return adoptPtr(new ParentPaintChecker(property, color)); + return wrapUnique(new ParentPaintChecker(property, color)); } - static PassOwnPtr<ParentPaintChecker> create(CSSPropertyID property) + static std::unique_ptr<ParentPaintChecker> create(CSSPropertyID property) { - return adoptPtr(new ParentPaintChecker(property)); + return wrapUnique(new ParentPaintChecker(property)); } private: @@ -73,7 +75,7 @@ InterpolationValue CSSPaintInterpolationType::maybeConvertValue(const CSSValue& value, const StyleResolverState&, ConversionCheckers&) const { - OwnPtr<InterpolableValue> interpolableColor = CSSColorInterpolationType::maybeCreateInterpolableColor(value); + std::unique_ptr<InterpolableValue> interpolableColor = CSSColorInterpolationType::maybeCreateInterpolableColor(value); if (!interpolableColor) return nullptr; return InterpolationValue(std::move(interpolableColor));
diff --git a/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp index 03c87db..f406ced 100644 --- a/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp
@@ -7,13 +7,15 @@ #include "core/animation/PathInterpolationFunctions.h" #include "core/css/CSSPathValue.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { void CSSPathInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const { ASSERT(cssProperty() == CSSPropertyD); - OwnPtr<SVGPathByteStream> pathByteStream = PathInterpolationFunctions::appliedValue(interpolableValue, nonInterpolableValue); + std::unique_ptr<SVGPathByteStream> pathByteStream = PathInterpolationFunctions::appliedValue(interpolableValue, nonInterpolableValue); if (pathByteStream->isEmpty()) { environment.state().style()->setD(nullptr); return; @@ -38,9 +40,9 @@ class ParentPathChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<ParentPathChecker> create(PassRefPtr<StylePath> stylePath) + static std::unique_ptr<ParentPathChecker> create(PassRefPtr<StylePath> stylePath) { - return adoptPtr(new ParentPathChecker(stylePath)); + return wrapUnique(new ParentPathChecker(stylePath)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp index c060bcad..d9eb7a8 100644 --- a/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp
@@ -7,6 +7,8 @@ #include "core/css/resolver/StyleBuilderConverter.h" #include "platform/transforms/RotateTransformOperation.h" #include "platform/transforms/Rotation.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -90,9 +92,9 @@ class InheritedRotationChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<InheritedRotationChecker> create(const Rotation& inheritedRotation) + static std::unique_ptr<InheritedRotationChecker> create(const Rotation& inheritedRotation) { - return adoptPtr(new InheritedRotationChecker(inheritedRotation)); + return wrapUnique(new InheritedRotationChecker(inheritedRotation)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final
diff --git a/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp index 1c4bb4e..8ff23f43 100644 --- a/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp
@@ -7,6 +7,8 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -37,9 +39,9 @@ array[2] = z; } - PassOwnPtr<InterpolableValue> createInterpolableValue() const + std::unique_ptr<InterpolableValue> createInterpolableValue() const { - OwnPtr<InterpolableList> result = InterpolableList::create(3); + std::unique_ptr<InterpolableList> result = InterpolableList::create(3); for (size_t i = 0; i < 3; i++) result->set(i, InterpolableNumber::create(array[i])); return std::move(result); @@ -59,9 +61,9 @@ class ParentScaleChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<ParentScaleChecker> create(const Scale& scale) + static std::unique_ptr<ParentScaleChecker> create(const Scale& scale) { - return adoptPtr(new ParentScaleChecker(scale)); + return wrapUnique(new ParentScaleChecker(scale)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp index 1a08cd58..eff2bd9 100644 --- a/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp
@@ -11,6 +11,8 @@ #include "core/css/resolver/StyleBuilder.h" #include "core/css/resolver/StyleResolverState.h" #include "core/style/ShadowList.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -41,9 +43,9 @@ class ParentShadowListChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<ParentShadowListChecker> create(CSSPropertyID property, PassRefPtr<ShadowList> shadowList) + static std::unique_ptr<ParentShadowListChecker> create(CSSPropertyID property, PassRefPtr<ShadowList> shadowList) { - return adoptPtr(new ParentShadowListChecker(property, shadowList)); + return wrapUnique(new ParentShadowListChecker(property, shadowList)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp index 4cf925d..019fe08 100644 --- a/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp
@@ -9,6 +9,8 @@ #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" #include "core/style/ComputedStyle.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -63,9 +65,9 @@ class UnderlyingIndentModeChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<UnderlyingIndentModeChecker> create(const IndentMode& mode) + static std::unique_ptr<UnderlyingIndentModeChecker> create(const IndentMode& mode) { - return adoptPtr(new UnderlyingIndentModeChecker(mode)); + return wrapUnique(new UnderlyingIndentModeChecker(mode)); } bool isValid(const InterpolationEnvironment&, const InterpolationValue& underlying) const final @@ -83,9 +85,9 @@ class InheritedIndentModeChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<InheritedIndentModeChecker> create(const IndentMode& mode) + static std::unique_ptr<InheritedIndentModeChecker> create(const IndentMode& mode) { - return adoptPtr(new InheritedIndentModeChecker(mode)); + return wrapUnique(new InheritedIndentModeChecker(mode)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue&) const final
diff --git a/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp index b44eb40..f938343 100644 --- a/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp
@@ -12,6 +12,8 @@ #include "core/css/resolver/TransformBuilder.h" #include "platform/transforms/TransformOperations.h" #include "platform/transforms/TranslateTransformOperation.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -107,9 +109,9 @@ class InheritedTransformChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<InheritedTransformChecker> create(const TransformOperations& inheritedTransform) + static std::unique_ptr<InheritedTransformChecker> create(const TransformOperations& inheritedTransform) { - return adoptPtr(new InheritedTransformChecker(inheritedTransform)); + return wrapUnique(new InheritedTransformChecker(inheritedTransform)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final @@ -160,7 +162,7 @@ primitiveValue.accumulateLengthArray(lengthArray); } } - OwnPtr<InterpolationType::ConversionChecker> lengthUnitsChecker = LengthUnitsChecker::maybeCreate(std::move(lengthArray), state); + std::unique_ptr<InterpolationType::ConversionChecker> lengthUnitsChecker = LengthUnitsChecker::maybeCreate(std::move(lengthArray), state); if (lengthUnitsChecker) conversionCheckers.append(std::move(lengthUnitsChecker));
diff --git a/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp index a544cb2..87e1460 100644 --- a/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp
@@ -8,6 +8,8 @@ #include "core/css/CSSValueList.h" #include "core/css/resolver/StyleResolverState.h" #include "platform/transforms/TranslateTransformOperation.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -17,9 +19,9 @@ public: ~ParentTranslateChecker() {} - static PassOwnPtr<ParentTranslateChecker> create(PassRefPtr<TranslateTransformOperation> parentTranslate) + static std::unique_ptr<ParentTranslateChecker> create(PassRefPtr<TranslateTransformOperation> parentTranslate) { - return adoptPtr(new ParentTranslateChecker(parentTranslate)); + return wrapUnique(new ParentTranslateChecker(parentTranslate)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final @@ -49,7 +51,7 @@ InterpolationValue createNeutralValue() { - OwnPtr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); + std::unique_ptr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); result->set(TranslateX, CSSLengthInterpolationType::createNeutralInterpolableValue()); result->set(TranslateY, CSSLengthInterpolationType::createNeutralInterpolableValue()); result->set(TranslateZ, CSSLengthInterpolationType::createNeutralInterpolableValue()); @@ -61,7 +63,7 @@ if (!translate) return createNeutralValue(); - OwnPtr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); + std::unique_ptr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); result->set(TranslateX, CSSLengthInterpolationType::maybeConvertLength(translate->x(), zoom).interpolableValue); result->set(TranslateY, CSSLengthInterpolationType::maybeConvertLength(translate->y(), zoom).interpolableValue); result->set(TranslateZ, CSSLengthInterpolationType::maybeConvertLength(Length(translate->z(), Fixed), zoom).interpolableValue); @@ -96,7 +98,7 @@ if (list.length() < 1 || list.length() > 3) return nullptr; - OwnPtr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); + std::unique_ptr<InterpolableList> result = InterpolableList::create(TranslateComponentIndexCount); for (size_t i = 0; i < TranslateComponentIndexCount; i++) { InterpolationValue component = nullptr; if (i < list.length()) {
diff --git a/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp index f620da1..40fc30ea 100644 --- a/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp
@@ -6,6 +6,8 @@ #include "core/css/CSSPrimitiveValueMappings.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -56,9 +58,9 @@ public: ~UnderlyingVisibilityChecker() final {} - static PassOwnPtr<UnderlyingVisibilityChecker> create(EVisibility visibility) + static std::unique_ptr<UnderlyingVisibilityChecker> create(EVisibility visibility) { - return adoptPtr(new UnderlyingVisibilityChecker(visibility)); + return wrapUnique(new UnderlyingVisibilityChecker(visibility)); } private: @@ -78,9 +80,9 @@ class ParentVisibilityChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<ParentVisibilityChecker> create(EVisibility visibility) + static std::unique_ptr<ParentVisibilityChecker> create(EVisibility visibility) { - return adoptPtr(new ParentVisibilityChecker(visibility)); + return wrapUnique(new ParentVisibilityChecker(visibility)); } private:
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp index 31e504c..a4bd613 100644 --- a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp +++ b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp
@@ -53,9 +53,10 @@ #include "platform/geometry/FloatBox.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" - +#include "wtf/PtrUtil.h" #include <algorithm> #include <cmath> +#include <memory> namespace blink { @@ -332,14 +333,14 @@ const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(effect); - Vector<OwnPtr<CompositorAnimation>> animations; + Vector<std::unique_ptr<CompositorAnimation>> animations; getAnimationOnCompositor(timing, group, startTime, timeOffset, keyframeEffect, animations, animationPlaybackRate); ASSERT(!animations.isEmpty()); for (auto& compositorAnimation : animations) { int id = compositorAnimation->id(); CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); ASSERT(compositorPlayer); - compositorPlayer->addAnimation(compositorAnimation.leakPtr()); + compositorPlayer->addAnimation(compositorAnimation.release()); startedAnimationIds.append(id); } ASSERT(!startedAnimationIds.isEmpty()); @@ -510,7 +511,7 @@ void addKeyframeToCurve(CompositorFilterAnimationCurve& curve, Keyframe::PropertySpecificKeyframe* keyframe, const AnimatableValue* value, const TimingFunction* keyframeTimingFunction) { - OwnPtr<CompositorFilterOperations> ops = CompositorFilterOperations::create(); + std::unique_ptr<CompositorFilterOperations> ops = CompositorFilterOperations::create(); toCompositorFilterOperations(toAnimatableFilterOperations(value)->operations(), ops.get()); CompositorFilterKeyframe filterKeyframe(keyframe->offset(), std::move(ops)); @@ -527,7 +528,7 @@ void addKeyframeToCurve(CompositorTransformAnimationCurve& curve, Keyframe::PropertySpecificKeyframe* keyframe, const AnimatableValue* value, const TimingFunction* keyframeTimingFunction) { - OwnPtr<CompositorTransformOperations> ops = CompositorTransformOperations::create(); + std::unique_ptr<CompositorTransformOperations> ops = CompositorTransformOperations::create(); toCompositorTransformOperations(toAnimatableTransform(value)->transformOperations(), ops.get()); CompositorTransformKeyframe transformKeyframe(keyframe->offset(), std::move(ops)); @@ -555,7 +556,7 @@ } // namespace -void CompositorAnimations::getAnimationOnCompositor(const Timing& timing, int group, double startTime, double timeOffset, const KeyframeEffectModelBase& effect, Vector<OwnPtr<CompositorAnimation>>& animations, double animationPlaybackRate) +void CompositorAnimations::getAnimationOnCompositor(const Timing& timing, int group, double startTime, double timeOffset, const KeyframeEffectModelBase& effect, Vector<std::unique_ptr<CompositorAnimation>>& animations, double animationPlaybackRate) { ASSERT(animations.isEmpty()); CompositorTiming compositorTiming; @@ -576,11 +577,11 @@ getKeyframeValuesForProperty(&effect, property, scale, values); CompositorTargetProperty::Type targetProperty; - OwnPtr<CompositorAnimationCurve> curve; + std::unique_ptr<CompositorAnimationCurve> curve; switch (property.cssProperty()) { case CSSPropertyOpacity: { targetProperty = CompositorTargetProperty::OPACITY; - OwnPtr<CompositorFloatAnimationCurve> floatCurve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> floatCurve = CompositorFloatAnimationCurve::create(); addKeyframesToCurve(*floatCurve, values); setTimingFunctionOnCurve(*floatCurve, timing.timingFunction.get()); curve = std::move(floatCurve); @@ -589,7 +590,7 @@ case CSSPropertyWebkitFilter: case CSSPropertyBackdropFilter: { targetProperty = CompositorTargetProperty::FILTER; - OwnPtr<CompositorFilterAnimationCurve> filterCurve = CompositorFilterAnimationCurve::create(); + std::unique_ptr<CompositorFilterAnimationCurve> filterCurve = CompositorFilterAnimationCurve::create(); addKeyframesToCurve(*filterCurve, values); setTimingFunctionOnCurve(*filterCurve, timing.timingFunction.get()); curve = std::move(filterCurve); @@ -600,7 +601,7 @@ case CSSPropertyTranslate: case CSSPropertyTransform: { targetProperty = CompositorTargetProperty::TRANSFORM; - OwnPtr<CompositorTransformAnimationCurve> transformCurve = CompositorTransformAnimationCurve::create(); + std::unique_ptr<CompositorTransformAnimationCurve> transformCurve = CompositorTransformAnimationCurve::create(); addKeyframesToCurve(*transformCurve, values); setTimingFunctionOnCurve(*transformCurve, timing.timingFunction.get()); curve = std::move(transformCurve); @@ -612,7 +613,7 @@ } ASSERT(curve.get()); - OwnPtr<CompositorAnimation> animation = CompositorAnimation::create(*curve, targetProperty, group, 0); + std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create(*curve, targetProperty, group, 0); if (!std::isnan(startTime)) animation->setStartTime(startTime);
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimations.h b/third_party/WebKit/Source/core/animation/CompositorAnimations.h index 7aa79b6..4770aa2 100644 --- a/third_party/WebKit/Source/core/animation/CompositorAnimations.h +++ b/third_party/WebKit/Source/core/animation/CompositorAnimations.h
@@ -37,6 +37,7 @@ #include "platform/animation/TimingFunction.h" #include "wtf/Allocator.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -76,7 +77,7 @@ static bool convertTimingForCompositor(const Timing&, double timeOffset, CompositorTiming& out, double animationPlaybackRate); - static void getAnimationOnCompositor(const Timing&, int group, double startTime, double timeOffset, const KeyframeEffectModelBase&, Vector<OwnPtr<CompositorAnimation>>& animations, double animationPlaybackRate); + static void getAnimationOnCompositor(const Timing&, int group, double startTime, double timeOffset, const KeyframeEffectModelBase&, Vector<std::unique_ptr<CompositorAnimation>>& animations, double animationPlaybackRate); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp b/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp index bd1ef13..dad1ada 100644 --- a/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp +++ b/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp
@@ -53,10 +53,10 @@ #include "platform/transforms/TranslateTransformOperation.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/HashFunctions.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -69,15 +69,15 @@ Timing m_timing; CompositorAnimations::CompositorTiming m_compositorTiming; - OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2; + std::unique_ptr<AnimatableValueKeyframeVector> m_keyframeVector2; Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2; - OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5; + std::unique_ptr<AnimatableValueKeyframeVector> m_keyframeVector5; Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5; Persistent<Document> m_document; Persistent<Element> m_element; Persistent<AnimationTimeline> m_timeline; - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; void SetUp() override { @@ -116,11 +116,11 @@ { return CompositorAnimations::isCandidateForAnimationOnCompositor(timing, *m_element.get(), nullptr, effect, 1); } - void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectModel& effect, Vector<OwnPtr<CompositorAnimation>>& animations) + void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectModel& effect, Vector<std::unique_ptr<CompositorAnimation>>& animations) { getAnimationOnCompositor(timing, effect, animations, 1); } - void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectModel& effect, Vector<OwnPtr<CompositorAnimation>>& animations, double playerPlaybackRate) + void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectModel& effect, Vector<std::unique_ptr<CompositorAnimation>>& animations, double playerPlaybackRate) { CompositorAnimations::getAnimationOnCompositor(timing, 0, std::numeric_limits<double>::quiet_NaN(), 0, effect, animations, playerPlaybackRate); } @@ -180,7 +180,7 @@ return keyframe; } - PassOwnPtr<AnimatableValueKeyframeVector> createCompositableFloatKeyframeVector(size_t n) + std::unique_ptr<AnimatableValueKeyframeVector> createCompositableFloatKeyframeVector(size_t n) { Vector<double> values; for (size_t i = 0; i < n; i++) { @@ -189,9 +189,9 @@ return createCompositableFloatKeyframeVector(values); } - PassOwnPtr<AnimatableValueKeyframeVector> createCompositableFloatKeyframeVector(Vector<double>& values) + std::unique_ptr<AnimatableValueKeyframeVector> createCompositableFloatKeyframeVector(Vector<double>& values) { - OwnPtr<AnimatableValueKeyframeVector> frames = adoptPtr(new AnimatableValueKeyframeVector); + std::unique_ptr<AnimatableValueKeyframeVector> frames = wrapUnique(new AnimatableValueKeyframeVector); for (size_t i = 0; i < values.size(); i++) { double offset = 1.0 / (values.size() - 1) * i; RefPtr<AnimatableDouble> value = AnimatableDouble::create(values[i]); @@ -200,9 +200,9 @@ return frames; } - PassOwnPtr<AnimatableValueKeyframeVector> createCompositableTransformKeyframeVector(const Vector<TransformOperations>& values) + std::unique_ptr<AnimatableValueKeyframeVector> createCompositableTransformKeyframeVector(const Vector<TransformOperations>& values) { - OwnPtr<AnimatableValueKeyframeVector> frames = adoptPtr(new AnimatableValueKeyframeVector); + std::unique_ptr<AnimatableValueKeyframeVector> frames = wrapUnique(new AnimatableValueKeyframeVector); for (size_t i = 0; i < values.size(); ++i) { double offset = 1.0f / (values.size() - 1) * i; RefPtr<AnimatableTransform> value = AnimatableTransform::create(values[i], 1); @@ -247,15 +247,15 @@ m_timeline->serviceAnimations(TimingUpdateForAnimationFrame); } - PassOwnPtr<CompositorAnimation> convertToCompositorAnimation(AnimatableValueKeyframeEffectModel& effect, double playerPlaybackRate) + std::unique_ptr<CompositorAnimation> convertToCompositorAnimation(AnimatableValueKeyframeEffectModel& effect, double playerPlaybackRate) { - Vector<OwnPtr<CompositorAnimation>> result; + Vector<std::unique_ptr<CompositorAnimation>> result; getAnimationOnCompositor(m_timing, effect, result, playerPlaybackRate); DCHECK_EQ(1U, result.size()); return std::move(result[0]); } - PassOwnPtr<CompositorAnimation> convertToCompositorAnimation(AnimatableValueKeyframeEffectModel& effect) + std::unique_ptr<CompositorAnimation> convertToCompositorAnimation(AnimatableValueKeyframeEffectModel& effect) { return convertToCompositorAnimation(effect, 1.0); } @@ -348,7 +348,7 @@ transformVector.last().operations().append(TranslateTransformOperation::create(Length(0, Fixed), Length(0, Fixed), 0.0, TransformOperation::Translate3D)); transformVector.append(TransformOperations()); transformVector.last().operations().append(TranslateTransformOperation::create(Length(200, Fixed), Length(200, Fixed), 0.0, TransformOperation::Translate3D)); - OwnPtr<AnimatableValueKeyframeVector> frames = createCompositableTransformKeyframeVector(transformVector); + std::unique_ptr<AnimatableValueKeyframeVector> frames = createCompositableTransformKeyframeVector(transformVector); FloatBox bounds; EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel::create(*frames), 0, 1)); EXPECT_EQ(FloatBox(0.0f, 0.f, 0.0f, 200.0f, 200.0f, 0.0f), bounds); @@ -646,14 +646,14 @@ createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0).get(), 0), createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0).get(), 1.0)); - OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(1.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection()); EXPECT_EQ(1.0, animation->playbackRate()); - OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size()); @@ -677,8 +677,8 @@ const double duration = 10.0; m_timing.iterationDuration = duration; - OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); - OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size()); @@ -699,14 +699,14 @@ m_timing.direction = Timing::PlaybackDirectionAlternate; m_timing.playbackRate = 2.0; - OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(5.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_NORMAL, animation->getDirection()); EXPECT_EQ(2.0, animation->playbackRate()); - OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(4UL, keyframes.size()); @@ -741,13 +741,13 @@ m_timing.iterationDuration = 1.75; m_timing.startDelay = startDelay; - OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(5.0, animation->iterations()); EXPECT_EQ(-startDelay, animation->timeOffset()); - OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size()); @@ -774,14 +774,14 @@ m_timing.iterationCount = 10; m_timing.direction = Timing::PlaybackDirectionAlternate; - OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(10.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_NORMAL, animation->getDirection()); EXPECT_EQ(1.0, animation->playbackRate()); - OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(4UL, keyframes.size()); @@ -822,14 +822,14 @@ m_timing.iterationCount = 10; m_timing.direction = Timing::PlaybackDirectionAlternateReverse; - OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(10.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_REVERSE, animation->getDirection()); EXPECT_EQ(1.0, animation->playbackRate()); - OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(4UL, keyframes.size()); @@ -867,14 +867,14 @@ m_timing.startDelay = negativeStartDelay; m_timing.direction = Timing::PlaybackDirectionAlternateReverse; - OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(5.0, animation->iterations()); EXPECT_EQ(-negativeStartDelay, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_REVERSE, animation->getDirection()); EXPECT_EQ(1.0, animation->playbackRate()); - OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size()); @@ -892,14 +892,14 @@ m_timing.playbackRate = playbackRate; - OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect, playerPlaybackRate); + std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect, playerPlaybackRate); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(1.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection()); EXPECT_EQ(playbackRate * playerPlaybackRate, animation->playbackRate()); - OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size()); @@ -914,7 +914,7 @@ m_timing.fillMode = Timing::FillModeNone; - OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorAnimation::FillMode::NONE, animation->getFillMode()); } @@ -927,7 +927,7 @@ m_timing.fillMode = Timing::FillModeAuto; - OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); EXPECT_EQ(1.0, animation->iterations()); EXPECT_EQ(0, animation->timeOffset()); @@ -945,9 +945,9 @@ m_timing.timingFunction = m_cubicCustomTimingFunction; - OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); + std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimation(*effect); - OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); + std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->floatCurveForTesting(); Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesForTesting(); ASSERT_EQ(2UL, keyframes.size());
diff --git a/third_party/WebKit/Source/core/animation/EffectInputTest.cpp b/third_party/WebKit/Source/core/animation/EffectInputTest.cpp index 3c307d2d1..32cf30f 100644 --- a/third_party/WebKit/Source/core/animation/EffectInputTest.cpp +++ b/third_party/WebKit/Source/core/animation/EffectInputTest.cpp
@@ -14,6 +14,7 @@ #include "core/dom/ExceptionCode.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> #include <v8.h> namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/EffectModel.h b/third_party/WebKit/Source/core/animation/EffectModel.h index 9bf46e3..cdf0cb6 100644 --- a/third_party/WebKit/Source/core/animation/EffectModel.h +++ b/third_party/WebKit/Source/core/animation/EffectModel.h
@@ -37,7 +37,6 @@ #include "core/animation/PropertyHandle.h" #include "platform/heap/Handle.h" #include "wtf/HashMap.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.cpp index 8d5b166..47d19883aa 100644 --- a/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.cpp
@@ -12,6 +12,7 @@ #include "core/css/resolver/StyleResolverState.h" #include "core/style/ShadowData.h" #include "platform/graphics/filters/FilterOperations.h" +#include <memory> namespace blink { @@ -195,7 +196,7 @@ return result; } -PassOwnPtr<InterpolableValue> FilterInterpolationFunctions::createNoneValue(const NonInterpolableValue& untypedNonInterpolableValue) +std::unique_ptr<InterpolableValue> FilterInterpolationFunctions::createNoneValue(const NonInterpolableValue& untypedNonInterpolableValue) { switch (toFilterNonInterpolableValue(untypedNonInterpolableValue).type()) { case FilterOperation::GRAYSCALE:
diff --git a/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.h index 0f9c6c96..38f18a09 100644 --- a/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/FilterInterpolationFunctions.h
@@ -7,6 +7,7 @@ #include "core/animation/InterpolationValue.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -18,7 +19,7 @@ InterpolationValue maybeConvertCSSFilter(const CSSValue&); InterpolationValue maybeConvertFilter(const FilterOperation&, double zoom); -PassOwnPtr<InterpolableValue> createNoneValue(const NonInterpolableValue&); +std::unique_ptr<InterpolableValue> createNoneValue(const NonInterpolableValue&); bool filtersAreCompatible(const NonInterpolableValue&, const NonInterpolableValue&); FilterOperation* createFilter(const InterpolableValue&, const NonInterpolableValue&, const StyleResolverState&);
diff --git a/third_party/WebKit/Source/core/animation/InterpolableValue.cpp b/third_party/WebKit/Source/core/animation/InterpolableValue.cpp index 084ecf8..de958c4b 100644 --- a/third_party/WebKit/Source/core/animation/InterpolableValue.cpp +++ b/third_party/WebKit/Source/core/animation/InterpolableValue.cpp
@@ -4,6 +4,8 @@ #include "core/animation/InterpolableValue.h" +#include <memory> + namespace blink { bool InterpolableNumber::equals(const InterpolableValue& other) const @@ -62,9 +64,9 @@ } } -PassOwnPtr<InterpolableValue> InterpolableList::cloneAndZero() const +std::unique_ptr<InterpolableValue> InterpolableList::cloneAndZero() const { - OwnPtr<InterpolableList> result = InterpolableList::create(m_size); + std::unique_ptr<InterpolableList> result = InterpolableList::create(m_size); for (size_t i = 0; i < m_size; i++) result->set(i, m_values[i]->cloneAndZero()); return std::move(result);
diff --git a/third_party/WebKit/Source/core/animation/InterpolableValue.h b/third_party/WebKit/Source/core/animation/InterpolableValue.h index a3d30a8d..d1720e841 100644 --- a/third_party/WebKit/Source/core/animation/InterpolableValue.h +++ b/third_party/WebKit/Source/core/animation/InterpolableValue.h
@@ -8,9 +8,9 @@ #include "core/CoreExport.h" #include "core/animation/animatable/AnimatableValue.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -26,8 +26,8 @@ virtual bool isAnimatableValue() const { return false; } virtual bool equals(const InterpolableValue&) const = 0; - virtual PassOwnPtr<InterpolableValue> clone() const = 0; - virtual PassOwnPtr<InterpolableValue> cloneAndZero() const = 0; + virtual std::unique_ptr<InterpolableValue> clone() const = 0; + virtual std::unique_ptr<InterpolableValue> cloneAndZero() const = 0; virtual void scale(double scale) = 0; virtual void scaleAndAdd(double scale, const InterpolableValue& other) = 0; @@ -49,16 +49,16 @@ class CORE_EXPORT InterpolableNumber final : public InterpolableValue { public: - static PassOwnPtr<InterpolableNumber> create(double value) + static std::unique_ptr<InterpolableNumber> create(double value) { - return adoptPtr(new InterpolableNumber(value)); + return wrapUnique(new InterpolableNumber(value)); } bool isNumber() const final { return true; } double value() const { return m_value; } bool equals(const InterpolableValue& other) const final; - PassOwnPtr<InterpolableValue> clone() const final { return create(m_value); } - PassOwnPtr<InterpolableValue> cloneAndZero() const final { return create(0); } + std::unique_ptr<InterpolableValue> clone() const final { return create(m_value); } + std::unique_ptr<InterpolableValue> cloneAndZero() const final { return create(0); } void scale(double scale) final; void scaleAndAdd(double scale, const InterpolableValue& other) final; void set(double value) { m_value = value; } @@ -76,16 +76,16 @@ class CORE_EXPORT InterpolableBool final : public InterpolableValue { public: - static PassOwnPtr<InterpolableBool> create(bool value) + static std::unique_ptr<InterpolableBool> create(bool value) { - return adoptPtr(new InterpolableBool(value)); + return wrapUnique(new InterpolableBool(value)); } bool isBool() const final { return true; } bool value() const { return m_value; } bool equals(const InterpolableValue&) const final { ASSERT_NOT_REACHED(); return false; } - PassOwnPtr<InterpolableValue> clone() const final { return create(m_value); } - PassOwnPtr<InterpolableValue> cloneAndZero() const final { ASSERT_NOT_REACHED(); return nullptr; } + std::unique_ptr<InterpolableValue> clone() const final { return create(m_value); } + std::unique_ptr<InterpolableValue> cloneAndZero() const final { ASSERT_NOT_REACHED(); return nullptr; } void scale(double scale) final { ASSERT_NOT_REACHED(); } void scaleAndAdd(double scale, const InterpolableValue& other) final { ASSERT_NOT_REACHED(); } @@ -110,18 +110,18 @@ // has its own copy constructor. So just delete operator= here. InterpolableList& operator=(const InterpolableList&) = delete; - static PassOwnPtr<InterpolableList> create(const InterpolableList &other) + static std::unique_ptr<InterpolableList> create(const InterpolableList &other) { - return adoptPtr(new InterpolableList(other)); + return wrapUnique(new InterpolableList(other)); } - static PassOwnPtr<InterpolableList> create(size_t size) + static std::unique_ptr<InterpolableList> create(size_t size) { - return adoptPtr(new InterpolableList(size)); + return wrapUnique(new InterpolableList(size)); } bool isList() const final { return true; } - void set(size_t position, PassOwnPtr<InterpolableValue> value) + void set(size_t position, std::unique_ptr<InterpolableValue> value) { ASSERT(position < m_size); m_values[position] = std::move(value); @@ -131,15 +131,15 @@ ASSERT(position < m_size); return m_values[position].get(); } - OwnPtr<InterpolableValue>& getMutable(size_t position) + std::unique_ptr<InterpolableValue>& getMutable(size_t position) { ASSERT(position < m_size); return m_values[position]; } size_t length() const { return m_size; } bool equals(const InterpolableValue& other) const final; - PassOwnPtr<InterpolableValue> clone() const final { return create(*this); } - PassOwnPtr<InterpolableValue> cloneAndZero() const final; + std::unique_ptr<InterpolableValue> clone() const final { return create(*this); } + std::unique_ptr<InterpolableValue> cloneAndZero() const final; void scale(double scale) final; void scaleAndAdd(double scale, const InterpolableValue& other) final; @@ -160,22 +160,22 @@ } size_t m_size; - Vector<OwnPtr<InterpolableValue>> m_values; + Vector<std::unique_ptr<InterpolableValue>> m_values; }; // FIXME: Remove this when we can. class InterpolableAnimatableValue : public InterpolableValue { public: - static PassOwnPtr<InterpolableAnimatableValue> create(PassRefPtr<AnimatableValue> value) + static std::unique_ptr<InterpolableAnimatableValue> create(PassRefPtr<AnimatableValue> value) { - return adoptPtr(new InterpolableAnimatableValue(value)); + return wrapUnique(new InterpolableAnimatableValue(value)); } bool isAnimatableValue() const final { return true; } AnimatableValue* value() const { return m_value.get(); } bool equals(const InterpolableValue&) const final { ASSERT_NOT_REACHED(); return false; } - PassOwnPtr<InterpolableValue> clone() const final { return create(m_value); } - PassOwnPtr<InterpolableValue> cloneAndZero() const final { ASSERT_NOT_REACHED(); return nullptr; } + std::unique_ptr<InterpolableValue> clone() const final { return create(m_value); } + std::unique_ptr<InterpolableValue> cloneAndZero() const final { ASSERT_NOT_REACHED(); return nullptr; } void scale(double scale) final { ASSERT_NOT_REACHED(); } void scaleAndAdd(double scale, const InterpolableValue& other) final { ASSERT_NOT_REACHED(); }
diff --git a/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp b/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp index b65d8255fc..3b96588 100644 --- a/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp +++ b/third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp
@@ -7,6 +7,7 @@ #include "core/animation/Interpolation.h" #include "core/animation/PropertyHandle.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -14,7 +15,7 @@ class SampleInterpolation : public Interpolation { public: - static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end) + static PassRefPtr<Interpolation> create(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end) { return adoptRef(new SampleInterpolation(std::move(start), std::move(end))); } @@ -24,7 +25,7 @@ return PropertyHandle(CSSPropertyBackgroundColor); } private: - SampleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end) + SampleInterpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end) : Interpolation(std::move(start), std::move(end)) { } @@ -58,7 +59,7 @@ base.scaleAndAdd(scale, add); } - PassRefPtr<Interpolation> interpolateLists(PassOwnPtr<InterpolableList> listA, PassOwnPtr<InterpolableList> listB, double progress) + PassRefPtr<Interpolation> interpolateLists(std::unique_ptr<InterpolableList> listA, std::unique_ptr<InterpolableList> listB, double progress) { RefPtr<Interpolation> i = SampleInterpolation::create(std::move(listA), std::move(listB)); i->interpolate(0, progress); @@ -88,12 +89,12 @@ TEST_F(AnimationInterpolableValueTest, SimpleList) { - OwnPtr<InterpolableList> listA = InterpolableList::create(3); + std::unique_ptr<InterpolableList> listA = InterpolableList::create(3); listA->set(0, InterpolableNumber::create(0)); listA->set(1, InterpolableNumber::create(42)); listA->set(2, InterpolableNumber::create(20.5)); - OwnPtr<InterpolableList> listB = InterpolableList::create(3); + std::unique_ptr<InterpolableList> listB = InterpolableList::create(3); listB->set(0, InterpolableNumber::create(100)); listB->set(1, InterpolableNumber::create(-200)); listB->set(2, InterpolableNumber::create(300)); @@ -107,16 +108,16 @@ TEST_F(AnimationInterpolableValueTest, NestedList) { - OwnPtr<InterpolableList> listA = InterpolableList::create(3); + std::unique_ptr<InterpolableList> listA = InterpolableList::create(3); listA->set(0, InterpolableNumber::create(0)); - OwnPtr<InterpolableList> subListA = InterpolableList::create(1); + std::unique_ptr<InterpolableList> subListA = InterpolableList::create(1); subListA->set(0, InterpolableNumber::create(100)); listA->set(1, std::move(subListA)); listA->set(2, InterpolableBool::create(false)); - OwnPtr<InterpolableList> listB = InterpolableList::create(3); + std::unique_ptr<InterpolableList> listB = InterpolableList::create(3); listB->set(0, InterpolableNumber::create(100)); - OwnPtr<InterpolableList> subListB = InterpolableList::create(1); + std::unique_ptr<InterpolableList> subListB = InterpolableList::create(1); subListB->set(0, InterpolableNumber::create(50)); listB->set(1, std::move(subListB)); listB->set(2, InterpolableBool::create(true)); @@ -130,7 +131,7 @@ TEST_F(AnimationInterpolableValueTest, ScaleAndAddNumbers) { - OwnPtr<InterpolableNumber> base = InterpolableNumber::create(10); + std::unique_ptr<InterpolableNumber> base = InterpolableNumber::create(10); scaleAndAdd(*base, 2, *InterpolableNumber::create(1)); EXPECT_FLOAT_EQ(21, base->value()); @@ -145,11 +146,11 @@ TEST_F(AnimationInterpolableValueTest, ScaleAndAddLists) { - OwnPtr<InterpolableList> baseList = InterpolableList::create(3); + std::unique_ptr<InterpolableList> baseList = InterpolableList::create(3); baseList->set(0, InterpolableNumber::create(5)); baseList->set(1, InterpolableNumber::create(10)); baseList->set(2, InterpolableNumber::create(15)); - OwnPtr<InterpolableList> addList = InterpolableList::create(3); + std::unique_ptr<InterpolableList> addList = InterpolableList::create(3); addList->set(0, InterpolableNumber::create(1)); addList->set(1, InterpolableNumber::create(2)); addList->set(2, InterpolableNumber::create(3));
diff --git a/third_party/WebKit/Source/core/animation/Interpolation.cpp b/third_party/WebKit/Source/core/animation/Interpolation.cpp index 2a6012c..87da640 100644 --- a/third_party/WebKit/Source/core/animation/Interpolation.cpp +++ b/third_party/WebKit/Source/core/animation/Interpolation.cpp
@@ -4,6 +4,8 @@ #include "core/animation/Interpolation.h" +#include <memory> + namespace blink { namespace { @@ -33,7 +35,7 @@ } // namespace -Interpolation::Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end) +Interpolation::Interpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end) : m_start(std::move(start)) , m_end(std::move(end)) , m_cachedFraction(0)
diff --git a/third_party/WebKit/Source/core/animation/Interpolation.h b/third_party/WebKit/Source/core/animation/Interpolation.h index e613163..6131a985 100644 --- a/third_party/WebKit/Source/core/animation/Interpolation.h +++ b/third_party/WebKit/Source/core/animation/Interpolation.h
@@ -9,6 +9,7 @@ #include "core/animation/InterpolableValue.h" #include "wtf/Forward.h" #include "wtf/RefCounted.h" +#include <memory> namespace blink { @@ -30,14 +31,14 @@ virtual bool dependsOnUnderlyingValue() const { return false; } protected: - const OwnPtr<InterpolableValue> m_start; - const OwnPtr<InterpolableValue> m_end; + const std::unique_ptr<InterpolableValue> m_start; + const std::unique_ptr<InterpolableValue> m_end; mutable double m_cachedFraction; mutable int m_cachedIteration; - mutable OwnPtr<InterpolableValue> m_cachedValue; + mutable std::unique_ptr<InterpolableValue> m_cachedValue; - Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end); + Interpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end); private: InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.get(); }
diff --git a/third_party/WebKit/Source/core/animation/InterpolationEffect.h b/third_party/WebKit/Source/core/animation/InterpolationEffect.h index a99f8eb..43f3550 100644 --- a/third_party/WebKit/Source/core/animation/InterpolationEffect.h +++ b/third_party/WebKit/Source/core/animation/InterpolationEffect.h
@@ -10,7 +10,6 @@ #include "core/animation/Keyframe.h" #include "platform/RuntimeEnabledFeatures.h" #include "platform/animation/TimingFunction.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp b/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp index 0c4e9c4..1d59730 100644 --- a/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp +++ b/third_party/WebKit/Source/core/animation/InterpolationEffectTest.cpp
@@ -5,6 +5,7 @@ #include "core/animation/InterpolationEffect.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -12,7 +13,7 @@ class SampleInterpolation : public Interpolation { public: - static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end) + static PassRefPtr<Interpolation> create(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end) { return adoptRef(new SampleInterpolation(std::move(start), std::move(end))); } @@ -22,7 +23,7 @@ return PropertyHandle(CSSPropertyBackgroundColor); } private: - SampleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end) + SampleInterpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end) : Interpolation(std::move(start), std::move(end)) { }
diff --git a/third_party/WebKit/Source/core/animation/InterpolationType.h b/third_party/WebKit/Source/core/animation/InterpolationType.h index 68ddba1..07f61ad 100644 --- a/third_party/WebKit/Source/core/animation/InterpolationType.h +++ b/third_party/WebKit/Source/core/animation/InterpolationType.h
@@ -13,6 +13,7 @@ #include "core/animation/UnderlyingValueOwner.h" #include "platform/heap/Handle.h" #include "wtf/Allocator.h" +#include <memory> namespace blink { @@ -46,7 +47,7 @@ { } const InterpolationType* m_type; }; - using ConversionCheckers = Vector<OwnPtr<ConversionChecker>>; + using ConversionCheckers = Vector<std::unique_ptr<ConversionChecker>>; virtual PairwiseInterpolationValue maybeConvertPairwise(const PropertySpecificKeyframe& startKeyframe, const PropertySpecificKeyframe& endKeyframe, const InterpolationEnvironment& environment, const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const {
diff --git a/third_party/WebKit/Source/core/animation/InterpolationValue.h b/third_party/WebKit/Source/core/animation/InterpolationValue.h index f3d2d84..10acf58c 100644 --- a/third_party/WebKit/Source/core/animation/InterpolationValue.h +++ b/third_party/WebKit/Source/core/animation/InterpolationValue.h
@@ -8,6 +8,7 @@ #include "core/animation/InterpolableValue.h" #include "core/animation/NonInterpolableValue.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -16,7 +17,7 @@ struct InterpolationValue { DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); - explicit InterpolationValue(PassOwnPtr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) + explicit InterpolationValue(std::unique_ptr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) : interpolableValue(std::move(interpolableValue)) , nonInterpolableValue(nonInterpolableValue) { } @@ -47,7 +48,7 @@ nonInterpolableValue.clear(); } - OwnPtr<InterpolableValue> interpolableValue; + std::unique_ptr<InterpolableValue> interpolableValue; RefPtr<NonInterpolableValue> nonInterpolableValue; };
diff --git a/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.cpp b/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.cpp index 816d580..7f1b47cf0 100644 --- a/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.cpp +++ b/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.cpp
@@ -7,6 +7,7 @@ #include "core/animation/InterpolationEnvironment.h" #include "core/animation/StringKeyframe.h" #include "core/css/resolver/StyleResolverState.h" +#include <memory> namespace blink { @@ -24,7 +25,7 @@ // We defer the interpolation to ensureValidInterpolation() if m_cachedPairConversion is null. } -PassOwnPtr<PairwisePrimitiveInterpolation> InvalidatableInterpolation::maybeConvertPairwise(const InterpolationEnvironment& environment, const UnderlyingValueOwner& underlyingValueOwner) const +std::unique_ptr<PairwisePrimitiveInterpolation> InvalidatableInterpolation::maybeConvertPairwise(const InterpolationEnvironment& environment, const UnderlyingValueOwner& underlyingValueOwner) const { ASSERT(m_currentFraction != 0 && m_currentFraction != 1); for (const auto& interpolationType : m_interpolationTypes) { @@ -43,7 +44,7 @@ return nullptr; } -PassOwnPtr<TypedInterpolationValue> InvalidatableInterpolation::convertSingleKeyframe(const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const UnderlyingValueOwner& underlyingValueOwner) const +std::unique_ptr<TypedInterpolationValue> InvalidatableInterpolation::convertSingleKeyframe(const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const UnderlyingValueOwner& underlyingValueOwner) const { if (keyframe.isNeutral() && !underlyingValueOwner) return nullptr; @@ -68,7 +69,7 @@ } } -PassOwnPtr<TypedInterpolationValue> InvalidatableInterpolation::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const +std::unique_ptr<TypedInterpolationValue> InvalidatableInterpolation::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const { for (const auto& interpolationType : m_interpolationTypes) { InterpolationValue result = interpolationType->maybeConvertUnderlyingValue(environment); @@ -125,7 +126,7 @@ } else if (m_currentFraction == 1) { m_cachedValue = convertSingleKeyframe(*m_endKeyframe, environment, underlyingValueOwner); } else { - OwnPtr<PairwisePrimitiveInterpolation> pairwiseConversion = maybeConvertPairwise(environment, underlyingValueOwner); + std::unique_ptr<PairwisePrimitiveInterpolation> pairwiseConversion = maybeConvertPairwise(environment, underlyingValueOwner); if (pairwiseConversion) { m_cachedValue = pairwiseConversion->initialValue(); m_cachedPairConversion = std::move(pairwiseConversion);
diff --git a/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.h b/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.h index fd977dd..7292583 100644 --- a/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.h +++ b/third_party/WebKit/Source/core/animation/InvalidatableInterpolation.h
@@ -10,6 +10,7 @@ #include "core/animation/PropertyInterpolationTypesMapping.h" #include "core/animation/StyleInterpolation.h" #include "core/animation/TypedInterpolationValue.h" +#include <memory> namespace blink { @@ -51,13 +52,13 @@ using ConversionCheckers = InterpolationType::ConversionCheckers; - PassOwnPtr<TypedInterpolationValue> maybeConvertUnderlyingValue(const InterpolationEnvironment&) const; + std::unique_ptr<TypedInterpolationValue> maybeConvertUnderlyingValue(const InterpolationEnvironment&) const; const TypedInterpolationValue* ensureValidInterpolation(const InterpolationEnvironment&, const UnderlyingValueOwner&) const; void clearCache() const; bool isCacheValid(const InterpolationEnvironment&, const UnderlyingValueOwner&) const; bool isNeutralKeyframeActive() const; - PassOwnPtr<PairwisePrimitiveInterpolation> maybeConvertPairwise(const InterpolationEnvironment&, const UnderlyingValueOwner&) const; - PassOwnPtr<TypedInterpolationValue> convertSingleKeyframe(const PropertySpecificKeyframe&, const InterpolationEnvironment&, const UnderlyingValueOwner&) const; + std::unique_ptr<PairwisePrimitiveInterpolation> maybeConvertPairwise(const InterpolationEnvironment&, const UnderlyingValueOwner&) const; + std::unique_ptr<TypedInterpolationValue> convertSingleKeyframe(const PropertySpecificKeyframe&, const InterpolationEnvironment&, const UnderlyingValueOwner&) const; void addConversionCheckers(const InterpolationType&, ConversionCheckers&) const; void setFlagIfInheritUsed(InterpolationEnvironment&) const; double underlyingFraction() const; @@ -68,9 +69,9 @@ RefPtr<PropertySpecificKeyframe> m_endKeyframe; double m_currentFraction; mutable bool m_isCached; - mutable OwnPtr<PrimitiveInterpolation> m_cachedPairConversion; + mutable std::unique_ptr<PrimitiveInterpolation> m_cachedPairConversion; mutable ConversionCheckers m_conversionCheckers; - mutable OwnPtr<TypedInterpolationValue> m_cachedValue; + mutable std::unique_ptr<TypedInterpolationValue> m_cachedValue; }; DEFINE_TYPE_CASTS(InvalidatableInterpolation, Interpolation, value, value->isInvalidatableInterpolation(), value.isInvalidatableInterpolation());
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp index 2c483b5..30e6198 100644 --- a/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp +++ b/third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp
@@ -39,6 +39,7 @@ #include "platform/animation/AnimationUtilities.h" #include "platform/geometry/FloatBox.h" #include "platform/transforms/TransformationMatrix.h" +#include "wtf/PtrUtil.h" #include "wtf/text/StringHash.h" namespace blink { @@ -171,7 +172,7 @@ if (m_keyframeGroups) return; - m_keyframeGroups = adoptPtr(new KeyframeGroupMap); + m_keyframeGroups = wrapUnique(new KeyframeGroupMap); RefPtr<TimingFunction> zeroOffsetEasing = m_defaultKeyframeEasing; for (const auto& keyframe : normalizedKeyframes(getFrames())) { if (keyframe->offset() == 0) @@ -181,7 +182,7 @@ KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(property); PropertySpecificKeyframeGroup* group; if (groupIter == m_keyframeGroups->end()) - group = m_keyframeGroups->add(property, adoptPtr(new PropertySpecificKeyframeGroup)).storedValue->value.get(); + group = m_keyframeGroups->add(property, wrapUnique(new PropertySpecificKeyframeGroup)).storedValue->value.get(); else group = groupIter->value.get();
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectModel.h b/third_party/WebKit/Source/core/animation/KeyframeEffectModel.h index cd2d332..28502f05 100644 --- a/third_party/WebKit/Source/core/animation/KeyframeEffectModel.h +++ b/third_party/WebKit/Source/core/animation/KeyframeEffectModel.h
@@ -44,6 +44,7 @@ #include "wtf/HashSet.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -83,7 +84,7 @@ return m_keyframeGroups->get(property)->keyframes(); } - using KeyframeGroupMap = HashMap<PropertyHandle, OwnPtr<PropertySpecificKeyframeGroup>>; + using KeyframeGroupMap = HashMap<PropertyHandle, std::unique_ptr<PropertySpecificKeyframeGroup>>; const KeyframeGroupMap& getPropertySpecificKeyframeGroups() const { ensureKeyframeGroups(); @@ -140,7 +141,7 @@ // The spec describes filtering the normalized keyframes at sampling time // to get the 'property-specific keyframes'. For efficiency, we cache the // property-specific lists. - mutable OwnPtr<KeyframeGroupMap> m_keyframeGroups; + mutable std::unique_ptr<KeyframeGroupMap> m_keyframeGroups; mutable InterpolationEffect m_interpolationEffect; mutable int m_lastIteration; mutable double m_lastFraction;
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp index a93c4ec..00f2c28 100644 --- a/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp +++ b/third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp
@@ -17,6 +17,7 @@ #include "core/dom/Document.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> #include <v8.h> namespace blink { @@ -35,7 +36,7 @@ Document& document() const { return pageHolder->document(); } - OwnPtr<DummyPageHolder> pageHolder; + std::unique_ptr<DummyPageHolder> pageHolder; Persistent<Element> element; TrackExceptionState exceptionState; };
diff --git a/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h b/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h index 3307373..cf7f0241 100644 --- a/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h +++ b/third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.h
@@ -7,6 +7,7 @@ #include "core/animation/StyleInterpolation.h" #include "core/css/resolver/AnimatedStyleBuilder.h" +#include <memory> namespace blink { @@ -29,7 +30,7 @@ } private: - LegacyStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, CSSPropertyID id) + LegacyStyleInterpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end, CSSPropertyID id) : StyleInterpolation(std::move(start), std::move(end), id) { }
diff --git a/third_party/WebKit/Source/core/animation/LengthUnitsChecker.h b/third_party/WebKit/Source/core/animation/LengthUnitsChecker.h index 65570c4..67fbe70 100644 --- a/third_party/WebKit/Source/core/animation/LengthUnitsChecker.h +++ b/third_party/WebKit/Source/core/animation/LengthUnitsChecker.h
@@ -8,12 +8,14 @@ #include "core/animation/InterpolationType.h" #include "core/css/CSSPrimitiveValue.h" #include "core/css/resolver/StyleResolverState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { class LengthUnitsChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<LengthUnitsChecker> maybeCreate(CSSLengthArray&& lengthArray, const StyleResolverState& state) + static std::unique_ptr<LengthUnitsChecker> maybeCreate(CSSLengthArray&& lengthArray, const StyleResolverState& state) { bool create = false; size_t lastIndex = 0; @@ -26,7 +28,7 @@ } if (!create) return nullptr; - return adoptPtr(new LengthUnitsChecker(std::move(lengthArray), lastIndex)); + return wrapUnique(new LengthUnitsChecker(std::move(lengthArray), lastIndex)); } bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final
diff --git a/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.cpp index 32c42ff..20566719 100644 --- a/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.cpp
@@ -7,6 +7,7 @@ #include "core/animation/UnderlyingValueOwner.h" #include "core/css/CSSValueList.h" #include "wtf/MathExtras.h" +#include <memory> namespace blink { @@ -53,7 +54,7 @@ } if (startLength == 0) { - OwnPtr<InterpolableValue> startInterpolableValue = end.interpolableValue->cloneAndZero(); + std::unique_ptr<InterpolableValue> startInterpolableValue = end.interpolableValue->cloneAndZero(); return PairwiseInterpolationValue( std::move(startInterpolableValue), std::move(end.interpolableValue), @@ -61,7 +62,7 @@ } if (endLength == 0) { - OwnPtr<InterpolableValue> endInterpolableValue = start.interpolableValue->cloneAndZero(); + std::unique_ptr<InterpolableValue> endInterpolableValue = start.interpolableValue->cloneAndZero(); return PairwiseInterpolationValue( std::move(start.interpolableValue), std::move(endInterpolableValue), @@ -69,8 +70,8 @@ } size_t finalLength = lowestCommonMultiple(startLength, endLength); - OwnPtr<InterpolableList> resultStartInterpolableList = InterpolableList::create(finalLength); - OwnPtr<InterpolableList> resultEndInterpolableList = InterpolableList::create(finalLength); + std::unique_ptr<InterpolableList> resultStartInterpolableList = InterpolableList::create(finalLength); + std::unique_ptr<InterpolableList> resultEndInterpolableList = InterpolableList::create(finalLength); Vector<RefPtr<NonInterpolableValue>> resultNonInterpolableValues(finalLength); InterpolableList& startInterpolableList = toInterpolableList(*start.interpolableValue); @@ -104,7 +105,7 @@ if (currentLength == length) return; ASSERT(currentLength < length); - OwnPtr<InterpolableList> newInterpolableList = InterpolableList::create(length); + std::unique_ptr<InterpolableList> newInterpolableList = InterpolableList::create(length); Vector<RefPtr<NonInterpolableValue>> newNonInterpolableValues(length); for (size_t i = length; i-- > 0;) { newInterpolableList->set(i, i < currentLength ? std::move(interpolableList.getMutable(i)) : interpolableList.get(i % currentLength)->clone());
diff --git a/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.h index b80dd09f..57764dc 100644 --- a/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/ListInterpolationFunctions.h
@@ -8,6 +8,7 @@ #include "core/animation/InterpolationValue.h" #include "core/animation/PairwiseInterpolationValue.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -28,7 +29,7 @@ static bool equalValues(const InterpolationValue&, const InterpolationValue&, EqualNonInterpolableValuesCallback); using NonInterpolableValuesAreCompatibleCallback = bool (*)(const NonInterpolableValue*, const NonInterpolableValue*); - using CompositeItemCallback = void (*)(OwnPtr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); + using CompositeItemCallback = void (*)(std::unique_ptr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); static void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationType&, const InterpolationValue&, NonInterpolableValuesAreCompatibleCallback, CompositeItemCallback); }; @@ -69,7 +70,7 @@ { if (length == 0) return createEmptyList(); - OwnPtr<InterpolableList> interpolableList = InterpolableList::create(length); + std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(length); Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(length); for (size_t i = 0; i < length; i++) { InterpolationValue item = createItem(i);
diff --git a/third_party/WebKit/Source/core/animation/PairwiseInterpolationValue.h b/third_party/WebKit/Source/core/animation/PairwiseInterpolationValue.h index 6f1d96c2..bc63e054 100644 --- a/third_party/WebKit/Source/core/animation/PairwiseInterpolationValue.h +++ b/third_party/WebKit/Source/core/animation/PairwiseInterpolationValue.h
@@ -8,6 +8,7 @@ #include "core/animation/InterpolableValue.h" #include "core/animation/NonInterpolableValue.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -15,7 +16,7 @@ struct PairwiseInterpolationValue { DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); - PairwiseInterpolationValue(PassOwnPtr<InterpolableValue> startInterpolableValue, PassOwnPtr<InterpolableValue> endInterpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) + PairwiseInterpolationValue(std::unique_ptr<InterpolableValue> startInterpolableValue, std::unique_ptr<InterpolableValue> endInterpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) : startInterpolableValue(std::move(startInterpolableValue)) , endInterpolableValue(std::move(endInterpolableValue)) , nonInterpolableValue(std::move(nonInterpolableValue)) @@ -31,8 +32,8 @@ operator bool() const { return startInterpolableValue.get(); } - OwnPtr<InterpolableValue> startInterpolableValue; - OwnPtr<InterpolableValue> endInterpolableValue; + std::unique_ptr<InterpolableValue> startInterpolableValue; + std::unique_ptr<InterpolableValue> endInterpolableValue; RefPtr<NonInterpolableValue> nonInterpolableValue; };
diff --git a/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.cpp index c69d7ec..206964f2 100644 --- a/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.cpp
@@ -12,6 +12,8 @@ #include "core/svg/SVGPathByteStreamBuilder.h" #include "core/svg/SVGPathByteStreamSource.h" #include "core/svg/SVGPathParser.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -51,7 +53,7 @@ SVGPathByteStreamSource pathSource(byteStream); size_t length = 0; PathCoordinates currentCoordinates; - Vector<OwnPtr<InterpolableValue>> interpolablePathSegs; + Vector<std::unique_ptr<InterpolableValue>> interpolablePathSegs; Vector<SVGPathSegType> pathSegTypes; while (pathSource.hasMoreData()) { @@ -61,11 +63,11 @@ length++; } - OwnPtr<InterpolableList> pathArgs = InterpolableList::create(length); + std::unique_ptr<InterpolableList> pathArgs = InterpolableList::create(length); for (size_t i = 0; i < interpolablePathSegs.size(); i++) pathArgs->set(i, std::move(interpolablePathSegs[i])); - OwnPtr<InterpolableList> result = InterpolableList::create(PathComponentIndexCount); + std::unique_ptr<InterpolableList> result = InterpolableList::create(PathComponentIndexCount); result->set(PathArgsIndex, std::move(pathArgs)); result->set(PathNeutralIndex, InterpolableNumber::create(0)); @@ -77,7 +79,7 @@ if (stylePath) return convertValue(stylePath->byteStream()); - OwnPtr<SVGPathByteStream> emptyPath = SVGPathByteStream::create(); + std::unique_ptr<SVGPathByteStream> emptyPath = SVGPathByteStream::create(); return convertValue(*emptyPath); } @@ -85,9 +87,9 @@ public: ~UnderlyingPathSegTypesChecker() final {} - static PassOwnPtr<UnderlyingPathSegTypesChecker> create(const InterpolationValue& underlying) + static std::unique_ptr<UnderlyingPathSegTypesChecker> create(const InterpolationValue& underlying) { - return adoptPtr(new UnderlyingPathSegTypesChecker(getPathSegTypes(underlying))); + return wrapUnique(new UnderlyingPathSegTypesChecker(getPathSegTypes(underlying))); } private: @@ -111,7 +113,7 @@ InterpolationValue PathInterpolationFunctions::maybeConvertNeutral(const InterpolationValue& underlying, InterpolationType::ConversionCheckers& conversionCheckers) { conversionCheckers.append(UnderlyingPathSegTypesChecker::create(underlying)); - OwnPtr<InterpolableList> result = InterpolableList::create(PathComponentIndexCount); + std::unique_ptr<InterpolableList> result = InterpolableList::create(PathComponentIndexCount); result->set(PathArgsIndex, toInterpolableList(*underlying.interpolableValue).get(PathArgsIndex)->cloneAndZero()); result->set(PathNeutralIndex, InterpolableNumber::create(1)); return InterpolationValue(std::move(result), underlying.nonInterpolableValue.get()); @@ -157,9 +159,9 @@ underlyingValueOwner.mutableValue().nonInterpolableValue = value.nonInterpolableValue.get(); } -PassOwnPtr<SVGPathByteStream> PathInterpolationFunctions::appliedValue(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue) +std::unique_ptr<SVGPathByteStream> PathInterpolationFunctions::appliedValue(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue) { - OwnPtr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); + std::unique_ptr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); InterpolatedSVGPathSource source( toInterpolableList(*toInterpolableList(interpolableValue).get(PathArgsIndex)), toSVGPathNonInterpolableValue(nonInterpolableValue)->pathSegTypes());
diff --git a/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.h index 188aeb4..662e13104 100644 --- a/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/PathInterpolationFunctions.h
@@ -7,6 +7,7 @@ #include "core/animation/InterpolationType.h" #include "core/svg/SVGPathByteStream.h" +#include <memory> namespace blink { @@ -14,7 +15,7 @@ class PathInterpolationFunctions { public: - static PassOwnPtr<SVGPathByteStream> appliedValue(const InterpolableValue&, const NonInterpolableValue*); + static std::unique_ptr<SVGPathByteStream> appliedValue(const InterpolableValue&, const NonInterpolableValue*); static void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationType&, const InterpolationValue&);
diff --git a/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h b/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h index cc07984..5a74b4be 100644 --- a/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h +++ b/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h
@@ -8,8 +8,10 @@ #include "core/animation/TypedInterpolationValue.h" #include "platform/animation/AnimationUtilities.h" #include "platform/heap/Handle.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include <cmath> +#include <memory> namespace blink { @@ -23,7 +25,7 @@ public: virtual ~PrimitiveInterpolation() { } - virtual void interpolateValue(double fraction, OwnPtr<TypedInterpolationValue>& result) const = 0; + virtual void interpolateValue(double fraction, std::unique_ptr<TypedInterpolationValue>& result) const = 0; virtual double interpolateUnderlyingFraction(double start, double end, double fraction) const = 0; virtual bool isFlip() const { return false; } @@ -36,20 +38,20 @@ public: ~PairwisePrimitiveInterpolation() override { } - static PassOwnPtr<PairwisePrimitiveInterpolation> create(const InterpolationType& type, PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, PassRefPtr<NonInterpolableValue> nonInterpolableValue) + static std::unique_ptr<PairwisePrimitiveInterpolation> create(const InterpolationType& type, std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end, PassRefPtr<NonInterpolableValue> nonInterpolableValue) { - return adoptPtr(new PairwisePrimitiveInterpolation(type, std::move(start), std::move(end), nonInterpolableValue)); + return wrapUnique(new PairwisePrimitiveInterpolation(type, std::move(start), std::move(end), nonInterpolableValue)); } const InterpolationType& type() const { return m_type; } - PassOwnPtr<TypedInterpolationValue> initialValue() const + std::unique_ptr<TypedInterpolationValue> initialValue() const { return TypedInterpolationValue::create(m_type, m_start->clone(), m_nonInterpolableValue); } private: - PairwisePrimitiveInterpolation(const InterpolationType& type, PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, PassRefPtr<NonInterpolableValue> nonInterpolableValue) + PairwisePrimitiveInterpolation(const InterpolationType& type, std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end, PassRefPtr<NonInterpolableValue> nonInterpolableValue) : m_type(type) , m_start(std::move(start)) , m_end(std::move(end)) @@ -59,7 +61,7 @@ ASSERT(m_end); } - void interpolateValue(double fraction, OwnPtr<TypedInterpolationValue>& result) const final + void interpolateValue(double fraction, std::unique_ptr<TypedInterpolationValue>& result) const final { ASSERT(result); ASSERT(&result->type() == &m_type); @@ -70,8 +72,8 @@ double interpolateUnderlyingFraction(double start, double end, double fraction) const final { return blend(start, end, fraction); } const InterpolationType& m_type; - OwnPtr<InterpolableValue> m_start; - OwnPtr<InterpolableValue> m_end; + std::unique_ptr<InterpolableValue> m_start; + std::unique_ptr<InterpolableValue> m_end; RefPtr<NonInterpolableValue> m_nonInterpolableValue; }; @@ -80,19 +82,19 @@ public: ~FlipPrimitiveInterpolation() override { } - static PassOwnPtr<FlipPrimitiveInterpolation> create(PassOwnPtr<TypedInterpolationValue> start, PassOwnPtr<TypedInterpolationValue> end) + static std::unique_ptr<FlipPrimitiveInterpolation> create(std::unique_ptr<TypedInterpolationValue> start, std::unique_ptr<TypedInterpolationValue> end) { - return adoptPtr(new FlipPrimitiveInterpolation(std::move(start), std::move(end))); + return wrapUnique(new FlipPrimitiveInterpolation(std::move(start), std::move(end))); } private: - FlipPrimitiveInterpolation(PassOwnPtr<TypedInterpolationValue> start, PassOwnPtr<TypedInterpolationValue> end) + FlipPrimitiveInterpolation(std::unique_ptr<TypedInterpolationValue> start, std::unique_ptr<TypedInterpolationValue> end) : m_start(std::move(start)) , m_end(std::move(end)) , m_lastFraction(std::numeric_limits<double>::quiet_NaN()) { } - void interpolateValue(double fraction, OwnPtr<TypedInterpolationValue>& result) const final + void interpolateValue(double fraction, std::unique_ptr<TypedInterpolationValue>& result) const final { // TODO(alancutter): Remove this optimisation once Oilpan is default. if (!std::isnan(m_lastFraction) && (fraction < 0.5) == (m_lastFraction < 0.5)) @@ -106,8 +108,8 @@ bool isFlip() const final { return true; } - OwnPtr<TypedInterpolationValue> m_start; - OwnPtr<TypedInterpolationValue> m_end; + std::unique_ptr<TypedInterpolationValue> m_start; + std::unique_ptr<TypedInterpolationValue> m_end; mutable double m_lastFraction; };
diff --git a/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.cpp b/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.cpp index 2e830b0..7071a27c 100644 --- a/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.cpp +++ b/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.cpp
@@ -48,18 +48,20 @@ #include "core/animation/SVGRectInterpolationType.h" #include "core/animation/SVGTransformListInterpolationType.h" #include "core/animation/SVGValueInterpolationType.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { const InterpolationTypes& PropertyInterpolationTypesMapping::get(const PropertyHandle& property) { - using ApplicableTypesMap = HashMap<PropertyHandle, OwnPtr<const InterpolationTypes>>; + using ApplicableTypesMap = HashMap<PropertyHandle, std::unique_ptr<const InterpolationTypes>>; DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ()); auto entry = applicableTypesMap.find(property); if (entry != applicableTypesMap.end()) return *entry->value.get(); - OwnPtr<InterpolationTypes> applicableTypes = adoptPtr(new InterpolationTypes()); + std::unique_ptr<InterpolationTypes> applicableTypes = wrapUnique(new InterpolationTypes()); if (property.isCSSProperty() || property.isPresentationAttribute()) { CSSPropertyID cssProperty = property.isCSSProperty() ? property.cssProperty() : property.presentationAttribute(); @@ -115,7 +117,7 @@ case CSSPropertyWordSpacing: case CSSPropertyX: case CSSPropertyY: - applicableTypes->append(adoptPtr(new CSSLengthInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSLengthInterpolationType(cssProperty))); break; case CSSPropertyFlexGrow: case CSSPropertyFlexShrink: @@ -131,11 +133,11 @@ case CSSPropertyColumnCount: case CSSPropertyWidows: case CSSPropertyZIndex: - applicableTypes->append(adoptPtr(new CSSNumberInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSNumberInterpolationType(cssProperty))); break; case CSSPropertyLineHeight: - applicableTypes->append(adoptPtr(new CSSLengthInterpolationType(cssProperty))); - applicableTypes->append(adoptPtr(new CSSNumberInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSLengthInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSNumberInterpolationType(cssProperty))); break; case CSSPropertyBackgroundColor: case CSSPropertyBorderBottomColor: @@ -150,118 +152,118 @@ case CSSPropertyTextDecorationColor: case CSSPropertyColumnRuleColor: case CSSPropertyWebkitTextStrokeColor: - applicableTypes->append(adoptPtr(new CSSColorInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSColorInterpolationType(cssProperty))); break; case CSSPropertyFill: case CSSPropertyStroke: - applicableTypes->append(adoptPtr(new CSSPaintInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSPaintInterpolationType(cssProperty))); break; case CSSPropertyD: - applicableTypes->append(adoptPtr(new CSSPathInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSPathInterpolationType(cssProperty))); break; case CSSPropertyBoxShadow: case CSSPropertyTextShadow: - applicableTypes->append(adoptPtr(new CSSShadowListInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSShadowListInterpolationType(cssProperty))); break; case CSSPropertyBorderImageSource: case CSSPropertyListStyleImage: case CSSPropertyWebkitMaskBoxImageSource: - applicableTypes->append(adoptPtr(new CSSImageInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSImageInterpolationType(cssProperty))); break; case CSSPropertyBackgroundImage: case CSSPropertyWebkitMaskImage: - applicableTypes->append(adoptPtr(new CSSImageListInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSImageListInterpolationType(cssProperty))); break; case CSSPropertyStrokeDasharray: - applicableTypes->append(adoptPtr(new CSSLengthListInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSLengthListInterpolationType(cssProperty))); break; case CSSPropertyFontWeight: - applicableTypes->append(adoptPtr(new CSSFontWeightInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSFontWeightInterpolationType(cssProperty))); break; case CSSPropertyVisibility: - applicableTypes->append(adoptPtr(new CSSVisibilityInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSVisibilityInterpolationType(cssProperty))); break; case CSSPropertyClip: - applicableTypes->append(adoptPtr(new CSSClipInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSClipInterpolationType(cssProperty))); break; case CSSPropertyMotionRotation: - applicableTypes->append(adoptPtr(new CSSMotionRotationInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSMotionRotationInterpolationType(cssProperty))); break; case CSSPropertyBackgroundPositionX: case CSSPropertyBackgroundPositionY: case CSSPropertyWebkitMaskPositionX: case CSSPropertyWebkitMaskPositionY: - applicableTypes->append(adoptPtr(new CSSPositionAxisListInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSPositionAxisListInterpolationType(cssProperty))); break; case CSSPropertyPerspectiveOrigin: case CSSPropertyObjectPosition: - applicableTypes->append(adoptPtr(new CSSPositionInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSPositionInterpolationType(cssProperty))); break; case CSSPropertyBorderBottomLeftRadius: case CSSPropertyBorderBottomRightRadius: case CSSPropertyBorderTopLeftRadius: case CSSPropertyBorderTopRightRadius: - applicableTypes->append(adoptPtr(new CSSLengthPairInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSLengthPairInterpolationType(cssProperty))); break; case CSSPropertyTranslate: - applicableTypes->append(adoptPtr(new CSSTranslateInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSTranslateInterpolationType(cssProperty))); break; case CSSPropertyTransformOrigin: - applicableTypes->append(adoptPtr(new CSSTransformOriginInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSTransformOriginInterpolationType(cssProperty))); break; case CSSPropertyBackgroundSize: case CSSPropertyWebkitMaskSize: - applicableTypes->append(adoptPtr(new CSSSizeListInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSSizeListInterpolationType(cssProperty))); break; case CSSPropertyBorderImageOutset: case CSSPropertyBorderImageWidth: case CSSPropertyWebkitMaskBoxImageOutset: case CSSPropertyWebkitMaskBoxImageWidth: - applicableTypes->append(adoptPtr(new CSSBorderImageLengthBoxInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSBorderImageLengthBoxInterpolationType(cssProperty))); break; case CSSPropertyScale: - applicableTypes->append(adoptPtr(new CSSScaleInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSScaleInterpolationType(cssProperty))); break; case CSSPropertyFontSize: - applicableTypes->append(adoptPtr(new CSSFontSizeInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSFontSizeInterpolationType(cssProperty))); break; case CSSPropertyTextIndent: - applicableTypes->append(adoptPtr(new CSSTextIndentInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSTextIndentInterpolationType(cssProperty))); break; case CSSPropertyBorderImageSlice: case CSSPropertyWebkitMaskBoxImageSlice: - applicableTypes->append(adoptPtr(new CSSImageSliceInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSImageSliceInterpolationType(cssProperty))); break; case CSSPropertyWebkitClipPath: case CSSPropertyShapeOutside: - applicableTypes->append(adoptPtr(new CSSBasicShapeInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSBasicShapeInterpolationType(cssProperty))); break; case CSSPropertyRotate: - applicableTypes->append(adoptPtr(new CSSRotateInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSRotateInterpolationType(cssProperty))); break; case CSSPropertyBackdropFilter: case CSSPropertyWebkitFilter: - applicableTypes->append(adoptPtr(new CSSFilterListInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSFilterListInterpolationType(cssProperty))); break; case CSSPropertyTransform: - applicableTypes->append(adoptPtr(new CSSTransformInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSTransformInterpolationType(cssProperty))); break; default: ASSERT(!CSSPropertyMetadata::isInterpolableProperty(cssProperty)); } - applicableTypes->append(adoptPtr(new CSSValueInterpolationType(cssProperty))); + applicableTypes->append(wrapUnique(new CSSValueInterpolationType(cssProperty))); } else { const QualifiedName& attribute = property.svgAttribute(); if (attribute == SVGNames::orientAttr) { - applicableTypes->append(adoptPtr(new SVGAngleInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGAngleInterpolationType(attribute))); } else if (attribute == SVGNames::numOctavesAttr || attribute == SVGNames::targetXAttr || attribute == SVGNames::targetYAttr) { - applicableTypes->append(adoptPtr(new SVGIntegerInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGIntegerInterpolationType(attribute))); } else if (attribute == SVGNames::orderAttr) { - applicableTypes->append(adoptPtr(new SVGIntegerOptionalIntegerInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGIntegerOptionalIntegerInterpolationType(attribute))); } else if (attribute == SVGNames::cxAttr || attribute == SVGNames::cyAttr || attribute == SVGNames::fxAttr @@ -281,15 +283,15 @@ || attribute == SVGNames::x2Attr || attribute == SVGNames::y1Attr || attribute == SVGNames::y2Attr) { - applicableTypes->append(adoptPtr(new SVGLengthInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGLengthInterpolationType(attribute))); } else if (attribute == SVGNames::dxAttr || attribute == SVGNames::dyAttr) { - applicableTypes->append(adoptPtr(new SVGNumberInterpolationType(attribute))); - applicableTypes->append(adoptPtr(new SVGLengthListInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGNumberInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGLengthListInterpolationType(attribute))); } else if (attribute == SVGNames::xAttr || attribute == SVGNames::yAttr) { - applicableTypes->append(adoptPtr(new SVGLengthInterpolationType(attribute))); - applicableTypes->append(adoptPtr(new SVGLengthListInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGLengthInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGLengthListInterpolationType(attribute))); } else if (attribute == SVGNames::amplitudeAttr || attribute == SVGNames::azimuthAttr || attribute == SVGNames::biasAttr @@ -315,27 +317,27 @@ || attribute == SVGNames::specularExponentAttr || attribute == SVGNames::surfaceScaleAttr || attribute == SVGNames::zAttr) { - applicableTypes->append(adoptPtr(new SVGNumberInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGNumberInterpolationType(attribute))); } else if (attribute == SVGNames::kernelMatrixAttr || attribute == SVGNames::rotateAttr || attribute == SVGNames::tableValuesAttr || attribute == SVGNames::valuesAttr) { - applicableTypes->append(adoptPtr(new SVGNumberListInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGNumberListInterpolationType(attribute))); } else if (attribute == SVGNames::baseFrequencyAttr || attribute == SVGNames::kernelUnitLengthAttr || attribute == SVGNames::radiusAttr || attribute == SVGNames::stdDeviationAttr) { - applicableTypes->append(adoptPtr(new SVGNumberOptionalNumberInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGNumberOptionalNumberInterpolationType(attribute))); } else if (attribute == SVGNames::dAttr) { - applicableTypes->append(adoptPtr(new SVGPathInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGPathInterpolationType(attribute))); } else if (attribute == SVGNames::pointsAttr) { - applicableTypes->append(adoptPtr(new SVGPointListInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGPointListInterpolationType(attribute))); } else if (attribute == SVGNames::viewBoxAttr) { - applicableTypes->append(adoptPtr(new SVGRectInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGRectInterpolationType(attribute))); } else if (attribute == SVGNames::gradientTransformAttr || attribute == SVGNames::patternTransformAttr || attribute == SVGNames::transformAttr) { - applicableTypes->append(adoptPtr(new SVGTransformListInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGTransformListInterpolationType(attribute))); } else if (attribute == HTMLNames::classAttr || attribute == SVGNames::clipPathUnitsAttr || attribute == SVGNames::edgeModeAttr @@ -369,7 +371,7 @@ ASSERT_NOT_REACHED(); } - applicableTypes->append(adoptPtr(new SVGValueInterpolationType(attribute))); + applicableTypes->append(wrapUnique(new SVGValueInterpolationType(attribute))); } auto addResult = applicableTypesMap.add(property, std::move(applicableTypes));
diff --git a/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.h b/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.h index cd3d6cf2..7e2736d 100644 --- a/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.h +++ b/third_party/WebKit/Source/core/animation/PropertyInterpolationTypesMapping.h
@@ -6,13 +6,14 @@ #define PropertyInterpolationTypesMapping_h #include "wtf/Vector.h" +#include <memory> namespace blink { class InterpolationType; class PropertyHandle; -using InterpolationTypes = Vector<OwnPtr<const InterpolationType>>; +using InterpolationTypes = Vector<std::unique_ptr<const InterpolationType>>; namespace PropertyInterpolationTypesMapping {
diff --git a/third_party/WebKit/Source/core/animation/SVGIntegerOptionalIntegerInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGIntegerOptionalIntegerInterpolationType.cpp index e67c712..f48cd4d 100644 --- a/third_party/WebKit/Source/core/animation/SVGIntegerOptionalIntegerInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGIntegerOptionalIntegerInterpolationType.cpp
@@ -6,12 +6,13 @@ #include "core/animation/InterpolationEnvironment.h" #include "core/svg/SVGIntegerOptionalInteger.h" +#include <memory> namespace blink { InterpolationValue SVGIntegerOptionalIntegerInterpolationType::maybeConvertNeutral(const InterpolationValue&, ConversionCheckers&) const { - OwnPtr<InterpolableList> result = InterpolableList::create(2); + std::unique_ptr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(0)); result->set(1, InterpolableNumber::create(0)); return InterpolationValue(std::move(result)); @@ -23,7 +24,7 @@ return nullptr; const SVGIntegerOptionalInteger& integerOptionalInteger = toSVGIntegerOptionalInteger(svgValue); - OwnPtr<InterpolableList> result = InterpolableList::create(2); + std::unique_ptr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(integerOptionalInteger.firstInteger()->value())); result->set(1, InterpolableNumber::create(integerOptionalInteger.secondInteger()->value())); return InterpolationValue(std::move(result));
diff --git a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp index 275bc83..74131a55 100644 --- a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp
@@ -10,6 +10,7 @@ #include "core/svg/SVGElement.h" #include "core/svg/SVGLength.h" #include "core/svg/SVGLengthContext.h" +#include <memory> namespace blink { @@ -75,9 +76,9 @@ } // namespace -PassOwnPtr<InterpolableValue> SVGLengthInterpolationType::neutralInterpolableValue() +std::unique_ptr<InterpolableValue> SVGLengthInterpolationType::neutralInterpolableValue() { - OwnPtr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); + std::unique_ptr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); for (size_t i = 0; i < numLengthInterpolatedUnits; ++i) listOfValues->set(i, InterpolableNumber::create(0)); @@ -92,7 +93,7 @@ double values[numLengthInterpolatedUnits] = { }; values[unitType] = value; - OwnPtr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); + std::unique_ptr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); for (size_t i = 0; i < numLengthInterpolatedUnits; ++i) listOfValues->set(i, InterpolableNumber::create(values[i]));
diff --git a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.h b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.h index 2890bcad..783d150 100644 --- a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.h
@@ -7,6 +7,7 @@ #include "core/animation/SVGInterpolationType.h" #include "core/svg/SVGLength.h" +#include <memory> namespace blink { @@ -21,7 +22,7 @@ , m_negativeValuesForbidden(SVGLength::negativeValuesForbiddenForAnimatedLengthAttribute(attribute)) { } - static PassOwnPtr<InterpolableValue> neutralInterpolableValue(); + static std::unique_ptr<InterpolableValue> neutralInterpolableValue(); static InterpolationValue convertSVGLength(const SVGLength&); static SVGLength* resolveInterpolableSVGLength(const InterpolableValue&, const SVGLengthContext&, SVGLengthMode, bool negativeValuesForbidden);
diff --git a/third_party/WebKit/Source/core/animation/SVGLengthListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGLengthListInterpolationType.cpp index e70381b..8685a8d 100644 --- a/third_party/WebKit/Source/core/animation/SVGLengthListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGLengthListInterpolationType.cpp
@@ -8,6 +8,7 @@ #include "core/animation/SVGLengthInterpolationType.h" #include "core/animation/UnderlyingLengthChecker.h" #include "core/svg/SVGLengthList.h" +#include <memory> namespace blink { @@ -19,7 +20,7 @@ if (underlyingLength == 0) return nullptr; - OwnPtr<InterpolableList> result = InterpolableList::create(underlyingLength); + std::unique_ptr<InterpolableList> result = InterpolableList::create(underlyingLength); for (size_t i = 0; i < underlyingLength; i++) result->set(i, SVGLengthInterpolationType::neutralInterpolableValue()); return InterpolationValue(std::move(result)); @@ -31,7 +32,7 @@ return nullptr; const SVGLengthList& lengthList = toSVGLengthList(svgValue); - OwnPtr<InterpolableList> result = InterpolableList::create(lengthList.length()); + std::unique_ptr<InterpolableList> result = InterpolableList::create(lengthList.length()); for (size_t i = 0; i < lengthList.length(); i++) { InterpolationValue component = SVGLengthInterpolationType::convertSVGLength(*lengthList.at(i)); result->set(i, std::move(component.interpolableValue));
diff --git a/third_party/WebKit/Source/core/animation/SVGNumberListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGNumberListInterpolationType.cpp index 4eaa1e74..c3f26cf 100644 --- a/third_party/WebKit/Source/core/animation/SVGNumberListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGNumberListInterpolationType.cpp
@@ -7,6 +7,7 @@ #include "core/animation/InterpolationEnvironment.h" #include "core/animation/UnderlyingLengthChecker.h" #include "core/svg/SVGNumberList.h" +#include <memory> namespace blink { @@ -18,7 +19,7 @@ if (underlyingLength == 0) return nullptr; - OwnPtr<InterpolableList> result = InterpolableList::create(underlyingLength); + std::unique_ptr<InterpolableList> result = InterpolableList::create(underlyingLength); for (size_t i = 0; i < underlyingLength; i++) result->set(i, InterpolableNumber::create(0)); return InterpolationValue(std::move(result)); @@ -30,7 +31,7 @@ return nullptr; const SVGNumberList& numberList = toSVGNumberList(svgValue); - OwnPtr<InterpolableList> result = InterpolableList::create(numberList.length()); + std::unique_ptr<InterpolableList> result = InterpolableList::create(numberList.length()); for (size_t i = 0; i < numberList.length(); i++) result->set(i, InterpolableNumber::create(numberList.at(i)->value())); return InterpolationValue(std::move(result)); @@ -45,14 +46,14 @@ return InterpolationType::maybeMergeSingles(std::move(start), std::move(end)); } -static void padWithZeroes(OwnPtr<InterpolableValue>& listPointer, size_t paddedLength) +static void padWithZeroes(std::unique_ptr<InterpolableValue>& listPointer, size_t paddedLength) { InterpolableList& list = toInterpolableList(*listPointer); if (list.length() >= paddedLength) return; - OwnPtr<InterpolableList> result = InterpolableList::create(paddedLength); + std::unique_ptr<InterpolableList> result = InterpolableList::create(paddedLength); size_t i = 0; for (; i < list.length(); i++) result->set(i, std::move(list.getMutable(i)));
diff --git a/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp index b4fcff91..2413ec3d 100644 --- a/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp
@@ -6,12 +6,13 @@ #include "core/animation/InterpolationEnvironment.h" #include "core/svg/SVGNumberOptionalNumber.h" +#include <memory> namespace blink { InterpolationValue SVGNumberOptionalNumberInterpolationType::maybeConvertNeutral(const InterpolationValue&, ConversionCheckers&) const { - OwnPtr<InterpolableList> result = InterpolableList::create(2); + std::unique_ptr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(0)); result->set(1, InterpolableNumber::create(0)); return InterpolationValue(std::move(result)); @@ -23,7 +24,7 @@ return nullptr; const SVGNumberOptionalNumber& numberOptionalNumber = toSVGNumberOptionalNumber(svgValue); - OwnPtr<InterpolableList> result = InterpolableList::create(2); + std::unique_ptr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(numberOptionalNumber.firstNumber()->value())); result->set(1, InterpolableNumber::create(numberOptionalNumber.secondNumber()->value())); return InterpolationValue(std::move(result));
diff --git a/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.cpp index f317954..2242b51 100644 --- a/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.cpp
@@ -4,10 +4,12 @@ #include "core/animation/SVGPathSegInterpolationFunctions.h" +#include <memory> + namespace blink { -PassOwnPtr<InterpolableNumber> consumeControlAxis(double value, bool isAbsolute, double currentValue) +std::unique_ptr<InterpolableNumber> consumeControlAxis(double value, bool isAbsolute, double currentValue) { return InterpolableNumber::create(isAbsolute ? value : currentValue + value); } @@ -18,7 +20,7 @@ return isAbsolute ? value : value - currentValue; } -PassOwnPtr<InterpolableNumber> consumeCoordinateAxis(double value, bool isAbsolute, double& currentValue) +std::unique_ptr<InterpolableNumber> consumeCoordinateAxis(double value, bool isAbsolute, double& currentValue) { if (isAbsolute) currentValue = value; @@ -34,7 +36,7 @@ return isAbsolute ? currentValue : currentValue - previousValue; } -PassOwnPtr<InterpolableValue> consumeClosePath(const PathSegmentData&, PathCoordinates& coordinates) +std::unique_ptr<InterpolableValue> consumeClosePath(const PathSegmentData&, PathCoordinates& coordinates) { coordinates.currentX = coordinates.initialX; coordinates.currentY = coordinates.initialY; @@ -51,10 +53,10 @@ return segment; } -PassOwnPtr<InterpolableValue> consumeSingleCoordinate(const PathSegmentData& segment, PathCoordinates& coordinates) +std::unique_ptr<InterpolableValue> consumeSingleCoordinate(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); - OwnPtr<InterpolableList> result = InterpolableList::create(2); + std::unique_ptr<InterpolableList> result = InterpolableList::create(2); result->set(0, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); result->set(1, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY)); @@ -85,10 +87,10 @@ return segment; } -PassOwnPtr<InterpolableValue> consumeCurvetoCubic(const PathSegmentData& segment, PathCoordinates& coordinates) +std::unique_ptr<InterpolableValue> consumeCurvetoCubic(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); - OwnPtr<InterpolableList> result = InterpolableList::create(6); + std::unique_ptr<InterpolableList> result = InterpolableList::create(6); result->set(0, consumeControlAxis(segment.x1(), isAbsolute, coordinates.currentX)); result->set(1, consumeControlAxis(segment.y1(), isAbsolute, coordinates.currentY)); result->set(2, consumeControlAxis(segment.x2(), isAbsolute, coordinates.currentX)); @@ -113,10 +115,10 @@ return segment; } -PassOwnPtr<InterpolableValue> consumeCurvetoQuadratic(const PathSegmentData& segment, PathCoordinates& coordinates) +std::unique_ptr<InterpolableValue> consumeCurvetoQuadratic(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); - OwnPtr<InterpolableList> result = InterpolableList::create(4); + std::unique_ptr<InterpolableList> result = InterpolableList::create(4); result->set(0, consumeControlAxis(segment.x1(), isAbsolute, coordinates.currentX)); result->set(1, consumeControlAxis(segment.y1(), isAbsolute, coordinates.currentY)); result->set(2, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); @@ -137,10 +139,10 @@ return segment; } -PassOwnPtr<InterpolableValue> consumeArc(const PathSegmentData& segment, PathCoordinates& coordinates) +std::unique_ptr<InterpolableValue> consumeArc(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); - OwnPtr<InterpolableList> result = InterpolableList::create(7); + std::unique_ptr<InterpolableList> result = InterpolableList::create(7); result->set(0, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); result->set(1, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY)); result->set(2, InterpolableNumber::create(segment.r1())); @@ -167,7 +169,7 @@ return segment; } -PassOwnPtr<InterpolableValue> consumeLinetoHorizontal(const PathSegmentData& segment, PathCoordinates& coordinates) +std::unique_ptr<InterpolableValue> consumeLinetoHorizontal(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); return consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX); @@ -182,7 +184,7 @@ return segment; } -PassOwnPtr<InterpolableValue> consumeLinetoVertical(const PathSegmentData& segment, PathCoordinates& coordinates) +std::unique_ptr<InterpolableValue> consumeLinetoVertical(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); return consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY); @@ -197,10 +199,10 @@ return segment; } -PassOwnPtr<InterpolableValue> consumeCurvetoCubicSmooth(const PathSegmentData& segment, PathCoordinates& coordinates) +std::unique_ptr<InterpolableValue> consumeCurvetoCubicSmooth(const PathSegmentData& segment, PathCoordinates& coordinates) { bool isAbsolute = isAbsolutePathSegType(segment.command); - OwnPtr<InterpolableList> result = InterpolableList::create(4); + std::unique_ptr<InterpolableList> result = InterpolableList::create(4); result->set(0, consumeControlAxis(segment.x2(), isAbsolute, coordinates.currentX)); result->set(1, consumeControlAxis(segment.y2(), isAbsolute, coordinates.currentY)); result->set(2, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); @@ -221,7 +223,7 @@ return segment; } -PassOwnPtr<InterpolableValue> SVGPathSegInterpolationFunctions::consumePathSeg(const PathSegmentData& segment, PathCoordinates& coordinates) +std::unique_ptr<InterpolableValue> SVGPathSegInterpolationFunctions::consumePathSeg(const PathSegmentData& segment, PathCoordinates& coordinates) { switch (segment.command) { case PathSegClosePath:
diff --git a/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.h index bc6f0de..776ccbe6 100644 --- a/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/SVGPathSegInterpolationFunctions.h
@@ -7,6 +7,7 @@ #include "core/animation/InterpolableValue.h" #include "core/svg/SVGPathData.h" +#include <memory> namespace blink { @@ -20,7 +21,7 @@ class SVGPathSegInterpolationFunctions { STATIC_ONLY(SVGPathSegInterpolationFunctions); public: - static PassOwnPtr<InterpolableValue> consumePathSeg(const PathSegmentData&, PathCoordinates& currentCoordinates); + static std::unique_ptr<InterpolableValue> consumePathSeg(const PathSegmentData&, PathCoordinates& currentCoordinates); static PathSegmentData consumeInterpolablePathSeg(const InterpolableValue&, SVGPathSegType, PathCoordinates& currentCoordinates); };
diff --git a/third_party/WebKit/Source/core/animation/SVGPointListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGPointListInterpolationType.cpp index 534cd47..13934d0 100644 --- a/third_party/WebKit/Source/core/animation/SVGPointListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGPointListInterpolationType.cpp
@@ -8,6 +8,7 @@ #include "core/animation/StringKeyframe.h" #include "core/animation/UnderlyingLengthChecker.h" #include "core/svg/SVGPointList.h" +#include <memory> namespace blink { @@ -19,7 +20,7 @@ if (underlyingLength == 0) return nullptr; - OwnPtr<InterpolableList> result = InterpolableList::create(underlyingLength); + std::unique_ptr<InterpolableList> result = InterpolableList::create(underlyingLength); for (size_t i = 0; i < underlyingLength; i++) result->set(i, InterpolableNumber::create(0)); return InterpolationValue(std::move(result)); @@ -31,7 +32,7 @@ return nullptr; const SVGPointList& pointList = toSVGPointList(svgValue); - OwnPtr<InterpolableList> result = InterpolableList::create(pointList.length() * 2); + std::unique_ptr<InterpolableList> result = InterpolableList::create(pointList.length() * 2); for (size_t i = 0; i < pointList.length(); i++) { const SVGPoint& point = *pointList.at(i); result->set(2 * i, InterpolableNumber::create(point.x()));
diff --git a/third_party/WebKit/Source/core/animation/SVGRectInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGRectInterpolationType.cpp index 76ae445..9eca8ae 100644 --- a/third_party/WebKit/Source/core/animation/SVGRectInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGRectInterpolationType.cpp
@@ -7,6 +7,7 @@ #include "core/animation/StringKeyframe.h" #include "core/svg/SVGRect.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { @@ -20,7 +21,7 @@ InterpolationValue SVGRectInterpolationType::maybeConvertNeutral(const InterpolationValue&, ConversionCheckers&) const { - OwnPtr<InterpolableList> result = InterpolableList::create(RectComponentIndexCount); + std::unique_ptr<InterpolableList> result = InterpolableList::create(RectComponentIndexCount); for (size_t i = 0; i < RectComponentIndexCount; i++) result->set(i, InterpolableNumber::create(0)); return InterpolationValue(std::move(result)); @@ -32,7 +33,7 @@ return nullptr; const SVGRect& rect = toSVGRect(svgValue); - OwnPtr<InterpolableList> result = InterpolableList::create(RectComponentIndexCount); + std::unique_ptr<InterpolableList> result = InterpolableList::create(RectComponentIndexCount); result->set(RectX, InterpolableNumber::create(rect.x())); result->set(RectY, InterpolableNumber::create(rect.y())); result->set(RectWidth, InterpolableNumber::create(rect.width()));
diff --git a/third_party/WebKit/Source/core/animation/SVGTransformListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGTransformListInterpolationType.cpp index fd392aa..e0ce0ed54 100644 --- a/third_party/WebKit/Source/core/animation/SVGTransformListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/SVGTransformListInterpolationType.cpp
@@ -10,6 +10,8 @@ #include "core/animation/StringKeyframe.h" #include "core/svg/SVGTransform.h" #include "core/svg/SVGTransformList.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -40,10 +42,10 @@ namespace { -PassOwnPtr<InterpolableValue> translateToInterpolableValue(SVGTransform* transform) +std::unique_ptr<InterpolableValue> translateToInterpolableValue(SVGTransform* transform) { FloatPoint translate = transform->translate(); - OwnPtr<InterpolableList> result = InterpolableList::create(2); + std::unique_ptr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(translate.x())); result->set(1, InterpolableNumber::create(translate.y())); return std::move(result); @@ -60,10 +62,10 @@ return transform; } -PassOwnPtr<InterpolableValue> scaleToInterpolableValue(SVGTransform* transform) +std::unique_ptr<InterpolableValue> scaleToInterpolableValue(SVGTransform* transform) { FloatSize scale = transform->scale(); - OwnPtr<InterpolableList> result = InterpolableList::create(2); + std::unique_ptr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(scale.width())); result->set(1, InterpolableNumber::create(scale.height())); return std::move(result); @@ -80,10 +82,10 @@ return transform; } -PassOwnPtr<InterpolableValue> rotateToInterpolableValue(SVGTransform* transform) +std::unique_ptr<InterpolableValue> rotateToInterpolableValue(SVGTransform* transform) { FloatPoint rotationCenter = transform->rotationCenter(); - OwnPtr<InterpolableList> result = InterpolableList::create(3); + std::unique_ptr<InterpolableList> result = InterpolableList::create(3); result->set(0, InterpolableNumber::create(transform->angle())); result->set(1, InterpolableNumber::create(rotationCenter.x())); result->set(2, InterpolableNumber::create(rotationCenter.y())); @@ -102,7 +104,7 @@ return transform; } -PassOwnPtr<InterpolableValue> skewXToInterpolableValue(SVGTransform* transform) +std::unique_ptr<InterpolableValue> skewXToInterpolableValue(SVGTransform* transform) { return InterpolableNumber::create(transform->angle()); } @@ -114,7 +116,7 @@ return transform; } -PassOwnPtr<InterpolableValue> skewYToInterpolableValue(SVGTransform* transform) +std::unique_ptr<InterpolableValue> skewYToInterpolableValue(SVGTransform* transform) { return InterpolableNumber::create(transform->angle()); } @@ -126,7 +128,7 @@ return transform; } -PassOwnPtr<InterpolableValue> toInterpolableValue(SVGTransform* transform, SVGTransformType transformType) +std::unique_ptr<InterpolableValue> toInterpolableValue(SVGTransform* transform, SVGTransformType transformType) { switch (transformType) { case SVG_TRANSFORM_TRANSLATE: @@ -182,9 +184,9 @@ class SVGTransformListChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<SVGTransformListChecker> create(const InterpolationValue& underlying) + static std::unique_ptr<SVGTransformListChecker> create(const InterpolationValue& underlying) { - return adoptPtr(new SVGTransformListChecker(underlying)); + return wrapUnique(new SVGTransformListChecker(underlying)); } bool isValid(const InterpolationEnvironment&, const InterpolationValue& underlying) const final @@ -214,7 +216,7 @@ return nullptr; const SVGTransformList& svgList = toSVGTransformList(svgValue); - OwnPtr<InterpolableList> result = InterpolableList::create(svgList.length()); + std::unique_ptr<InterpolableList> result = InterpolableList::create(svgList.length()); Vector<SVGTransformType> transformTypes; for (size_t i = 0; i < svgList.length(); i++) { @@ -233,7 +235,7 @@ InterpolationValue SVGTransformListInterpolationType::maybeConvertSingle(const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { Vector<SVGTransformType> types; - Vector<OwnPtr<InterpolableValue>> interpolableParts; + Vector<std::unique_ptr<InterpolableValue>> interpolableParts; if (keyframe.composite() == EffectModel::CompositeAdd) { if (underlying) { @@ -254,7 +256,7 @@ interpolableParts.append(std::move(value.interpolableValue)); } - OwnPtr<InterpolableList> interpolableList = InterpolableList::create(types.size()); + std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(types.size()); size_t interpolableListIndex = 0; for (auto& part : interpolableParts) { InterpolableList& list = toInterpolableList(*part);
diff --git a/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.cpp index 697f1bda..cf7c772 100644 --- a/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.cpp
@@ -12,6 +12,7 @@ #include "core/css/resolver/StyleResolverState.h" #include "core/style/ShadowData.h" #include "platform/geometry/FloatPoint.h" +#include <memory> namespace blink { @@ -62,7 +63,7 @@ InterpolationValue ShadowInterpolationFunctions::convertShadowData(const ShadowData& shadowData, double zoom) { - OwnPtr<InterpolableList> interpolableList = InterpolableList::create(ShadowComponentIndexCount); + std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(ShadowComponentIndexCount); interpolableList->set(ShadowX, CSSLengthInterpolationType::createInterpolablePixels(shadowData.x() / zoom)); interpolableList->set(ShadowY, CSSLengthInterpolationType::createInterpolablePixels(shadowData.y() / zoom)); interpolableList->set(ShadowBlur, CSSLengthInterpolationType::createInterpolablePixels(shadowData.blur() / zoom)); @@ -85,7 +86,7 @@ return nullptr; } - OwnPtr<InterpolableList> interpolableList = InterpolableList::create(ShadowComponentIndexCount); + std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(ShadowComponentIndexCount); static_assert(ShadowX == 0, "Enum ordering check."); static_assert(ShadowY == 1, "Enum ordering check."); static_assert(ShadowBlur == 2, "Enum ordering check."); @@ -109,7 +110,7 @@ } if (shadow.color) { - OwnPtr<InterpolableValue> interpolableColor = CSSColorInterpolationType::maybeCreateInterpolableColor(*shadow.color); + std::unique_ptr<InterpolableValue> interpolableColor = CSSColorInterpolationType::maybeCreateInterpolableColor(*shadow.color); if (!interpolableColor) return nullptr; interpolableList->set(ShadowColor, std::move(interpolableColor)); @@ -120,12 +121,12 @@ return InterpolationValue(std::move(interpolableList), ShadowNonInterpolableValue::create(style)); } -PassOwnPtr<InterpolableValue> ShadowInterpolationFunctions::createNeutralInterpolableValue() +std::unique_ptr<InterpolableValue> ShadowInterpolationFunctions::createNeutralInterpolableValue() { return convertShadowData(ShadowData(FloatPoint(0, 0), 0, 0, Normal, StyleColor(Color::transparent)), 1).interpolableValue; } -void ShadowInterpolationFunctions::composite(OwnPtr<InterpolableValue>& underlyingInterpolableValue, RefPtr<NonInterpolableValue>& underlyingNonInterpolableValue, double underlyingFraction, const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue) +void ShadowInterpolationFunctions::composite(std::unique_ptr<InterpolableValue>& underlyingInterpolableValue, RefPtr<NonInterpolableValue>& underlyingNonInterpolableValue, double underlyingFraction, const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue) { ASSERT(nonInterpolableValuesAreCompatible(underlyingNonInterpolableValue.get(), nonInterpolableValue)); InterpolableList& underlyingInterpolableList = toInterpolableList(*underlyingInterpolableValue);
diff --git a/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.h b/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.h index 584aa2a0..56e72167 100644 --- a/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.h +++ b/third_party/WebKit/Source/core/animation/ShadowInterpolationFunctions.h
@@ -7,6 +7,7 @@ #include "core/animation/InterpolationValue.h" #include "core/animation/PairwiseInterpolationValue.h" +#include <memory> namespace blink { @@ -18,10 +19,10 @@ public: static InterpolationValue convertShadowData(const ShadowData&, double zoom); static InterpolationValue maybeConvertCSSValue(const CSSValue&); - static PassOwnPtr<InterpolableValue> createNeutralInterpolableValue(); + static std::unique_ptr<InterpolableValue> createNeutralInterpolableValue(); static bool nonInterpolableValuesAreCompatible(const NonInterpolableValue*, const NonInterpolableValue*); static PairwiseInterpolationValue maybeMergeSingles(InterpolationValue&& start, InterpolationValue&& end); - static void composite(OwnPtr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); + static void composite(std::unique_ptr<InterpolableValue>&, RefPtr<NonInterpolableValue>&, double underlyingFraction, const InterpolableValue&, const NonInterpolableValue*); static ShadowData createShadowData(const InterpolableValue&, const NonInterpolableValue*, const StyleResolverState&); };
diff --git a/third_party/WebKit/Source/core/animation/StyleInterpolation.h b/third_party/WebKit/Source/core/animation/StyleInterpolation.h index 74b67746..3317039 100644 --- a/third_party/WebKit/Source/core/animation/StyleInterpolation.h +++ b/third_party/WebKit/Source/core/animation/StyleInterpolation.h
@@ -9,6 +9,7 @@ #include "core/CoreExport.h" #include "core/animation/Interpolation.h" #include "core/animation/PropertyHandle.h" +#include <memory> namespace blink { @@ -47,7 +48,7 @@ protected: CSSPropertyID m_id; - StyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, CSSPropertyID id) + StyleInterpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end, CSSPropertyID id) : Interpolation(std::move(start), std::move(end)) , m_id(id) {
diff --git a/third_party/WebKit/Source/core/animation/TypedInterpolationValue.h b/third_party/WebKit/Source/core/animation/TypedInterpolationValue.h index 993ddf9d..28dd675a 100644 --- a/third_party/WebKit/Source/core/animation/TypedInterpolationValue.h +++ b/third_party/WebKit/Source/core/animation/TypedInterpolationValue.h
@@ -6,6 +6,8 @@ #define TypedInterpolationValue_h #include "core/animation/InterpolationValue.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -14,12 +16,12 @@ // Represents an interpolated value between an adjacent pair of PropertySpecificKeyframes. class TypedInterpolationValue { public: - static PassOwnPtr<TypedInterpolationValue> create(const InterpolationType& type, PassOwnPtr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) + static std::unique_ptr<TypedInterpolationValue> create(const InterpolationType& type, std::unique_ptr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) { - return adoptPtr(new TypedInterpolationValue(type, std::move(interpolableValue), nonInterpolableValue)); + return wrapUnique(new TypedInterpolationValue(type, std::move(interpolableValue), nonInterpolableValue)); } - PassOwnPtr<TypedInterpolationValue> clone() const + std::unique_ptr<TypedInterpolationValue> clone() const { InterpolationValue copy = m_value.clone(); return create(m_type, std::move(copy.interpolableValue), copy.nonInterpolableValue.release()); @@ -33,7 +35,7 @@ InterpolationValue& mutableValue() { return m_value; } private: - TypedInterpolationValue(const InterpolationType& type, PassOwnPtr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue) + TypedInterpolationValue(const InterpolationType& type, std::unique_ptr<InterpolableValue> interpolableValue, PassRefPtr<NonInterpolableValue> nonInterpolableValue) : m_type(type) , m_value(std::move(interpolableValue), nonInterpolableValue) {
diff --git a/third_party/WebKit/Source/core/animation/UnderlyingLengthChecker.h b/third_party/WebKit/Source/core/animation/UnderlyingLengthChecker.h index 78ef68b..12870d52 100644 --- a/third_party/WebKit/Source/core/animation/UnderlyingLengthChecker.h +++ b/third_party/WebKit/Source/core/animation/UnderlyingLengthChecker.h
@@ -7,14 +7,16 @@ #include "core/animation/InterpolableValue.h" #include "core/animation/InterpolationType.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { class UnderlyingLengthChecker : public InterpolationType::ConversionChecker { public: - static PassOwnPtr<UnderlyingLengthChecker> create(size_t underlyingLength) + static std::unique_ptr<UnderlyingLengthChecker> create(size_t underlyingLength) { - return adoptPtr(new UnderlyingLengthChecker(underlyingLength)); + return wrapUnique(new UnderlyingLengthChecker(underlyingLength)); } static size_t getUnderlyingLength(const InterpolationValue& underlying)
diff --git a/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.cpp b/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.cpp index 68a7a91..f109581 100644 --- a/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.cpp +++ b/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.cpp
@@ -4,6 +4,8 @@ #include "core/animation/UnderlyingValueOwner.h" +#include <memory> + namespace blink { struct NullValueWrapper { @@ -42,7 +44,7 @@ m_value = &m_valueOwner; } -void UnderlyingValueOwner::set(PassOwnPtr<TypedInterpolationValue> value) +void UnderlyingValueOwner::set(std::unique_ptr<TypedInterpolationValue> value) { if (value) set(value->type(), std::move(value->mutableValue()));
diff --git a/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.h b/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.h index 5644eb8a..ddd115e 100644 --- a/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.h +++ b/third_party/WebKit/Source/core/animation/UnderlyingValueOwner.h
@@ -8,12 +8,13 @@ #include "core/animation/TypedInterpolationValue.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { // Handles memory management of underlying InterpolationValues in applyStack() // Ensures we perform copy on write if we are not the owner of an underlying InterpolationValue. -// This functions similar to a DataRef except on OwnPtr'd objects. +// This functions similar to a DataRef except on std::unique_ptr'd objects. class UnderlyingValueOwner { WTF_MAKE_NONCOPYABLE(UnderlyingValueOwner); STACK_ALLOCATED(); @@ -42,7 +43,7 @@ void set(std::nullptr_t); void set(const InterpolationType&, const InterpolationValue&); void set(const InterpolationType&, InterpolationValue&&); - void set(PassOwnPtr<TypedInterpolationValue>); + void set(std::unique_ptr<TypedInterpolationValue>); void set(const TypedInterpolationValue*); InterpolationValue& mutableValue();
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatablePath.cpp b/third_party/WebKit/Source/core/animation/animatable/AnimatablePath.cpp index deb2889..872acf3 100644 --- a/third_party/WebKit/Source/core/animation/animatable/AnimatablePath.cpp +++ b/third_party/WebKit/Source/core/animation/animatable/AnimatablePath.cpp
@@ -8,6 +8,7 @@ #include "core/svg/SVGPathBlender.h" #include "core/svg/SVGPathByteStreamBuilder.h" #include "core/svg/SVGPathByteStreamSource.h" +#include <memory> namespace blink { @@ -43,7 +44,7 @@ if (usesDefaultInterpolationWith(value)) return defaultInterpolateTo(this, value, fraction); - OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); + std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); SVGPathByteStreamBuilder builder(*byteStream); SVGPathByteStreamSource fromSource(path()->byteStream());
diff --git a/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h b/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h index c1dceb5..9396d38 100644 --- a/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h +++ b/third_party/WebKit/Source/core/animation/css/CSSAnimationData.h
@@ -8,19 +8,21 @@ #include "core/animation/Timing.h" #include "core/animation/css/CSSTimingData.h" #include "core/style/ComputedStyleConstants.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { class CSSAnimationData final : public CSSTimingData { public: - static PassOwnPtr<CSSAnimationData> create() + static std::unique_ptr<CSSAnimationData> create() { - return adoptPtr(new CSSAnimationData); + return wrapUnique(new CSSAnimationData); } - static PassOwnPtr<CSSAnimationData> create(const CSSAnimationData& animationData) + static std::unique_ptr<CSSAnimationData> create(const CSSAnimationData& animationData) { - return adoptPtr(new CSSAnimationData(animationData)); + return wrapUnique(new CSSAnimationData(animationData)); } bool animationsMatchForStyleRecalc(const CSSAnimationData& other) const;
diff --git a/third_party/WebKit/Source/core/animation/css/CSSTransitionData.h b/third_party/WebKit/Source/core/animation/css/CSSTransitionData.h index 0e00f35..261eb7a 100644 --- a/third_party/WebKit/Source/core/animation/css/CSSTransitionData.h +++ b/third_party/WebKit/Source/core/animation/css/CSSTransitionData.h
@@ -7,7 +7,9 @@ #include "core/CSSPropertyNames.h" #include "core/animation/css/CSSTimingData.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -50,14 +52,14 @@ String propertyString; }; - static PassOwnPtr<CSSTransitionData> create() + static std::unique_ptr<CSSTransitionData> create() { - return adoptPtr(new CSSTransitionData); + return wrapUnique(new CSSTransitionData); } - static PassOwnPtr<CSSTransitionData> create(const CSSTransitionData& transitionData) + static std::unique_ptr<CSSTransitionData> create(const CSSTransitionData& transitionData) { - return adoptPtr(new CSSTransitionData(transitionData)); + return wrapUnique(new CSSTransitionData(transitionData)); } bool transitionsMatchForStyleRecalc(const CSSTransitionData& other) const;
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp index c31ff3a..4beaad3 100644 --- a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp +++ b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
@@ -43,6 +43,7 @@ #include "platform/MIMETypeRegistry.h" #include "platform/clipboard/ClipboardMimeTypes.h" #include "platform/clipboard/ClipboardUtilities.h" +#include <memory> namespace blink { @@ -243,7 +244,7 @@ setDragImage(0, node, loc); } -PassOwnPtr<DragImage> DataTransfer::createDragImage(IntPoint& loc, LocalFrame* frame) const +std::unique_ptr<DragImage> DataTransfer::createDragImage(IntPoint& loc, LocalFrame* frame) const { if (m_dragImageElement) { loc = m_dragLoc;
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransfer.h b/third_party/WebKit/Source/core/clipboard/DataTransfer.h index 99e53aa..cf06853 100644 --- a/third_party/WebKit/Source/core/clipboard/DataTransfer.h +++ b/third_party/WebKit/Source/core/clipboard/DataTransfer.h
@@ -32,6 +32,7 @@ #include "platform/geometry/IntPoint.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -83,7 +84,7 @@ void setDragImageResource(ImageResource*, const IntPoint&); void setDragImageElement(Node*, const IntPoint&); - PassOwnPtr<DragImage> createDragImage(IntPoint& dragLocation, LocalFrame*) const; + std::unique_ptr<DragImage> createDragImage(IntPoint& dragLocation, LocalFrame*) const; void declareAndWriteDragImage(Element*, const KURL&, const String& title); void writeURL(Node*, const KURL&, const String&); void writeSelection(const FrameSelection&);
diff --git a/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp b/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp index 635465b74..ed3fa292 100644 --- a/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp +++ b/third_party/WebKit/Source/core/css/AffectedByFocusTest.cpp
@@ -12,6 +12,7 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -34,7 +35,7 @@ void checkElements(ElementResult expected[], unsigned expectedCount) const; private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/css/BinaryDataFontFaceSource.h b/third_party/WebKit/Source/core/css/BinaryDataFontFaceSource.h index 2bc8565..e2e064a 100644 --- a/third_party/WebKit/Source/core/css/BinaryDataFontFaceSource.h +++ b/third_party/WebKit/Source/core/css/BinaryDataFontFaceSource.h
@@ -6,7 +6,7 @@ #define BinaryDataFontFaceSource_h #include "core/css/CSSFontFaceSource.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -22,7 +22,7 @@ private: PassRefPtr<SimpleFontData> createFontData(const FontDescription&) override; - OwnPtr<FontCustomPlatformData> m_customPlatformData; + std::unique_ptr<FontCustomPlatformData> m_customPlatformData; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp b/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp index b1de7219..ffbff60 100644 --- a/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSCalculationValue.cpp
@@ -33,7 +33,6 @@ #include "core/css/CSSPrimitiveValueMappings.h" #include "core/css/resolver/StyleResolver.h" #include "wtf/MathExtras.h" -#include "wtf/OwnPtr.h" #include "wtf/text/StringBuilder.h" static const int maxExpressionDepth = 100;
diff --git a/third_party/WebKit/Source/core/css/CSSKeyframesRule.cpp b/third_party/WebKit/Source/core/css/CSSKeyframesRule.cpp index f8105054..de4d0c27 100644 --- a/third_party/WebKit/Source/core/css/CSSKeyframesRule.cpp +++ b/third_party/WebKit/Source/core/css/CSSKeyframesRule.cpp
@@ -31,6 +31,7 @@ #include "core/css/parser/CSSParser.h" #include "core/frame/UseCounter.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -74,7 +75,7 @@ int StyleRuleKeyframes::findKeyframeIndex(const String& key) const { - OwnPtr<Vector<double>> keys = CSSParser::parseKeyframeKeyList(key); + std::unique_ptr<Vector<double>> keys = CSSParser::parseKeyframeKeyList(key); if (!keys) return -1; for (size_t i = m_keyframes.size(); i--; ) {
diff --git a/third_party/WebKit/Source/core/css/CSSMatrix.h b/third_party/WebKit/Source/core/css/CSSMatrix.h index 7adb5835..f43eb5c2 100644 --- a/third_party/WebKit/Source/core/css/CSSMatrix.h +++ b/third_party/WebKit/Source/core/css/CSSMatrix.h
@@ -29,6 +29,7 @@ #include "bindings/core/v8/ScriptWrappable.h" #include "platform/transforms/TransformationMatrix.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -152,10 +153,10 @@ CSSMatrix(const String&, ExceptionState&); // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc - // supports 16-byte alignment but Oilpan doesn't. So we use an OwnPtr + // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr // to allocate TransformationMatrix on PartitionAlloc. // TODO(oilpan): Oilpan should support 16-byte aligned allocations. - OwnPtr<TransformationMatrix> m_matrix; + std::unique_ptr<TransformationMatrix> m_matrix; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/CSSPathValue.cpp b/third_party/WebKit/Source/core/css/CSSPathValue.cpp index ff88f62..2cb4e3a 100644 --- a/third_party/WebKit/Source/core/css/CSSPathValue.cpp +++ b/third_party/WebKit/Source/core/css/CSSPathValue.cpp
@@ -6,6 +6,7 @@ #include "core/style/StylePath.h" #include "core/svg/SVGPathUtilities.h" +#include <memory> namespace blink { @@ -14,7 +15,7 @@ return new CSSPathValue(stylePath); } -CSSPathValue* CSSPathValue::create(PassOwnPtr<SVGPathByteStream> pathByteStream) +CSSPathValue* CSSPathValue::create(std::unique_ptr<SVGPathByteStream> pathByteStream) { return CSSPathValue::create(StylePath::create(std::move(pathByteStream))); } @@ -30,7 +31,7 @@ CSSPathValue* createPathValue() { - OwnPtr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); + std::unique_ptr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create(); // Need to be registered as LSan ignored, as it will be reachable and // separately referred to by emptyPathValue() callers. LEAK_SANITIZER_IGNORE_OBJECT(pathByteStream.get());
diff --git a/third_party/WebKit/Source/core/css/CSSPathValue.h b/third_party/WebKit/Source/core/css/CSSPathValue.h index 99e3e799..0d9a1f06 100644 --- a/third_party/WebKit/Source/core/css/CSSPathValue.h +++ b/third_party/WebKit/Source/core/css/CSSPathValue.h
@@ -10,6 +10,7 @@ #include "core/svg/SVGPathByteStream.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -18,7 +19,7 @@ class CSSPathValue : public CSSValue { public: static CSSPathValue* create(PassRefPtr<StylePath>); - static CSSPathValue* create(PassOwnPtr<SVGPathByteStream>); + static CSSPathValue* create(std::unique_ptr<SVGPathByteStream>); static CSSPathValue& emptyPathValue();
diff --git a/third_party/WebKit/Source/core/css/CSSSelector.cpp b/third_party/WebKit/Source/core/css/CSSSelector.cpp index 9662a27..3a40cb6d 100644 --- a/third_party/WebKit/Source/core/css/CSSSelector.cpp +++ b/third_party/WebKit/Source/core/css/CSSSelector.cpp
@@ -34,6 +34,7 @@ #include "wtf/StdLibExtras.h" #include "wtf/text/StringBuilder.h" #include <algorithm> +#include <memory> #ifndef NDEBUG #include <stdio.h> @@ -766,7 +767,7 @@ m_data.m_rareData->m_argument = value; } -void CSSSelector::setSelectorList(PassOwnPtr<CSSSelectorList> selectorList) +void CSSSelector::setSelectorList(std::unique_ptr<CSSSelectorList> selectorList) { createRareData(); m_data.m_rareData->m_selectorList = std::move(selectorList);
diff --git a/third_party/WebKit/Source/core/css/CSSSelector.h b/third_party/WebKit/Source/core/css/CSSSelector.h index 65dab52..766005b 100644 --- a/third_party/WebKit/Source/core/css/CSSSelector.h +++ b/third_party/WebKit/Source/core/css/CSSSelector.h
@@ -25,9 +25,8 @@ #include "core/CoreExport.h" #include "core/dom/QualifiedName.h" #include "core/style/ComputedStyleConstants.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" +#include <memory> namespace blink { class CSSSelectorList; @@ -252,7 +251,7 @@ void setValue(const AtomicString&, bool matchLowerCase); void setAttribute(const QualifiedName&, AttributeMatchType); void setArgument(const AtomicString&); - void setSelectorList(PassOwnPtr<CSSSelectorList>); + void setSelectorList(std::unique_ptr<CSSSelectorList>); void setNth(int a, int b); bool matchNth(int count) const; @@ -338,7 +337,7 @@ } m_bits; QualifiedName m_attribute; // used for attribute selector AtomicString m_argument; // Used for :contains, :lang, :nth-* - OwnPtr<CSSSelectorList> m_selectorList; // Used for :-webkit-any and :not + std::unique_ptr<CSSSelectorList> m_selectorList; // Used for :-webkit-any and :not private: RareData(const AtomicString& value);
diff --git a/third_party/WebKit/Source/core/css/CSSSelectorList.cpp b/third_party/WebKit/Source/core/css/CSSSelectorList.cpp index 541104d..01544222 100644 --- a/third_party/WebKit/Source/core/css/CSSSelectorList.cpp +++ b/third_party/WebKit/Source/core/css/CSSSelectorList.cpp
@@ -29,6 +29,7 @@ #include "core/css/parser/CSSParserSelector.h" #include "wtf/allocator/Partitions.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace { // CSSSelector is one of the top types that consume renderer memory, @@ -52,7 +53,7 @@ return list; } -CSSSelectorList CSSSelectorList::adoptSelectorVector(Vector<OwnPtr<CSSParserSelector>>& selectorVector) +CSSSelectorList CSSSelectorList::adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector) { size_t flattenedSize = 0; for (size_t i = 0; i < selectorVector.size(); ++i) { @@ -68,7 +69,7 @@ CSSParserSelector* current = selectorVector[i].get(); while (current) { // Move item from the parser selector vector into m_selectorArray without invoking destructor (Ugh.) - CSSSelector* currentSelector = current->releaseSelector().leakPtr(); + CSSSelector* currentSelector = current->releaseSelector().release(); memcpy(&list.m_selectorArray[arrayIndex], currentSelector, sizeof(CSSSelector)); WTF::Partitions::fastFree(currentSelector);
diff --git a/third_party/WebKit/Source/core/css/CSSSelectorList.h b/third_party/WebKit/Source/core/css/CSSSelectorList.h index c0edf57f..534ef70 100644 --- a/third_party/WebKit/Source/core/css/CSSSelectorList.h +++ b/third_party/WebKit/Source/core/css/CSSSelectorList.h
@@ -28,6 +28,7 @@ #include "core/CoreExport.h" #include "core/css/CSSSelector.h" +#include <memory> namespace blink { @@ -57,7 +58,7 @@ deleteSelectorsIfNeeded(); } - static CSSSelectorList adoptSelectorVector(Vector<OwnPtr<CSSParserSelector>>& selectorVector); + static CSSSelectorList adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector); CSSSelectorList copy() const; bool isValid() const { return !!m_selectorArray; }
diff --git a/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp b/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp index d78d6625..0cb68c1 100644 --- a/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp +++ b/third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp
@@ -31,8 +31,10 @@ #include "public/platform/Platform.h" #include "public/platform/WebURLResponse.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -57,7 +59,7 @@ Document* document() { return &m_page->document(); } Persistent<MemoryCache> m_originalMemoryCache; - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; }; TEST_F(CSSStyleSheetResourceTest, PruneCanCauseEviction) @@ -83,8 +85,8 @@ CSSImageValue::create(String("image"), imageURL), CSSImageValue::create(String("image"), imageURL), CSSPrimitiveValue::create(1.0, CSSPrimitiveValue::UnitType::Number)); - Vector<OwnPtr<CSSParserSelector>> selectors; - selectors.append(adoptPtr(new CSSParserSelector())); + Vector<std::unique_ptr<CSSParserSelector>> selectors; + selectors.append(wrapUnique(new CSSParserSelector())); selectors[0]->setMatch(CSSSelector::Id); selectors[0]->setValue("foo"); CSSProperty property(CSSPropertyBackground, *crossfade);
diff --git a/third_party/WebKit/Source/core/css/DragUpdateTest.cpp b/third_party/WebKit/Source/core/css/DragUpdateTest.cpp index 0e53520..14bced50 100644 --- a/third_party/WebKit/Source/core/css/DragUpdateTest.cpp +++ b/third_party/WebKit/Source/core/css/DragUpdateTest.cpp
@@ -10,6 +10,7 @@ #include "core/layout/LayoutObject.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -18,7 +19,7 @@ // Check that when dragging the div in the document below, you only get a // single element style recalc. - OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); + std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); HTMLDocument& document = toHTMLDocument(dummyPageHolder->document()); document.documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:-webkit-drag { background-color: green }</style>" "<div>" @@ -44,7 +45,7 @@ // Check that when dragging the div in the document below, you get a // single element style recalc. - OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); + std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); HTMLDocument& document = toHTMLDocument(dummyPageHolder->document()); document.documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:-webkit-drag .drag { background-color: green }</style>" "<div>" @@ -70,7 +71,7 @@ // Check that when dragging the div in the document below, you get a // single element style recalc. - OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); + std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); HTMLDocument& document = toHTMLDocument(dummyPageHolder->document()); document.documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:-webkit-drag + .drag { background-color: green }</style>" "<div>"
diff --git a/third_party/WebKit/Source/core/css/MediaList.cpp b/third_party/WebKit/Source/core/css/MediaList.cpp index 7892ee2..cfa531b 100644 --- a/third_party/WebKit/Source/core/css/MediaList.cpp +++ b/third_party/WebKit/Source/core/css/MediaList.cpp
@@ -25,6 +25,7 @@ #include "core/css/MediaQueryExp.h" #include "core/css/parser/MediaQueryParser.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -159,7 +160,7 @@ DEFINE_TRACE(MediaQuerySet) { - // We don't support tracing of vectors of OwnPtrs (ie. OwnPtr<Vector<OwnPtr<MediaQuery>>>). + // We don't support tracing of vectors of OwnPtrs (ie. std::unique_ptr<Vector<std::unique_ptr<MediaQuery>>>). // Since this is a transitional object we are just ifdef'ing it out when oilpan is not enabled. visitor->trace(m_queries); }
diff --git a/third_party/WebKit/Source/core/css/MediaQuery.cpp b/third_party/WebKit/Source/core/css/MediaQuery.cpp index f440b1c..6ba95d1 100644 --- a/third_party/WebKit/Source/core/css/MediaQuery.cpp +++ b/third_party/WebKit/Source/core/css/MediaQuery.cpp
@@ -33,6 +33,7 @@ #include "core/html/parser/HTMLParserIdioms.h" #include "wtf/NonCopyingSort.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -134,7 +135,7 @@ DEFINE_TRACE(MediaQuery) { - // We don't support tracing of vectors of OwnPtrs (ie. OwnPtr<Vector<OwnPtr<MediaQuery>>>). + // We don't support tracing of vectors of OwnPtrs (ie. std::unique_ptr<Vector<std::unique_ptr<MediaQuery>>>). // Since this is a transitional object we are just ifdef'ing it out when oilpan is not enabled. visitor->trace(m_expressions); }
diff --git a/third_party/WebKit/Source/core/css/MediaQuery.h b/third_party/WebKit/Source/core/css/MediaQuery.h index 18719e7..c2202388 100644 --- a/third_party/WebKit/Source/core/css/MediaQuery.h +++ b/third_party/WebKit/Source/core/css/MediaQuery.h
@@ -31,7 +31,6 @@ #include "core/CoreExport.h" #include "platform/heap/Handle.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/StringHash.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp b/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp index 2c8b1b2..16382b1 100644 --- a/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp +++ b/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
@@ -10,8 +10,8 @@ #include "core/frame/FrameView.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -174,7 +174,7 @@ TEST(MediaQueryEvaluatorTest, Dynamic) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); pageHolder->frameView().setMediaType(MediaTypeNames::screen); MediaQueryEvaluator mediaQueryEvaluator(&pageHolder->frame()); @@ -185,7 +185,7 @@ TEST(MediaQueryEvaluatorTest, DynamicNoView) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); LocalFrame* frame = &pageHolder->frame(); pageHolder.reset(); ASSERT_EQ(nullptr, frame->view());
diff --git a/third_party/WebKit/Source/core/css/MediaQueryExp.h b/third_party/WebKit/Source/core/css/MediaQueryExp.h index 266a3eb..91b0fd3 100644 --- a/third_party/WebKit/Source/core/css/MediaQueryExp.h +++ b/third_party/WebKit/Source/core/css/MediaQueryExp.h
@@ -35,7 +35,6 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/CSSValue.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp b/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp index b201c81..14f8b1f 100644 --- a/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp +++ b/third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp
@@ -8,12 +8,13 @@ #include "core/css/MediaList.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { TEST(MediaQueryMatcherTest, LostFrame) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(500, 500)); MediaQueryMatcher* matcher = MediaQueryMatcher::create(pageHolder->document()); MediaQuerySet* querySet = MediaQuerySet::create(MediaTypeNames::all); ASSERT_TRUE(matcher->evaluate(querySet));
diff --git a/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp b/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp index 5ac3543..76dd83b 100644 --- a/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp +++ b/third_party/WebKit/Source/core/css/MediaQuerySetTest.cpp
@@ -6,7 +6,6 @@ #include "core/css/MediaList.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.h b/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.h index 14c2f4f..7016c24 100644 --- a/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.h +++ b/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.h
@@ -28,7 +28,6 @@ #include "core/css/CSSStyleDeclaration.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/SelectorFilter.cpp b/third_party/WebKit/Source/core/css/SelectorFilter.cpp index 73107df..deb464e4 100644 --- a/third_party/WebKit/Source/core/css/SelectorFilter.cpp +++ b/third_party/WebKit/Source/core/css/SelectorFilter.cpp
@@ -30,6 +30,7 @@ #include "core/css/CSSSelector.h" #include "core/dom/Document.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -86,7 +87,7 @@ if (m_parentStack.isEmpty()) { ASSERT(parent == parent.document().documentElement()); ASSERT(!m_ancestorIdentifierFilter); - m_ancestorIdentifierFilter = adoptPtr(new IdentifierFilter); + m_ancestorIdentifierFilter = wrapUnique(new IdentifierFilter); pushParentStackFrame(parent); return; }
diff --git a/third_party/WebKit/Source/core/css/SelectorFilter.h b/third_party/WebKit/Source/core/css/SelectorFilter.h index 91adbfd..6119434b 100644 --- a/third_party/WebKit/Source/core/css/SelectorFilter.h +++ b/third_party/WebKit/Source/core/css/SelectorFilter.h
@@ -32,6 +32,7 @@ #include "core/dom/Element.h" #include "wtf/BloomFilter.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -74,7 +75,7 @@ // With 100 unique strings in the filter, 2^12 slot table has false positive rate of ~0.2%. using IdentifierFilter = BloomFilter<12>; - OwnPtr<IdentifierFilter> m_ancestorIdentifierFilter; + std::unique_ptr<IdentifierFilter> m_ancestorIdentifierFilter; }; template <unsigned maximumIdentifierCount>
diff --git a/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp b/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp index db237ad..77423a3ad 100644 --- a/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp +++ b/third_party/WebKit/Source/core/css/StyleRuleKeyframe.cpp
@@ -7,10 +7,11 @@ #include "core/css/StylePropertySet.h" #include "core/css/parser/CSSParser.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { -StyleRuleKeyframe::StyleRuleKeyframe(PassOwnPtr<Vector<double>> keys, StylePropertySet* properties) +StyleRuleKeyframe::StyleRuleKeyframe(std::unique_ptr<Vector<double>> keys, StylePropertySet* properties) : StyleRuleBase(Keyframe) , m_properties(properties) , m_keys(*keys) @@ -36,7 +37,7 @@ { ASSERT(!keyText.isNull()); - OwnPtr<Vector<double>> keys = CSSParser::parseKeyframeKeyList(keyText); + std::unique_ptr<Vector<double>> keys = CSSParser::parseKeyframeKeyList(keyText); if (!keys || keys->isEmpty()) return false;
diff --git a/third_party/WebKit/Source/core/css/StyleRuleKeyframe.h b/third_party/WebKit/Source/core/css/StyleRuleKeyframe.h index 8d5c3cb..34cb9ac 100644 --- a/third_party/WebKit/Source/core/css/StyleRuleKeyframe.h +++ b/third_party/WebKit/Source/core/css/StyleRuleKeyframe.h
@@ -6,6 +6,7 @@ #define StyleRuleKeyframe_h #include "core/css/StyleRule.h" +#include <memory> namespace blink { @@ -14,7 +15,7 @@ class StyleRuleKeyframe final : public StyleRuleBase { public: - static StyleRuleKeyframe* create(PassOwnPtr<Vector<double>> keys, StylePropertySet* properties) + static StyleRuleKeyframe* create(std::unique_ptr<Vector<double>> keys, StylePropertySet* properties) { return new StyleRuleKeyframe(std::move(keys), properties); } @@ -34,7 +35,7 @@ DECLARE_TRACE_AFTER_DISPATCH(); private: - StyleRuleKeyframe(PassOwnPtr<Vector<double>>, StylePropertySet*); + StyleRuleKeyframe(std::unique_ptr<Vector<double>>, StylePropertySet*); Member<StylePropertySet> m_properties; Vector<double> m_keys;
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.cpp b/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.cpp index 4de332a5..ac63595 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.cpp
@@ -7,6 +7,7 @@ #include "core/css/CSSPrimitiveValue.h" #include "wtf/MathExtras.h" #include <cmath> +#include <memory> namespace blink { @@ -32,7 +33,7 @@ CSSMatrixTransformComponent* CSSMatrixTransformComponent::perspective(double length) { - OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); + std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); if (length != 0) matrix->setM34(-1 / length); return new CSSMatrixTransformComponent(std::move(matrix), PerspectiveType); @@ -40,21 +41,21 @@ CSSMatrixTransformComponent* CSSMatrixTransformComponent::rotate(double angle) { - OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); + std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->rotate(angle); return new CSSMatrixTransformComponent(std::move(matrix), RotationType); } CSSMatrixTransformComponent* CSSMatrixTransformComponent::rotate3d(double angle, double x, double y, double z) { - OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); + std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->rotate3d(x, y, z, angle); return new CSSMatrixTransformComponent(std::move(matrix), Rotation3DType); } CSSMatrixTransformComponent* CSSMatrixTransformComponent::scale(double x, double y) { - OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); + std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->setM11(x); matrix->setM22(y); return new CSSMatrixTransformComponent(std::move(matrix), ScaleType); @@ -62,7 +63,7 @@ CSSMatrixTransformComponent* CSSMatrixTransformComponent::scale3d(double x, double y, double z) { - OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); + std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->setM11(x); matrix->setM22(y); matrix->setM33(z); @@ -74,7 +75,7 @@ double tanAx = std::tan(deg2rad(ax)); double tanAy = std::tan(deg2rad(ay)); - OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); + std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->setM12(tanAy); matrix->setM21(tanAx); return new CSSMatrixTransformComponent(std::move(matrix), SkewType); @@ -82,7 +83,7 @@ CSSMatrixTransformComponent* CSSMatrixTransformComponent::translate(double x, double y) { - OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); + std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->setM41(x); matrix->setM42(y); return new CSSMatrixTransformComponent(std::move(matrix), TranslationType); @@ -90,7 +91,7 @@ CSSMatrixTransformComponent* CSSMatrixTransformComponent::translate3d(double x, double y, double z) { - OwnPtr<TransformationMatrix> matrix = TransformationMatrix::create(); + std::unique_ptr<TransformationMatrix> matrix = TransformationMatrix::create(); matrix->setM41(x); matrix->setM42(y); matrix->setM43(z);
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.h b/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.h index fcc05ab..d0c5e80 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSMatrixTransformComponent.h
@@ -7,6 +7,7 @@ #include "core/css/cssom/TransformComponent.h" #include "platform/transforms/TransformationMatrix.h" +#include <memory> namespace blink { @@ -91,17 +92,17 @@ , m_is2D(false) { } - CSSMatrixTransformComponent(PassOwnPtr<const TransformationMatrix> matrix, TransformComponentType fromType) + CSSMatrixTransformComponent(std::unique_ptr<const TransformationMatrix> matrix, TransformComponentType fromType) : TransformComponent() , m_matrix(std::move(matrix)) , m_is2D(is2DComponentType(fromType)) { } // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc - // supports 16-byte alignment but Oilpan doesn't. So we use an OwnPtr + // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr // to allocate TransformationMatrix on PartitionAlloc. // TODO(oilpan): Oilpan should support 16-byte aligned allocations. - OwnPtr<const TransformationMatrix> m_matrix; + std::unique_ptr<const TransformationMatrix> m_matrix; bool m_is2D; };
diff --git a/third_party/WebKit/Source/core/css/cssom/FilteredComputedStylePropertyMapTest.cpp b/third_party/WebKit/Source/core/css/cssom/FilteredComputedStylePropertyMapTest.cpp index 042b125..a6d9269 100644 --- a/third_party/WebKit/Source/core/css/cssom/FilteredComputedStylePropertyMapTest.cpp +++ b/third_party/WebKit/Source/core/css/cssom/FilteredComputedStylePropertyMapTest.cpp
@@ -9,6 +9,7 @@ #include "core/testing/DummyPageHolder.h" #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -23,7 +24,7 @@ CSSComputedStyleDeclaration* declaration() const { return m_declaration.get(); } private: - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; Persistent<CSSComputedStyleDeclaration> m_declaration; };
diff --git a/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.cpp b/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.cpp index 925ad85..a035222 100644 --- a/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.cpp +++ b/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.cpp
@@ -35,7 +35,9 @@ #include "core/inspector/InspectorTraceEvents.h" #include "platform/TracedValue.h" #include "wtf/Compiler.h" +#include "wtf/PtrUtil.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -168,28 +170,28 @@ HashSet<AtomicString>& InvalidationSet::ensureClassSet() { if (!m_classes) - m_classes = adoptPtr(new HashSet<AtomicString>); + m_classes = wrapUnique(new HashSet<AtomicString>); return *m_classes; } HashSet<AtomicString>& InvalidationSet::ensureIdSet() { if (!m_ids) - m_ids = adoptPtr(new HashSet<AtomicString>); + m_ids = wrapUnique(new HashSet<AtomicString>); return *m_ids; } HashSet<AtomicString>& InvalidationSet::ensureTagNameSet() { if (!m_tagNames) - m_tagNames = adoptPtr(new HashSet<AtomicString>); + m_tagNames = wrapUnique(new HashSet<AtomicString>); return *m_tagNames; } HashSet<AtomicString>& InvalidationSet::ensureAttributeSet() { if (!m_attributes) - m_attributes = adoptPtr(new HashSet<AtomicString>); + m_attributes = wrapUnique(new HashSet<AtomicString>); return *m_attributes; } @@ -288,7 +290,7 @@ #ifndef NDEBUG void InvalidationSet::show() const { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->beginArray("InvalidationSet"); toTracedValue(value.get()); value->endArray();
diff --git a/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h b/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h index 35f8a42..61932a2 100644 --- a/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h +++ b/third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h
@@ -40,6 +40,7 @@ #include "wtf/RefPtr.h" #include "wtf/text/AtomicStringHash.h" #include "wtf/text/StringHash.h" +#include <memory> namespace blink { @@ -146,10 +147,10 @@ HashSet<AtomicString>& ensureAttributeSet(); // FIXME: optimize this if it becomes a memory issue. - OwnPtr<HashSet<AtomicString>> m_classes; - OwnPtr<HashSet<AtomicString>> m_ids; - OwnPtr<HashSet<AtomicString>> m_tagNames; - OwnPtr<HashSet<AtomicString>> m_attributes; + std::unique_ptr<HashSet<AtomicString>> m_classes; + std::unique_ptr<HashSet<AtomicString>> m_ids; + std::unique_ptr<HashSet<AtomicString>> m_tagNames; + std::unique_ptr<HashSet<AtomicString>> m_attributes; unsigned m_type : 1;
diff --git a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp index a6a9e97..b5d291e 100644 --- a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp +++ b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp
@@ -14,6 +14,7 @@ #include "core/html/HTMLSlotElement.h" #include "core/inspector/InspectorTraceEvents.h" #include "core/layout/LayoutObject.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -100,7 +101,7 @@ { PendingInvalidationMap::AddResult addResult = m_pendingInvalidationMap.add(&element, nullptr); if (addResult.isNewEntry) - addResult.storedValue->value = adoptPtr(new PendingInvalidations()); + addResult.storedValue->value = wrapUnique(new PendingInvalidations()); return *addResult.storedValue->value; }
diff --git a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h index 1123158..4ce06cb 100644 --- a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h +++ b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h
@@ -8,6 +8,7 @@ #include "core/css/invalidation/PendingInvalidations.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -128,7 +129,7 @@ RecursionData* m_data; }; - using PendingInvalidationMap = HeapHashMap<Member<Element>, OwnPtr<PendingInvalidations>>; + using PendingInvalidationMap = HeapHashMap<Member<Element>, std::unique_ptr<PendingInvalidations>>; PendingInvalidations& ensurePendingInvalidations(Element&);
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSParser.cpp index a8061e5..fd94660 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSParser.cpp
@@ -18,6 +18,7 @@ #include "core/css/parser/CSSTokenizer.h" #include "core/css/parser/CSSVariableParser.h" #include "core/layout/LayoutTheme.h" +#include <memory> namespace blink { @@ -114,7 +115,7 @@ return CSSParserImpl::parseInlineStyleDeclaration(styleString, element); } -PassOwnPtr<Vector<double>> CSSParser::parseKeyframeKeyList(const String& keyList) +std::unique_ptr<Vector<double>> CSSParser::parseKeyframeKeyList(const String& keyList) { return CSSParserImpl::parseKeyframeKeyList(keyList); }
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParser.h b/third_party/WebKit/Source/core/css/parser/CSSParser.h index 341a2d58..706dd562 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParser.h +++ b/third_party/WebKit/Source/core/css/parser/CSSParser.h
@@ -10,6 +10,7 @@ #include "core/css/CSSValue.h" #include "core/css/parser/CSSParserMode.h" #include "platform/graphics/Color.h" +#include <memory> namespace blink { @@ -47,7 +48,7 @@ static ImmutableStylePropertySet* parseInlineStyleDeclaration(const String&, Element*); - static PassOwnPtr<Vector<double>> parseKeyframeKeyList(const String&); + static std::unique_ptr<Vector<double>> parseKeyframeKeyList(const String&); static StyleRuleKeyframe* parseKeyframeRule(const CSSParserContext&, const String&); static bool parseSupportsCondition(const String&);
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp index f9c9e8d..afe156f 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
@@ -28,7 +28,9 @@ #include "core/frame/Deprecation.h" #include "core/frame/UseCounter.h" #include "platform/TraceEvent.h" +#include "wtf/PtrUtil.h" #include <bitset> +#include <memory> namespace blink { @@ -204,7 +206,7 @@ if (!range.atEnd()) return CSSSelectorList(); // Parse error; extra tokens in @page selector - OwnPtr<CSSParserSelector> selector; + std::unique_ptr<CSSParserSelector> selector; if (!typeSelector.isNull() && pseudo.isNull()) { selector = CSSParserSelector::create(QualifiedName(nullAtom, typeSelector, styleSheet->defaultNamespace())); } else { @@ -221,7 +223,7 @@ } selector->setForPage(); - Vector<OwnPtr<CSSParserSelector>> selectorVector; + Vector<std::unique_ptr<CSSParserSelector>> selectorVector; selectorVector.append(std::move(selector)); CSSSelectorList selectorList = CSSSelectorList::adoptSelectorVector(selectorVector); return selectorList; @@ -249,7 +251,7 @@ return createStylePropertySet(parser.m_parsedProperties, HTMLStandardMode); } -PassOwnPtr<Vector<double>> CSSParserImpl::parseKeyframeKeyList(const String& keyList) +std::unique_ptr<Vector<double>> CSSParserImpl::parseKeyframeKeyList(const String& keyList) { return consumeKeyframeKeyList(CSSTokenizer::Scope(keyList).tokenRange()); } @@ -646,7 +648,7 @@ StyleRuleKeyframe* CSSParserImpl::consumeKeyframeStyleRule(CSSParserTokenRange prelude, CSSParserTokenRange block) { - OwnPtr<Vector<double>> keyList = consumeKeyframeKeyList(prelude); + std::unique_ptr<Vector<double>> keyList = consumeKeyframeKeyList(prelude); if (!keyList) return nullptr; @@ -803,9 +805,9 @@ CSSPropertyParser::parseValue(unresolvedProperty, important, range, m_context, m_parsedProperties, ruleType); } -PassOwnPtr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenRange range) +std::unique_ptr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenRange range) { - OwnPtr<Vector<double>> result = adoptPtr(new Vector<double>); + std::unique_ptr<Vector<double>> result = wrapUnique(new Vector<double>); while (true) { range.consumeWhitespace(); const CSSParserToken& token = range.consumeIncludingWhitespace();
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.h b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.h index 3d8fbea..0bcd515 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.h +++ b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.h
@@ -13,6 +13,7 @@ #include "platform/heap/Handle.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -66,7 +67,7 @@ static ImmutableStylePropertySet* parseCustomPropertySet(CSSParserTokenRange); - static PassOwnPtr<Vector<double>> parseKeyframeKeyList(const String&); + static std::unique_ptr<Vector<double>> parseKeyframeKeyList(const String&); bool supportsDeclaration(CSSParserTokenRange&); @@ -108,7 +109,7 @@ void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool important, StyleRule::RuleType); void consumeVariableValue(CSSParserTokenRange, const AtomicString& propertyName, bool important); - static PassOwnPtr<Vector<double>> consumeKeyframeKeyList(CSSParserTokenRange); + static std::unique_ptr<Vector<double>> consumeKeyframeKeyList(CSSParserTokenRange); // FIXME: Can we build StylePropertySets directly? // FIXME: Investigate using a smaller inline buffer
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserSelector.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserSelector.cpp index f3263ea..93b8731 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserSelector.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSParserSelector.cpp
@@ -21,16 +21,18 @@ #include "core/css/parser/CSSParserSelector.h" #include "core/css/CSSSelectorList.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { CSSParserSelector::CSSParserSelector() - : m_selector(adoptPtr(new CSSSelector())) + : m_selector(wrapUnique(new CSSSelector())) { } CSSParserSelector::CSSParserSelector(const QualifiedName& tagQName, bool isImplicit) - : m_selector(adoptPtr(new CSSSelector(tagQName, isImplicit))) + : m_selector(wrapUnique(new CSSSelector(tagQName, isImplicit))) { } @@ -38,10 +40,10 @@ { if (!m_tagHistory) return; - Vector<OwnPtr<CSSParserSelector>, 16> toDelete; - OwnPtr<CSSParserSelector> selector = std::move(m_tagHistory); + Vector<std::unique_ptr<CSSParserSelector>, 16> toDelete; + std::unique_ptr<CSSParserSelector> selector = std::move(m_tagHistory); while (true) { - OwnPtr<CSSParserSelector> next = std::move(selector->m_tagHistory); + std::unique_ptr<CSSParserSelector> next = std::move(selector->m_tagHistory); toDelete.append(std::move(selector)); if (!next) break; @@ -49,13 +51,13 @@ } } -void CSSParserSelector::adoptSelectorVector(Vector<OwnPtr<CSSParserSelector>>& selectorVector) +void CSSParserSelector::adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector) { CSSSelectorList* selectorList = new CSSSelectorList(CSSSelectorList::adoptSelectorVector(selectorVector)); - m_selector->setSelectorList(adoptPtr(selectorList)); + m_selector->setSelectorList(wrapUnique(selectorList)); } -void CSSParserSelector::setSelectorList(PassOwnPtr<CSSSelectorList> selectorList) +void CSSParserSelector::setSelectorList(std::unique_ptr<CSSSelectorList> selectorList) { m_selector->setSelectorList(std::move(selectorList)); } @@ -80,7 +82,7 @@ return false; } -void CSSParserSelector::appendTagHistory(CSSSelector::RelationType relation, PassOwnPtr<CSSParserSelector> selector) +void CSSParserSelector::appendTagHistory(CSSSelector::RelationType relation, std::unique_ptr<CSSParserSelector> selector) { CSSParserSelector* end = this; while (end->tagHistory()) @@ -89,7 +91,7 @@ end->setTagHistory(std::move(selector)); } -PassOwnPtr<CSSParserSelector> CSSParserSelector::releaseTagHistory() +std::unique_ptr<CSSParserSelector> CSSParserSelector::releaseTagHistory() { setRelation(CSSSelector::SubSelector); return std::move(m_tagHistory); @@ -97,11 +99,11 @@ void CSSParserSelector::prependTagSelector(const QualifiedName& tagQName, bool isImplicit) { - OwnPtr<CSSParserSelector> second = CSSParserSelector::create(); + std::unique_ptr<CSSParserSelector> second = CSSParserSelector::create(); second->m_selector = std::move(m_selector); second->m_tagHistory = std::move(m_tagHistory); m_tagHistory = std::move(second); - m_selector = adoptPtr(new CSSSelector(tagQName, isImplicit)); + m_selector = wrapUnique(new CSSSelector(tagQName, isImplicit)); } bool CSSParserSelector::isHostPseudoSelector() const
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserSelector.h b/third_party/WebKit/Source/core/css/parser/CSSParserSelector.h index 8be43de..1d3cf2e 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserSelector.h +++ b/third_party/WebKit/Source/core/css/parser/CSSParserSelector.h
@@ -23,6 +23,8 @@ #include "core/CoreExport.h" #include "core/css/CSSSelector.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -32,12 +34,12 @@ CSSParserSelector(); explicit CSSParserSelector(const QualifiedName&, bool isImplicit = false); - static PassOwnPtr<CSSParserSelector> create() { return adoptPtr(new CSSParserSelector); } - static PassOwnPtr<CSSParserSelector> create(const QualifiedName& name, bool isImplicit = false) { return adoptPtr(new CSSParserSelector(name, isImplicit)); } + static std::unique_ptr<CSSParserSelector> create() { return wrapUnique(new CSSParserSelector); } + static std::unique_ptr<CSSParserSelector> create(const QualifiedName& name, bool isImplicit = false) { return wrapUnique(new CSSParserSelector(name, isImplicit)); } ~CSSParserSelector(); - PassOwnPtr<CSSSelector> releaseSelector() { return std::move(m_selector); } + std::unique_ptr<CSSSelector> releaseSelector() { return std::move(m_selector); } CSSSelector::RelationType relation() const { return m_selector->relation(); } void setValue(const AtomicString& value, bool matchLowerCase = false) { m_selector->setValue(value, matchLowerCase); } @@ -52,8 +54,8 @@ void updatePseudoType(const AtomicString& value, bool hasArguments = false) const { m_selector->updatePseudoType(value, hasArguments); } - void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector>>& selectorVector); - void setSelectorList(PassOwnPtr<CSSSelectorList>); + void adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector); + void setSelectorList(std::unique_ptr<CSSSelectorList>); bool isHostPseudoSelector() const; @@ -66,15 +68,15 @@ bool isSimple() const; CSSParserSelector* tagHistory() const { return m_tagHistory.get(); } - void setTagHistory(PassOwnPtr<CSSParserSelector> selector) { m_tagHistory = std::move(selector); } + void setTagHistory(std::unique_ptr<CSSParserSelector> selector) { m_tagHistory = std::move(selector); } void clearTagHistory() { m_tagHistory.reset(); } - void appendTagHistory(CSSSelector::RelationType, PassOwnPtr<CSSParserSelector>); - PassOwnPtr<CSSParserSelector> releaseTagHistory(); + void appendTagHistory(CSSSelector::RelationType, std::unique_ptr<CSSParserSelector>); + std::unique_ptr<CSSParserSelector> releaseTagHistory(); void prependTagSelector(const QualifiedName&, bool tagIsImplicit = false); private: - OwnPtr<CSSSelector> m_selector; - OwnPtr<CSSParserSelector> m_tagHistory; + std::unique_ptr<CSSSelector> m_selector; + std::unique_ptr<CSSParserSelector> m_tagHistory; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp index cdfe75ff..94b727a 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -47,6 +47,7 @@ #include "core/layout/LayoutTheme.h" #include "core/svg/SVGPathUtilities.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -1514,7 +1515,7 @@ return nullptr; String pathString = functionArgs.consumeIncludingWhitespace().value().toString(); - OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); + std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); if (buildByteStreamFromString(pathString, *byteStream) != SVGParseStatus::NoError || !functionArgs.atEnd()) return nullptr;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp index 8fac603..806f0fc 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp
@@ -8,6 +8,8 @@ #include "core/css/StyleSheetContents.h" #include "core/frame/UseCounter.h" #include "platform/RuntimeEnabledFeatures.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -104,8 +106,8 @@ CSSSelectorList CSSSelectorParser::consumeComplexSelectorList(CSSParserTokenRange& range) { - Vector<OwnPtr<CSSParserSelector>> selectorList; - OwnPtr<CSSParserSelector> selector = consumeComplexSelector(range); + Vector<std::unique_ptr<CSSParserSelector>> selectorList; + std::unique_ptr<CSSParserSelector> selector = consumeComplexSelector(range); if (!selector) return CSSSelectorList(); selectorList.append(std::move(selector)); @@ -125,8 +127,8 @@ CSSSelectorList CSSSelectorParser::consumeCompoundSelectorList(CSSParserTokenRange& range) { - Vector<OwnPtr<CSSParserSelector>> selectorList; - OwnPtr<CSSParserSelector> selector = consumeCompoundSelector(range); + Vector<std::unique_ptr<CSSParserSelector>> selectorList; + std::unique_ptr<CSSParserSelector> selector = consumeCompoundSelector(range); range.consumeWhitespace(); if (!selector) return CSSSelectorList(); @@ -171,9 +173,9 @@ } // namespace -PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeComplexSelector(CSSParserTokenRange& range) +std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeComplexSelector(CSSParserTokenRange& range) { - OwnPtr<CSSParserSelector> selector = consumeCompoundSelector(range); + std::unique_ptr<CSSParserSelector> selector = consumeCompoundSelector(range); if (!selector) return nullptr; @@ -184,7 +186,7 @@ previousCompoundFlags |= extractCompoundFlags(*simple, m_context.mode()); while (CSSSelector::RelationType combinator = consumeCombinator(range)) { - OwnPtr<CSSParserSelector> nextSelector = consumeCompoundSelector(range); + std::unique_ptr<CSSParserSelector> nextSelector = consumeCompoundSelector(range); if (!nextSelector) return combinator == CSSSelector::Descendant ? std::move(selector) : nullptr; if (previousCompoundFlags & HasPseudoElementForRightmostCompound) @@ -286,9 +288,9 @@ } // namespace -PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeCompoundSelector(CSSParserTokenRange& range) +std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeCompoundSelector(CSSParserTokenRange& range) { - OwnPtr<CSSParserSelector> compoundSelector; + std::unique_ptr<CSSParserSelector> compoundSelector; AtomicString namespacePrefix; AtomicString elementName; @@ -303,7 +305,7 @@ if (m_context.isHTMLDocument()) elementName = elementName.lower(); - while (OwnPtr<CSSParserSelector> simpleSelector = consumeSimpleSelector(range)) { + while (std::unique_ptr<CSSParserSelector> simpleSelector = consumeSimpleSelector(range)) { // TODO(rune@opera.com): crbug.com/578131 // The UASheetMode check is a work-around to allow this selector in mediaControls(New).css: // video::-webkit-media-text-track-region-container.scrolling @@ -334,10 +336,10 @@ return splitCompoundAtImplicitShadowCrossingCombinator(std::move(compoundSelector)); } -PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeSimpleSelector(CSSParserTokenRange& range) +std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeSimpleSelector(CSSParserTokenRange& range) { const CSSParserToken& token = range.peek(); - OwnPtr<CSSParserSelector> selector; + std::unique_ptr<CSSParserSelector> selector; if (token.type() == HashToken) selector = consumeId(range); else if (token.type() == DelimiterToken && token.delimiter() == '.') @@ -391,33 +393,33 @@ return true; } -PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeId(CSSParserTokenRange& range) +std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeId(CSSParserTokenRange& range) { ASSERT(range.peek().type() == HashToken); if (range.peek().getHashTokenType() != HashTokenId) return nullptr; - OwnPtr<CSSParserSelector> selector = CSSParserSelector::create(); + std::unique_ptr<CSSParserSelector> selector = CSSParserSelector::create(); selector->setMatch(CSSSelector::Id); AtomicString value = range.consume().value().toAtomicString(); selector->setValue(value, isQuirksModeBehavior(m_context.matchMode())); return selector; } -PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeClass(CSSParserTokenRange& range) +std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeClass(CSSParserTokenRange& range) { ASSERT(range.peek().type() == DelimiterToken); ASSERT(range.peek().delimiter() == '.'); range.consume(); if (range.peek().type() != IdentToken) return nullptr; - OwnPtr<CSSParserSelector> selector = CSSParserSelector::create(); + std::unique_ptr<CSSParserSelector> selector = CSSParserSelector::create(); selector->setMatch(CSSSelector::Class); AtomicString value = range.consume().value().toAtomicString(); selector->setValue(value, isQuirksModeBehavior(m_context.matchMode())); return selector; } -PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeAttribute(CSSParserTokenRange& range) +std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeAttribute(CSSParserTokenRange& range) { ASSERT(range.peek().type() == LeftBracketToken); CSSParserTokenRange block = range.consumeBlock(); @@ -440,7 +442,7 @@ ? QualifiedName(nullAtom, attributeName, nullAtom) : QualifiedName(namespacePrefix, attributeName, namespaceURI); - OwnPtr<CSSParserSelector> selector = CSSParserSelector::create(); + std::unique_ptr<CSSParserSelector> selector = CSSParserSelector::create(); if (block.atEnd()) { selector->setAttribute(qualifiedName, CSSSelector::CaseSensitive); @@ -461,7 +463,7 @@ return selector; } -PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumePseudo(CSSParserTokenRange& range) +std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumePseudo(CSSParserTokenRange& range) { ASSERT(range.peek().type() == ColonToken); range.consume(); @@ -476,7 +478,7 @@ if (token.type() != IdentToken && token.type() != FunctionToken) return nullptr; - OwnPtr<CSSParserSelector> selector = CSSParserSelector::create(); + std::unique_ptr<CSSParserSelector> selector = CSSParserSelector::create(); selector->setMatch(colons == 1 ? CSSSelector::PseudoClass : CSSSelector::PseudoElement); String value = token.value().toString(); @@ -506,7 +508,7 @@ { DisallowPseudoElementsScope scope(this); - OwnPtr<CSSSelectorList> selectorList = adoptPtr(new CSSSelectorList()); + std::unique_ptr<CSSSelectorList> selectorList = wrapUnique(new CSSSelectorList()); *selectorList = consumeCompoundSelectorList(block); if (!selectorList->isValid() || !block.atEnd()) return nullptr; @@ -515,11 +517,11 @@ } case CSSSelector::PseudoNot: { - OwnPtr<CSSParserSelector> innerSelector = consumeCompoundSelector(block); + std::unique_ptr<CSSParserSelector> innerSelector = consumeCompoundSelector(block); block.consumeWhitespace(); if (!innerSelector || !innerSelector->isSimple() || !block.atEnd()) return nullptr; - Vector<OwnPtr<CSSParserSelector>> selectorVector; + Vector<std::unique_ptr<CSSParserSelector>> selectorVector; selectorVector.append(std::move(innerSelector)); selector->adoptSelectorVector(selectorVector); return selector; @@ -528,11 +530,11 @@ { DisallowPseudoElementsScope scope(this); - OwnPtr<CSSParserSelector> innerSelector = consumeCompoundSelector(block); + std::unique_ptr<CSSParserSelector> innerSelector = consumeCompoundSelector(block); block.consumeWhitespace(); if (!innerSelector || !block.atEnd() || !RuntimeEnabledFeatures::shadowDOMV1Enabled()) return nullptr; - Vector<OwnPtr<CSSParserSelector>> selectorVector; + Vector<std::unique_ptr<CSSParserSelector>> selectorVector; selectorVector.append(std::move(innerSelector)); selector->adoptSelectorVector(selectorVector); return selector; @@ -763,13 +765,13 @@ compoundSelector->prependTagSelector(tag, determinedPrefix == nullAtom && determinedElementName == starAtom && !explicitForHost); } -PassOwnPtr<CSSParserSelector> CSSSelectorParser::addSimpleSelectorToCompound(PassOwnPtr<CSSParserSelector> compoundSelector, PassOwnPtr<CSSParserSelector> simpleSelector) +std::unique_ptr<CSSParserSelector> CSSSelectorParser::addSimpleSelectorToCompound(std::unique_ptr<CSSParserSelector> compoundSelector, std::unique_ptr<CSSParserSelector> simpleSelector) { compoundSelector->appendTagHistory(CSSSelector::SubSelector, std::move(simpleSelector)); return compoundSelector; } -PassOwnPtr<CSSParserSelector> CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator(PassOwnPtr<CSSParserSelector> compoundSelector) +std::unique_ptr<CSSParserSelector> CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator(std::unique_ptr<CSSParserSelector> compoundSelector) { // The tagHistory is a linked list that stores combinator separated compound selectors // from right-to-left. Yet, within a single compound selector, stores the simple selectors @@ -796,7 +798,7 @@ if (!splitAfter || !splitAfter->tagHistory()) return compoundSelector; - OwnPtr<CSSParserSelector> secondCompound = splitAfter->releaseTagHistory(); + std::unique_ptr<CSSParserSelector> secondCompound = splitAfter->releaseTagHistory(); secondCompound->appendTagHistory(secondCompound->pseudoType() == CSSSelector::PseudoSlotted ? CSSSelector::ShadowSlot : CSSSelector::ShadowPseudo, std::move(compoundSelector)); return secondCompound; }
diff --git a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.h b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.h index 8d3c0a1..496d3fe 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.h +++ b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.h
@@ -8,6 +8,7 @@ #include "core/CoreExport.h" #include "core/css/parser/CSSParserSelector.h" #include "core/css/parser/CSSParserTokenRange.h" +#include <memory> namespace blink { @@ -31,18 +32,18 @@ CSSSelectorList consumeComplexSelectorList(CSSParserTokenRange&); CSSSelectorList consumeCompoundSelectorList(CSSParserTokenRange&); - PassOwnPtr<CSSParserSelector> consumeComplexSelector(CSSParserTokenRange&); - PassOwnPtr<CSSParserSelector> consumeCompoundSelector(CSSParserTokenRange&); + std::unique_ptr<CSSParserSelector> consumeComplexSelector(CSSParserTokenRange&); + std::unique_ptr<CSSParserSelector> consumeCompoundSelector(CSSParserTokenRange&); // This doesn't include element names, since they're handled specially - PassOwnPtr<CSSParserSelector> consumeSimpleSelector(CSSParserTokenRange&); + std::unique_ptr<CSSParserSelector> consumeSimpleSelector(CSSParserTokenRange&); bool consumeName(CSSParserTokenRange&, AtomicString& name, AtomicString& namespacePrefix); // These will return nullptr when the selector is invalid - PassOwnPtr<CSSParserSelector> consumeId(CSSParserTokenRange&); - PassOwnPtr<CSSParserSelector> consumeClass(CSSParserTokenRange&); - PassOwnPtr<CSSParserSelector> consumePseudo(CSSParserTokenRange&); - PassOwnPtr<CSSParserSelector> consumeAttribute(CSSParserTokenRange&); + std::unique_ptr<CSSParserSelector> consumeId(CSSParserTokenRange&); + std::unique_ptr<CSSParserSelector> consumeClass(CSSParserTokenRange&); + std::unique_ptr<CSSParserSelector> consumePseudo(CSSParserTokenRange&); + std::unique_ptr<CSSParserSelector> consumeAttribute(CSSParserTokenRange&); CSSSelector::RelationType consumeCombinator(CSSParserTokenRange&); CSSSelector::MatchType consumeAttributeMatch(CSSParserTokenRange&); @@ -51,8 +52,8 @@ const AtomicString& defaultNamespace() const; const AtomicString& determineNamespace(const AtomicString& prefix); void prependTypeSelectorIfNeeded(const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector*); - static PassOwnPtr<CSSParserSelector> addSimpleSelectorToCompound(PassOwnPtr<CSSParserSelector> compoundSelector, PassOwnPtr<CSSParserSelector> simpleSelector); - static PassOwnPtr<CSSParserSelector> splitCompoundAtImplicitShadowCrossingCombinator(PassOwnPtr<CSSParserSelector> compoundSelector); + static std::unique_ptr<CSSParserSelector> addSimpleSelectorToCompound(std::unique_ptr<CSSParserSelector> compoundSelector, std::unique_ptr<CSSParserSelector> simpleSelector); + static std::unique_ptr<CSSParserSelector> splitCompoundAtImplicitShadowCrossingCombinator(std::unique_ptr<CSSParserSelector> compoundSelector); const CSSParserContext& m_context; Member<StyleSheetContents> m_styleSheet; // FIXME: Should be const
diff --git a/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp b/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp index abb997d..f888c48d 100644 --- a/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp +++ b/third_party/WebKit/Source/core/css/parser/MediaConditionTest.cpp
@@ -7,7 +7,6 @@ #include "core/css/parser/CSSTokenizer.h" #include "core/css/parser/MediaQueryParser.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp b/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp index 3206d150..6a7591a2 100644 --- a/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp +++ b/third_party/WebKit/Source/core/css/resolver/FontBuilderTest.cpp
@@ -11,6 +11,7 @@ #include "core/style/ComputedStyle.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -26,7 +27,7 @@ Settings& settings() { return *document().settings(); } private: - OwnPtr<DummyPageHolder> m_dummy; + std::unique_ptr<DummyPageHolder> m_dummy; }; using BuilderFunc = void (*)(FontBuilder&);
diff --git a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h index adf8f418..58f4e0b 100644 --- a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h +++ b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h
@@ -32,8 +32,6 @@ #include "core/dom/TreeScope.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp index e049800..b33285e 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -66,18 +66,20 @@ #include "core/css/resolver/TransformBuilder.h" #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" -#include "core/style/ContentData.h" -#include "core/style/CounterContent.h" #include "core/style/ComputedStyle.h" #include "core/style/ComputedStyleConstants.h" +#include "core/style/ContentData.h" +#include "core/style/CounterContent.h" #include "core/style/QuotesData.h" #include "core/style/SVGComputedStyle.h" #include "core/style/StyleGeneratedImage.h" #include "core/style/StyleVariableData.h" #include "platform/fonts/FontDescription.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -707,7 +709,7 @@ CSSValueID listStyleIdent = counterValue->listStyle(); if (listStyleIdent != CSSValueNone) listStyleType = static_cast<EListStyleType>(listStyleIdent - CSSValueDisc); - OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(AtomicString(counterValue->identifier()), listStyleType, AtomicString(counterValue->separator()))); + std::unique_ptr<CounterContent> counter = wrapUnique(new CounterContent(AtomicString(counterValue->identifier()), listStyleType, AtomicString(counterValue->separator()))); nextContent = ContentData::create(std::move(counter)); } else if (item->isPrimitiveValue()) { QuoteType quoteType;
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h b/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h index 547e58a..f8171170 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolverState.h
@@ -36,6 +36,7 @@ #include "core/style/CachedUAStyle.h" #include "core/style/ComputedStyle.h" #include "core/style/StyleInheritedData.h" +#include <memory> namespace blink { @@ -180,7 +181,7 @@ FontBuilder m_fontBuilder; - OwnPtr<CachedUAStyle> m_cachedUAStyle; + std::unique_ptr<CachedUAStyle> m_cachedUAStyle; ElementStyleResources m_elementStyleResources;
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.cpp index 1e1902b..f9c2973 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.cpp
@@ -30,6 +30,8 @@ #include "core/css/resolver/StyleResolverStats.h" +#include <memory> + namespace blink { void StyleResolverStats::reset() @@ -63,9 +65,9 @@ return allCountersEnabled; } -PassOwnPtr<TracedValue> StyleResolverStats::toTracedValue() const +std::unique_ptr<TracedValue> StyleResolverStats::toTracedValue() const { - OwnPtr<TracedValue> tracedValue = TracedValue::create(); + std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); tracedValue->setInteger("sharedStyleLookups", sharedStyleLookups); tracedValue->setInteger("sharedStyleCandidates", sharedStyleCandidates); tracedValue->setInteger("sharedStyleFound", sharedStyleFound);
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.h b/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.h index 8e0f820..59c630bf 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.h +++ b/third_party/WebKit/Source/core/css/resolver/StyleResolverStats.h
@@ -33,21 +33,22 @@ #include "platform/TraceEvent.h" #include "platform/TracedValue.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { class StyleResolverStats { USING_FAST_MALLOC(StyleResolverStats); public: - static PassOwnPtr<StyleResolverStats> create() + static std::unique_ptr<StyleResolverStats> create() { - return adoptPtr(new StyleResolverStats); + return wrapUnique(new StyleResolverStats); } void reset(); bool allCountersEnabled() const; - PassOwnPtr<TracedValue> toTracedValue() const; + std::unique_ptr<TracedValue> toTracedValue() const; unsigned sharedStyleLookups; unsigned sharedStyleCandidates;
diff --git a/third_party/WebKit/Source/core/dom/AXObjectCache.cpp b/third_party/WebKit/Source/core/dom/AXObjectCache.cpp index 373e1b73..0051d5e 100644 --- a/third_party/WebKit/Source/core/dom/AXObjectCache.cpp +++ b/third_party/WebKit/Source/core/dom/AXObjectCache.cpp
@@ -28,6 +28,9 @@ #include "core/dom/AXObjectCache.h" +#include "wtf/PtrUtil.h" +#include <memory> + namespace blink { AXObjectCache::AXObjectCacheCreateFunction AXObjectCache::m_createFunction = nullptr; @@ -52,9 +55,9 @@ { } -PassOwnPtr<ScopedAXObjectCache> ScopedAXObjectCache::create(Document& document) +std::unique_ptr<ScopedAXObjectCache> ScopedAXObjectCache::create(Document& document) { - return adoptPtr(new ScopedAXObjectCache(document)); + return wrapUnique(new ScopedAXObjectCache(document)); } ScopedAXObjectCache::ScopedAXObjectCache(Document& document)
diff --git a/third_party/WebKit/Source/core/dom/AXObjectCache.h b/third_party/WebKit/Source/core/dom/AXObjectCache.h index be51633..21c25416 100644 --- a/third_party/WebKit/Source/core/dom/AXObjectCache.h +++ b/third_party/WebKit/Source/core/dom/AXObjectCache.h
@@ -28,6 +28,7 @@ #include "core/CoreExport.h" #include "core/dom/Document.h" +#include <memory> typedef unsigned AXID; @@ -154,7 +155,7 @@ USING_FAST_MALLOC(ScopedAXObjectCache); WTF_MAKE_NONCOPYABLE(ScopedAXObjectCache); public: - static PassOwnPtr<ScopedAXObjectCache> create(Document&); + static std::unique_ptr<ScopedAXObjectCache> create(Document&); ~ScopedAXObjectCache(); AXObjectCache* get();
diff --git a/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp b/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp index 3faad02..196d623 100644 --- a/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp +++ b/third_party/WebKit/Source/core/dom/ActiveDOMObjectTest.cpp
@@ -34,6 +34,7 @@ #include "core/testing/DummyPageHolder.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -61,8 +62,8 @@ MockActiveDOMObject& activeDOMObject() { return *m_activeDOMObject; } private: - OwnPtr<DummyPageHolder> m_srcPageHolder; - OwnPtr<DummyPageHolder> m_destPageHolder; + std::unique_ptr<DummyPageHolder> m_srcPageHolder; + std::unique_ptr<DummyPageHolder> m_destPageHolder; Persistent<MockActiveDOMObject> m_activeDOMObject; };
diff --git a/third_party/WebKit/Source/core/dom/AddConsoleMessageTask.h b/third_party/WebKit/Source/core/dom/AddConsoleMessageTask.h index f4a258d..f3cf08b 100644 --- a/third_party/WebKit/Source/core/dom/AddConsoleMessageTask.h +++ b/third_party/WebKit/Source/core/dom/AddConsoleMessageTask.h
@@ -29,8 +29,6 @@ #include "core/dom/ExecutionContextTask.h" #include "platform/v8_inspector/public/ConsoleTypes.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/dom/CSSSelectorWatchTest.cpp b/third_party/WebKit/Source/core/dom/CSSSelectorWatchTest.cpp index fe7fcd4..d4e47193 100644 --- a/third_party/WebKit/Source/core/dom/CSSSelectorWatchTest.cpp +++ b/third_party/WebKit/Source/core/dom/CSSSelectorWatchTest.cpp
@@ -10,6 +10,7 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -25,7 +26,7 @@ static void clearAddedRemoved(CSSSelectorWatch&); private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; void CSSSelectorWatchTest::SetUp()
diff --git a/third_party/WebKit/Source/core/dom/ChildListMutationScope.h b/third_party/WebKit/Source/core/dom/ChildListMutationScope.h index 6aab53f9..6865b41 100644 --- a/third_party/WebKit/Source/core/dom/ChildListMutationScope.h +++ b/third_party/WebKit/Source/core/dom/ChildListMutationScope.h
@@ -36,7 +36,6 @@ #include "core/dom/Node.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.cpp b/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.cpp index 3a0a614..cd02b73 100644 --- a/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.cpp +++ b/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.cpp
@@ -4,13 +4,14 @@ #include "core/dom/CompositorProxiedPropertySet.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<CompositorProxiedPropertySet> CompositorProxiedPropertySet::create() +std::unique_ptr<CompositorProxiedPropertySet> CompositorProxiedPropertySet::create() { - return adoptPtr(new CompositorProxiedPropertySet); + return wrapUnique(new CompositorProxiedPropertySet); } CompositorProxiedPropertySet::CompositorProxiedPropertySet()
diff --git a/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.h b/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.h index 874b6ea..73fd68e 100644 --- a/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.h +++ b/third_party/WebKit/Source/core/dom/CompositorProxiedPropertySet.h
@@ -9,6 +9,7 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -17,7 +18,7 @@ WTF_MAKE_NONCOPYABLE(CompositorProxiedPropertySet); USING_FAST_MALLOC(CompositorProxiedPropertySet); public: - static PassOwnPtr<CompositorProxiedPropertySet> create(); + static std::unique_ptr<CompositorProxiedPropertySet> create(); virtual ~CompositorProxiedPropertySet(); bool isEmpty() const;
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.h b/third_party/WebKit/Source/core/dom/ContainerNode.h index b85b102a..fa76665 100644 --- a/third_party/WebKit/Source/core/dom/ContainerNode.h +++ b/third_party/WebKit/Source/core/dom/ContainerNode.h
@@ -28,7 +28,6 @@ #include "core/CoreExport.h" #include "core/dom/Node.h" #include "core/html/CollectionType.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/ContextFeatures.cpp b/third_party/WebKit/Source/core/dom/ContextFeatures.cpp index ee2f3e42..05d936e 100644 --- a/third_party/WebKit/Source/core/dom/ContextFeatures.cpp +++ b/third_party/WebKit/Source/core/dom/ContextFeatures.cpp
@@ -29,13 +29,15 @@ #include "core/dom/Document.h" #include "core/page/Page.h" #include "platform/RuntimeEnabledFeatures.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { -PassOwnPtr<ContextFeaturesClient> ContextFeaturesClient::empty() +std::unique_ptr<ContextFeaturesClient> ContextFeaturesClient::empty() { - return adoptPtr(new ContextFeaturesClient()); + return wrapUnique(new ContextFeaturesClient()); } const char* ContextFeatures::supplementName() @@ -64,7 +66,7 @@ return document->contextFeatures().isEnabled(document, MutationEvents, true); } -void provideContextFeaturesTo(Page& page, PassOwnPtr<ContextFeaturesClient> client) +void provideContextFeaturesTo(Page& page, std::unique_ptr<ContextFeaturesClient> client) { Supplement<Page>::provideTo(page, ContextFeatures::supplementName(), ContextFeatures::create(std::move(client))); }
diff --git a/third_party/WebKit/Source/core/dom/ContextFeatures.h b/third_party/WebKit/Source/core/dom/ContextFeatures.h index 78766a60..16ea195 100644 --- a/third_party/WebKit/Source/core/dom/ContextFeatures.h +++ b/third_party/WebKit/Source/core/dom/ContextFeatures.h
@@ -30,6 +30,7 @@ #include "core/CoreExport.h" #include "core/page/Page.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -48,7 +49,7 @@ static const char* supplementName(); static ContextFeatures& defaultSwitch(); - static ContextFeatures* create(PassOwnPtr<ContextFeaturesClient>); + static ContextFeatures* create(std::unique_ptr<ContextFeaturesClient>); static bool pagePopupEnabled(Document*); static bool mutationEventsEnabled(Document*); @@ -57,27 +58,27 @@ void urlDidChange(Document*); private: - explicit ContextFeatures(PassOwnPtr<ContextFeaturesClient> client) + explicit ContextFeatures(std::unique_ptr<ContextFeaturesClient> client) : m_client(std::move(client)) { } - OwnPtr<ContextFeaturesClient> m_client; + std::unique_ptr<ContextFeaturesClient> m_client; }; class ContextFeaturesClient { USING_FAST_MALLOC(ContextFeaturesClient); public: - static PassOwnPtr<ContextFeaturesClient> empty(); + static std::unique_ptr<ContextFeaturesClient> empty(); virtual ~ContextFeaturesClient() { } virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool defaultValue) { return defaultValue; } virtual void urlDidChange(Document*) { } }; -CORE_EXPORT void provideContextFeaturesTo(Page&, PassOwnPtr<ContextFeaturesClient>); +CORE_EXPORT void provideContextFeaturesTo(Page&, std::unique_ptr<ContextFeaturesClient>); void provideContextFeaturesToDocumentFrom(Document&, Page&); -inline ContextFeatures* ContextFeatures::create(PassOwnPtr<ContextFeaturesClient> client) +inline ContextFeatures* ContextFeatures::create(std::unique_ptr<ContextFeaturesClient> client) { return new ContextFeatures(std::move(client)); }
diff --git a/third_party/WebKit/Source/core/dom/CrossThreadTask.h b/third_party/WebKit/Source/core/dom/CrossThreadTask.h index 5c9a094..fb744cf 100644 --- a/third_party/WebKit/Source/core/dom/CrossThreadTask.h +++ b/third_party/WebKit/Source/core/dom/CrossThreadTask.h
@@ -34,7 +34,6 @@ #include "core/dom/ExecutionContext.h" #include "core/dom/ExecutionContextTask.h" #include "platform/ThreadSafeFunctional.h" -#include "wtf/PassOwnPtr.h" #include <type_traits> namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h index 3a57ab5..890990b 100644 --- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h +++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h
@@ -9,6 +9,7 @@ #include "core/dom/DOMTypedArray.h" #include "platform/heap/Handle.h" #include "platform/transforms/TransformationMatrix.h" +#include <memory> namespace blink { @@ -62,10 +63,10 @@ protected: // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc - // supports 16-byte alignment but Oilpan doesn't. So we use an OwnPtr + // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr // to allocate TransformationMatrix on PartitionAlloc. // TODO(oilpan): Oilpan should support 16-byte aligned allocations. - OwnPtr<TransformationMatrix> m_matrix; + std::unique_ptr<TransformationMatrix> m_matrix; bool m_is2D; };
diff --git a/third_party/WebKit/Source/core/dom/DatasetDOMStringMap.h b/third_party/WebKit/Source/core/dom/DatasetDOMStringMap.h index 8ad8552..b244846 100644 --- a/third_party/WebKit/Source/core/dom/DatasetDOMStringMap.h +++ b/third_party/WebKit/Source/core/dom/DatasetDOMStringMap.h
@@ -27,7 +27,6 @@ #define DatasetDOMStringMap_h #include "core/dom/DOMStringMap.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp b/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp index b0f5d56c..616dcdd 100644 --- a/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp +++ b/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp
@@ -28,6 +28,7 @@ #include "core/dom/Document.h" #include "core/dom/DocumentEncodingData.h" #include "core/html/parser/TextResourceDecoder.h" +#include <memory> namespace blink { @@ -41,7 +42,7 @@ { } -void DecodedDataDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) +void DecodedDataDocumentParser::setDecoder(std::unique_ptr<TextResourceDecoder> decoder) { // If the decoder is explicitly unset rather than having ownership // transferred away by takeDecoder(), we need to make sure it's recreated @@ -55,7 +56,7 @@ return m_decoder.get(); } -PassOwnPtr<TextResourceDecoder> DecodedDataDocumentParser::takeDecoder() +std::unique_ptr<TextResourceDecoder> DecodedDataDocumentParser::takeDecoder() { return std::move(m_decoder); }
diff --git a/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.h b/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.h index a2dbce68..4d80cf9 100644 --- a/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.h +++ b/third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.h
@@ -27,7 +27,7 @@ #define DecodedDataDocumentParser_h #include "core/dom/DocumentParser.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { class TextResourceDecoder; @@ -42,10 +42,10 @@ void appendBytes(const char* bytes, size_t length) override; virtual void flush(); bool needsDecoder() const final { return m_needsDecoder; } - void setDecoder(PassOwnPtr<TextResourceDecoder>) override; + void setDecoder(std::unique_ptr<TextResourceDecoder>) override; TextResourceDecoder* decoder() final; - PassOwnPtr<TextResourceDecoder> takeDecoder(); + std::unique_ptr<TextResourceDecoder> takeDecoder(); protected: explicit DecodedDataDocumentParser(Document&); @@ -55,7 +55,7 @@ void updateDocument(String& decodedData); bool m_needsDecoder; - OwnPtr<TextResourceDecoder> m_decoder; + std::unique_ptr<TextResourceDecoder> m_decoder; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index fffbbe5..0e123a4 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -238,6 +238,7 @@ #include "wtf/TemporaryChange.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/TextEncodingRegistry.h" +#include <memory> using namespace WTF; using namespace Unicode; @@ -520,7 +521,7 @@ SelectorQueryCache& Document::selectorQueryCache() { if (!m_selectorQueryCache) - m_selectorQueryCache = adoptPtr(new SelectorQueryCache()); + m_selectorQueryCache = wrapUnique(new SelectorQueryCache()); return *m_selectorQueryCache; } @@ -2887,7 +2888,7 @@ return domWindow(); } -void Document::logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation> location) +void Document::logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation> location) { ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location)); addConsoleMessage(consoleMessage); @@ -3940,12 +3941,12 @@ const OriginAccessEntry& Document::accessEntryFromURL() { if (!m_accessEntryFromURL) { - m_accessEntryFromURL = adoptPtr(new OriginAccessEntry(url().protocol(), url().host(), OriginAccessEntry::AllowRegisterableDomains)); + m_accessEntryFromURL = wrapUnique(new OriginAccessEntry(url().protocol(), url().host(), OriginAccessEntry::AllowRegisterableDomains)); } return *m_accessEntryFromURL; } -void Document::registerEventFactory(PassOwnPtr<EventFactoryBase> eventFactory) +void Document::registerEventFactory(std::unique_ptr<EventFactoryBase> eventFactory) { DCHECK(!eventFactories().contains(eventFactory.get())); eventFactories().add(std::move(eventFactory)); @@ -4377,7 +4378,7 @@ && m_titleElement->textContent().containsOnlyLatin1()) { CString originalBytes = m_titleElement->textContent().latin1(); - OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); + std::unique_ptr<TextCodec> codec = newTextCodec(newData.encoding()); String correctlyDecodedTitle = codec->decode(originalBytes.data(), originalBytes.length(), DataEOF); m_titleElement->setTextContent(correctlyDecodedTitle); } @@ -4593,7 +4594,7 @@ m_currentScriptStack.removeLast(); } -void Document::setTransformSource(PassOwnPtr<TransformSource> source) +void Document::setTransformSource(std::unique_ptr<TransformSource> source) { m_transformSource = std::move(source); }
diff --git a/third_party/WebKit/Source/core/dom/Document.h b/third_party/WebKit/Source/core/dom/Document.h index 19878dc0..15ac304 100644 --- a/third_party/WebKit/Source/core/dom/Document.h +++ b/third_party/WebKit/Source/core/dom/Document.h
@@ -55,9 +55,8 @@ #include "public/platform/WebFocusType.h" #include "public/platform/WebInsecureRequestPolicy.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include <memory> namespace blink { @@ -672,7 +671,7 @@ void setWindowAttributeEventListener(const AtomicString& eventType, EventListener*); EventListener* getWindowAttributeEventListener(const AtomicString& eventType); - static void registerEventFactory(PassOwnPtr<EventFactoryBase>); + static void registerEventFactory(std::unique_ptr<EventFactoryBase>); static Event* createEvent(ExecutionContext*, const String& eventType, ExceptionState&); // keep track of what types of event listeners are registered, so we don't @@ -813,7 +812,7 @@ void pushCurrentScript(Element*); void popCurrentScript(); - void setTransformSource(PassOwnPtr<TransformSource>); + void setTransformSource(std::unique_ptr<TransformSource>); TransformSource* transformSource() const { return m_transformSource.get(); } void incDOMTreeVersion() { DCHECK(m_lifecycle.stateAllowsTreeMutations()); m_domTreeVersion = ++s_globalTreeVersion; } @@ -950,7 +949,7 @@ void cancelIdleCallback(int id); EventTarget* errorEventTarget() final; - void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) final; + void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) final; void initDNSPrefetch(); @@ -1178,7 +1177,7 @@ void setHoverNode(Node*); - using EventFactorySet = HashSet<OwnPtr<EventFactoryBase>>; + using EventFactorySet = HashSet<std::unique_ptr<EventFactoryBase>>; static EventFactorySet& eventFactories(); void setNthIndexCache(NthIndexCache* nthIndexCache) { DCHECK(!m_nthIndexCache || !nthIndexCache); m_nthIndexCache = nthIndexCache; } @@ -1211,7 +1210,7 @@ KURL m_baseURLOverride; // An alternative base URL that takes precedence over m_baseURL (but not m_baseElementURL). KURL m_baseElementURL; // The URL set by the <base> element. KURL m_cookieURL; // The URL to use for cookie access. - OwnPtr<OriginAccessEntry> m_accessEntryFromURL; + std::unique_ptr<OriginAccessEntry> m_accessEntryFromURL; AtomicString m_baseTarget; @@ -1230,7 +1229,7 @@ CompatibilityMode m_compatibilityMode; bool m_compatibilityModeLocked; // This is cheaper than making setCompatibilityMode virtual. - OwnPtr<CancellableTaskFactory> m_executeScriptsWaitingForResourcesTask; + std::unique_ptr<CancellableTaskFactory> m_executeScriptsWaitingForResourcesTask; bool m_hasAutofocused; Timer<Document> m_clearFocusedElementTimer; @@ -1297,7 +1296,7 @@ HeapVector<Member<Element>> m_currentScriptStack; - OwnPtr<TransformSource> m_transformSource; + std::unique_ptr<TransformSource> m_transformSource; String m_xmlEncoding; String m_xmlVersion; @@ -1323,7 +1322,7 @@ bool m_hasAnnotatedRegions; bool m_annotatedRegionsDirty; - OwnPtr<SelectorQueryCache> m_selectorQueryCache; + std::unique_ptr<SelectorQueryCache> m_selectorQueryCache; // It is safe to keep a raw, untraced pointer to this stack-allocated // cache object: it is set upon the cache object being allocated on @@ -1367,7 +1366,7 @@ Member<ScriptedAnimationController> m_scriptedAnimationController; Member<ScriptedIdleTaskController> m_scriptedIdleTaskController; - OwnPtr<MainThreadTaskRunner> m_taskRunner; + std::unique_ptr<MainThreadTaskRunner> m_taskRunner; Member<TextAutosizer> m_textAutosizer; Member<V0CustomElementRegistrationContext> m_registrationContext; @@ -1378,7 +1377,7 @@ Member<ElementDataCache> m_elementDataCache; - using LocaleIdentifierToLocaleMap = HashMap<AtomicString, OwnPtr<Locale>>; + using LocaleIdentifierToLocaleMap = HashMap<AtomicString, std::unique_ptr<Locale>>; LocaleIdentifierToLocaleMap m_localeCache; Member<AnimationTimeline> m_timeline;
diff --git a/third_party/WebKit/Source/core/dom/DocumentParser.cpp b/third_party/WebKit/Source/core/dom/DocumentParser.cpp index 0faa590..64f22f2 100644 --- a/third_party/WebKit/Source/core/dom/DocumentParser.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentParser.cpp
@@ -29,6 +29,7 @@ #include "core/dom/DocumentParserClient.h" #include "core/html/parser/TextResourceDecoder.h" #include "wtf/Assertions.h" +#include <memory> namespace blink { @@ -50,7 +51,7 @@ visitor->trace(m_clients); } -void DocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder>) +void DocumentParser::setDecoder(std::unique_ptr<TextResourceDecoder>) { ASSERT_NOT_REACHED(); }
diff --git a/third_party/WebKit/Source/core/dom/DocumentParser.h b/third_party/WebKit/Source/core/dom/DocumentParser.h index 3362c21e..9d6dfee 100644 --- a/third_party/WebKit/Source/core/dom/DocumentParser.h +++ b/third_party/WebKit/Source/core/dom/DocumentParser.h
@@ -26,6 +26,7 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -51,7 +52,7 @@ // The below functions are used by DocumentWriter (the loader). virtual void appendBytes(const char* bytes, size_t length) = 0; virtual bool needsDecoder() const { return false; } - virtual void setDecoder(PassOwnPtr<TextResourceDecoder>); + virtual void setDecoder(std::unique_ptr<TextResourceDecoder>); virtual TextResourceDecoder* decoder(); virtual void setHasAppendedData() { }
diff --git a/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp index 2f4daa137..51a3622 100644 --- a/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp
@@ -13,6 +13,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -36,7 +37,7 @@ void setHtmlInnerHTML(const String&); private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; void DocumentStatisticsCollectorTest::SetUp()
diff --git a/third_party/WebKit/Source/core/dom/DocumentTest.cpp b/third_party/WebKit/Source/core/dom/DocumentTest.cpp index d1559700..f4cab42 100644 --- a/third_party/WebKit/Source/core/dom/DocumentTest.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentTest.cpp
@@ -40,6 +40,7 @@ #include "platform/weborigin/SecurityOrigin.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -58,7 +59,7 @@ void setHtmlInnerHTML(const char*); private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; void DocumentTest::SetUp()
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp index 6efc5c6..5a811b2 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -139,6 +139,7 @@ #include "wtf/text/CString.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/TextPosition.h" +#include <memory> namespace blink { @@ -1050,14 +1051,14 @@ const AtomicString& Element::computedRole() { document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); - OwnPtr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document()); + std::unique_ptr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document()); return cache->get()->computedRoleForNode(this); } String Element::computedName() { document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); - OwnPtr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document()); + std::unique_ptr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document()); return cache->get()->computedNameForNode(this); }
diff --git a/third_party/WebKit/Source/core/dom/ElementRareData.h b/third_party/WebKit/Source/core/dom/ElementRareData.h index f43a032..c3bb62e 100644 --- a/third_party/WebKit/Source/core/dom/ElementRareData.h +++ b/third_party/WebKit/Source/core/dom/ElementRareData.h
@@ -38,7 +38,7 @@ #include "core/style/StyleInheritedData.h" #include "platform/heap/Handle.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -158,7 +158,7 @@ Member<AttrNodeList> m_attrNodeList; Member<InlineCSSStyleDeclaration> m_cssomWrapper; Member<InlineStylePropertyMap> m_cssomMapWrapper; - OwnPtr<CompositorProxiedPropertySet> m_proxiedProperties; + std::unique_ptr<CompositorProxiedPropertySet> m_proxiedProperties; Member<ElementAnimations> m_elementAnimations; Member<NodeIntersectionObserverData> m_intersectionObserverData;
diff --git a/third_party/WebKit/Source/core/dom/ElementTest.cpp b/third_party/WebKit/Source/core/dom/ElementTest.cpp index be8af0d..3ac914f 100644 --- a/third_party/WebKit/Source/core/dom/ElementTest.cpp +++ b/third_party/WebKit/Source/core/dom/ElementTest.cpp
@@ -9,12 +9,13 @@ #include "core/html/HTMLHtmlElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { TEST(ElementTest, SupportsFocus) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(); Document& document = pageHolder->document(); DCHECK(isHTMLHtmlElement(document.documentElement())); document.setDesignMode("on");
diff --git a/third_party/WebKit/Source/core/dom/ExecutionContext.cpp b/third_party/WebKit/Source/core/dom/ExecutionContext.cpp index e061090..4a49825c 100644 --- a/third_party/WebKit/Source/core/dom/ExecutionContext.cpp +++ b/third_party/WebKit/Source/core/dom/ExecutionContext.cpp
@@ -37,20 +37,22 @@ #include "core/inspector/InspectorInstrumentation.h" #include "core/workers/WorkerGlobalScope.h" #include "core/workers/WorkerThread.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { class ExecutionContext::PendingException { WTF_MAKE_NONCOPYABLE(PendingException); public: - PendingException(const String& errorMessage, PassOwnPtr<SourceLocation> location) + PendingException(const String& errorMessage, std::unique_ptr<SourceLocation> location) : m_errorMessage(errorMessage) , m_location(std::move(location)) { } String m_errorMessage; - OwnPtr<SourceLocation> m_location; + std::unique_ptr<SourceLocation> m_location; }; ExecutionContext::ExecutionContext() @@ -88,7 +90,7 @@ notifyStoppingActiveDOMObjects(); } -void ExecutionContext::postSuspendableTask(PassOwnPtr<SuspendableTask> task) +void ExecutionContext::postSuspendableTask(std::unique_ptr<SuspendableTask> task) { m_suspendedTasks.append(std::move(task)); if (!m_activeDOMObjectsAreSuspended) @@ -97,9 +99,9 @@ void ExecutionContext::notifyContextDestroyed() { - Deque<OwnPtr<SuspendableTask>> suspendedTasks; + Deque<std::unique_ptr<SuspendableTask>> suspendedTasks; suspendedTasks.swap(m_suspendedTasks); - for (Deque<OwnPtr<SuspendableTask>>::iterator it = suspendedTasks.begin(); it != suspendedTasks.end(); ++it) + for (Deque<std::unique_ptr<SuspendableTask>>::iterator it = suspendedTasks.begin(); it != suspendedTasks.end(); ++it) (*it)->contextDestroyed(); ContextLifecycleNotifier::notifyContextDestroyed(); } @@ -142,8 +144,8 @@ { if (m_inDispatchErrorEvent) { if (!m_pendingExceptions) - m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException>>()); - m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->messageForConsole(), errorEvent->location()->clone()))); + m_pendingExceptions = wrapUnique(new Vector<std::unique_ptr<PendingException>>()); + m_pendingExceptions->append(wrapUnique(new PendingException(errorEvent->messageForConsole(), errorEvent->location()->clone()))); return; } @@ -181,7 +183,7 @@ { m_isRunSuspendableTasksScheduled = false; while (!m_activeDOMObjectsAreSuspended && m_suspendedTasks.size()) { - OwnPtr<SuspendableTask> task = m_suspendedTasks.takeFirst(); + std::unique_ptr<SuspendableTask> task = m_suspendedTasks.takeFirst(); task->run(); } }
diff --git a/third_party/WebKit/Source/core/dom/ExecutionContext.h b/third_party/WebKit/Source/core/dom/ExecutionContext.h index cd3c1fe..92d1d2ce 100644 --- a/third_party/WebKit/Source/core/dom/ExecutionContext.h +++ b/third_party/WebKit/Source/core/dom/ExecutionContext.h
@@ -40,8 +40,7 @@ #include "platform/weborigin/ReferrerPolicy.h" #include "wtf/Deque.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -108,7 +107,7 @@ void reportException(ErrorEvent*, AccessControlStatus); virtual void addConsoleMessage(ConsoleMessage*) = 0; - virtual void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) = 0; + virtual void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) = 0; PublicURLManager& publicURLManager(); @@ -117,7 +116,7 @@ void suspendActiveDOMObjects(); void resumeActiveDOMObjects(); void stopActiveDOMObjects(); - void postSuspendableTask(PassOwnPtr<SuspendableTask>); + void postSuspendableTask(std::unique_ptr<SuspendableTask>); void notifyContextDestroyed() override; virtual void suspendScheduledTasks(); @@ -168,7 +167,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; bool m_activeDOMObjectsAreStopped; @@ -181,7 +180,7 @@ // increment and decrement the counter. int m_windowInteractionTokens; - Deque<OwnPtr<SuspendableTask>> m_suspendedTasks; + Deque<std::unique_ptr<SuspendableTask>> m_suspendedTasks; bool m_isRunSuspendableTasksScheduled; ReferrerPolicy m_referrerPolicy;
diff --git a/third_party/WebKit/Source/core/dom/ExecutionContextTask.h b/third_party/WebKit/Source/core/dom/ExecutionContextTask.h index 4efe576..4fdbbc90 100644 --- a/third_party/WebKit/Source/core/dom/ExecutionContextTask.h +++ b/third_party/WebKit/Source/core/dom/ExecutionContextTask.h
@@ -104,7 +104,7 @@ std::unique_ptr<ExecutionContextTask> createSameThreadTask( FunctionType function, P&&... parameters) { - return internal::createCallClosureTask(bind(function, std::forward<P>(parameters)...)); + return internal::createCallClosureTask(WTF::bind(function, std::forward<P>(parameters)...)); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.cpp b/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.cpp index dfb887d1..f795010 100644 --- a/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.cpp +++ b/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.cpp
@@ -5,12 +5,14 @@ #include "core/dom/IncrementLoadEventDelayCount.h" #include "core/dom/Document.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<IncrementLoadEventDelayCount> IncrementLoadEventDelayCount::create(Document& document) +std::unique_ptr<IncrementLoadEventDelayCount> IncrementLoadEventDelayCount::create(Document& document) { - return adoptPtr(new IncrementLoadEventDelayCount(document)); + return wrapUnique(new IncrementLoadEventDelayCount(document)); } IncrementLoadEventDelayCount::IncrementLoadEventDelayCount(Document& document)
diff --git a/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.h b/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.h index 43e971d..dfafde11 100644 --- a/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.h +++ b/third_party/WebKit/Source/core/dom/IncrementLoadEventDelayCount.h
@@ -8,6 +8,7 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -20,7 +21,7 @@ WTF_MAKE_NONCOPYABLE(IncrementLoadEventDelayCount); public: - static PassOwnPtr<IncrementLoadEventDelayCount> create(Document&); + static std::unique_ptr<IncrementLoadEventDelayCount> create(Document&); ~IncrementLoadEventDelayCount(); // Increments the new document's count and decrements the old count.
diff --git a/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h b/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h index 0d1d6cd..8db704e 100644 --- a/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h +++ b/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h
@@ -32,8 +32,10 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/WeakPtr.h" +#include <memory> namespace blink { @@ -44,7 +46,7 @@ USING_FAST_MALLOC(MainThreadTaskRunner); WTF_MAKE_NONCOPYABLE(MainThreadTaskRunner); public: - static PassOwnPtr<MainThreadTaskRunner> create(ExecutionContext*); + static std::unique_ptr<MainThreadTaskRunner> create(ExecutionContext*); ~MainThreadTaskRunner(); @@ -73,9 +75,9 @@ WeakPtrFactory<MainThreadTaskRunner> m_weakFactory; }; -inline PassOwnPtr<MainThreadTaskRunner> MainThreadTaskRunner::create(ExecutionContext* context) +inline std::unique_ptr<MainThreadTaskRunner> MainThreadTaskRunner::create(ExecutionContext* context) { - return adoptPtr(new MainThreadTaskRunner(context)); + return wrapUnique(new MainThreadTaskRunner(context)); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp b/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp index 13f52143..1651ef4f 100644 --- a/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp +++ b/third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp
@@ -33,8 +33,7 @@ #include "platform/testing/UnitTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -46,7 +45,7 @@ TEST(MainThreadTaskRunnerTest, PostTask) { NullExecutionContext* context = new NullExecutionContext(); - OwnPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); + std::unique_ptr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); bool isMarked = false; runner->postTask(BLINK_FROM_HERE, createSameThreadTask(&markBoolean, &isMarked)); @@ -58,7 +57,7 @@ TEST(MainThreadTaskRunnerTest, SuspendTask) { NullExecutionContext* context = new NullExecutionContext(); - OwnPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); + std::unique_ptr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); bool isMarked = false; context->setTasksNeedSuspension(true); @@ -76,7 +75,7 @@ TEST(MainThreadTaskRunnerTest, RemoveRunner) { NullExecutionContext* context = new NullExecutionContext(); - OwnPtr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); + std::unique_ptr<MainThreadTaskRunner> runner = MainThreadTaskRunner::create(context); bool isMarked = false; context->setTasksNeedSuspension(true);
diff --git a/third_party/WebKit/Source/core/dom/MessagePort.cpp b/third_party/WebKit/Source/core/dom/MessagePort.cpp index 17fc8bb3..59fce93 100644 --- a/third_party/WebKit/Source/core/dom/MessagePort.cpp +++ b/third_party/WebKit/Source/core/dom/MessagePort.cpp
@@ -39,7 +39,9 @@ #include "core/workers/WorkerGlobalScope.h" #include "public/platform/WebString.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -79,7 +81,7 @@ return; } } - OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); + std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); if (exceptionState.hadException()) return; @@ -87,16 +89,16 @@ getExecutionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "MessagePort cannot send an ArrayBuffer as a transferable object yet. See http://crbug.com/334408")); WebString messageString = message->toWireString(); - OwnPtr<WebMessagePortChannelArray> webChannels = toWebMessagePortChannelArray(std::move(channels)); - m_entangledChannel->postMessage(messageString, webChannels.leakPtr()); + std::unique_ptr<WebMessagePortChannelArray> webChannels = toWebMessagePortChannelArray(std::move(channels)); + m_entangledChannel->postMessage(messageString, webChannels.release()); } // static -PassOwnPtr<WebMessagePortChannelArray> MessagePort::toWebMessagePortChannelArray(PassOwnPtr<MessagePortChannelArray> channels) +std::unique_ptr<WebMessagePortChannelArray> MessagePort::toWebMessagePortChannelArray(std::unique_ptr<MessagePortChannelArray> channels) { - OwnPtr<WebMessagePortChannelArray> webChannels; + std::unique_ptr<WebMessagePortChannelArray> webChannels; if (channels && channels->size()) { - webChannels = adoptPtr(new WebMessagePortChannelArray(channels->size())); + webChannels = wrapUnique(new WebMessagePortChannelArray(channels->size())); for (size_t i = 0; i < channels->size(); ++i) (*webChannels)[i] = (*channels)[i].release(); } @@ -106,7 +108,7 @@ // static MessagePortArray* MessagePort::toMessagePortArray(ExecutionContext* context, const WebMessagePortChannelArray& webChannels) { - OwnPtr<MessagePortChannelArray> channels = adoptPtr(new MessagePortChannelArray(webChannels.size())); + std::unique_ptr<MessagePortChannelArray> channels = wrapUnique(new MessagePortChannelArray(webChannels.size())); for (size_t i = 0; i < webChannels.size(); ++i) (*channels)[i] = WebMessagePortChannelUniquePtr(webChannels[i]); return MessagePort::entanglePorts(*context, std::move(channels)); @@ -163,7 +165,7 @@ return EventTargetNames::MessagePort; } -static bool tryGetMessageFrom(WebMessagePortChannel& webChannel, RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePortChannelArray>& channels) +static bool tryGetMessageFrom(WebMessagePortChannel& webChannel, RefPtr<SerializedScriptValue>& message, std::unique_ptr<MessagePortChannelArray>& channels) { WebString messageString; WebMessagePortChannelArray webChannels; @@ -171,7 +173,7 @@ return false; if (webChannels.size()) { - channels = adoptPtr(new MessagePortChannelArray(webChannels.size())); + channels = wrapUnique(new MessagePortChannelArray(webChannels.size())); for (size_t i = 0; i < webChannels.size(); ++i) (*channels)[i] = WebMessagePortChannelUniquePtr(webChannels[i]); } @@ -179,7 +181,7 @@ return true; } -bool MessagePort::tryGetMessage(RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePortChannelArray>& channels) +bool MessagePort::tryGetMessage(RefPtr<SerializedScriptValue>& message, std::unique_ptr<MessagePortChannelArray>& channels) { if (!m_entangledChannel) return false; @@ -198,7 +200,7 @@ return; RefPtr<SerializedScriptValue> message; - OwnPtr<MessagePortChannelArray> channels; + std::unique_ptr<MessagePortChannelArray> channels; while (tryGetMessage(message, channels)) { // close() in Worker onmessage handler should prevent next message from dispatching. if (getExecutionContext()->isWorkerGlobalScope() && toWorkerGlobalScope(getExecutionContext())->isClosing()) @@ -218,7 +220,7 @@ return m_started && isEntangled(); } -PassOwnPtr<MessagePortChannelArray> MessagePort::disentanglePorts(ExecutionContext* context, const MessagePortArray& ports, ExceptionState& exceptionState) +std::unique_ptr<MessagePortChannelArray> MessagePort::disentanglePorts(ExecutionContext* context, const MessagePortArray& ports, ExceptionState& exceptionState) { if (!ports.size()) return nullptr; @@ -245,13 +247,13 @@ UseCounter::count(context, UseCounter::MessagePortsTransferred); // Passed-in ports passed validity checks, so we can disentangle them. - OwnPtr<MessagePortChannelArray> portArray = adoptPtr(new MessagePortChannelArray(ports.size())); + std::unique_ptr<MessagePortChannelArray> portArray = wrapUnique(new MessagePortChannelArray(ports.size())); for (unsigned i = 0; i < ports.size(); ++i) (*portArray)[i] = ports[i]->disentangle(); return portArray; } -MessagePortArray* MessagePort::entanglePorts(ExecutionContext& context, PassOwnPtr<MessagePortChannelArray> channels) +MessagePortArray* MessagePort::entanglePorts(ExecutionContext& context, std::unique_ptr<MessagePortChannelArray> channels) { // https://html.spec.whatwg.org/multipage/comms.html#message-ports // |ports| should be an empty array, not null even when there is no ports.
diff --git a/third_party/WebKit/Source/core/dom/MessagePort.h b/third_party/WebKit/Source/core/dom/MessagePort.h index 4742b7d..6224a2b 100644 --- a/third_party/WebKit/Source/core/dom/MessagePort.h +++ b/third_party/WebKit/Source/core/dom/MessagePort.h
@@ -35,8 +35,6 @@ #include "core/events/EventTarget.h" #include "public/platform/WebMessagePortChannel.h" #include "public/platform/WebMessagePortChannelClient.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" @@ -73,16 +71,16 @@ WebMessagePortChannelUniquePtr disentangle(); // Returns nullptr if the passed-in array is nullptr/empty. - static PassOwnPtr<WebMessagePortChannelArray> toWebMessagePortChannelArray(PassOwnPtr<MessagePortChannelArray>); + static std::unique_ptr<WebMessagePortChannelArray> toWebMessagePortChannelArray(std::unique_ptr<MessagePortChannelArray>); // Returns an empty array if the passed array is empty. static MessagePortArray* toMessagePortArray(ExecutionContext*, const WebMessagePortChannelArray&); // Returns nullptr if there is an exception, or if the passed-in array is nullptr/empty. - static PassOwnPtr<MessagePortChannelArray> disentanglePorts(ExecutionContext*, const MessagePortArray&, ExceptionState&); + static std::unique_ptr<MessagePortChannelArray> disentanglePorts(ExecutionContext*, const MessagePortArray&, ExceptionState&); // Returns an empty array if the passed array is nullptr/empty. - static MessagePortArray* entanglePorts(ExecutionContext&, PassOwnPtr<MessagePortChannelArray>); + static MessagePortArray* entanglePorts(ExecutionContext&, std::unique_ptr<MessagePortChannelArray>); bool started() const { return m_started; } @@ -113,7 +111,7 @@ protected: explicit MessagePort(ExecutionContext&); - bool tryGetMessage(RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePortChannelArray>& channels); + bool tryGetMessage(RefPtr<SerializedScriptValue>& message, std::unique_ptr<MessagePortChannelArray>& channels); private: // WebMessagePortChannelClient implementation.
diff --git a/third_party/WebKit/Source/core/dom/MutationObserverInterestGroup.h b/third_party/WebKit/Source/core/dom/MutationObserverInterestGroup.h index a0520a1c..3b1cf40 100644 --- a/third_party/WebKit/Source/core/dom/MutationObserverInterestGroup.h +++ b/third_party/WebKit/Source/core/dom/MutationObserverInterestGroup.h
@@ -37,7 +37,6 @@ #include "core/dom/QualifiedName.h" #include "platform/heap/Handle.h" #include "wtf/HashMap.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp index c0853351..a7f51f70 100644 --- a/third_party/WebKit/Source/core/dom/Node.cpp +++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -93,7 +93,6 @@ #include "platform/TraceEvent.h" #include "platform/TracedValue.h" #include "wtf/HashSet.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/allocator/Partitions.h" #include "wtf/text/CString.h"
diff --git a/third_party/WebKit/Source/core/dom/NodeRareData.h b/third_party/WebKit/Source/core/dom/NodeRareData.h index f8d7759..5103db61 100644 --- a/third_party/WebKit/Source/core/dom/NodeRareData.h +++ b/third_party/WebKit/Source/core/dom/NodeRareData.h
@@ -26,8 +26,6 @@ #include "core/dom/NodeListsNodeData.h" #include "platform/heap/Handle.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp b/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp index fe24da8..3a0b750 100644 --- a/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp +++ b/third_party/WebKit/Source/core/dom/NthIndexCacheTest.cpp
@@ -8,6 +8,7 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -19,7 +20,7 @@ void setHtmlInnerHTML(const char* htmlContent); private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; void NthIndexCacheTest::SetUp()
diff --git a/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp b/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp index 0c9eb8c..c2f9f38c 100644 --- a/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp +++ b/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
@@ -34,6 +34,7 @@ #include "core/xml/DocumentXSLT.h" #include "core/xml/XSLStyleSheet.h" #include "core/xml/parser/XMLDocumentParser.h" // for parseAttributes() +#include <memory> namespace blink { @@ -224,7 +225,7 @@ DCHECK(m_isXSL); m_sheet = XSLStyleSheet::create(this, href, baseURL); - OwnPtr<IncrementLoadEventDelayCount> delay = IncrementLoadEventDelayCount::create(document()); + std::unique_ptr<IncrementLoadEventDelayCount> delay = IncrementLoadEventDelayCount::create(document()); parseStyleSheet(sheet); }
diff --git a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp index 9fc5886..212d353 100644 --- a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp +++ b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp
@@ -36,6 +36,8 @@ #include "core/dom/StaticNodeList.h" #include "core/dom/shadow/ElementShadow.h" #include "core/dom/shadow/ShadowRoot.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -525,9 +527,9 @@ findTraverseRootsAndExecute<SelectorQueryTrait>(rootNode, output); } -PassOwnPtr<SelectorQuery> SelectorQuery::adopt(CSSSelectorList selectorList) +std::unique_ptr<SelectorQuery> SelectorQuery::adopt(CSSSelectorList selectorList) { - return adoptPtr(new SelectorQuery(std::move(selectorList))); + return wrapUnique(new SelectorQuery(std::move(selectorList))); } SelectorQuery::SelectorQuery(CSSSelectorList selectorList) @@ -558,7 +560,7 @@ SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, const Document& document, ExceptionState& exceptionState) { - HashMap<AtomicString, OwnPtr<SelectorQuery>>::iterator it = m_entries.find(selectors); + HashMap<AtomicString, std::unique_ptr<SelectorQuery>>::iterator it = m_entries.find(selectors); if (it != m_entries.end()) return it->value.get();
diff --git a/third_party/WebKit/Source/core/dom/SelectorQuery.h b/third_party/WebKit/Source/core/dom/SelectorQuery.h index 33fb551..2dc05bf4 100644 --- a/third_party/WebKit/Source/core/dom/SelectorQuery.h +++ b/third_party/WebKit/Source/core/dom/SelectorQuery.h
@@ -32,6 +32,7 @@ #include "wtf/HashMap.h" #include "wtf/Vector.h" #include "wtf/text/AtomicStringHash.h" +#include <memory> namespace blink { @@ -89,7 +90,7 @@ WTF_MAKE_NONCOPYABLE(SelectorQuery); USING_FAST_MALLOC(SelectorQuery); public: - static PassOwnPtr<SelectorQuery> adopt(CSSSelectorList); + static std::unique_ptr<SelectorQuery> adopt(CSSSelectorList); bool matches(Element&) const; Element* closest(Element&) const; @@ -109,7 +110,7 @@ void invalidate(); private: - HashMap<AtomicString, OwnPtr<SelectorQuery>> m_entries; + HashMap<AtomicString, std::unique_ptr<SelectorQuery>> m_entries; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp b/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp index 5f44146..d10c1af 100644 --- a/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp +++ b/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp
@@ -8,6 +8,7 @@ #include "core/dom/Document.h" #include "core/html/HTMLHtmlElement.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -19,7 +20,7 @@ document->documentElement()->setInnerHTML("<body><style>span::before { content: 'X' }</style><span></span></body>", ASSERT_NO_EXCEPTION); CSSSelectorList selectorList = CSSParser::parseSelector(CSSParserContext(*document, nullptr), nullptr, "span::before"); - OwnPtr<SelectorQuery> query = SelectorQuery::adopt(std::move(selectorList)); + std::unique_ptr<SelectorQuery> query = SelectorQuery::adopt(std::move(selectorList)); Element* elm = query->queryFirst(*document); EXPECT_EQ(nullptr, elm);
diff --git a/third_party/WebKit/Source/core/dom/StyleElementTest.cpp b/third_party/WebKit/Source/core/dom/StyleElementTest.cpp index 5f1f6c61..c37c7b8 100644 --- a/third_party/WebKit/Source/core/dom/StyleElementTest.cpp +++ b/third_party/WebKit/Source/core/dom/StyleElementTest.cpp
@@ -9,12 +9,13 @@ #include "core/html/HTMLStyleElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { TEST(StyleElementTest, CreateSheetUsesCache) { - OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); + std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); Document& document = dummyPageHolder->document(); document.documentElement()->setInnerHTML("<style id=style>a { top: 0; }</style>", ASSERT_NO_EXCEPTION);
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.h b/third_party/WebKit/Source/core/dom/StyleEngine.h index 24dfe57..b2cd4f0 100644 --- a/third_party/WebKit/Source/core/dom/StyleEngine.h +++ b/third_party/WebKit/Source/core/dom/StyleEngine.h
@@ -43,6 +43,7 @@ #include "wtf/TemporaryChange.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -261,7 +262,7 @@ HeapHashMap<AtomicString, Member<StyleSheetContents>> m_textToSheetCache; HeapHashMap<Member<StyleSheetContents>, AtomicString> m_sheetToTextCache; - OwnPtr<StyleResolverStats> m_styleResolverStats; + std::unique_ptr<StyleResolverStats> m_styleResolverStats; unsigned m_styleForElementCount = 0; friend class StyleEngineTest;
diff --git a/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp b/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp index 098395e..7d2bd26a 100644 --- a/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp +++ b/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp
@@ -11,6 +11,7 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -24,7 +25,7 @@ bool isDocumentStyleSheetCollectionClean() { return !styleEngine().shouldUpdateDocumentStyleSheetCollection(AnalyzedStyleUpdate); } private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; void StyleEngineTest::SetUp()
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp index f3a4b56..8567a58 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp
@@ -10,6 +10,7 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -131,7 +132,7 @@ const char* bodyContent = "<div id=div></div>" "<a-a id=v1v0></a-a>" "<font-face id=v0></font-face>"; - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(); Document& document = pageHolder->document(); document.body()->setInnerHTML(String::fromUTF8(bodyContent), ASSERT_NO_EXCEPTION); @@ -166,7 +167,7 @@ { "font-face", CustomElementState::Uncustomized, Element::V0WaitingForUpgrade }, { "_-X", CustomElementState::Uncustomized, Element::V0WaitingForUpgrade }, }; - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(); Document& document = pageHolder->document(); for (const auto& data : createElementData) { Element* element = document.createElement(data.name, ASSERT_NO_EXCEPTION);
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp index 22b80ad..a838691 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp
@@ -14,8 +14,8 @@ #include "core/testing/DummyPageHolder.h" #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -56,7 +56,7 @@ } private: - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; }; TEST_F(CustomElementUpgradeSorterTest, inOtherDocument_notInSet)
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistryTest.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistryTest.cpp index da2245a..17467d0b 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistryTest.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistryTest.cpp
@@ -71,7 +71,7 @@ void SetUp() override { CustomElementsRegistryTestBase::SetUp(); - m_page.reset(DummyPageHolder::create(IntSize(1, 1)).leakPtr()); + m_page.reset(DummyPageHolder::create(IntSize(1, 1)).release()); } void TearDown() override
diff --git a/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversalTest.cpp b/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversalTest.cpp index 6dbcf26..55ca8a7 100644 --- a/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversalTest.cpp +++ b/third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversalTest.cpp
@@ -17,9 +17,9 @@ #include "platform/geometry/IntSize.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/Compiler.h" -#include "wtf/OwnPtr.h" #include "wtf/StdLibExtras.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -41,7 +41,7 @@ void SetUp() override; Persistent<HTMLDocument> m_document; - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; void FlatTreeTraversalTest::SetUp()
diff --git a/third_party/WebKit/Source/core/editing/EditingTestBase.h b/third_party/WebKit/Source/core/editing/EditingTestBase.h index 1f30bac..53f971b 100644 --- a/third_party/WebKit/Source/core/editing/EditingTestBase.h +++ b/third_party/WebKit/Source/core/editing/EditingTestBase.h
@@ -8,6 +8,7 @@ #include "core/editing/Position.h" #include "wtf/Forward.h" #include <gtest/gtest.h> +#include <memory> #include <string> namespace blink { @@ -32,7 +33,7 @@ void updateAllLifecyclePhases(); private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp index e705c69..4c2e912 100644 --- a/third_party/WebKit/Source/core/editing/Editor.cpp +++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -87,6 +87,7 @@ #include "core/svg/SVGImageElement.h" #include "platform/KillRing.h" #include "platform/weborigin/KURL.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CharacterNames.h" namespace blink { @@ -768,7 +769,7 @@ , m_shouldStartNewKillRingSequence(false) // This is off by default, since most editors want this behavior (this matches IE but not FF). , m_shouldStyleWithCSS(false) - , m_killRing(adoptPtr(new KillRing)) + , m_killRing(wrapUnique(new KillRing)) , m_areMarkedTextMatchesHighlighted(false) , m_defaultParagraphSeparator(EditorParagraphSeparatorIsDiv) , m_overwriteModeEnabled(false)
diff --git a/third_party/WebKit/Source/core/editing/Editor.h b/third_party/WebKit/Source/core/editing/Editor.h index 4262211..e2bd766a 100644 --- a/third_party/WebKit/Source/core/editing/Editor.h +++ b/third_party/WebKit/Source/core/editing/Editor.h
@@ -39,6 +39,7 @@ #include "core/editing/markers/DocumentMarker.h" #include "platform/PasteMode.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -255,7 +256,7 @@ int m_preventRevealSelection; bool m_shouldStartNewKillRingSequence; bool m_shouldStyleWithCSS; - const OwnPtr<KillRing> m_killRing; + const std::unique_ptr<KillRing> m_killRing; VisibleSelection m_mark; bool m_areMarkedTextMatchesHighlighted; EditorParagraphSeparator m_defaultParagraphSeparator;
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp index 6b3befe..0e7844a 100644 --- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp +++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -77,6 +77,7 @@ #include "platform/geometry/FloatQuad.h" #include "platform/graphics/GraphicsContext.h" #include "platform/text/UnicodeUtilities.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include <stdio.h> @@ -1299,9 +1300,9 @@ return m_granularityStrategy.get(); if (strategyType == SelectionStrategy::Direction) - m_granularityStrategy = adoptPtr(new DirectionGranularityStrategy()); + m_granularityStrategy = wrapUnique(new DirectionGranularityStrategy()); else - m_granularityStrategy = adoptPtr(new CharacterGranularityStrategy()); + m_granularityStrategy = wrapUnique(new CharacterGranularityStrategy()); return m_granularityStrategy.get(); }
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.h b/third_party/WebKit/Source/core/editing/FrameSelection.h index 3f559f5..f50aa62 100644 --- a/third_party/WebKit/Source/core/editing/FrameSelection.h +++ b/third_party/WebKit/Source/core/editing/FrameSelection.h
@@ -39,6 +39,7 @@ #include "platform/geometry/LayoutRect.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -301,7 +302,7 @@ bool m_focused : 1; // Controls text granularity used to adjust the selection's extent in moveRangeSelectionExtent. - OwnPtr<GranularityStrategy> m_granularityStrategy; + std::unique_ptr<GranularityStrategy> m_granularityStrategy; const Member<FrameCaret> m_frameCaret; };
diff --git a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp index 19050016..1924c09 100644 --- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp +++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
@@ -19,10 +19,10 @@ #include "platform/graphics/paint/DrawingRecorder.h" #include "platform/graphics/paint/PaintController.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { @@ -113,7 +113,7 @@ frameRect.setHeight(frameRect.height() + 1); dummyPageHolder().frameView().setFrameRect(frameRect); } - OwnPtr<PaintController> paintController = PaintController::create(); + std::unique_ptr<PaintController> paintController = PaintController::create(); { GraphicsContext context(*paintController); DrawingRecorder drawingRecorder(context, *dummyPageHolder().frameView().layoutView(), DisplayItem::Caret, LayoutRect::infiniteIntRect());
diff --git a/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp b/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp index dac7bae0..82853aff 100644 --- a/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp +++ b/third_party/WebKit/Source/core/editing/GranularityStrategyTest.cpp
@@ -15,10 +15,10 @@ #include "core/testing/DummyPageHolder.h" #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { @@ -69,7 +69,7 @@ Vector<IntPoint> m_wordMiddles; private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp index b176244..1a8bf2c5 100644 --- a/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp +++ b/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
@@ -15,6 +15,7 @@ #include "core/html/HTMLInputElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -28,7 +29,7 @@ private: void SetUp() override; - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp b/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp index 3a9b2c942..46ceeac 100644 --- a/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp +++ b/third_party/WebKit/Source/core/editing/SurroundingTextTest.cpp
@@ -12,6 +12,7 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -25,7 +26,7 @@ private: void SetUp() override; - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; void SurroundingTextTest::SetUp()
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp index 62a53a0..5611a89 100644 --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp
@@ -41,6 +41,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -60,7 +61,7 @@ void setBodyInnerHTML(const char*); private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; Text* DocumentMarkerControllerTest::createTextNode(const char* textContents)
diff --git a/third_party/WebKit/Source/core/events/ErrorEvent.cpp b/third_party/WebKit/Source/core/events/ErrorEvent.cpp index bab76836f..1d878850 100644 --- a/third_party/WebKit/Source/core/events/ErrorEvent.cpp +++ b/third_party/WebKit/Source/core/events/ErrorEvent.cpp
@@ -31,6 +31,7 @@ #include "core/events/ErrorEvent.h" #include "bindings/core/v8/V8Binding.h" +#include <memory> #include <v8.h> namespace blink { @@ -58,7 +59,7 @@ m_error = initializer.error(); } -ErrorEvent::ErrorEvent(const String& message, PassOwnPtr<SourceLocation> location, DOMWrapperWorld* world) +ErrorEvent::ErrorEvent(const String& message, std::unique_ptr<SourceLocation> location, DOMWrapperWorld* world) : Event(EventTypeNames::error, false, true) , m_sanitizedMessage(message) , m_location(std::move(location))
diff --git a/third_party/WebKit/Source/core/events/ErrorEvent.h b/third_party/WebKit/Source/core/events/ErrorEvent.h index 97121d5..e44e284 100644 --- a/third_party/WebKit/Source/core/events/ErrorEvent.h +++ b/third_party/WebKit/Source/core/events/ErrorEvent.h
@@ -37,6 +37,7 @@ #include "core/events/Event.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -47,7 +48,7 @@ { return new ErrorEvent; } - static ErrorEvent* create(const String& message, PassOwnPtr<SourceLocation> location, DOMWrapperWorld* world) + static ErrorEvent* create(const String& message, std::unique_ptr<SourceLocation> location, DOMWrapperWorld* world) { return new ErrorEvent(message, std::move(location), world); } @@ -82,12 +83,12 @@ private: ErrorEvent(); - ErrorEvent(const String& message, PassOwnPtr<SourceLocation>, DOMWrapperWorld*); + ErrorEvent(const String& message, std::unique_ptr<SourceLocation>, DOMWrapperWorld*); ErrorEvent(const AtomicString&, const ErrorEventInit&); String m_unsanitizedMessage; String m_sanitizedMessage; - OwnPtr<SourceLocation> m_location; + std::unique_ptr<SourceLocation> m_location; ScriptValue m_error; RefPtr<DOMWrapperWorld> m_world;
diff --git a/third_party/WebKit/Source/core/events/EventFactory.h b/third_party/WebKit/Source/core/events/EventFactory.h index 01f7c688c..78b6de61 100644 --- a/third_party/WebKit/Source/core/events/EventFactory.h +++ b/third_party/WebKit/Source/core/events/EventFactory.h
@@ -29,7 +29,9 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -48,9 +50,9 @@ class EventFactory final : public EventFactoryBase { public: - static PassOwnPtr<EventFactory> create() + static std::unique_ptr<EventFactory> create() { - return adoptPtr(new EventFactory()); + return wrapUnique(new EventFactory()); } Event* create(ExecutionContext*, const String& eventType) override;
diff --git a/third_party/WebKit/Source/core/events/EventListenerMap.h b/third_party/WebKit/Source/core/events/EventListenerMap.h index a6a6b8d..37851fc 100644 --- a/third_party/WebKit/Source/core/events/EventListenerMap.h +++ b/third_party/WebKit/Source/core/events/EventListenerMap.h
@@ -38,7 +38,6 @@ #include "core/events/EventListenerOptions.h" #include "core/events/RegisteredEventListener.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/AtomicStringHash.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/events/EventPathTest.cpp b/third_party/WebKit/Source/core/events/EventPathTest.cpp index 4351aab..ad8654a 100644 --- a/third_party/WebKit/Source/core/events/EventPathTest.cpp +++ b/third_party/WebKit/Source/core/events/EventPathTest.cpp
@@ -10,6 +10,7 @@ #include "core/style/ComputedStyleConstants.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -20,7 +21,7 @@ private: void SetUp() override; - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; void EventPathTest::SetUp()
diff --git a/third_party/WebKit/Source/core/events/EventQueue.h b/third_party/WebKit/Source/core/events/EventQueue.h index 1ac313cd..b7beffb 100644 --- a/third_party/WebKit/Source/core/events/EventQueue.h +++ b/third_party/WebKit/Source/core/events/EventQueue.h
@@ -31,7 +31,6 @@ #include "platform/heap/Handle.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/events/EventTarget.cpp b/third_party/WebKit/Source/core/events/EventTarget.cpp index 21ee9c2..a7115074 100644 --- a/third_party/WebKit/Source/core/events/EventTarget.cpp +++ b/third_party/WebKit/Source/core/events/EventTarget.cpp
@@ -46,9 +46,11 @@ #include "core/inspector/ConsoleMessage.h" #include "core/inspector/InspectorInstrumentation.h" #include "platform/EventDispatchForbiddenScope.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/Threading.h" #include "wtf/Vector.h" +#include <memory> using namespace WTF; @@ -107,7 +109,7 @@ event->type().getString().utf8().data(), lround(delayedSeconds * 1000)); v8::Local<v8::Function> function = eventListenerEffectiveFunction(v8Listener->isolate(), handler); - OwnPtr<SourceLocation> location = SourceLocation::fromFunction(function); + std::unique_ptr<SourceLocation> location = SourceLocation::fromFunction(function); ConsoleMessage* message = ConsoleMessage::create(JSMessageSource, WarningMessageLevel, messageText, std::move(location)); context->addConsoleMessage(message); registeredListener->setBlockedEventWarningEmitted(); @@ -552,7 +554,7 @@ size_t i = 0; size_t size = entry.size(); if (!d->firingEventIterators) - d->firingEventIterators = adoptPtr(new FiringEventIteratorVector); + d->firingEventIterators = wrapUnique(new FiringEventIteratorVector); d->firingEventIterators->append(FiringEventIterator(event->type(), i, size)); double blockedEventThreshold = blockedEventsWarningThreshold(context, event);
diff --git a/third_party/WebKit/Source/core/events/EventTarget.h b/third_party/WebKit/Source/core/events/EventTarget.h index 56b0544..366bc3f 100644 --- a/third_party/WebKit/Source/core/events/EventTarget.h +++ b/third_party/WebKit/Source/core/events/EventTarget.h
@@ -44,6 +44,7 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -78,7 +79,7 @@ DECLARE_TRACE(); EventListenerMap eventListenerMap; - OwnPtr<FiringEventIteratorVector> firingEventIterators; + std::unique_ptr<FiringEventIteratorVector> firingEventIterators; }; // This is the base class for all DOM event targets. To make your class an
diff --git a/third_party/WebKit/Source/core/events/GenericEventQueue.h b/third_party/WebKit/Source/core/events/GenericEventQueue.h index 18fb486..62cd783 100644 --- a/third_party/WebKit/Source/core/events/GenericEventQueue.h +++ b/third_party/WebKit/Source/core/events/GenericEventQueue.h
@@ -30,7 +30,6 @@ #include "core/events/EventQueue.h" #include "core/events/EventTarget.h" #include "platform/Timer.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h"
diff --git a/third_party/WebKit/Source/core/events/KeyboardEvent.cpp b/third_party/WebKit/Source/core/events/KeyboardEvent.cpp index 146800f..9d4f92f4 100644 --- a/third_party/WebKit/Source/core/events/KeyboardEvent.cpp +++ b/third_party/WebKit/Source/core/events/KeyboardEvent.cpp
@@ -26,6 +26,7 @@ #include "bindings/core/v8/ScriptState.h" #include "platform/PlatformKeyboardEvent.h" #include "platform/WindowsKeyboardCodes.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -73,7 +74,7 @@ KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* view) : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true, view, 0, key.getModifiers(), key.timestamp(), InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities()) - , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) + , m_keyEvent(wrapUnique(new PlatformKeyboardEvent(key))) , m_keyIdentifier(key.keyIdentifier()) , m_code(key.code()) , m_key(key.key())
diff --git a/third_party/WebKit/Source/core/events/KeyboardEvent.h b/third_party/WebKit/Source/core/events/KeyboardEvent.h index e3f075e..c1f97456 100644 --- a/third_party/WebKit/Source/core/events/KeyboardEvent.h +++ b/third_party/WebKit/Source/core/events/KeyboardEvent.h
@@ -27,6 +27,7 @@ #include "core/CoreExport.h" #include "core/events/KeyboardEventInit.h" #include "core/events/UIEventWithKeyState.h" +#include <memory> namespace blink { @@ -97,7 +98,7 @@ void initLocationModifiers(unsigned location); - OwnPtr<PlatformKeyboardEvent> m_keyEvent; + std::unique_ptr<PlatformKeyboardEvent> m_keyEvent; String m_keyIdentifier; String m_code; String m_key;
diff --git a/third_party/WebKit/Source/core/events/MessageEvent.cpp b/third_party/WebKit/Source/core/events/MessageEvent.cpp index 8a0aa5d..0966e17 100644 --- a/third_party/WebKit/Source/core/events/MessageEvent.cpp +++ b/third_party/WebKit/Source/core/events/MessageEvent.cpp
@@ -31,6 +31,7 @@ #include "bindings/core/v8/ExceptionState.h" #include "bindings/core/v8/V8ArrayBuffer.h" #include "bindings/core/v8/V8PrivateProperty.h" +#include <memory> namespace blink { @@ -87,7 +88,7 @@ ASSERT(isValidSource(m_source.get())); } -MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, EventTarget* source, PassOwnPtr<MessagePortChannelArray> channels, const String& suborigin) +MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, EventTarget* source, std::unique_ptr<MessagePortChannelArray> channels, const String& suborigin) : Event(EventTypeNames::message, false, false) , m_dataType(DataTypeSerializedScriptValue) , m_dataAsSerializedScriptValue(data)
diff --git a/third_party/WebKit/Source/core/events/MessageEvent.h b/third_party/WebKit/Source/core/events/MessageEvent.h index 1f961bec..b338c11 100644 --- a/third_party/WebKit/Source/core/events/MessageEvent.h +++ b/third_party/WebKit/Source/core/events/MessageEvent.h
@@ -37,6 +37,7 @@ #include "core/events/MessageEventInit.h" #include "core/fileapi/Blob.h" #include "core/frame/DOMWindow.h" +#include <memory> namespace blink { @@ -55,7 +56,7 @@ { return new MessageEvent(data, origin, lastEventId, source, ports, suborigin); } - static MessageEvent* create(PassOwnPtr<MessagePortChannelArray> channels, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), const String& lastEventId = String(), EventTarget* source = nullptr, const String& suborigin = String()) + static MessageEvent* create(std::unique_ptr<MessagePortChannelArray> channels, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), const String& lastEventId = String(), EventTarget* source = nullptr, const String& suborigin = String()) { return new MessageEvent(data, origin, lastEventId, source, std::move(channels), suborigin); } @@ -118,7 +119,7 @@ MessageEvent(const AtomicString&, const MessageEventInit&); MessageEvent(const String& origin, const String& lastEventId, EventTarget* source, MessagePortArray*, const String& suborigin); MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, EventTarget* source, MessagePortArray*, const String& suborigin); - MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, EventTarget* source, PassOwnPtr<MessagePortChannelArray>, const String& suborigin); + MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, EventTarget* source, std::unique_ptr<MessagePortChannelArray>, const String& suborigin); MessageEvent(const String& data, const String& origin, const String& suborigin); MessageEvent(Blob* data, const String& origin, const String& suborigin); @@ -137,7 +138,7 @@ // the MessageChannels in a disentangled state. Only one of them can be // non-empty at a time. entangleMessagePorts() moves between the states. Member<MessagePortArray> m_ports; - OwnPtr<MessagePortChannelArray> m_channels; + std::unique_ptr<MessagePortChannelArray> m_channels; String m_suborigin; };
diff --git a/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp b/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp index c514ec67..ea6b553 100644 --- a/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp +++ b/third_party/WebKit/Source/core/events/ScopedEventQueue.cpp
@@ -34,7 +34,8 @@ #include "core/events/EventDispatchMediator.h" #include "core/events/EventDispatcher.h" #include "core/events/EventTarget.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -54,8 +55,8 @@ void ScopedEventQueue::initialize() { ASSERT(!s_instance); - OwnPtr<ScopedEventQueue> instance = adoptPtr(new ScopedEventQueue); - s_instance = instance.leakPtr(); + std::unique_ptr<ScopedEventQueue> instance = wrapUnique(new ScopedEventQueue); + s_instance = instance.release(); } void ScopedEventQueue::enqueueEventDispatchMediator(EventDispatchMediator* mediator)
diff --git a/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp b/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp index 2d7cbb0..fb03c6c6 100644 --- a/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp +++ b/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
@@ -36,7 +36,6 @@ #include "core/fetch/ResourceFetcher.h" #include "platform/network/ResourceRequest.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp b/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp index 267e0d9..d302bcaf 100644 --- a/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp +++ b/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
@@ -34,16 +34,18 @@ #include "platform/network/ResourceResponse.h" #include "platform/weborigin/SchemeRegistry.h" #include "platform/weborigin/SecurityOrigin.h" +#include "wtf/PtrUtil.h" #include "wtf/Threading.h" #include "wtf/text/AtomicString.h" #include "wtf/text/StringBuilder.h" #include <algorithm> +#include <memory> namespace blink { -static PassOwnPtr<HTTPHeaderSet> createAllowedCrossOriginResponseHeadersSet() +static std::unique_ptr<HTTPHeaderSet> createAllowedCrossOriginResponseHeadersSet() { - OwnPtr<HTTPHeaderSet> headerSet = adoptPtr(new HashSet<String, CaseFoldingHash>); + std::unique_ptr<HTTPHeaderSet> headerSet = wrapUnique(new HashSet<String, CaseFoldingHash>); headerSet->add("cache-control"); headerSet->add("content-language"); @@ -57,7 +59,7 @@ bool isOnAccessControlResponseHeaderWhitelist(const String& name) { - DEFINE_THREAD_SAFE_STATIC_LOCAL(HTTPHeaderSet, allowedCrossOriginResponseHeaders, (createAllowedCrossOriginResponseHeadersSet().leakPtr())); + DEFINE_THREAD_SAFE_STATIC_LOCAL(HTTPHeaderSet, allowedCrossOriginResponseHeaders, (createAllowedCrossOriginResponseHeadersSet().release())); return allowedCrossOriginResponseHeaders.contains(name); }
diff --git a/third_party/WebKit/Source/core/fetch/DocumentResource.h b/third_party/WebKit/Source/core/fetch/DocumentResource.h index 68027484..ea70a68 100644 --- a/third_party/WebKit/Source/core/fetch/DocumentResource.h +++ b/third_party/WebKit/Source/core/fetch/DocumentResource.h
@@ -27,6 +27,7 @@ #include "core/fetch/ResourceClient.h" #include "core/html/parser/TextResourceDecoder.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -65,7 +66,7 @@ Document* createDocument(const KURL&); Member<Document> m_document; - OwnPtr<TextResourceDecoder> m_decoder; + std::unique_ptr<TextResourceDecoder> m_decoder; }; DEFINE_TYPE_CASTS(DocumentResource, Resource, resource, resource->getType() == Resource::SVGDocument, resource.getType() == Resource::SVGDocument);
diff --git a/third_party/WebKit/Source/core/fetch/FontResource.h b/third_party/WebKit/Source/core/fetch/FontResource.h index 27ceeb7..6b8eb95a 100644 --- a/third_party/WebKit/Source/core/fetch/FontResource.h +++ b/third_party/WebKit/Source/core/fetch/FontResource.h
@@ -31,7 +31,7 @@ #include "platform/Timer.h" #include "platform/fonts/FontOrientation.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -84,7 +84,7 @@ enum LoadLimitState { UnderLimit, ShortLimitExceeded, LongLimitExceeded }; - OwnPtr<FontCustomPlatformData> m_fontData; + std::unique_ptr<FontCustomPlatformData> m_fontData; String m_otsParsingMessage; LoadLimitState m_loadLimitState; bool m_corsFailed;
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp index 827f4c9..9d49d11 100644 --- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp +++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -39,6 +39,7 @@ #include "public/platform/WebCachePolicy.h" #include "wtf/CurrentTime.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { @@ -406,7 +407,7 @@ notifyObservers(); } -void ImageResource::responseReceived(const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void ImageResource::responseReceived(const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { ASSERT(!handle); ASSERT(!m_multipartParser);
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.h b/third_party/WebKit/Source/core/fetch/ImageResource.h index 8ab5b6d1..a0962d9 100644 --- a/third_party/WebKit/Source/core/fetch/ImageResource.h +++ b/third_party/WebKit/Source/core/fetch/ImageResource.h
@@ -32,6 +32,7 @@ #include "platform/graphics/ImageObserver.h" #include "platform/graphics/ImageOrientation.h" #include "wtf/HashMap.h" +#include <memory> namespace blink { @@ -100,7 +101,7 @@ void appendData(const char*, size_t) override; void error(const ResourceError&) override; - void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; + void responseReceived(const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; void finish(double finishTime = 0.0) override; // For compatibility, images keep loading even if there are HTTP errors.
diff --git a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp index 3224ca7..6754c1d 100644 --- a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp +++ b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
@@ -45,6 +45,8 @@ #include "public/platform/WebURLLoaderMockFactory.h" #include "public/platform/WebURLResponse.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -108,10 +110,10 @@ private: ImageResourceTestMockFetchContext() - : m_runner(adoptPtr(new MockTaskRunner)) + : m_runner(wrapUnique(new MockTaskRunner)) { } - OwnPtr<MockTaskRunner> m_runner; + std::unique_ptr<MockTaskRunner> m_runner; }; TEST(ImageResourceTest, MultipartImage)
diff --git a/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp b/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp index a66426a3..f029b62 100644 --- a/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp +++ b/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp
@@ -36,7 +36,6 @@ #include "platform/testing/UnitTestHelpers.h" #include "public/platform/Platform.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/fetch/RawResource.cpp b/third_party/WebKit/Source/core/fetch/RawResource.cpp index 37c225d..d6cfe576 100644 --- a/third_party/WebKit/Source/core/fetch/RawResource.cpp +++ b/third_party/WebKit/Source/core/fetch/RawResource.cpp
@@ -31,6 +31,7 @@ #include "core/fetch/ResourceFetcher.h" #include "core/fetch/ResourceLoader.h" #include "platform/HTTPNames.h" +#include <memory> namespace blink { @@ -142,7 +143,7 @@ c->redirectBlocked(); } -void RawResource::responseReceived(const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void RawResource::responseReceived(const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { bool isSuccessfulRevalidation = isCacheValidator() && response.httpStatusCode() == 304; Resource::responseReceived(response, nullptr);
diff --git a/third_party/WebKit/Source/core/fetch/RawResource.h b/third_party/WebKit/Source/core/fetch/RawResource.h index 84b7026..a2328a2 100644 --- a/third_party/WebKit/Source/core/fetch/RawResource.h +++ b/third_party/WebKit/Source/core/fetch/RawResource.h
@@ -27,8 +27,8 @@ #include "core/fetch/Resource.h" #include "core/fetch/ResourceClient.h" #include "public/platform/WebDataConsumerHandle.h" -#include "wtf/PassOwnPtr.h" #include "wtf/WeakPtr.h" +#include <memory> namespace blink { class FetchRequest; @@ -82,7 +82,7 @@ void willFollowRedirect(ResourceRequest&, const ResourceResponse&) override; void willNotFollowRedirect() override; - void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; + void responseReceived(const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; void setSerializedCachedMetadata(const char*, size_t) override; void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; void didDownloadData(int) override; @@ -112,7 +112,7 @@ ResourceClientType getResourceClientType() const final { return RawResourceType; } virtual void dataSent(Resource*, unsigned long long /* bytesSent */, unsigned long long /* totalBytesToBeSent */) { } - virtual void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) { } + virtual void responseReceived(Resource*, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) { } virtual void setSerializedCachedMetadata(Resource*, const char*, size_t) { } virtual void dataReceived(Resource*, const char* /* data */, size_t /* length */) { } virtual void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) { }
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp index c481de0..20b69e38 100644 --- a/third_party/WebKit/Source/core/fetch/Resource.cpp +++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -48,6 +48,7 @@ #include "wtf/text/CString.h" #include "wtf/text/StringBuilder.h" #include <algorithm> +#include <memory> namespace blink { @@ -236,7 +237,7 @@ ResourceCallback(); void runTask(); - OwnPtr<CancellableTaskFactory> m_callbackTaskFactory; + std::unique_ptr<CancellableTaskFactory> m_callbackTaskFactory; HeapHashSet<Member<Resource>> m_resourcesWithPendingClients; }; @@ -567,7 +568,7 @@ return true; } -void Resource::responseReceived(const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle>) +void Resource::responseReceived(const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle>) { m_responseTimestamp = currentTime(); if (m_preloadDiscoveryTime) {
diff --git a/third_party/WebKit/Source/core/fetch/Resource.h b/third_party/WebKit/Source/core/fetch/Resource.h index c524d3b..36a1f2a 100644 --- a/third_party/WebKit/Source/core/fetch/Resource.h +++ b/third_party/WebKit/Source/core/fetch/Resource.h
@@ -37,8 +37,8 @@ #include "wtf/Allocator.h" #include "wtf/HashCountedSet.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -181,7 +181,7 @@ // already been made to not follow it. virtual void willNotFollowRedirect() {} - virtual void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>); + virtual void responseReceived(const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>); void setResponse(const ResourceResponse&); const ResourceResponse& response() const { return m_response; }
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp index 554ef07..2a8f5d8b 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp +++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -52,6 +52,7 @@ #include "public/platform/WebURLRequest.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" +#include <memory> using blink::WebURLRequest; @@ -292,7 +293,7 @@ if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && !m_validatedURLs.contains(request.resourceRequest().url())) { // Resources loaded from memory cache should be reported the first time they're used. - OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.options().initiatorInfo.name, monotonicallyIncreasingTime(), resource->getType() == Resource::MainResource); + std::unique_ptr<ResourceTimingInfo> info = ResourceTimingInfo::create(request.options().initiatorInfo.name, monotonicallyIncreasingTime(), resource->getType() == Resource::MainResource); populateResourceTiming(info.get(), resource); info->clearLoadTimings(); info->setLoadFinishTime(info->initialTime()); @@ -307,9 +308,9 @@ m_validatedURLs.add(request.resourceRequest().url()); } -static PassOwnPtr<TracedValue> urlForTraceEvent(const KURL& url) +static std::unique_ptr<TracedValue> urlForTraceEvent(const KURL& url) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("url", url.getString()); return value; } @@ -524,7 +525,7 @@ void ResourceFetcher::resourceTimingReportTimerFired(Timer<ResourceFetcher>* timer) { ASSERT_UNUSED(timer, timer == &m_resourceTimingReportTimer); - Vector<OwnPtr<ResourceTimingInfo>> timingReports; + Vector<std::unique_ptr<ResourceTimingInfo>> timingReports; timingReports.swap(m_scheduledResourceTimingReports); for (const auto& timingInfo : timingReports) context().addResourceTiming(*timingInfo); @@ -609,7 +610,7 @@ return; bool isMainResource = resource->getType() == Resource::MainResource; - OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(fetchInitiator, monotonicallyIncreasingTime(), isMainResource); + std::unique_ptr<ResourceTimingInfo> info = ResourceTimingInfo::create(fetchInitiator, monotonicallyIncreasingTime(), isMainResource); if (resource->isCacheValidator()) { const AtomicString& timingAllowOrigin = resource->response().httpHeaderField(HTTPNames::Timing_Allow_Origin); @@ -911,7 +912,7 @@ DCHECK(!m_loaders.contains(resource->loader())); DCHECK(finishReason == DidFinishFirstPartInMultipart || !m_nonBlockingLoaders.contains(resource->loader())); - if (OwnPtr<ResourceTimingInfo> info = m_resourceTimingInfoMap.take(resource)) { + if (std::unique_ptr<ResourceTimingInfo> info = m_resourceTimingInfoMap.take(resource)) { if (resource->response().isHTTP() && resource->response().httpStatusCode() < 400) { populateResourceTiming(info.get(), resource); info->setLoadFinishTime(finishTime);
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.h b/third_party/WebKit/Source/core/fetch/ResourceFetcher.h index 31a65ed..faad67c 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.h +++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.h
@@ -42,6 +42,7 @@ #include "wtf/HashSet.h" #include "wtf/ListHashSet.h" #include "wtf/text/StringHash.h" +#include <memory> namespace blink { @@ -189,10 +190,10 @@ Timer<ResourceFetcher> m_resourceTimingReportTimer; - using ResourceTimingInfoMap = HeapHashMap<Member<Resource>, OwnPtr<ResourceTimingInfo>>; + using ResourceTimingInfoMap = HeapHashMap<Member<Resource>, std::unique_ptr<ResourceTimingInfo>>; ResourceTimingInfoMap m_resourceTimingInfoMap; - Vector<OwnPtr<ResourceTimingInfo>> m_scheduledResourceTimingReports; + Vector<std::unique_ptr<ResourceTimingInfo>> m_scheduledResourceTimingReports; ResourceLoaderSet m_loaders; ResourceLoaderSet m_nonBlockingLoaders;
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp index f230f79..b17a699 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp +++ b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
@@ -46,6 +46,8 @@ #include "public/platform/WebURLLoaderMockFactory.h" #include "public/platform/WebURLResponse.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -83,12 +85,12 @@ private: ResourceFetcherTestMockFetchContext() : m_policy(CachePolicyVerify) - , m_runner(adoptPtr(new MockTaskRunner)) + , m_runner(wrapUnique(new MockTaskRunner)) , m_complete(false) { } CachePolicy m_policy; - OwnPtr<MockTaskRunner> m_runner; + std::unique_ptr<MockTaskRunner> m_runner; bool m_complete; }; @@ -354,7 +356,7 @@ // No callbacks should be received except for the notifyFinished() // triggered by ResourceLoader::cancel(). void dataSent(Resource*, unsigned long long, unsigned long long) override { ASSERT_TRUE(false); } - void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override { ASSERT_TRUE(false); } + void responseReceived(Resource*, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override { ASSERT_TRUE(false); } void setSerializedCachedMetadata(Resource*, const char*, size_t) override { ASSERT_TRUE(false); } void dataReceived(Resource*, const char*, size_t) override { ASSERT_TRUE(false); } void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) override { ASSERT_TRUE(false); }
diff --git a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp index 4b28e5c..2be163c8 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp +++ b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp
@@ -44,6 +44,8 @@ #include "public/platform/WebURLResponse.h" #include "wtf/Assertions.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -80,7 +82,7 @@ return; } - m_loader = adoptPtr(Platform::current()->createURLLoader()); + m_loader = wrapUnique(Platform::current()->createURLLoader()); m_loader->setDefersLoading(defersLoading); ASSERT(m_loader); m_loader->setLoadingTaskRunner(loadingTaskRunner); @@ -152,14 +154,14 @@ { ASSERT(!response.isNull()); // |rawHandle|'s ownership is transferred to the callee. - OwnPtr<WebDataConsumerHandle> handle = adoptPtr(rawHandle); + std::unique_ptr<WebDataConsumerHandle> handle = wrapUnique(rawHandle); const ResourceResponse& resourceResponse = response.toResourceResponse(); if (responseNeedsAccessControlCheck()) { if (response.wasFetchedViaServiceWorker()) { if (response.wasFallbackRequiredByServiceWorker()) { m_loader.reset(); - m_loader = adoptPtr(Platform::current()->createURLLoader()); + m_loader = wrapUnique(Platform::current()->createURLLoader()); ASSERT(m_loader); ResourceRequest request = m_resource->lastResourceRequest(); ASSERT(!request.skipServiceWorker());
diff --git a/third_party/WebKit/Source/core/fetch/ResourceLoader.h b/third_party/WebKit/Source/core/fetch/ResourceLoader.h index 80eb85d..d8f6395 100644 --- a/third_party/WebKit/Source/core/fetch/ResourceLoader.h +++ b/third_party/WebKit/Source/core/fetch/ResourceLoader.h
@@ -35,6 +35,7 @@ #include "public/platform/WebURLLoader.h" #include "public/platform/WebURLLoaderClient.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -87,7 +88,7 @@ bool responseNeedsAccessControlCheck() const; - OwnPtr<WebURLLoader> m_loader; + std::unique_ptr<WebURLLoader> m_loader; Member<ResourceFetcher> m_fetcher; Member<Resource> m_resource; };
diff --git a/third_party/WebKit/Source/core/fetch/TextResource.h b/third_party/WebKit/Source/core/fetch/TextResource.h index a412f16..075f241 100644 --- a/third_party/WebKit/Source/core/fetch/TextResource.h +++ b/third_party/WebKit/Source/core/fetch/TextResource.h
@@ -7,6 +7,7 @@ #include "core/CoreExport.h" #include "core/fetch/Resource.h" +#include <memory> namespace blink { @@ -26,7 +27,7 @@ ~TextResource() override; private: - OwnPtr<TextResourceDecoder> m_decoder; + std::unique_ptr<TextResourceDecoder> m_decoder; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/fileapi/Blob.cpp b/third_party/WebKit/Source/core/fileapi/Blob.cpp index 22143b9..57c3b5f1a 100644 --- a/third_party/WebKit/Source/core/fileapi/Blob.cpp +++ b/third_party/WebKit/Source/core/fileapi/Blob.cpp
@@ -38,6 +38,7 @@ #include "core/frame/UseCounter.h" #include "platform/blob/BlobRegistry.h" #include "platform/blob/BlobURL.h" +#include <memory> namespace blink { @@ -99,7 +100,7 @@ if (normalizeLineEndingsToNative) UseCounter::count(context, UseCounter::FileAPINativeLineEndings); - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->setContentType(options.type().lower()); populateBlobData(blobData.get(), blobParts, normalizeLineEndingsToNative); @@ -112,7 +113,7 @@ { ASSERT(data); - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->setContentType(contentType); blobData->appendBytes(data, bytes); long long blobSize = blobData->length(); @@ -177,7 +178,7 @@ clampSliceOffsets(size, start, end); long long length = end - start; - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->setContentType(contentType); blobData->appendBlob(m_blobDataHandle, start, length); return Blob::create(BlobDataHandle::create(std::move(blobData), length)); @@ -199,7 +200,7 @@ // size as zero. Blob and FileReader operations now throws on // being passed a Blob in that state. Downstream uses of closed Blobs // (e.g., XHR.send()) consider them as empty. - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->setContentType(type()); m_blobDataHandle = BlobDataHandle::create(std::move(blobData), 0); m_isClosed = true;
diff --git a/third_party/WebKit/Source/core/fileapi/File.cpp b/third_party/WebKit/Source/core/fileapi/File.cpp index 0270cca..e8f41f96 100644 --- a/third_party/WebKit/Source/core/fileapi/File.cpp +++ b/third_party/WebKit/Source/core/fileapi/File.cpp
@@ -36,6 +36,7 @@ #include "public/platform/WebFileUtilities.h" #include "wtf/CurrentTime.h" #include "wtf/DateMath.h" +#include <memory> namespace blink { @@ -54,35 +55,35 @@ return type; } -static PassOwnPtr<BlobData> createBlobDataForFileWithType(const String& path, const String& contentType) +static std::unique_ptr<BlobData> createBlobDataForFileWithType(const String& path, const String& contentType) { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->setContentType(contentType); blobData->appendFile(path); return blobData; } -static PassOwnPtr<BlobData> createBlobDataForFile(const String& path, File::ContentTypeLookupPolicy policy) +static std::unique_ptr<BlobData> createBlobDataForFile(const String& path, File::ContentTypeLookupPolicy policy) { return createBlobDataForFileWithType(path, getContentTypeFromFileName(path, policy)); } -static PassOwnPtr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName, File::ContentTypeLookupPolicy policy) +static std::unique_ptr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName, File::ContentTypeLookupPolicy policy) { return createBlobDataForFileWithType(path, getContentTypeFromFileName(fileSystemName, policy)); } -static PassOwnPtr<BlobData> createBlobDataForFileWithMetadata(const String& fileSystemName, const FileMetadata& metadata) +static std::unique_ptr<BlobData> createBlobDataForFileWithMetadata(const String& fileSystemName, const FileMetadata& metadata) { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->setContentType(getContentTypeFromFileName(fileSystemName, File::WellKnownContentTypes)); blobData->appendFile(metadata.platformPath, 0, metadata.length, metadata.modificationTime / msPerSecond); return blobData; } -static PassOwnPtr<BlobData> createBlobDataForFileSystemURL(const KURL& fileSystemURL, const FileMetadata& metadata) +static std::unique_ptr<BlobData> createBlobDataForFileSystemURL(const KURL& fileSystemURL, const FileMetadata& metadata) { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->setContentType(getContentTypeFromFileName(fileSystemURL.path(), File::WellKnownContentTypes)); blobData->appendFileSystemURL(fileSystemURL, 0, metadata.length, metadata.modificationTime / msPerSecond); return blobData; @@ -107,7 +108,7 @@ if (normalizeLineEndingsToNative) UseCounter::count(context, UseCounter::FileAPINativeLineEndings); - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->setContentType(options.type().lower()); populateBlobData(blobData.get(), fileBits, normalizeLineEndingsToNative); @@ -277,7 +278,7 @@ clampSliceOffsets(size, start, end); long long length = end - start; - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->setContentType(contentType); if (!m_fileSystemURL.isEmpty()) { blobData->appendFileSystemURL(m_fileSystemURL, start, length, modificationTimeMS / msPerSecond);
diff --git a/third_party/WebKit/Source/core/fileapi/FileReader.h b/third_party/WebKit/Source/core/fileapi/FileReader.h index 945ef15..de7bee0d 100644 --- a/third_party/WebKit/Source/core/fileapi/FileReader.h +++ b/third_party/WebKit/Source/core/fileapi/FileReader.h
@@ -40,6 +40,7 @@ #include "core/fileapi/FileReaderLoaderClient.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -128,7 +129,7 @@ FileReaderLoader::ReadType m_readType; String m_encoding; - OwnPtr<FileReaderLoader> m_loader; + std::unique_ptr<FileReaderLoader> m_loader; Member<FileError> m_error; double m_lastProgressNotificationTimeMS; };
diff --git a/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp b/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp index 18c91d8..92af972 100644 --- a/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp +++ b/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp
@@ -43,12 +43,13 @@ #include "platform/network/ResourceRequest.h" #include "platform/network/ResourceResponse.h" #include "public/platform/WebURLRequest.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/Base64.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -173,7 +174,7 @@ } } -void FileReaderLoader::didReceiveResponse(unsigned long, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void FileReaderLoader::didReceiveResponse(unsigned long, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(handle, !handle); if (response.httpStatusCode() != 200) { @@ -211,9 +212,9 @@ } if (initialBufferLength < 0) - m_rawData = adoptPtr(new ArrayBufferBuilder()); + m_rawData = wrapUnique(new ArrayBufferBuilder()); else - m_rawData = adoptPtr(new ArrayBufferBuilder(static_cast<unsigned>(initialBufferLength))); + m_rawData = wrapUnique(new ArrayBufferBuilder(static_cast<unsigned>(initialBufferLength))); if (!m_rawData || !m_rawData->isValid()) { failed(FileError::NOT_READABLE_ERR);
diff --git a/third_party/WebKit/Source/core/fileapi/FileReaderLoader.h b/third_party/WebKit/Source/core/fileapi/FileReaderLoader.h index 66060e0..9d5f453 100644 --- a/third_party/WebKit/Source/core/fileapi/FileReaderLoader.h +++ b/third_party/WebKit/Source/core/fileapi/FileReaderLoader.h
@@ -36,10 +36,11 @@ #include "core/loader/ThreadableLoaderClient.h" #include "platform/weborigin/KURL.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" #include "wtf/typed_arrays/ArrayBufferBuilder.h" +#include <memory> namespace blink { @@ -63,9 +64,9 @@ }; // If client is given, do the loading asynchronously. Otherwise, load synchronously. - static PassOwnPtr<FileReaderLoader> create(ReadType readType, FileReaderLoaderClient* client) + static std::unique_ptr<FileReaderLoader> create(ReadType readType, FileReaderLoaderClient* client) { - return adoptPtr(new FileReaderLoader(readType, client)); + return wrapUnique(new FileReaderLoader(readType, client)); } FileReaderLoader(ReadType, FileReaderLoaderClient*); @@ -76,7 +77,7 @@ void cancel(); // ThreadableLoaderClient - void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; void didReceiveData(const char*, unsigned) override; void didFinishLoading(unsigned long, double) override; void didFail(const ResourceError&) override; @@ -122,15 +123,15 @@ KURL m_urlForReading; bool m_urlForReadingIsStream; - OwnPtr<ThreadableLoader> m_loader; + std::unique_ptr<ThreadableLoader> m_loader; - OwnPtr<ArrayBufferBuilder> m_rawData; + std::unique_ptr<ArrayBufferBuilder> m_rawData; bool m_isRawDataConverted; String m_stringResult; // The decoder used to decode the text data. - OwnPtr<TextResourceDecoder> m_decoder; + std::unique_ptr<TextResourceDecoder> m_decoder; bool m_finishedLoading; long long m_bytesLoaded;
diff --git a/third_party/WebKit/Source/core/frame/DOMTimer.h b/third_party/WebKit/Source/core/frame/DOMTimer.h index ad00b44..236e9297 100644 --- a/third_party/WebKit/Source/core/frame/DOMTimer.h +++ b/third_party/WebKit/Source/core/frame/DOMTimer.h
@@ -32,8 +32,6 @@ #include "core/frame/SuspendableTimer.h" #include "platform/UserGestureIndicator.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.cpp b/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.cpp index 3f3460e6..e9311351 100644 --- a/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.cpp +++ b/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.cpp
@@ -7,10 +7,11 @@ #include "core/dom/ExecutionContext.h" #include "core/frame/DOMTimer.h" #include <algorithm> +#include <memory> namespace blink { -DOMTimerCoordinator::DOMTimerCoordinator(PassOwnPtr<WebTaskRunner> timerTaskRunner) +DOMTimerCoordinator::DOMTimerCoordinator(std::unique_ptr<WebTaskRunner> timerTaskRunner) : m_circularSequentialID(0) , m_timerNestingLevel(0) , m_timerTaskRunner(std::move(timerTaskRunner)) @@ -61,7 +62,7 @@ } } -void DOMTimerCoordinator::setTimerTaskRunner(PassOwnPtr<WebTaskRunner> timerTaskRunner) +void DOMTimerCoordinator::setTimerTaskRunner(std::unique_ptr<WebTaskRunner> timerTaskRunner) { m_timerTaskRunner = std::move(timerTaskRunner); }
diff --git a/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.h b/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.h index e3270fa..a431574 100644 --- a/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.h +++ b/third_party/WebKit/Source/core/frame/DOMTimerCoordinator.h
@@ -7,7 +7,7 @@ #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -25,7 +25,7 @@ DISALLOW_NEW(); WTF_MAKE_NONCOPYABLE(DOMTimerCoordinator); public: - explicit DOMTimerCoordinator(PassOwnPtr<WebTaskRunner>); + explicit DOMTimerCoordinator(std::unique_ptr<WebTaskRunner>); // Creates and installs a new timer. Returns the assigned ID. int installNewTimeout(ExecutionContext*, ScheduledAction*, int timeout, bool singleShot); @@ -45,7 +45,7 @@ // deeper timer nesting level, see DOMTimer::DOMTimer. void setTimerNestingLevel(int level) { m_timerNestingLevel = level; } - void setTimerTaskRunner(PassOwnPtr<WebTaskRunner>); + void setTimerTaskRunner(std::unique_ptr<WebTaskRunner>); WebTaskRunner* timerTaskRunner() const { return m_timerTaskRunner.get(); } @@ -59,7 +59,7 @@ int m_circularSequentialID; int m_timerNestingLevel; - OwnPtr<WebTaskRunner> m_timerTaskRunner; + std::unique_ptr<WebTaskRunner> m_timerTaskRunner; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/frame/DOMWindow.cpp b/third_party/WebKit/Source/core/frame/DOMWindow.cpp index ef72b51..e871c8e 100644 --- a/third_party/WebKit/Source/core/frame/DOMWindow.cpp +++ b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
@@ -29,6 +29,7 @@ #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" #include "platform/weborigin/Suborigin.h" +#include <memory> namespace blink { @@ -197,7 +198,7 @@ } } - OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(getExecutionContext(), ports, exceptionState); + std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(getExecutionContext(), ports, exceptionState); if (exceptionState.hadException()) return;
diff --git a/third_party/WebKit/Source/core/frame/Frame.cpp b/third_party/WebKit/Source/core/frame/Frame.cpp index 833e9200..c612285 100644 --- a/third_party/WebKit/Source/core/frame/Frame.cpp +++ b/third_party/WebKit/Source/core/frame/Frame.cpp
@@ -31,8 +31,8 @@ #include "core/dom/DocumentType.h" #include "core/events/Event.h" -#include "core/frame/LocalDOMWindow.h" #include "core/frame/FrameHost.h" +#include "core/frame/LocalDOMWindow.h" #include "core/frame/Settings.h" #include "core/html/HTMLFrameElementBase.h" #include "core/input/EventHandler.h" @@ -45,7 +45,6 @@ #include "core/page/Page.h" #include "platform/Histogram.h" #include "platform/UserGestureIndicator.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/frame/FrameConsole.cpp b/third_party/WebKit/Source/core/frame/FrameConsole.cpp index 2faacc3..ab36bd3 100644 --- a/third_party/WebKit/Source/core/frame/FrameConsole.cpp +++ b/third_party/WebKit/Source/core/frame/FrameConsole.cpp
@@ -38,6 +38,7 @@ #include "platform/network/ResourceError.h" #include "platform/network/ResourceResponse.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -81,7 +82,7 @@ if (!frame().host()) return; if (frame().chromeClient().shouldReportDetailedMessageForSource(frame(), url)) { - OwnPtr<SourceLocation> location = SourceLocation::captureWithFullStackTrace(); + std::unique_ptr<SourceLocation> location = SourceLocation::captureWithFullStackTrace(); if (!location->isUnknown()) stackTrace = location->toString(); }
diff --git a/third_party/WebKit/Source/core/frame/FrameConsole.h b/third_party/WebKit/Source/core/frame/FrameConsole.h index 7024c16..e3797ad 100644 --- a/third_party/WebKit/Source/core/frame/FrameConsole.h +++ b/third_party/WebKit/Source/core/frame/FrameConsole.h
@@ -33,7 +33,6 @@ #include "core/CoreExport.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/frame/FrameHost.h b/third_party/WebKit/Source/core/frame/FrameHost.h index b3685b97..1a44fcc 100644 --- a/third_party/WebKit/Source/core/frame/FrameHost.h +++ b/third_party/WebKit/Source/core/frame/FrameHost.h
@@ -35,9 +35,8 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -140,7 +139,7 @@ const Member<Page> m_page; const Member<TopControls> m_topControls; - const OwnPtr<PageScaleConstraintsSet> m_pageScaleConstraintsSet; + const std::unique_ptr<PageScaleConstraintsSet> m_pageScaleConstraintsSet; const Member<VisualViewport> m_visualViewport; const Member<OverscrollController> m_overscrollController; const Member<EventHandlerRegistry> m_eventHandlerRegistry;
diff --git a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp index 9babd85..a8626c6 100644 --- a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp +++ b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
@@ -63,7 +63,6 @@ #include "platform/graphics/Image.h" #include "platform/heap/Handle.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" #include "wtf/text/CString.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/TextEncoding.h"
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp index ad346da..c6270646 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.cpp +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -108,8 +108,10 @@ #include "public/platform/WebDisplayItemList.h" #include "public/platform/WebFrameScheduler.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/TemporaryChange.h" +#include <memory> namespace blink { @@ -220,7 +222,7 @@ m_safeToPropagateScrollToParent = true; m_lastViewportSize = IntSize(); m_lastZoomFactor = 1.0f; - m_trackedObjectPaintInvalidations = adoptPtr(s_initialTrackAllPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr); + m_trackedObjectPaintInvalidations = wrapUnique(s_initialTrackAllPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr); m_visuallyNonEmptyCharacterCount = 0; m_visuallyNonEmptyPixelCount = 0; m_isVisuallyNonEmpty = false; @@ -835,15 +837,15 @@ return; } if (!m_analyzer) - m_analyzer = adoptPtr(new LayoutAnalyzer()); + m_analyzer = wrapUnique(new LayoutAnalyzer()); m_analyzer->reset(); } -PassOwnPtr<TracedValue> FrameView::analyzerCounters() +std::unique_ptr<TracedValue> FrameView::analyzerCounters() { if (!m_analyzer) return TracedValue::create(); - OwnPtr<TracedValue> value = m_analyzer->toTracedValue(); + std::unique_ptr<TracedValue> value = m_analyzer->toTracedValue(); value->setString("host", layoutViewItem().document().location()->host()); value->setString("frame", String::format("0x%" PRIxPTR, reinterpret_cast<uintptr_t>(m_frame.get()))); value->setInteger("contentsHeightAfterLayout", layoutViewItem().documentRect().height()); @@ -1307,7 +1309,7 @@ void FrameView::addViewportConstrainedObject(LayoutObject* object) { if (!m_viewportConstrainedObjects) - m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet); + m_viewportConstrainedObjects = wrapUnique(new ViewportConstrainedObjectSet); if (!m_viewportConstrainedObjects->contains(object)) { m_viewportConstrainedObjects->add(object); @@ -2943,7 +2945,7 @@ if (!frame->isLocalFrame()) continue; if (LayoutViewItem layoutView = toLocalFrame(frame)->contentLayoutItem()) { - layoutView.frameView()->m_trackedObjectPaintInvalidations = adoptPtr(trackPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr); + layoutView.frameView()->m_trackedObjectPaintInvalidations = wrapUnique(trackPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr); layoutView.compositor()->setTracksPaintInvalidations(trackPaintInvalidations); } } @@ -2979,7 +2981,7 @@ void FrameView::addResizerArea(LayoutBox& resizerBox) { if (!m_resizerAreas) - m_resizerAreas = adoptPtr(new ResizerAreaSet); + m_resizerAreas = wrapUnique(new ResizerAreaSet); m_resizerAreas->add(&resizerBox); }
diff --git a/third_party/WebKit/Source/core/frame/FrameView.h b/third_party/WebKit/Source/core/frame/FrameView.h index ce1d5d8..a3d645e 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.h +++ b/third_party/WebKit/Source/core/frame/FrameView.h
@@ -49,9 +49,9 @@ #include "wtf/Forward.h" #include "wtf/HashSet.h" #include "wtf/ListHashSet.h" -#include "wtf/OwnPtr.h" #include "wtf/TemporaryChange.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -758,7 +758,7 @@ ScrollingCoordinator* scrollingCoordinator() const; void prepareLayoutAnalyzer(); - PassOwnPtr<TracedValue> analyzerCounters(); + std::unique_ptr<TracedValue> analyzerCounters(); // LayoutObject for the viewport-defining element (see Document::viewportDefiningElement). LayoutObject* viewportLayoutObject(); @@ -810,7 +810,7 @@ unsigned m_nestedLayoutCount; Timer<FrameView> m_postLayoutTasksTimer; Timer<FrameView> m_updateWidgetsTimer; - OwnPtr<CancellableTaskFactory> m_renderThrottlingObserverNotificationFactory; + std::unique_ptr<CancellableTaskFactory> m_renderThrottlingObserverNotificationFactory; bool m_firstLayout; bool m_isTransparent; @@ -834,8 +834,8 @@ Member<ScrollableAreaSet> m_scrollableAreas; Member<ScrollableAreaSet> m_animatingScrollableAreas; - OwnPtr<ResizerAreaSet> m_resizerAreas; - OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects; + std::unique_ptr<ResizerAreaSet> m_resizerAreas; + std::unique_ptr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects; unsigned m_stickyPositionObjectCount; ViewportConstrainedObjectSet m_backgroundAttachmentFixedObjects; Member<FrameViewAutoSizeInfo> m_autoSizeInfo; @@ -880,7 +880,7 @@ bool m_inUpdateScrollbars; - OwnPtr<LayoutAnalyzer> m_analyzer; + std::unique_ptr<LayoutAnalyzer> m_analyzer; // Mark if something has changed in the mapping from Frame to GraphicsLayer // and the Frame Timing regions should be recalculated. @@ -926,7 +926,7 @@ String name; PaintInvalidationReason reason; }; - OwnPtr<Vector<ObjectPaintInvalidation>> m_trackedObjectPaintInvalidations; + std::unique_ptr<Vector<ObjectPaintInvalidation>> m_trackedObjectPaintInvalidations; }; inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
diff --git a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp index c4024cd..f567725 100644 --- a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp +++ b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
@@ -17,7 +17,7 @@ #include "platform/heap/Handle.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" +#include <memory> using testing::_; using testing::AnyNumber; @@ -63,7 +63,7 @@ private: Persistent<MockChromeClient> m_chromeClient; - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; }; class FrameViewTest : public FrameViewTestBase {
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp index 94b7e8b7..5eb9d50a 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp +++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -11,7 +11,9 @@ #include "platform/image-decoders/ImageDecoder.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkSurface.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -33,16 +35,16 @@ return frameBitmap.colorType() == kN32_SkColorType; } -static PassOwnPtr<uint8_t[]> copySkImageData(SkImage* input, const SkImageInfo& info) +static std::unique_ptr<uint8_t[]> copySkImageData(SkImage* input, const SkImageInfo& info) { - OwnPtr<uint8_t[]> dstPixels = adoptArrayPtr(new uint8_t[input->width() * input->height() * info.bytesPerPixel()]); + std::unique_ptr<uint8_t[]> dstPixels = wrapArrayUnique(new uint8_t[input->width() * input->height() * info.bytesPerPixel()]); input->readPixels(info, dstPixels.get(), input->width() * info.bytesPerPixel(), 0, 0); return dstPixels; } -static PassRefPtr<SkImage> newSkImageFromRaster(const SkImageInfo& info, PassOwnPtr<uint8_t[]> imagePixels, int imageRowBytes) +static PassRefPtr<SkImage> newSkImageFromRaster(const SkImageInfo& info, std::unique_ptr<uint8_t[]> imagePixels, int imageRowBytes) { - return fromSkSp(SkImage::MakeFromRaster(SkPixmap(info, imagePixels.leakPtr(), imageRowBytes), + return fromSkSp(SkImage::MakeFromRaster(SkPixmap(info, imagePixels.release(), imageRowBytes), [](const void* pixels, void*) { delete[] static_cast<const uint8_t*>(pixels); @@ -74,7 +76,7 @@ int height = input->height(); SkImageInfo info = SkImageInfo::MakeN32(width, height, (alphaOp == PremultiplyAlpha) ? kPremul_SkAlphaType : kUnpremul_SkAlphaType); int imageRowBytes = width * info.bytesPerPixel(); - OwnPtr<uint8_t[]> imagePixels = copySkImageData(input, info); + std::unique_ptr<uint8_t[]> imagePixels = copySkImageData(input, info); for (int i = 0; i < height / 2; i++) { int topFirstElement = i * imageRowBytes; int topLastElement = (i + 1) * imageRowBytes; @@ -87,18 +89,18 @@ static PassRefPtr<SkImage> premulSkImageToUnPremul(SkImage* input) { SkImageInfo info = SkImageInfo::Make(input->width(), input->height(), kN32_SkColorType, kUnpremul_SkAlphaType); - OwnPtr<uint8_t[]> dstPixels = copySkImageData(input, info); + std::unique_ptr<uint8_t[]> dstPixels = copySkImageData(input, info); return newSkImageFromRaster(info, std::move(dstPixels), input->width() * info.bytesPerPixel()); } static PassRefPtr<SkImage> unPremulSkImageToPremul(SkImage* input) { SkImageInfo info = SkImageInfo::Make(input->width(), input->height(), kN32_SkColorType, kPremul_SkAlphaType); - OwnPtr<uint8_t[]> dstPixels = copySkImageData(input, info); + std::unique_ptr<uint8_t[]> dstPixels = copySkImageData(input, info); return newSkImageFromRaster(info, std::move(dstPixels), input->width() * info.bytesPerPixel()); } -PassRefPtr<SkImage> ImageBitmap::getSkImageFromDecoder(PassOwnPtr<ImageDecoder> decoder) +PassRefPtr<SkImage> ImageBitmap::getSkImageFromDecoder(std::unique_ptr<ImageDecoder> decoder) { if (!decoder->frameCount()) return nullptr; @@ -126,14 +128,14 @@ // We immediately return a transparent black image with cropRect.size() if (srcRect.isEmpty() && !premultiplyAlpha) { SkImageInfo info = SkImageInfo::Make(cropRect.width(), cropRect.height(), kN32_SkColorType, kUnpremul_SkAlphaType); - OwnPtr<uint8_t[]> dstPixels = adoptArrayPtr(new uint8_t[cropRect.width() * cropRect.height() * info.bytesPerPixel()]()); + std::unique_ptr<uint8_t[]> dstPixels = wrapArrayUnique(new uint8_t[cropRect.width() * cropRect.height() * info.bytesPerPixel()]()); return StaticBitmapImage::create(newSkImageFromRaster(info, std::move(dstPixels), cropRect.width() * info.bytesPerPixel())); } RefPtr<SkImage> skiaImage = image->imageForCurrentFrame(); // Attempt to get raw unpremultiplied image data, executed only when skiaImage is premultiplied. if ((((!premultiplyAlpha && !skiaImage->isOpaque()) || !skiaImage) && image->data() && imageFormat == PremultiplyAlpha) || colorSpaceOp == ImageDecoder::GammaAndColorProfileIgnored) { - OwnPtr<ImageDecoder> decoder(ImageDecoder::create(*(image->data()), + std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(*(image->data()), premultiplyAlpha ? ImageDecoder::AlphaPremultiplied : ImageDecoder::AlphaNotPremultiplied, colorSpaceOp)); if (!decoder) @@ -214,7 +216,7 @@ IntRect videoRect = IntRect(IntPoint(), playerSize); IntRect srcRect = intersection(cropRect, videoRect); - OwnPtr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels); + std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels); if (!buffer) return; @@ -283,7 +285,7 @@ // restore the original ImageData swizzleImageData(srcAddr, srcHeight, srcPixelBytesPerRow, flipY); } else { - OwnPtr<uint8_t[]> copiedDataBuffer = adoptArrayPtr(new uint8_t[dstHeight * dstPixelBytesPerRow]()); + std::unique_ptr<uint8_t[]> copiedDataBuffer = wrapArrayUnique(new uint8_t[dstHeight * dstPixelBytesPerRow]()); if (!srcRect.isEmpty()) { IntPoint srcPoint = IntPoint((cropRect.x() > 0) ? cropRect.x() : 0, (cropRect.y() > 0) ? cropRect.y() : 0); IntPoint dstPoint = IntPoint((cropRect.x() >= 0) ? 0 : -cropRect.x(), (cropRect.y() >= 0) ? 0 : -cropRect.y()); @@ -317,7 +319,7 @@ return; } - OwnPtr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels); + std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels); if (!buffer) return; @@ -443,10 +445,10 @@ return ImageBitmap::create(StaticBitmapImage::create(fromSkSp(image))); } -PassOwnPtr<uint8_t[]> ImageBitmap::copyBitmapData(AlphaDisposition alphaOp) +std::unique_ptr<uint8_t[]> ImageBitmap::copyBitmapData(AlphaDisposition alphaOp) { SkImageInfo info = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorType, (alphaOp == PremultiplyAlpha) ? kPremul_SkAlphaType : kUnpremul_SkAlphaType); - OwnPtr<uint8_t[]> dstPixels = copySkImageData(m_image->imageForCurrentFrame().get(), info); + std::unique_ptr<uint8_t[]> dstPixels = copySkImageData(m_image->imageForCurrentFrame().get(), info); return dstPixels; }
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.h b/third_party/WebKit/Source/core/frame/ImageBitmap.h index 71aba7f..102232a 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmap.h +++ b/third_party/WebKit/Source/core/frame/ImageBitmap.h
@@ -17,6 +17,7 @@ #include "platform/graphics/StaticBitmapImage.h" #include "platform/heap/Handle.h" #include "wtf/PassRefPtr.h" +#include <memory> namespace blink { @@ -41,14 +42,14 @@ static ImageBitmap* create(PassRefPtr<StaticBitmapImage>); static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, const IntRect&, const ImageBitmapOptions& = ImageBitmapOptions()); static ImageBitmap* create(WebExternalTextureMailbox&); - static PassRefPtr<SkImage> getSkImageFromDecoder(PassOwnPtr<ImageDecoder>); + static PassRefPtr<SkImage> getSkImageFromDecoder(std::unique_ptr<ImageDecoder>); // Type and helper function required by CallbackPromiseAdapter: using WebType = sk_sp<SkImage>; static ImageBitmap* take(ScriptPromiseResolver*, sk_sp<SkImage>); StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() : nullptr; } - PassOwnPtr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPremultiplyAlpha); + std::unique_ptr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPremultiplyAlpha); unsigned long width() const; unsigned long height() const; IntSize size() const;
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp index 274315b..6027353 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp +++ b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
@@ -45,7 +45,6 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp index 20a01b9..b8654e6 100644 --- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp +++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
@@ -78,7 +78,7 @@ #include "public/platform/Platform.h" #include "public/platform/WebFrameScheduler.h" #include "public/platform/WebScreenInfo.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -127,7 +127,7 @@ class PostMessageTimer final : public GarbageCollectedFinalized<PostMessageTimer>, public SuspendableTimer { USING_GARBAGE_COLLECTED_MIXIN(PostMessageTimer); public: - PostMessageTimer(LocalDOMWindow& window, MessageEvent* event, PassRefPtr<SecurityOrigin> targetOrigin, PassOwnPtr<SourceLocation> location, UserGestureToken* userGestureToken) + PostMessageTimer(LocalDOMWindow& window, MessageEvent* event, PassRefPtr<SecurityOrigin> targetOrigin, std::unique_ptr<SourceLocation> location, UserGestureToken* userGestureToken) : SuspendableTimer(window.document()) , m_event(event) , m_window(&window) @@ -141,7 +141,7 @@ MessageEvent* event() const { return m_event; } SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } - PassOwnPtr<SourceLocation> takeLocation() { return std::move(m_location); } + std::unique_ptr<SourceLocation> takeLocation() { return std::move(m_location); } UserGestureToken* userGestureToken() const { return m_userGestureToken.get(); } void stop() override { @@ -184,7 +184,7 @@ Member<MessageEvent> m_event; Member<LocalDOMWindow> m_window; RefPtr<SecurityOrigin> m_targetOrigin; - OwnPtr<SourceLocation> m_location; + std::unique_ptr<SourceLocation> m_location; RefPtr<UserGestureToken> m_userGestureToken; bool m_disposalAllowed; }; @@ -695,7 +695,7 @@ m_postMessageTimers.remove(timer); } -void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event* event, PassOwnPtr<SourceLocation> location) +void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event* event, std::unique_ptr<SourceLocation> location) { if (intendedTargetOrigin) { // Check target origin now since the target document may have changed since the timer was scheduled.
diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.h b/third_party/WebKit/Source/core/frame/LocalDOMWindow.h index 87e5acdf..00c57bb 100644 --- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.h +++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.h
@@ -36,9 +36,9 @@ #include "core/frame/LocalFrameLifecycleObserver.h" #include "platform/Supplementable.h" #include "platform/heap/Handle.h" - #include "wtf/Assertions.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -170,7 +170,7 @@ void postMessageTimerFired(PostMessageTimer*); void removePostMessageTimer(PostMessageTimer*); - void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event*, PassOwnPtr<SourceLocation>); + void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event*, std::unique_ptr<SourceLocation>); // Events // EventTarget API
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp index 8c25729a..8bb45280b 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -86,8 +86,9 @@ #include "public/platform/WebScreenInfo.h" #include "public/platform/WebViewScheduler.h" #include "third_party/skia/include/core/SkImage.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { @@ -114,7 +115,7 @@ m_bounds.setWidth(m_bounds.width() * deviceScaleFactor); m_bounds.setHeight(m_bounds.height() * deviceScaleFactor); - m_pictureBuilder = adoptPtr(new SkPictureBuilder(SkRect::MakeIWH(m_bounds.width(), m_bounds.height()))); + m_pictureBuilder = wrapUnique(new SkPictureBuilder(SkRect::MakeIWH(m_bounds.width(), m_bounds.height()))); AffineTransform transform; transform.scale(deviceScaleFactor, deviceScaleFactor); @@ -124,7 +125,7 @@ GraphicsContext& context() { return m_pictureBuilder->context(); } - PassOwnPtr<DragImage> createImage() + std::unique_ptr<DragImage> createImage() { if (m_draggedNode && m_draggedNode->layoutObject()) m_draggedNode->layoutObject()->updateDragState(false); @@ -148,7 +149,7 @@ Member<Node> m_draggedNode; FloatRect m_bounds; float m_opacity; - OwnPtr<SkPictureBuilder> m_pictureBuilder; + std::unique_ptr<SkPictureBuilder> m_pictureBuilder; }; inline float parentPageZoomFactor(LocalFrame* frame) @@ -595,7 +596,7 @@ return ratio; } -PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node) +std::unique_ptr<DragImage> LocalFrame::nodeImage(Node& node) { m_view->updateAllLifecyclePhasesExceptPaint(); LayoutObject* layoutObject = node.layoutObject(); @@ -619,7 +620,7 @@ return dragImageBuilder.createImage(); } -PassOwnPtr<DragImage> LocalFrame::dragImageForSelection(float opacity) +std::unique_ptr<DragImage> LocalFrame::dragImageForSelection(float opacity) { if (!selection().isRange()) return nullptr;
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.h b/third_party/WebKit/Source/core/frame/LocalFrame.h index 7c5a2f34..2165cca6 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.h +++ b/third_party/WebKit/Source/core/frame/LocalFrame.h
@@ -41,6 +41,7 @@ #include "platform/heap/Handle.h" #include "platform/scroll/ScrollTypes.h" #include "wtf/HashSet.h" +#include <memory> namespace blink { @@ -154,8 +155,8 @@ void deviceScaleFactorChanged(); double devicePixelRatio() const; - PassOwnPtr<DragImage> nodeImage(Node&); - PassOwnPtr<DragImage> dragImageForSelection(float opacity); + std::unique_ptr<DragImage> nodeImage(Node&); + std::unique_ptr<DragImage> dragImageForSelection(float opacity); String selectedText() const; String selectedTextForClipboard() const; @@ -212,7 +213,7 @@ const Member<EventHandler> m_eventHandler; const Member<FrameConsole> m_console; const Member<InputMethodController> m_inputMethodController; - OwnPtr<WebFrameScheduler> m_frameScheduler; + std::unique_ptr<WebFrameScheduler> m_frameScheduler; int m_navigationDisableCount;
diff --git a/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.h b/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.h index 7104d6d..9dd45f92 100644 --- a/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.h +++ b/third_party/WebKit/Source/core/frame/PageScaleConstraintsSet.h
@@ -37,7 +37,8 @@ #include "platform/Length.h" #include "platform/geometry/IntSize.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -46,9 +47,9 @@ class CORE_EXPORT PageScaleConstraintsSet { USING_FAST_MALLOC(PageScaleConstraintsSet); public: - static PassOwnPtr<PageScaleConstraintsSet> create() + static std::unique_ptr<PageScaleConstraintsSet> create() { - return adoptPtr(new PageScaleConstraintsSet); + return wrapUnique(new PageScaleConstraintsSet); } void setDefaultConstraints(const PageScaleConstraints&);
diff --git a/third_party/WebKit/Source/core/frame/Settings.cpp b/third_party/WebKit/Source/core/frame/Settings.cpp index 7ba6251f..066ba97 100644 --- a/third_party/WebKit/Source/core/frame/Settings.cpp +++ b/third_party/WebKit/Source/core/frame/Settings.cpp
@@ -27,6 +27,8 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/scroll/ScrollbarTheme.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -68,9 +70,9 @@ { } -PassOwnPtr<Settings> Settings::create() +std::unique_ptr<Settings> Settings::create() { - return adoptPtr(new Settings); + return wrapUnique(new Settings); } SETTINGS_SETTER_BODIES
diff --git a/third_party/WebKit/Source/core/frame/Settings.h b/third_party/WebKit/Source/core/frame/Settings.h index 6ab18c6..8b909e3 100644 --- a/third_party/WebKit/Source/core/frame/Settings.h +++ b/third_party/WebKit/Source/core/frame/Settings.h
@@ -44,6 +44,7 @@ #include "public/platform/PointerProperties.h" #include "public/platform/WebDisplayMode.h" #include "public/platform/WebViewportStyle.h" +#include <memory> namespace blink { @@ -51,7 +52,7 @@ WTF_MAKE_NONCOPYABLE(Settings); USING_FAST_MALLOC(Settings); public: - static PassOwnPtr<Settings> create(); + static std::unique_ptr<Settings> create(); GenericFontFamilySettings& genericFontFamilySettings() { return m_genericFontFamilySettings; } void notifyGenericFontFamilyChange() { invalidate(SettingsDelegate::FontFamilyChange); }
diff --git a/third_party/WebKit/Source/core/frame/SettingsDelegate.cpp b/third_party/WebKit/Source/core/frame/SettingsDelegate.cpp index 71236be..1b7c221 100644 --- a/third_party/WebKit/Source/core/frame/SettingsDelegate.cpp +++ b/third_party/WebKit/Source/core/frame/SettingsDelegate.cpp
@@ -31,10 +31,11 @@ #include "core/frame/SettingsDelegate.h" #include "core/frame/Settings.h" +#include <memory> namespace blink { -SettingsDelegate::SettingsDelegate(PassOwnPtr<Settings> settings) +SettingsDelegate::SettingsDelegate(std::unique_ptr<Settings> settings) : m_settings(std::move(settings)) { if (m_settings)
diff --git a/third_party/WebKit/Source/core/frame/SettingsDelegate.h b/third_party/WebKit/Source/core/frame/SettingsDelegate.h index 561cfa7..4b37ff97 100644 --- a/third_party/WebKit/Source/core/frame/SettingsDelegate.h +++ b/third_party/WebKit/Source/core/frame/SettingsDelegate.h
@@ -33,8 +33,7 @@ #include "core/CoreExport.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -43,7 +42,7 @@ class CORE_EXPORT SettingsDelegate { DISALLOW_NEW(); public: - explicit SettingsDelegate(PassOwnPtr<Settings>); + explicit SettingsDelegate(std::unique_ptr<Settings>); virtual ~SettingsDelegate(); Settings* settings() const { return m_settings.get(); } @@ -67,7 +66,7 @@ virtual void settingsChanged(ChangeType) = 0; protected: - OwnPtr<Settings> const m_settings; + std::unique_ptr<Settings> const m_settings; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/frame/TopControls.h b/third_party/WebKit/Source/core/frame/TopControls.h index 49dd9ee..e6cef92 100644 --- a/third_party/WebKit/Source/core/frame/TopControls.h +++ b/third_party/WebKit/Source/core/frame/TopControls.h
@@ -8,8 +8,6 @@ #include "core/CoreExport.h" #include "platform/heap/Handle.h" #include "public/platform/WebTopControlsState.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" namespace blink { class FrameHost;
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h index 9f27be2..a75982d 100644 --- a/third_party/WebKit/Source/core/frame/UseCounter.h +++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -31,8 +31,6 @@ #include "core/css/parser/CSSParserMode.h" #include "wtf/BitVector.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" #include <v8.h>
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.cpp b/third_party/WebKit/Source/core/frame/VisualViewport.cpp index cd08431..85c73df4 100644 --- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp +++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
@@ -55,6 +55,7 @@ #include "public/platform/WebLayerTreeView.h" #include "public/platform/WebScrollbar.h" #include "public/platform/WebScrollbarLayer.h" +#include <memory> using blink::WebLayer; using blink::WebLayerTreeView; @@ -375,7 +376,7 @@ return; } - if (currentLayerTreeRoot->parent() && currentLayerTreeRoot->parent() == m_innerViewportScrollLayer) + if (currentLayerTreeRoot->parent() && currentLayerTreeRoot->parent() == m_innerViewportScrollLayer.get()) return; if (!m_innerViewportScrollLayer) { @@ -447,7 +448,7 @@ bool isHorizontal = orientation == WebScrollbar::Horizontal; GraphicsLayer* scrollbarGraphicsLayer = isHorizontal ? m_overlayScrollbarHorizontal.get() : m_overlayScrollbarVertical.get(); - OwnPtr<WebScrollbarLayer>& webScrollbarLayer = isHorizontal ? + std::unique_ptr<WebScrollbarLayer>& webScrollbarLayer = isHorizontal ? m_webOverlayScrollbarHorizontal : m_webOverlayScrollbarVertical; ScrollbarThemeOverlay& theme = ScrollbarThemeOverlay::mobileTheme(); @@ -832,7 +833,7 @@ name = "Overlay Scrollbar Horizontal Layer"; } else if (graphicsLayer == m_overlayScrollbarVertical.get()) { name = "Overlay Scrollbar Vertical Layer"; - } else if (graphicsLayer == m_rootTransformLayer) { + } else if (graphicsLayer == m_rootTransformLayer.get()) { name = "Root Transform Layer"; } else { ASSERT_NOT_REACHED();
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.h b/third_party/WebKit/Source/core/frame/VisualViewport.h index d15d234..58b3d7b9 100644 --- a/third_party/WebKit/Source/core/frame/VisualViewport.h +++ b/third_party/WebKit/Source/core/frame/VisualViewport.h
@@ -40,8 +40,7 @@ #include "platform/scroll/ScrollableArea.h" #include "public/platform/WebScrollbar.h" #include "public/platform/WebSize.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { class WebLayerTreeView; @@ -248,15 +247,15 @@ } Member<FrameHost> m_frameHost; - OwnPtr<GraphicsLayer> m_rootTransformLayer; - OwnPtr<GraphicsLayer> m_innerViewportContainerLayer; - OwnPtr<GraphicsLayer> m_overscrollElasticityLayer; - OwnPtr<GraphicsLayer> m_pageScaleLayer; - OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; - OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; - OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; - OwnPtr<WebScrollbarLayer> m_webOverlayScrollbarHorizontal; - OwnPtr<WebScrollbarLayer> m_webOverlayScrollbarVertical; + std::unique_ptr<GraphicsLayer> m_rootTransformLayer; + std::unique_ptr<GraphicsLayer> m_innerViewportContainerLayer; + std::unique_ptr<GraphicsLayer> m_overscrollElasticityLayer; + std::unique_ptr<GraphicsLayer> m_pageScaleLayer; + std::unique_ptr<GraphicsLayer> m_innerViewportScrollLayer; + std::unique_ptr<GraphicsLayer> m_overlayScrollbarHorizontal; + std::unique_ptr<GraphicsLayer> m_overlayScrollbarVertical; + std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarHorizontal; + std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarVertical; // Offset of the visual viewport from the main frame's origin, in CSS pixels. FloatPoint m_offset;
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h index 257ccb0..3b611112 100644 --- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h +++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h
@@ -15,7 +15,6 @@ #include "platform/network/ResourceRequest.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/ReferrerPolicy.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp index 3f0944bf..643530e 100644 --- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp +++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -60,9 +60,11 @@ #include "public/platform/Platform.h" #include "public/platform/WebAddressSpace.h" #include "public/platform/WebURLRequest.h" +#include "wtf/PtrUtil.h" #include "wtf/StringHasher.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/StringUTF8Adaptor.h" +#include <memory> namespace blink { @@ -343,9 +345,9 @@ m_selfSource = new CSPSource(this, m_selfProtocol, origin->host(), origin->port(), String(), CSPSource::NoWildcard, CSPSource::NoWildcard); } -PassOwnPtr<Vector<CSPHeaderAndType>> ContentSecurityPolicy::headers() const +std::unique_ptr<Vector<CSPHeaderAndType>> ContentSecurityPolicy::headers() const { - OwnPtr<Vector<CSPHeaderAndType>> headers = adoptPtr(new Vector<CSPHeaderAndType>); + std::unique_ptr<Vector<CSPHeaderAndType>> headers = wrapUnique(new Vector<CSPHeaderAndType>); for (const auto& policy : m_policies) { CSPHeaderAndType headerAndType(policy->header(), policy->headerType()); headers->append(headerAndType); @@ -808,7 +810,7 @@ if (!SecurityOrigin::isSecure(document->url()) && document->loader()) init.setStatusCode(document->loader()->response().httpStatusCode()); - OwnPtr<SourceLocation> location = SourceLocation::capture(document); + std::unique_ptr<SourceLocation> location = SourceLocation::capture(document); if (location->lineNumber()) { KURL source = KURL(ParsedURLString, location->url()); init.setSourceFile(stripURLForUseInReport(document, source, redirectStatus));
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h index 88554042..9c4eceb0 100644 --- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h +++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h
@@ -39,11 +39,11 @@ #include "platform/weborigin/ReferrerPolicy.h" #include "public/platform/WebInsecureRequestPolicy.h" #include "wtf/HashSet.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/StringHash.h" #include "wtf/text/TextPosition.h" #include "wtf/text/WTFString.h" +#include <memory> #include <utility> namespace WTF { @@ -148,7 +148,7 @@ void addPolicyFromHeaderValue(const String&, ContentSecurityPolicyHeaderType, ContentSecurityPolicyHeaderSource); void reportAccumulatedHeaders(FrameLoaderClient*) const; - PassOwnPtr<Vector<CSPHeaderAndType>> headers() const; + std::unique_ptr<Vector<CSPHeaderAndType>> headers() const; bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const; bool allowInlineEventHandler(const String& source, const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const;
diff --git a/third_party/WebKit/Source/core/html/ClassList.cpp b/third_party/WebKit/Source/core/html/ClassList.cpp index 1637c65..8637d0a 100644 --- a/third_party/WebKit/Source/core/html/ClassList.cpp +++ b/third_party/WebKit/Source/core/html/ClassList.cpp
@@ -25,6 +25,7 @@ #include "core/html/ClassList.h" #include "core/dom/Document.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -54,7 +55,7 @@ ASSERT(m_element->hasClass()); if (m_element->document().inQuirksMode()) { if (!m_classNamesForQuirksMode) - m_classNamesForQuirksMode = adoptPtr(new SpaceSplitString(value(), SpaceSplitString::ShouldNotFoldCase)); + m_classNamesForQuirksMode = wrapUnique(new SpaceSplitString(value(), SpaceSplitString::ShouldNotFoldCase)); return *m_classNamesForQuirksMode.get(); } return m_element->classNames();
diff --git a/third_party/WebKit/Source/core/html/ClassList.h b/third_party/WebKit/Source/core/html/ClassList.h index 1ee73c4..9656909 100644 --- a/third_party/WebKit/Source/core/html/ClassList.h +++ b/third_party/WebKit/Source/core/html/ClassList.h
@@ -29,7 +29,7 @@ #include "core/dom/DOMTokenList.h" #include "core/dom/Element.h" #include "core/dom/SpaceSplitString.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -64,7 +64,7 @@ void setValue(const AtomicString& value) override { m_element->setAttribute(HTMLNames::classAttr, value); } Member<Element> m_element; - mutable OwnPtr<SpaceSplitString> m_classNamesForQuirksMode; + mutable std::unique_ptr<SpaceSplitString> m_classNamesForQuirksMode; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp b/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp index f9f7872b..7e72fd17 100644 --- a/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp
@@ -30,6 +30,7 @@ #include "core/layout/LayoutImage.h" #include "platform/graphics/Path.h" #include "platform/transforms/AffineTransform.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -165,7 +166,7 @@ } // Cache the original path, not depending on containerObject. - m_path = adoptPtr(new Path(path)); + m_path = wrapUnique(new Path(path)); } // Zoom the path into coordinates of the container object.
diff --git a/third_party/WebKit/Source/core/html/HTMLAreaElement.h b/third_party/WebKit/Source/core/html/HTMLAreaElement.h index 1a85d80ed..c92e20c 100644 --- a/third_party/WebKit/Source/core/html/HTMLAreaElement.h +++ b/third_party/WebKit/Source/core/html/HTMLAreaElement.h
@@ -26,6 +26,7 @@ #include "core/CoreExport.h" #include "core/html/HTMLAnchorElement.h" #include "platform/geometry/LayoutRect.h" +#include <memory> namespace blink { @@ -67,7 +68,7 @@ enum Shape { Default, Poly, Rect, Circle }; void invalidateCachedPath(); - mutable OwnPtr<Path> m_path; + mutable std::unique_ptr<Path> m_path; Vector<double> m_coords; Shape m_shape; };
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp index 5df9847..ca982ba 100644 --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -68,7 +68,9 @@ #include "public/platform/Platform.h" #include "public/platform/WebTraceLocation.h" #include "wtf/CheckedNumeric.h" +#include "wtf/PtrUtil.h" #include <math.h> +#include <memory> #include <v8.h> namespace blink { @@ -208,7 +210,7 @@ return renderingContextFactories()[type].get(); } -void HTMLCanvasElement::registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContextFactory> renderingContextFactory) +void HTMLCanvasElement::registerRenderingContextFactory(std::unique_ptr<CanvasRenderingContextFactory> renderingContextFactory) { CanvasRenderingContext::ContextType type = renderingContextFactory->getContextType(); DCHECK(type < CanvasRenderingContext::ContextTypeCount); @@ -769,9 +771,9 @@ class UnacceleratedSurfaceFactory : public RecordingImageBufferFallbackSurfaceFactory { public: - virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode opacityMode) + virtual std::unique_ptr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode opacityMode) { - return adoptPtr(new UnacceleratedImageBufferSurface(size, opacityMode)); + return wrapUnique(new UnacceleratedImageBufferSurface(size, opacityMode)); } virtual ~UnacceleratedSurfaceFactory() { } @@ -788,7 +790,7 @@ return true; } -PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount) +std::unique_ptr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount) { OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque; @@ -797,13 +799,13 @@ // If 3d, but the use of the canvas will be for non-accelerated content // then make a non-accelerated ImageBuffer. This means copying the internal // Image will require a pixel readback, but that is unavoidable in this case. - return adoptPtr(new AcceleratedImageBufferSurface(deviceSize, opacityMode)); + return wrapUnique(new AcceleratedImageBufferSurface(deviceSize, opacityMode)); } if (shouldAccelerate(deviceSize)) { if (document().settings()) *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASampleCount(); - OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSurface(deviceSize, *msaaSampleCount, opacityMode, Canvas2DLayerBridge::EnableAcceleration)); + std::unique_ptr<ImageBufferSurface> surface = wrapUnique(new Canvas2DImageBufferSurface(deviceSize, *msaaSampleCount, opacityMode, Canvas2DLayerBridge::EnableAcceleration)); if (surface->isValid()) { CanvasMetrics::countCanvasContextUsage(CanvasMetrics::GPUAccelerated2DCanvasImageBufferCreated); return surface; @@ -811,15 +813,15 @@ CanvasMetrics::countCanvasContextUsage(CanvasMetrics::GPUAccelerated2DCanvasImageBufferCreationFailed); } - OwnPtr<RecordingImageBufferFallbackSurfaceFactory> surfaceFactory = adoptPtr(new UnacceleratedSurfaceFactory()); + std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> surfaceFactory = wrapUnique(new UnacceleratedSurfaceFactory()); if (shouldUseDisplayList(deviceSize)) { - OwnPtr<ImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(deviceSize, std::move(surfaceFactory), opacityMode)); + std::unique_ptr<ImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(deviceSize, std::move(surfaceFactory), opacityMode)); if (surface->isValid()) { CanvasMetrics::countCanvasContextUsage(CanvasMetrics::DisplayList2DCanvasImageBufferCreated); return surface; } - surfaceFactory = adoptPtr(new UnacceleratedSurfaceFactory()); // recreate because previous one was released + surfaceFactory = wrapUnique(new UnacceleratedSurfaceFactory()); // recreate because previous one was released } auto surface = surfaceFactory->createSurface(deviceSize, opacityMode); if (!surface->isValid()) { @@ -837,7 +839,7 @@ m_context->loseContext(CanvasRenderingContext::SyntheticLostContext); } -void HTMLCanvasElement::createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurface) +void HTMLCanvasElement::createImageBufferInternal(std::unique_ptr<ImageBufferSurface> externalSurface) { DCHECK(!m_imageBuffer); @@ -848,7 +850,7 @@ return; int msaaSampleCount = 0; - OwnPtr<ImageBufferSurface> surface; + std::unique_ptr<ImageBufferSurface> surface; if (externalSurface) { surface = std::move(externalSurface); } else { @@ -957,7 +959,7 @@ return m_imageBuffer.get(); } -void HTMLCanvasElement::createImageBufferUsingSurfaceForTesting(PassOwnPtr<ImageBufferSurface> surface) +void HTMLCanvasElement::createImageBufferUsingSurfaceForTesting(std::unique_ptr<ImageBufferSurface> surface) { discardImageBuffer(); setWidth(surface->size().width()); @@ -1184,7 +1186,7 @@ void HTMLCanvasElement::createSurfaceLayerBridge() { - m_surfaceLayerBridge = adoptPtr(new CanvasSurfaceLayerBridge()); + m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge()); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.h b/third_party/WebKit/Source/core/html/HTMLCanvasElement.h index cb6c241..7ba4aa0 100644 --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.h +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.h
@@ -46,6 +46,7 @@ #include "platform/graphics/GraphicsTypes3D.h" #include "platform/graphics/ImageBufferClient.h" #include "platform/heap/Handle.h" +#include <memory> #define CanvasDefaultInterpolationQuality InterpolationLow @@ -185,9 +186,9 @@ DECLARE_VIRTUAL_TRACE_WRAPPERS(); - void createImageBufferUsingSurfaceForTesting(PassOwnPtr<ImageBufferSurface>); + void createImageBufferUsingSurfaceForTesting(std::unique_ptr<ImageBufferSurface>); - static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContextFactory>); + static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingContextFactory>); void updateExternallyAllocatedMemory() const; void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newStyle); @@ -212,7 +213,7 @@ explicit HTMLCanvasElement(Document&); void dispose(); - using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; + using ContextFactoryVector = Vector<std::unique_ptr<CanvasRenderingContextFactory>>; static ContextFactoryVector& renderingContextFactories(); static CanvasRenderingContextFactory* getRenderingContextFactory(int); @@ -222,9 +223,9 @@ void reset(); - PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount); + std::unique_ptr<ImageBufferSurface> createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount); void createImageBuffer(); - void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurface); + void createImageBufferInternal(std::unique_ptr<ImageBufferSurface> externalSurface); bool shouldUseDisplayList(const IntSize& deviceSize); void setSurfaceSize(const IntSize&); @@ -252,12 +253,12 @@ // after the first attempt failed. mutable bool m_didFailToCreateImageBuffer; bool m_imageBufferIsClear; - OwnPtr<ImageBuffer> m_imageBuffer; + std::unique_ptr<ImageBuffer> m_imageBuffer; mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platforms that have to copy the image buffer to render (and for CSSCanvasValue). // Used for OffscreenCanvas that controls this HTML canvas element - OwnPtr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; + std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp index f4c621c..1f9acf5e 100644 --- a/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp
@@ -11,6 +11,7 @@ #include "core/loader/EmptyClients.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -22,7 +23,7 @@ HTMLDocument& document() const { return *m_document; } private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/html/HTMLFormElement.h b/third_party/WebKit/Source/core/html/HTMLFormElement.h index 53feb7a0..df92148 100644 --- a/third_party/WebKit/Source/core/html/HTMLFormElement.h +++ b/third_party/WebKit/Source/core/html/HTMLFormElement.h
@@ -29,7 +29,6 @@ #include "core/html/HTMLFormControlElement.h" #include "core/html/forms/RadioButtonGroupScope.h" #include "core/loader/FormSubmission.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp index 551499de..76e70be 100644 --- a/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp
@@ -8,6 +8,7 @@ #include "core/frame/FrameView.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -20,7 +21,7 @@ { } - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; TEST_F(HTMLImageElementTest, width)
diff --git a/third_party/WebKit/Source/core/html/HTMLImageFallbackHelper.cpp b/third_party/WebKit/Source/core/html/HTMLImageFallbackHelper.cpp index 8e367eb6..843cb92 100644 --- a/third_party/WebKit/Source/core/html/HTMLImageFallbackHelper.cpp +++ b/third_party/WebKit/Source/core/html/HTMLImageFallbackHelper.cpp
@@ -16,7 +16,6 @@ #include "core/html/HTMLImageLoader.h" #include "core/html/HTMLInputElement.h" #include "core/html/HTMLStyleElement.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp index a5bc1375..bb5c667 100644 --- a/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
@@ -10,6 +10,7 @@ #include "core/html/HTMLHtmlElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -36,7 +37,7 @@ toHTMLBodyElement(html->firstChild())->setInnerHTML("<input type='range' />", ASSERT_NO_EXCEPTION); documentWithoutFrame->appendChild(html); - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(); auto& document = pageHolder->document(); EXPECT_NE(nullptr, document.frameHost());
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp index bd1dc1d..76a40bc 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -91,6 +91,7 @@ #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" #include "wtf/CurrentTime.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include <limits> @@ -3612,7 +3613,7 @@ void HTMLMediaElement::mediaSourceOpened(WebMediaSource* webMediaSource) { - m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); + m_mediaSource->setWebMediaSourceAndOpen(wrapUnique(webMediaSource)); } bool HTMLMediaElement::isInteractiveContent() const
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.h b/third_party/WebKit/Source/core/html/HTMLMediaElement.h index 653bd314..79c1a3e 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.h +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.h
@@ -40,6 +40,7 @@ #include "public/platform/WebAudioSourceProviderClient.h" #include "public/platform/WebMediaPlayerClient.h" #include "public/platform/WebMimeRegistry.h" +#include <memory> namespace blink { @@ -547,7 +548,7 @@ DeferredLoadState m_deferredLoadState; Timer<HTMLMediaElement> m_deferredLoadTimer; - OwnPtr<WebMediaPlayer> m_webMediaPlayer; + std::unique_ptr<WebMediaPlayer> m_webMediaPlayer; WebLayer* m_webLayer; DisplayMode m_displayMode; @@ -596,8 +597,8 @@ Member<CueTimeline> m_cueTimeline; HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolvers; - OwnPtr<CancellableTaskFactory> m_playPromiseResolveTask; - OwnPtr<CancellableTaskFactory> m_playPromiseRejectTask; + std::unique_ptr<CancellableTaskFactory> m_playPromiseResolveTask; + std::unique_ptr<CancellableTaskFactory> m_playPromiseRejectTask; HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolveList; HeapVector<Member<ScriptPromiseResolver>> m_playPromiseRejectList; ExceptionCode m_playPromiseErrorCode;
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaSource.h b/third_party/WebKit/Source/core/html/HTMLMediaSource.h index 796e6f4..bdee973 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaSource.h +++ b/third_party/WebKit/Source/core/html/HTMLMediaSource.h
@@ -35,6 +35,7 @@ #include "core/html/URLRegistry.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -55,7 +56,7 @@ // Once attached, the source uses the element to synchronously service some // API operations like duration change that may need to initiate seek. virtual bool attachToElement(HTMLMediaElement*) = 0; - virtual void setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource>) = 0; + virtual void setWebMediaSourceAndOpen(std::unique_ptr<WebMediaSource>) = 0; virtual void close() = 0; virtual bool isClosed() const = 0; virtual double duration() const = 0;
diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp index 8f8622b..f24144ea 100644 --- a/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp
@@ -11,6 +11,7 @@ #include "core/loader/EmptyClients.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -20,7 +21,7 @@ HTMLDocument& document() const { return *m_document; } private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp index 93529b68..76cad26 100644 --- a/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp
@@ -21,7 +21,8 @@ #include "core/testing/DummyPageHolder.h" #include "platform/testing/UnitTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -38,8 +39,8 @@ void forceLayoutFlag(); private: - OwnPtr<SpellCheckerClient> m_spellCheckerClient; - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<SpellCheckerClient> m_spellCheckerClient; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; Persistent<HTMLTextFormControlElement> m_textControl; @@ -62,7 +63,7 @@ { Page::PageClients pageClients; fillWithEmptyClients(pageClients); - m_spellCheckerClient = adoptPtr(new DummySpellCheckerClient); + m_spellCheckerClient = wrapUnique(new DummySpellCheckerClient); pageClients.spellCheckerClient = m_spellCheckerClient.get(); m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients);
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp index a68cc16..04ae3c0f 100644 --- a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp
@@ -46,6 +46,7 @@ #include "platform/graphics/ImageBuffer.h" #include "platform/graphics/gpu/Extensions3DUtil.h" #include "public/platform/WebCanvas.h" +#include <memory> namespace blink { @@ -294,7 +295,7 @@ IntSize intrinsicSize(videoWidth(), videoHeight()); // FIXME: Not sure if we dhould we be doing anything with the AccelerationHint argument here? - OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); + std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); if (!imageBuffer) { *status = InvalidSourceImageStatus; return nullptr;
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp index 23c88ae..d50e429 100644 --- a/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp
@@ -14,6 +14,8 @@ #include "public/platform/WebSize.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -64,9 +66,9 @@ return new StubFrameLoaderClient; } - PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override + std::unique_ptr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override { - return adoptPtr(new MockWebMediaPlayer); + return wrapUnique(new MockWebMediaPlayer); } }; @@ -93,7 +95,7 @@ return static_cast<MockWebMediaPlayer*>(m_video->webMediaPlayer()); } - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLVideoElement> m_video; };
diff --git a/third_party/WebKit/Source/core/html/LinkManifest.h b/third_party/WebKit/Source/core/html/LinkManifest.h index 7e4db20..0d34d30b 100644 --- a/third_party/WebKit/Source/core/html/LinkManifest.h +++ b/third_party/WebKit/Source/core/html/LinkManifest.h
@@ -7,7 +7,6 @@ #include "core/html/LinkResource.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/PublicURLManager.h b/third_party/WebKit/Source/core/html/PublicURLManager.h index ec7fbb5..ec59435 100644 --- a/third_party/WebKit/Source/core/html/PublicURLManager.h +++ b/third_party/WebKit/Source/core/html/PublicURLManager.h
@@ -30,7 +30,6 @@ #include "platform/heap/Handle.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/ValidityState.h b/third_party/WebKit/Source/core/html/ValidityState.h index 13dd57e5..ad43fe0 100644 --- a/third_party/WebKit/Source/core/html/ValidityState.h +++ b/third_party/WebKit/Source/core/html/ValidityState.h
@@ -26,7 +26,6 @@ #include "bindings/core/v8/ScriptWrappable.h" #include "core/html/FormAssociatedElement.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp index 8781100..0ea4fc06 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
@@ -17,6 +17,7 @@ #include "public/platform/WebTraceLocation.h" #include "wtf/CurrentTime.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -90,7 +91,7 @@ , m_callback(callback) { ASSERT(m_data->length() == (unsigned) (size.height() * size.width() * 4)); - m_encodedImage = adoptPtr(new Vector<unsigned char>()); + m_encodedImage = wrapUnique(new Vector<unsigned char>()); m_pixelRowStride = size.width() * NumChannelsPng; m_idleTaskStatus = IdleTaskNotSupported; m_numRowsCompleted = 0;
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h index b1176d55..0bb35ed 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
@@ -7,9 +7,9 @@ #include "core/fileapi/BlobCallback.h" #include "platform/geometry/IntSize.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -66,10 +66,10 @@ void dispose(); - OwnPtr<PNGImageEncoderState> m_pngEncoderState; - OwnPtr<JPEGImageEncoderState> m_jpegEncoderState; + std::unique_ptr<PNGImageEncoderState> m_pngEncoderState; + std::unique_ptr<JPEGImageEncoderState> m_jpegEncoderState; Member<DOMUint8ClampedArray> m_data; - OwnPtr<Vector<unsigned char>> m_encodedImage; + std::unique_ptr<Vector<unsigned char>> m_encodedImage; int m_numRowsCompleted; const IntSize m_size;
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp index 4717d51..0fa892a 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.cpp
@@ -4,6 +4,8 @@ #include "core/html/canvas/CanvasDrawListener.h" +#include <memory> + namespace blink { CanvasDrawListener::~CanvasDrawListener() {} @@ -23,7 +25,7 @@ m_frameCaptureRequested = true; } -CanvasDrawListener::CanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler> handler) +CanvasDrawListener::CanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler> handler) : m_frameCaptureRequested(true) , m_handler(std::move(handler)) {
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h index b03a04d..e0a654db 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h +++ b/third_party/WebKit/Source/core/html/canvas/CanvasDrawListener.h
@@ -9,6 +9,7 @@ #include "platform/heap/Handle.h" #include "public/platform/WebCanvasCaptureHandler.h" #include "wtf/PassRefPtr.h" +#include <memory> class SkImage; @@ -22,10 +23,10 @@ void requestFrame(); protected: - explicit CanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler>); + explicit CanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler>); bool m_frameCaptureRequested; - OwnPtr<WebCanvasCaptureHandler> m_handler; + std::unique_ptr<WebCanvasCaptureHandler> m_handler; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp index cc641808..a6da4a2 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp
@@ -10,6 +10,7 @@ #include "core/style/ComputedStyle.h" #include "platform/fonts/FontCache.h" #include "public/platform/Platform.h" +#include "wtf/PtrUtil.h" namespace { @@ -134,7 +135,7 @@ if (m_pruningScheduled) return; ASSERT(!m_mainCachePurgePreventer); - m_mainCachePurgePreventer = adoptPtr(new FontCachePurgePreventer); + m_mainCachePurgePreventer = wrapUnique(new FontCachePurgePreventer); Platform::current()->currentThread()->addTaskObserver(this); m_pruningScheduled = true; }
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.h b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.h index 47fc912..f17c620 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.h +++ b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.h
@@ -13,6 +13,7 @@ #include "wtf/HashMap.h" #include "wtf/ListHashSet.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -55,7 +56,7 @@ HashMap<String, Font> m_fontsResolvedUsingDefaultStyle; MutableStylePropertyMap m_fetchedFonts; ListHashSet<String> m_fontLRUList; - OwnPtr<FontCachePurgePreventer> m_mainCachePurgePreventer; + std::unique_ptr<FontCachePurgePreventer> m_mainCachePurgePreventer; Member<Document> m_document; RefPtr<ComputedStyle> m_defaultFontStyle; bool m_pruningScheduled;
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp index 462df0e..ffd08f2 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasFontCacheTest.cpp
@@ -13,6 +13,7 @@ #include "platform/graphics/UnacceleratedImageBufferSurface.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> using ::testing::Mock; @@ -30,7 +31,7 @@ CanvasFontCache* cache() { return m_document->canvasFontCache(); } private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; Persistent<HTMLCanvasElement> m_canvasElement; };
diff --git a/third_party/WebKit/Source/core/html/forms/ButtonInputType.cpp b/third_party/WebKit/Source/core/html/forms/ButtonInputType.cpp index 8c287c76..3a921fe3 100644 --- a/third_party/WebKit/Source/core/html/forms/ButtonInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/ButtonInputType.cpp
@@ -31,7 +31,6 @@ #include "core/html/forms/ButtonInputType.h" #include "core/InputTypeNames.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp b/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp index e6ef9410..1872d26 100644 --- a/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp
@@ -35,7 +35,6 @@ #include "core/events/KeyboardEvent.h" #include "core/html/HTMLInputElement.h" #include "platform/text/PlatformLocale.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp index 55a62830..e7510c5 100644 --- a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp
@@ -49,7 +49,6 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/UserGestureIndicator.h" #include "platform/graphics/Color.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/DateInputType.cpp b/third_party/WebKit/Source/core/html/forms/DateInputType.cpp index ab75ee4..71bbb9ba 100644 --- a/third_party/WebKit/Source/core/html/forms/DateInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/DateInputType.cpp
@@ -37,7 +37,6 @@ #include "core/html/forms/DateTimeFieldsState.h" #include "platform/DateComponents.h" #include "platform/text/PlatformLocale.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/DateTimeLocalInputType.cpp b/third_party/WebKit/Source/core/html/forms/DateTimeLocalInputType.cpp index 7c525fc2..1e6f6a62 100644 --- a/third_party/WebKit/Source/core/html/forms/DateTimeLocalInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/DateTimeLocalInputType.cpp
@@ -37,7 +37,6 @@ #include "core/html/forms/DateTimeFieldsState.h" #include "platform/DateComponents.h" #include "platform/text/PlatformLocale.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/FileInputType.cpp b/third_party/WebKit/Source/core/html/forms/FileInputType.cpp index fe130fe..98353fb 100644 --- a/third_party/WebKit/Source/core/html/forms/FileInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/FileInputType.cpp
@@ -40,7 +40,6 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/UserGestureIndicator.h" #include "platform/text/PlatformLocale.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/html/forms/FormController.cpp b/third_party/WebKit/Source/core/html/forms/FormController.cpp index e28c74d..558ada8 100644 --- a/third_party/WebKit/Source/core/html/forms/FormController.cpp +++ b/third_party/WebKit/Source/core/html/forms/FormController.cpp
@@ -26,7 +26,9 @@ #include "platform/FileChooser.h" #include "wtf/Deque.h" #include "wtf/HashTableDeletedValueType.h" +#include "wtf/PtrUtil.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -176,8 +178,8 @@ USING_FAST_MALLOC(SavedFormState); public: - static PassOwnPtr<SavedFormState> create(); - static PassOwnPtr<SavedFormState> deserialize(const Vector<String>&, size_t& index); + static std::unique_ptr<SavedFormState> create(); + static std::unique_ptr<SavedFormState> deserialize(const Vector<String>&, size_t& index); void serializeTo(Vector<String>&) const; bool isEmpty() const { return m_stateForNewFormElements.isEmpty(); } void appendControlState(const AtomicString& name, const AtomicString& type, const FormControlState&); @@ -193,9 +195,9 @@ size_t m_controlStateCount; }; -PassOwnPtr<SavedFormState> SavedFormState::create() +std::unique_ptr<SavedFormState> SavedFormState::create() { - return adoptPtr(new SavedFormState); + return wrapUnique(new SavedFormState); } static bool isNotFormControlTypeCharacter(UChar ch) @@ -203,7 +205,7 @@ return ch != '-' && (ch > 'z' || ch < 'a'); } -PassOwnPtr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVector, size_t& index) +std::unique_ptr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVector, size_t& index) { if (index >= stateVector.size()) return nullptr; @@ -211,7 +213,7 @@ size_t itemCount = stateVector[index++].toUInt(); if (!itemCount) return nullptr; - OwnPtr<SavedFormState> savedFormState = adoptPtr(new SavedFormState); + std::unique_ptr<SavedFormState> savedFormState = wrapUnique(new SavedFormState); while (itemCount--) { if (index + 1 >= stateVector.size()) return nullptr; @@ -411,7 +413,7 @@ Vector<String> DocumentState::toStateVector() { FormKeyGenerator* keyGenerator = FormKeyGenerator::create(); - OwnPtr<SavedFormStateMap> stateMap = adoptPtr(new SavedFormStateMap); + std::unique_ptr<SavedFormStateMap> stateMap = wrapUnique(new SavedFormStateMap); for (const auto& formControl : m_formControls) { HTMLFormControlElementWithState* control = formControl.get(); ASSERT(control->inShadowIncludingDocument()); @@ -488,7 +490,7 @@ while (i + 1 < stateVector.size()) { AtomicString formKey = AtomicString(stateVector[i++]); - OwnPtr<SavedFormState> state = SavedFormState::deserialize(stateVector, i); + std::unique_ptr<SavedFormState> state = SavedFormState::deserialize(stateVector, i); if (!state) { i = 0; break;
diff --git a/third_party/WebKit/Source/core/html/forms/FormController.h b/third_party/WebKit/Source/core/html/forms/FormController.h index 785237b..16a6c75 100644 --- a/third_party/WebKit/Source/core/html/forms/FormController.h +++ b/third_party/WebKit/Source/core/html/forms/FormController.h
@@ -28,6 +28,7 @@ #include "wtf/ListHashSet.h" #include "wtf/Vector.h" #include "wtf/text/AtomicStringHash.h" +#include <memory> namespace blink { @@ -72,7 +73,7 @@ m_values.append(value); } -using SavedFormStateMap = HashMap<AtomicString, OwnPtr<SavedFormState>>; +using SavedFormStateMap = HashMap<AtomicString, std::unique_ptr<SavedFormState>>; class DocumentState final : public GarbageCollected<DocumentState> { public:
diff --git a/third_party/WebKit/Source/core/html/forms/HiddenInputType.cpp b/third_party/WebKit/Source/core/html/forms/HiddenInputType.cpp index ebf7327..a2b0666 100644 --- a/third_party/WebKit/Source/core/html/forms/HiddenInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/HiddenInputType.cpp
@@ -36,7 +36,6 @@ #include "core/html/FormData.h" #include "core/html/HTMLInputElement.h" #include "core/html/forms/FormController.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/ImageInputType.cpp b/third_party/WebKit/Source/core/html/forms/ImageInputType.cpp index a6d333a..3e87020 100644 --- a/third_party/WebKit/Source/core/html/forms/ImageInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/ImageInputType.cpp
@@ -35,7 +35,6 @@ #include "core/html/parser/HTMLParserIdioms.h" #include "core/layout/LayoutBlockFlow.h" #include "core/layout/LayoutImage.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/InputType.cpp b/third_party/WebKit/Source/core/html/forms/InputType.cpp index 4144964..ebd6b06 100644 --- a/third_party/WebKit/Source/core/html/forms/InputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/InputType.cpp
@@ -71,6 +71,8 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/text/PlatformLocale.h" #include "platform/text/TextBreakIterator.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -80,9 +82,9 @@ using InputTypeFactoryFunction = InputType* (*)(HTMLInputElement&); using InputTypeFactoryMap = HashMap<AtomicString, InputTypeFactoryFunction, CaseFoldingHash>; -static PassOwnPtr<InputTypeFactoryMap> createInputTypeFactoryMap() +static std::unique_ptr<InputTypeFactoryMap> createInputTypeFactoryMap() { - OwnPtr<InputTypeFactoryMap> map = adoptPtr(new InputTypeFactoryMap); + std::unique_ptr<InputTypeFactoryMap> map = wrapUnique(new InputTypeFactoryMap); map->add(InputTypeNames::button, ButtonInputType::create); map->add(InputTypeNames::checkbox, CheckboxInputType::create); map->add(InputTypeNames::color, ColorInputType::create); @@ -110,7 +112,7 @@ static const InputTypeFactoryMap* factoryMap() { - static const InputTypeFactoryMap* factoryMap = createInputTypeFactoryMap().leakPtr(); + static const InputTypeFactoryMap* factoryMap = createInputTypeFactoryMap().release(); return factoryMap; }
diff --git a/third_party/WebKit/Source/core/html/forms/MonthInputType.cpp b/third_party/WebKit/Source/core/html/forms/MonthInputType.cpp index 2b33186..3c60b01 100644 --- a/third_party/WebKit/Source/core/html/forms/MonthInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/MonthInputType.cpp
@@ -39,7 +39,6 @@ #include "wtf/CurrentTime.h" #include "wtf/DateMath.h" #include "wtf/MathExtras.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/NumberInputType.cpp b/third_party/WebKit/Source/core/html/forms/NumberInputType.cpp index 9b48e328..d234c1e 100644 --- a/third_party/WebKit/Source/core/html/forms/NumberInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/NumberInputType.cpp
@@ -43,7 +43,6 @@ #include "core/layout/LayoutObject.h" #include "platform/text/PlatformLocale.h" #include "wtf/MathExtras.h" -#include "wtf/PassOwnPtr.h" #include <limits> namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.h b/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.h index bdc28630..4dd49dde 100644 --- a/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.h +++ b/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.h
@@ -24,7 +24,6 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" #include "wtf/text/StringHash.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp b/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp index 656a6e98..550985d8 100644 --- a/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/RadioInputType.cpp
@@ -31,7 +31,6 @@ #include "core/html/HTMLInputElement.h" #include "core/page/SpatialNavigation.h" #include "platform/text/PlatformLocale.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp b/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp index ffb1bea..b5bc8c4 100644 --- a/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp
@@ -56,7 +56,6 @@ #include "platform/PlatformMouseEvent.h" #include "wtf/MathExtras.h" #include "wtf/NonCopyingSort.h" -#include "wtf/PassOwnPtr.h" #include <limits> namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/ResetInputType.cpp b/third_party/WebKit/Source/core/html/forms/ResetInputType.cpp index 7bb7317..e832161 100644 --- a/third_party/WebKit/Source/core/html/forms/ResetInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/ResetInputType.cpp
@@ -36,7 +36,6 @@ #include "core/html/HTMLFormElement.h" #include "core/html/HTMLInputElement.h" #include "platform/text/PlatformLocale.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/SearchInputType.cpp b/third_party/WebKit/Source/core/html/forms/SearchInputType.cpp index e12b515..23dfa89 100644 --- a/third_party/WebKit/Source/core/html/forms/SearchInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/SearchInputType.cpp
@@ -40,7 +40,6 @@ #include "core/html/shadow/ShadowElementNames.h" #include "core/html/shadow/TextControlInnerElements.h" #include "core/layout/LayoutSearchField.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/SubmitInputType.cpp b/third_party/WebKit/Source/core/html/forms/SubmitInputType.cpp index c33b946..59c7aaf 100644 --- a/third_party/WebKit/Source/core/html/forms/SubmitInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/SubmitInputType.cpp
@@ -37,7 +37,6 @@ #include "core/html/HTMLFormElement.h" #include "core/html/HTMLInputElement.h" #include "platform/text/PlatformLocale.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/TelephoneInputType.cpp b/third_party/WebKit/Source/core/html/forms/TelephoneInputType.cpp index 11982aa0..5c041b8 100644 --- a/third_party/WebKit/Source/core/html/forms/TelephoneInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/TelephoneInputType.cpp
@@ -31,7 +31,6 @@ #include "core/html/forms/TelephoneInputType.h" #include "core/InputTypeNames.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/TextInputType.cpp b/third_party/WebKit/Source/core/html/forms/TextInputType.cpp index 854a2d3..3073c70 100644 --- a/third_party/WebKit/Source/core/html/forms/TextInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/TextInputType.cpp
@@ -32,7 +32,6 @@ #include "core/InputTypeNames.h" #include "core/html/HTMLInputElement.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/TimeInputType.cpp b/third_party/WebKit/Source/core/html/forms/TimeInputType.cpp index 8a0edc7a..475d4e7 100644 --- a/third_party/WebKit/Source/core/html/forms/TimeInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/TimeInputType.cpp
@@ -41,7 +41,6 @@ #include "wtf/CurrentTime.h" #include "wtf/DateMath.h" #include "wtf/MathExtras.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/URLInputType.cpp b/third_party/WebKit/Source/core/html/forms/URLInputType.cpp index 4328f90..e4ce6b2 100644 --- a/third_party/WebKit/Source/core/html/forms/URLInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/URLInputType.cpp
@@ -34,7 +34,6 @@ #include "core/html/HTMLInputElement.h" #include "core/html/parser/HTMLParserIdioms.h" #include "platform/text/PlatformLocale.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/forms/WeekInputType.cpp b/third_party/WebKit/Source/core/html/forms/WeekInputType.cpp index f9592d9..626c8d82 100644 --- a/third_party/WebKit/Source/core/html/forms/WeekInputType.cpp +++ b/third_party/WebKit/Source/core/html/forms/WeekInputType.cpp
@@ -36,7 +36,6 @@ #include "core/html/forms/DateTimeFieldsState.h" #include "platform/DateComponents.h" #include "platform/text/PlatformLocale.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp b/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp index 4a9596f0..1615aac 100644 --- a/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp +++ b/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp
@@ -39,6 +39,7 @@ #include "core/html/imports/HTMLImportsController.h" #include "core/loader/DocumentWriter.h" #include "platform/network/ContentSecurityPolicyResponseHeaders.h" +#include <memory> namespace blink { @@ -71,7 +72,7 @@ setResource(resource); } -void HTMLImportLoader::responseReceived(Resource* resource, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void HTMLImportLoader::responseReceived(Resource* resource, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(handle, !handle); // Resource may already have been loaded with the import loader
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.h b/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.h index b029f2b..0ecc96db 100644 --- a/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.h +++ b/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.h
@@ -35,9 +35,8 @@ #include "core/fetch/RawResource.h" #include "core/fetch/ResourceOwner.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -97,7 +96,7 @@ HTMLImportLoader(HTMLImportsController*); // RawResourceClient - void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; + void responseReceived(Resource*, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; void dataReceived(Resource*, const char* data, size_t length) override; void notifyFinished(Resource*) override; String debugName() const override { return "HTMLImportLoader"; }
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h b/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h index 317bf5d..f2ec8a7f 100644 --- a/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h +++ b/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h
@@ -7,7 +7,6 @@ #include "core/html/imports/HTMLImport.h" #include "platform/Timer.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/imports/LinkImport.h b/third_party/WebKit/Source/core/html/imports/LinkImport.h index d512bb6..b0cc9a4b 100644 --- a/third_party/WebKit/Source/core/html/imports/LinkImport.h +++ b/third_party/WebKit/Source/core/html/imports/LinkImport.h
@@ -34,7 +34,6 @@ #include "core/html/LinkResource.h" #include "core/html/imports/HTMLImportChildClient.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/parser/AtomicHTMLToken.h b/third_party/WebKit/Source/core/html/parser/AtomicHTMLToken.h index 8f8205f2..3c28c83c 100644 --- a/third_party/WebKit/Source/core/html/parser/AtomicHTMLToken.h +++ b/third_party/WebKit/Source/core/html/parser/AtomicHTMLToken.h
@@ -31,6 +31,8 @@ #include "core/html/parser/CompactHTMLToken.h" #include "core/html/parser/HTMLToken.h" #include "wtf/Allocator.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -151,7 +153,7 @@ break; case HTMLToken::DOCTYPE: m_name = AtomicString(token.data()); - m_doctypeData = adoptPtr(new DoctypeData()); + m_doctypeData = wrapUnique(new DoctypeData()); m_doctypeData->m_hasPublicIdentifier = true; append(m_doctypeData->m_publicIdentifier, token.publicIdentifier()); m_doctypeData->m_hasSystemIdentifier = true; @@ -212,7 +214,7 @@ String m_data; // For DOCTYPE - OwnPtr<DoctypeData> m_doctypeData; + std::unique_ptr<DoctypeData> m_doctypeData; // For StartTag and EndTag bool m_selfClosing;
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp index d2e5924f..a022af5 100644 --- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
@@ -33,7 +33,9 @@ #include "platform/TraceEvent.h" #include "public/platform/Platform.h" #include "public/platform/WebTaskRunner.h" +#include "wtf/PtrUtil.h" #include "wtf/text/TextPosition.h" +#include <memory> namespace blink { @@ -80,7 +82,7 @@ #endif -void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, PassOwnPtr<WebTaskRunner> loadingTaskRunner) +void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, std::unique_ptr<Configuration> config, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, std::unique_ptr<WebTaskRunner> loadingTaskRunner) { new BackgroundHTMLParser(reference, std::move(config), documentURL, std::move(cachedDocumentParameters), mediaValuesCachedData, std::move(loadingTaskRunner)); // Caller must free by calling stop(). @@ -92,18 +94,18 @@ { } -BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, PassOwnPtr<WebTaskRunner> loadingTaskRunner) +BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, std::unique_ptr<Configuration> config, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, std::unique_ptr<WebTaskRunner> loadingTaskRunner) : m_weakFactory(reference, this) - , m_token(adoptPtr(new HTMLToken)) + , m_token(wrapUnique(new HTMLToken)) , m_tokenizer(HTMLTokenizer::create(config->options)) , m_treeBuilderSimulator(config->options) , m_options(config->options) , m_outstandingTokenLimit(config->outstandingTokenLimit) , m_parser(config->parser) - , m_pendingTokens(adoptPtr(new CompactHTMLTokenStream)) + , m_pendingTokens(wrapUnique(new CompactHTMLTokenStream)) , m_pendingTokenLimit(config->pendingTokenLimit) , m_xssAuditor(std::move(config->xssAuditor)) - , m_preloadScanner(adoptPtr(new TokenPreloadScanner(documentURL, std::move(cachedDocumentParameters), mediaValuesCachedData))) + , m_preloadScanner(wrapUnique(new TokenPreloadScanner(documentURL, std::move(cachedDocumentParameters), mediaValuesCachedData))) , m_decoder(std::move(config->decoder)) , m_loadingTaskRunner(std::move(loadingTaskRunner)) , m_parsedChunkQueue(config->parsedChunkQueue.release()) @@ -124,7 +126,7 @@ updateDocument(m_decoder->decode(data, dataLength)); } -void BackgroundHTMLParser::appendRawBytesFromMainThread(PassOwnPtr<Vector<char>> buffer) +void BackgroundHTMLParser::appendRawBytesFromMainThread(std::unique_ptr<Vector<char>> buffer) { ASSERT(m_decoder); updateDocument(m_decoder->decode(buffer->data(), buffer->size())); @@ -137,7 +139,7 @@ pumpTokenizer(); } -void BackgroundHTMLParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) +void BackgroundHTMLParser::setDecoder(std::unique_ptr<TextResourceDecoder> decoder) { ASSERT(decoder); m_decoder = std::move(decoder); @@ -168,7 +170,7 @@ appendDecodedBytes(decodedData); } -void BackgroundHTMLParser::resumeFrom(PassOwnPtr<Checkpoint> checkpoint) +void BackgroundHTMLParser::resumeFrom(std::unique_ptr<Checkpoint> checkpoint) { m_parser = checkpoint->parser; m_token = std::move(checkpoint->token); @@ -240,7 +242,7 @@ { TextPosition position = TextPosition(m_input.current().currentLine(), m_input.current().currentColumn()); - if (OwnPtr<XSSInfo> xssInfo = m_xssAuditor->filterToken(FilterTokenRequest(*m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) { + if (std::unique_ptr<XSSInfo> xssInfo = m_xssAuditor->filterToken(FilterTokenRequest(*m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) { xssInfo->m_textPosition = position; m_pendingXSSInfos.append(std::move(xssInfo)); } @@ -287,7 +289,7 @@ checkThatXSSInfosAreSafeToSendToAnotherThread(m_pendingXSSInfos); #endif - OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentParser::ParsedChunk); + std::unique_ptr<HTMLDocumentParser::ParsedChunk> chunk = wrapUnique(new HTMLDocumentParser::ParsedChunk); TRACE_EVENT_WITH_FLOW0("blink,loading", "BackgroundHTMLParser::sendTokensToMainThread", chunk.get(), TRACE_EVENT_FLAG_FLOW_OUT); chunk->preloads.swap(m_pendingPreloads); if (m_viewportDescription.set) @@ -309,7 +311,7 @@ threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChunks, m_parser)); } - m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); + m_pendingTokens = wrapUnique(new CompactHTMLTokenStream); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h index 28320e7..3553f42 100644 --- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h +++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h
@@ -36,8 +36,8 @@ #include "core/html/parser/ParsedChunkQueue.h" #include "core/html/parser/TextResourceDecoder.h" #include "core/html/parser/XSSAuditorDelegate.h" -#include "wtf/PassOwnPtr.h" #include "wtf/WeakPtr.h" +#include <memory> namespace blink { @@ -55,8 +55,8 @@ Configuration(); HTMLParserOptions options; WeakPtr<HTMLDocumentParser> parser; - OwnPtr<XSSAuditor> xssAuditor; - OwnPtr<TextResourceDecoder> decoder; + std::unique_ptr<XSSAuditor> xssAuditor; + std::unique_ptr<TextResourceDecoder> decoder; RefPtr<ParsedChunkQueue> parsedChunkQueue; // outstandingTokenLimit must be greater than or equal to // pendingTokenLimit @@ -64,14 +64,14 @@ size_t pendingTokenLimit; }; - static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPtr<Configuration>, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&, PassOwnPtr<WebTaskRunner>); + static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, std::unique_ptr<Configuration>, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&, std::unique_ptr<WebTaskRunner>); struct Checkpoint { USING_FAST_MALLOC(Checkpoint); public: WeakPtr<HTMLDocumentParser> parser; - OwnPtr<HTMLToken> token; - OwnPtr<HTMLTokenizer> tokenizer; + std::unique_ptr<HTMLToken> token; + std::unique_ptr<HTMLTokenizer> tokenizer; HTMLTreeBuilderSimulator::State treeBuilderState; HTMLInputCheckpoint inputCheckpoint; TokenPreloadScannerCheckpoint preloadScannerCheckpoint; @@ -80,10 +80,10 @@ void appendRawBytesFromParserThread(const char* data, int dataLength); - void appendRawBytesFromMainThread(PassOwnPtr<Vector<char>>); - void setDecoder(PassOwnPtr<TextResourceDecoder>); + void appendRawBytesFromMainThread(std::unique_ptr<Vector<char>>); + void setDecoder(std::unique_ptr<TextResourceDecoder>); void flush(); - void resumeFrom(PassOwnPtr<Checkpoint>); + void resumeFrom(std::unique_ptr<Checkpoint>); void startedChunkWithCheckpoint(HTMLInputCheckpoint); void finish(); void stop(); @@ -91,7 +91,7 @@ void forcePlaintextForTextDocument(); private: - BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPtr<Configuration>, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&, PassOwnPtr<WebTaskRunner>); + BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, std::unique_ptr<Configuration>, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&, std::unique_ptr<WebTaskRunner>); ~BackgroundHTMLParser(); void appendDecodedBytes(const String&); @@ -103,14 +103,14 @@ WeakPtrFactory<BackgroundHTMLParser> m_weakFactory; BackgroundHTMLInputStream m_input; HTMLSourceTracker m_sourceTracker; - OwnPtr<HTMLToken> m_token; - OwnPtr<HTMLTokenizer> m_tokenizer; + std::unique_ptr<HTMLToken> m_token; + std::unique_ptr<HTMLTokenizer> m_tokenizer; HTMLTreeBuilderSimulator m_treeBuilderSimulator; HTMLParserOptions m_options; const size_t m_outstandingTokenLimit; WeakPtr<HTMLDocumentParser> m_parser; - OwnPtr<CompactHTMLTokenStream> m_pendingTokens; + std::unique_ptr<CompactHTMLTokenStream> m_pendingTokens; const size_t m_pendingTokenLimit; PreloadRequestStream m_pendingPreloads; // Indices into |m_pendingTokens|. @@ -118,11 +118,11 @@ ViewportDescriptionWrapper m_viewportDescription; XSSInfoStream m_pendingXSSInfos; - OwnPtr<XSSAuditor> m_xssAuditor; - OwnPtr<TokenPreloadScanner> m_preloadScanner; - OwnPtr<TextResourceDecoder> m_decoder; + std::unique_ptr<XSSAuditor> m_xssAuditor; + std::unique_ptr<TokenPreloadScanner> m_preloadScanner; + std::unique_ptr<TextResourceDecoder> m_decoder; DocumentEncodingData m_lastSeenEncodingData; - OwnPtr<WebTaskRunner> m_loadingTaskRunner; + std::unique_ptr<WebTaskRunner> m_loadingTaskRunner; RefPtr<ParsedChunkQueue> m_parsedChunkQueue; bool m_startingScript;
diff --git a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp index 939aa383..0b8fb30 100644 --- a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp +++ b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
@@ -30,6 +30,7 @@ #include "core/fetch/FetchInitiatorTypeNames.h" #include "core/html/parser/HTMLParserIdioms.h" #include "platform/text/SegmentedString.h" +#include <memory> namespace blink { @@ -220,7 +221,7 @@ String url = parseCSSStringOrURL(m_ruleValue.toString()); if (!url.isEmpty()) { TextPosition position = TextPosition(source.currentLine(), source.currentColumn()); - OwnPtr<PreloadRequest> request = PreloadRequest::create(FetchInitiatorTypeNames::css, position, url, *m_predictedBaseElementURL, Resource::CSSStyleSheet, m_referrerPolicy); + std::unique_ptr<PreloadRequest> request = PreloadRequest::create(FetchInitiatorTypeNames::css, position, url, *m_predictedBaseElementURL, Resource::CSSStyleSheet, m_referrerPolicy); // FIXME: Should this be including the charset in the preload request? m_requests->append(std::move(request)); }
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp index 69f8d51..aa007910 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -55,7 +55,9 @@ #include "public/platform/WebLoadingBehaviorFlag.h" #include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" +#include "wtf/PtrUtil.h" #include "wtf/TemporaryChange.h" +#include <memory> namespace blink { @@ -89,11 +91,11 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, ParserSynchronizationPolicy syncPolicy) : ScriptableDocumentParser(document) , m_options(&document) - , m_token(syncPolicy == ForceSynchronousParsing ? adoptPtr(new HTMLToken) : nullptr) + , m_token(syncPolicy == ForceSynchronousParsing ? wrapUnique(new HTMLToken) : nullptr) , m_tokenizer(syncPolicy == ForceSynchronousParsing ? HTMLTokenizer::create(m_options) : nullptr) , m_scriptRunner(HTMLScriptRunner::create(&document, this)) , m_treeBuilder(HTMLTreeBuilder::create(this, &document, getParserContentPolicy(), m_options)) - , m_loadingTaskRunner(adoptPtr(document.loadingTaskRunner()->clone())) + , m_loadingTaskRunner(wrapUnique(document.loadingTaskRunner()->clone())) , m_parserScheduler(HTMLParserScheduler::create(this, m_loadingTaskRunner.get())) , m_xssAuditorDelegate(&document) , m_weakFactory(this) @@ -117,10 +119,10 @@ HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* contextElement, ParserContentPolicy parserContentPolicy) : ScriptableDocumentParser(fragment->document(), parserContentPolicy) , m_options(&fragment->document()) - , m_token(adoptPtr(new HTMLToken)) + , m_token(wrapUnique(new HTMLToken)) , m_tokenizer(HTMLTokenizer::create(m_options)) , m_treeBuilder(HTMLTreeBuilder::create(this, fragment, contextElement, this->getParserContentPolicy(), m_options)) - , m_loadingTaskRunner(adoptPtr(fragment->document().loadingTaskRunner()->clone())) + , m_loadingTaskRunner(wrapUnique(fragment->document().loadingTaskRunner()->clone())) , m_xssAuditorDelegate(&fragment->document()) , m_weakFactory(this) , m_shouldUseThreading(false) @@ -290,7 +292,7 @@ TRACE_EVENT0("blink", "HTMLDocumentParser::notifyPendingParsedChunks"); ASSERT(m_parsedChunkQueue); - Vector<OwnPtr<ParsedChunk>> pendingChunks; + Vector<std::unique_ptr<ParsedChunk>> pendingChunks; m_parsedChunkQueue->takeAll(pendingChunks); if (!isParsing()) @@ -341,7 +343,7 @@ document()->setEncodingData(data); } -void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk) +void HTMLDocumentParser::validateSpeculations(std::unique_ptr<ParsedChunk> chunk) { ASSERT(chunk); if (isWaitingForScripts()) { @@ -355,8 +357,8 @@ } ASSERT(!m_lastChunkBeforeScript); - OwnPtr<HTMLTokenizer> tokenizer = std::move(m_tokenizer); - OwnPtr<HTMLToken> token = std::move(m_token); + std::unique_ptr<HTMLTokenizer> tokenizer = std::move(m_tokenizer); + std::unique_ptr<HTMLToken> token = std::move(m_token); if (!tokenizer) { // There must not have been any changes to the HTMLTokenizer state on @@ -380,12 +382,12 @@ discardSpeculationsAndResumeFrom(std::move(chunk), std::move(token), std::move(tokenizer)); } -void HTMLDocumentParser::discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunkBeforeScript, PassOwnPtr<HTMLToken> token, PassOwnPtr<HTMLTokenizer> tokenizer) +void HTMLDocumentParser::discardSpeculationsAndResumeFrom(std::unique_ptr<ParsedChunk> lastChunkBeforeScript, std::unique_ptr<HTMLToken> token, std::unique_ptr<HTMLTokenizer> tokenizer) { m_weakFactory.revokeAll(); m_speculations.clear(); - OwnPtr<BackgroundHTMLParser::Checkpoint> checkpoint = adoptPtr(new BackgroundHTMLParser::Checkpoint); + std::unique_ptr<BackgroundHTMLParser::Checkpoint> checkpoint = wrapUnique(new BackgroundHTMLParser::Checkpoint); checkpoint->parser = m_weakFactory.createWeakPtr(); checkpoint->token = std::move(token); checkpoint->tokenizer = std::move(tokenizer); @@ -399,7 +401,7 @@ HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::resumeFrom, m_backgroundParser, passed(std::move(checkpoint)))); } -size_t HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk> popChunk) +size_t HTMLDocumentParser::processParsedChunkFromBackgroundParser(std::unique_ptr<ParsedChunk> popChunk) { TRACE_EVENT_WITH_FLOW0("blink,loading", "HTMLDocumentParser::processParsedChunkFromBackgroundParser", popChunk.get(), TRACE_EVENT_FLAG_FLOW_IN); TemporaryChange<bool> hasLineNumber(m_isParsingAtLineNumber, true); @@ -414,8 +416,8 @@ ASSERT(!m_token); ASSERT(!m_lastChunkBeforeScript); - OwnPtr<ParsedChunk> chunk(std::move(popChunk)); - OwnPtr<CompactHTMLTokenStream> tokens = std::move(chunk->tokens); + std::unique_ptr<ParsedChunk> chunk(std::move(popChunk)); + std::unique_ptr<CompactHTMLTokenStream> tokens = std::move(chunk->tokens); size_t elementTokenCount = 0; HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::startedChunkWithCheckpoint, m_backgroundParser, chunk->inputCheckpoint)); @@ -584,7 +586,7 @@ // We do not XSS filter innerHTML, which means we (intentionally) fail // http/tests/security/xssAuditor/dom-write-innerHTML.html - if (OwnPtr<XSSInfo> xssInfo = m_xssAuditor.filterToken(FilterTokenRequest(token(), m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) + if (std::unique_ptr<XSSInfo> xssInfo = m_xssAuditor.filterToken(FilterTokenRequest(token(), m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) m_xssAuditorDelegate.didBlockScript(*xssInfo); } @@ -673,7 +675,7 @@ if (!m_tokenizer) { ASSERT(!inPumpSession()); ASSERT(m_haveBackgroundParser || wasCreatedByScript()); - m_token = adoptPtr(new HTMLToken); + m_token = wrapUnique(new HTMLToken); m_tokenizer = HTMLTokenizer::create(m_options); } @@ -709,10 +711,10 @@ RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<BackgroundHTMLParser>::createUnbound(); m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference); - OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new BackgroundHTMLParser::Configuration); + std::unique_ptr<BackgroundHTMLParser::Configuration> config = wrapUnique(new BackgroundHTMLParser::Configuration); config->options = m_options; config->parser = m_weakFactory.createWeakPtr(); - config->xssAuditor = adoptPtr(new XSSAuditor); + config->xssAuditor = wrapUnique(new XSSAuditor); config->xssAuditor->init(document(), &m_xssAuditorDelegate); config->decoder = takeDecoder(); @@ -732,7 +734,7 @@ document()->url(), passed(CachedDocumentParameters::create(document())), MediaValuesCached::MediaValuesCachedData(*document()), - passed(adoptPtr(m_loadingTaskRunner->clone())))); + passed(wrapUnique(m_loadingTaskRunner->clone())))); } void HTMLDocumentParser::stopBackgroundParser() @@ -858,7 +860,7 @@ // We're finishing before receiving any data. Rather than booting up // the background parser just to spin it down, we finish parsing // synchronously. - m_token = adoptPtr(new HTMLToken); + m_token = wrapUnique(new HTMLToken); m_tokenizer = HTMLTokenizer::create(m_options); } @@ -1010,7 +1012,7 @@ if (!m_haveBackgroundParser) startBackgroundParser(); - OwnPtr<Vector<char>> buffer = adoptPtr(new Vector<char>(length)); + std::unique_ptr<Vector<char>> buffer = wrapUnique(new Vector<char>(length)); memcpy(buffer->data(), data, length); TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "HTMLDocumentParser::appendBytes", "size", (unsigned)length); @@ -1032,7 +1034,7 @@ // appendBytes. Fallback to synchronous parsing in that case. if (!m_haveBackgroundParser) { m_shouldUseThreading = false; - m_token = adoptPtr(new HTMLToken); + m_token = wrapUnique(new HTMLToken); m_tokenizer = HTMLTokenizer::create(m_options); DecodedDataDocumentParser::flush(); return; @@ -1044,7 +1046,7 @@ } } -void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) +void HTMLDocumentParser::setDecoder(std::unique_ptr<TextResourceDecoder> decoder) { ASSERT(decoder); DecodedDataDocumentParser::setDecoder(std::move(decoder)); @@ -1066,7 +1068,7 @@ m_preloader->takeAndPreload(m_queuedPreloads); } -PassOwnPtr<HTMLPreloadScanner> HTMLDocumentParser::createPreloadScanner() +std::unique_ptr<HTMLPreloadScanner> HTMLDocumentParser::createPreloadScanner() { return HTMLPreloadScanner::create( m_options, @@ -1093,7 +1095,7 @@ double duration = monotonicallyIncreasingTimeMS() - startTime; int currentPreloadCount = document()->loader()->fetcher()->countPreloads(); - OwnPtr<HTMLPreloadScanner> scanner = createPreloadScanner(); + std::unique_ptr<HTMLPreloadScanner> scanner = createPreloadScanner(); scanner->appendToEnd(SegmentedString(writtenSource)); scanner->scanAndPreload(m_preloader.get(), document()->baseElementURL(), nullptr); int numPreloads = document()->loader()->fetcher()->countPreloads() - currentPreloadCount;
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h index 11273d40..8f4fc0e 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h
@@ -47,9 +47,9 @@ #include "core/html/parser/XSSAuditorDelegate.h" #include "platform/text/SegmentedString.h" #include "wtf/Deque.h" -#include "wtf/OwnPtr.h" #include "wtf/WeakPtr.h" #include "wtf/text/TextPosition.h" +#include <memory> namespace blink { @@ -94,7 +94,7 @@ struct ParsedChunk { USING_FAST_MALLOC(ParsedChunk); public: - OwnPtr<CompactHTMLTokenStream> tokens; + std::unique_ptr<CompactHTMLTokenStream> tokens; PreloadRequestStream preloads; ViewportDescriptionWrapper viewport; XSSInfoStream xssInfos; @@ -111,7 +111,7 @@ void appendBytes(const char* bytes, size_t length) override; void flush() final; - void setDecoder(PassOwnPtr<TextResourceDecoder>) final; + void setDecoder(std::unique_ptr<TextResourceDecoder>) final; protected: void insert(const SegmentedString&) final; @@ -149,9 +149,9 @@ void startBackgroundParser(); void stopBackgroundParser(); - void validateSpeculations(PassOwnPtr<ParsedChunk> lastChunk); - void discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk> lastChunk, PassOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>); - size_t processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); + void validateSpeculations(std::unique_ptr<ParsedChunk> lastChunk); + void discardSpeculationsAndResumeFrom(std::unique_ptr<ParsedChunk> lastChunk, std::unique_ptr<HTMLToken>, std::unique_ptr<HTMLTokenizer>); + size_t processParsedChunkFromBackgroundParser(std::unique_ptr<ParsedChunk>); void pumpPendingSpeculations(); bool canTakeNextToken(); @@ -175,7 +175,7 @@ bool inPumpSession() const { return m_pumpSessionNestingLevel > 0; } bool shouldDelayEnd() const { return inPumpSession() || isWaitingForScripts() || isScheduledForResume() || isExecutingScript(); } - PassOwnPtr<HTMLPreloadScanner> createPreloadScanner(); + std::unique_ptr<HTMLPreloadScanner> createPreloadScanner(); int preloadInsertion(const SegmentedString& source); void evaluateAndPreloadScriptForDocumentWrite(const String& source); @@ -185,13 +185,13 @@ HTMLParserOptions m_options; HTMLInputStream m_input; - OwnPtr<HTMLToken> m_token; - OwnPtr<HTMLTokenizer> m_tokenizer; + std::unique_ptr<HTMLToken> m_token; + std::unique_ptr<HTMLTokenizer> m_tokenizer; Member<HTMLScriptRunner> m_scriptRunner; Member<HTMLTreeBuilder> m_treeBuilder; - OwnPtr<HTMLPreloadScanner> m_preloadScanner; - OwnPtr<HTMLPreloadScanner> m_insertionPreloadScanner; - OwnPtr<WebTaskRunner> m_loadingTaskRunner; + std::unique_ptr<HTMLPreloadScanner> m_preloadScanner; + std::unique_ptr<HTMLPreloadScanner> m_insertionPreloadScanner; + std::unique_ptr<WebTaskRunner> m_loadingTaskRunner; Member<HTMLParserScheduler> m_parserScheduler; HTMLSourceTracker m_sourceTracker; TextPosition m_textPosition; @@ -200,15 +200,15 @@ // FIXME: m_lastChunkBeforeScript, m_tokenizer, m_token, and m_input should be combined into a single state object // so they can be set and cleared together and passed between threads together. - OwnPtr<ParsedChunk> m_lastChunkBeforeScript; - Deque<OwnPtr<ParsedChunk>> m_speculations; + std::unique_ptr<ParsedChunk> m_lastChunkBeforeScript; + Deque<std::unique_ptr<ParsedChunk>> m_speculations; WeakPtrFactory<HTMLDocumentParser> m_weakFactory; WeakPtr<BackgroundHTMLParser> m_backgroundParser; Member<HTMLResourcePreloader> m_preloader; PreloadRequestStream m_queuedPreloads; Vector<String> m_queuedDocumentWriteScripts; RefPtr<ParsedChunkQueue> m_parsedChunkQueue; - OwnPtr<DocumentWriteEvaluator> m_evaluator; + std::unique_ptr<DocumentWriteEvaluator> m_evaluator; bool m_shouldUseThreading; bool m_endWasDelayed;
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLElementStack.h b/third_party/WebKit/Source/core/html/parser/HTMLElementStack.h index 4bb7331..53d3e0c 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLElementStack.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLElementStack.h
@@ -30,8 +30,6 @@ #include "core/html/parser/HTMLStackItem.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLMetaCharsetParser.h b/third_party/WebKit/Source/core/html/parser/HTMLMetaCharsetParser.h index 18796f83..35837bd 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLMetaCharsetParser.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLMetaCharsetParser.h
@@ -29,8 +29,10 @@ #include "core/html/parser/HTMLToken.h" #include "platform/text/SegmentedString.h" #include "wtf/Noncopyable.h" +#include "wtf/PtrUtil.h" #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" +#include <memory> namespace blink { @@ -39,7 +41,7 @@ class HTMLMetaCharsetParser { WTF_MAKE_NONCOPYABLE(HTMLMetaCharsetParser); USING_FAST_MALLOC(HTMLMetaCharsetParser); public: - static PassOwnPtr<HTMLMetaCharsetParser> create() { return adoptPtr(new HTMLMetaCharsetParser()); } + static std::unique_ptr<HTMLMetaCharsetParser> create() { return wrapUnique(new HTMLMetaCharsetParser()); } ~HTMLMetaCharsetParser(); @@ -53,8 +55,8 @@ bool processMeta(); - OwnPtr<HTMLTokenizer> m_tokenizer; - OwnPtr<TextCodec> m_assumedCodec; + std::unique_ptr<HTMLTokenizer> m_tokenizer; + std::unique_ptr<TextCodec> m_assumedCodec; SegmentedString m_input; HTMLToken m_token; bool m_inHeadSection;
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp index ae74514..0d757cbc5 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.cpp
@@ -26,12 +26,13 @@ #include "core/html/parser/HTMLParserScheduler.h" #include "core/dom/Document.h" -#include "core/html/parser/HTMLDocumentParser.h" #include "core/frame/FrameView.h" +#include "core/html/parser/HTMLDocumentParser.h" #include "public/platform/Platform.h" #include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -67,7 +68,7 @@ HTMLParserScheduler::HTMLParserScheduler(HTMLDocumentParser* parser, WebTaskRunner* loadingTaskRunner) : m_parser(parser) - , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone())) + , m_loadingTaskRunner(wrapUnique(loadingTaskRunner->clone())) , m_cancellableContinueParse(CancellableTaskFactory::create(this, &HTMLParserScheduler::continueParsing)) , m_isSuspendedWithActiveTimer(false) {
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h index 2651e5e..e8bd9af 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScheduler.h
@@ -29,8 +29,8 @@ #include "core/html/parser/NestingLevelIncrementer.h" #include "platform/scheduler/CancellableTaskFactory.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -96,9 +96,9 @@ void continueParsing(); Member<HTMLDocumentParser> m_parser; - OwnPtr<WebTaskRunner> m_loadingTaskRunner; + std::unique_ptr<WebTaskRunner> m_loadingTaskRunner; - OwnPtr<CancellableTaskFactory> m_cancellableContinueParse; + std::unique_ptr<CancellableTaskFactory> m_cancellableContinueParse; bool m_isSuspendedWithActiveTimer; };
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp index 90a6fea..8740657 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserThread.cpp
@@ -35,7 +35,6 @@ #include "platform/heap/SafePoint.h" #include "public/platform/Platform.h" #include "public/platform/WebTraceLocation.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserThread.h b/third_party/WebKit/Source/core/html/parser/HTMLParserThread.h index 3a595b79..308229a 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLParserThread.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLParserThread.h
@@ -36,8 +36,7 @@ #include "platform/WebThreadSupportingGC.h" #include "wtf/Allocator.h" #include "wtf/Functional.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -58,7 +57,7 @@ void setupHTMLParserThread(); void cleanupHTMLParserThread(WaitableEvent*); - OwnPtr<WebThreadSupportingGC> m_thread; + std::unique_ptr<WebThreadSupportingGC> m_thread; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp index 40c27a3..14ecba3 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -50,6 +50,7 @@ #include "platform/Histogram.h" #include "platform/MIMETypeRegistry.h" #include "platform/TraceEvent.h" +#include <memory> namespace blink { @@ -206,7 +207,7 @@ } } - PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL, const SegmentedString& source, const ClientHintsPreferences& clientHintsPreferences, const PictureData& pictureData, const ReferrerPolicy documentReferrerPolicy) + std::unique_ptr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL, const SegmentedString& source, const ClientHintsPreferences& clientHintsPreferences, const PictureData& pictureData, const ReferrerPolicy documentReferrerPolicy) { PreloadRequest::RequestType requestType = PreloadRequest::RequestTypePreload; if (shouldPreconnect()) { @@ -240,7 +241,7 @@ // The element's 'referrerpolicy' attribute (if present) takes precedence over the document's referrer policy. ReferrerPolicy referrerPolicy = (m_referrerPolicy != ReferrerPolicyDefault) ? m_referrerPolicy : documentReferrerPolicy; - OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_tagImpl), position, m_urlToLoad, predictedBaseURL, type, referrerPolicy, resourceWidth, clientHintsPreferences, requestType); + std::unique_ptr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_tagImpl), position, m_urlToLoad, predictedBaseURL, type, referrerPolicy, resourceWidth, clientHintsPreferences, requestType); request->setCrossOrigin(m_crossOrigin); request->setCharset(charset()); request->setDefer(m_defer); @@ -480,7 +481,7 @@ IntegrityMetadataSet m_integrityMetadata; }; -TokenPreloadScanner::TokenPreloadScanner(const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) +TokenPreloadScanner::TokenPreloadScanner(const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) : m_documentURL(documentURL) , m_inStyle(false) , m_inPicture(false) @@ -744,7 +745,7 @@ scanner.processAttributes(token.attributes()); if (m_inPicture) scanner.handlePictureSourceURL(m_pictureData); - OwnPtr<PreloadRequest> request = scanner.createPreloadRequest(m_predictedBaseElementURL, source, m_clientHintsPreferences, m_pictureData, m_documentParameters->referrerPolicy); + std::unique_ptr<PreloadRequest> request = scanner.createPreloadRequest(m_predictedBaseElementURL, source, m_clientHintsPreferences, m_pictureData, m_documentParameters->referrerPolicy); if (request) requests.append(std::move(request)); return; @@ -765,7 +766,7 @@ } } -HTMLPreloadScanner::HTMLPreloadScanner(const HTMLParserOptions& options, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) +HTMLPreloadScanner::HTMLPreloadScanner(const HTMLParserOptions& options, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) : m_scanner(documentURL, std::move(documentParameters), mediaValuesCachedData) , m_tokenizer(HTMLTokenizer::create(options)) {
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h index fbbe93b..8da9b7b 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.h
@@ -34,7 +34,9 @@ #include "core/html/parser/CompactHTMLToken.h" #include "core/html/parser/HTMLToken.h" #include "platform/text/SegmentedString.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -56,9 +58,9 @@ struct CORE_EXPORT CachedDocumentParameters { USING_FAST_MALLOC(CachedDocumentParameters); public: - static PassOwnPtr<CachedDocumentParameters> create(Document* document) + static std::unique_ptr<CachedDocumentParameters> create(Document* document) { - return adoptPtr(new CachedDocumentParameters(document)); + return wrapUnique(new CachedDocumentParameters(document)); } bool doHtmlPreloadScanning; @@ -75,7 +77,7 @@ class TokenPreloadScanner { WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); USING_FAST_MALLOC(TokenPreloadScanner); public: - TokenPreloadScanner(const KURL& documentURL, PassOwnPtr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&); + TokenPreloadScanner(const KURL& documentURL, std::unique_ptr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&); ~TokenPreloadScanner(); void scan(const HTMLToken&, const SegmentedString&, PreloadRequestStream& requests, ViewportDescriptionWrapper*); @@ -142,7 +144,7 @@ bool m_isCSPEnabled; PictureData m_pictureData; size_t m_templateCount; - OwnPtr<CachedDocumentParameters> m_documentParameters; + std::unique_ptr<CachedDocumentParameters> m_documentParameters; Persistent<MediaValuesCached> m_mediaValues; ClientHintsPreferences m_clientHintsPreferences; @@ -154,9 +156,9 @@ class CORE_EXPORT HTMLPreloadScanner { WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); USING_FAST_MALLOC(HTMLPreloadScanner); public: - static PassOwnPtr<HTMLPreloadScanner> create(const HTMLParserOptions& options, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) + static std::unique_ptr<HTMLPreloadScanner> create(const HTMLParserOptions& options, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> documentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData) { - return adoptPtr(new HTMLPreloadScanner(options, documentURL, std::move(documentParameters), mediaValuesCachedData)); + return wrapUnique(new HTMLPreloadScanner(options, documentURL, std::move(documentParameters), mediaValuesCachedData)); } @@ -166,12 +168,12 @@ void scanAndPreload(ResourcePreloader*, const KURL& documentBaseElementURL, ViewportDescriptionWrapper*); private: - HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&); + HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters>, const MediaValuesCached::MediaValuesCachedData&); TokenPreloadScanner m_scanner; SegmentedString m_source; HTMLToken m_token; - OwnPtr<HTMLTokenizer> m_tokenizer; + std::unique_ptr<HTMLTokenizer> m_tokenizer; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp index 8b90b65..bc584d1e 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
@@ -13,6 +13,7 @@ #include "core/html/parser/HTMLResourcePreloader.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -80,13 +81,13 @@ } protected: - void preload(PassOwnPtr<PreloadRequest> preloadRequest, const NetworkHintsInterface&) override + void preload(std::unique_ptr<PreloadRequest> preloadRequest, const NetworkHintsInterface&) override { m_preloadRequest = std::move(preloadRequest); } private: - OwnPtr<PreloadRequest> m_preloadRequest; + std::unique_ptr<PreloadRequest> m_preloadRequest; }; class HTMLPreloadScannerTest : public testing::Test { @@ -171,8 +172,8 @@ } private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; - OwnPtr<HTMLPreloadScanner> m_scanner; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<HTMLPreloadScanner> m_scanner; }; TEST_F(HTMLPreloadScannerTest, testImages)
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp index efa3ff9..1b6b669 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp
@@ -31,6 +31,7 @@ #include "core/loader/DocumentLoader.h" #include "platform/Histogram.h" #include "public/platform/Platform.h" +#include <memory> namespace blink { @@ -59,7 +60,7 @@ networkHintsInterface.preconnectHost(host, request->crossOrigin()); } -void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload, const NetworkHintsInterface& networkHintsInterface) +void HTMLResourcePreloader::preload(std::unique_ptr<PreloadRequest> preload, const NetworkHintsInterface& networkHintsInterface) { if (preload->isPreconnect()) { preconnectHost(preload.get(), networkHintsInterface);
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h index 29ddf17c..e2df0cde 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h
@@ -33,6 +33,7 @@ #include "core/loader/NetworkHintsInterface.h" #include "wtf/CurrentTime.h" #include "wtf/text/TextPosition.h" +#include <memory> namespace blink { @@ -44,7 +45,7 @@ DECLARE_TRACE(); protected: - void preload(PassOwnPtr<PreloadRequest>, const NetworkHintsInterface&) override; + void preload(std::unique_ptr<PreloadRequest>, const NetworkHintsInterface&) override; private: explicit HTMLResourcePreloader(Document&);
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp index 4326fd3..7455b241 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp
@@ -7,6 +7,7 @@ #include "core/html/parser/PreloadRequest.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -53,7 +54,7 @@ { // TODO(yoav): Need a mock loader here to verify things are happenning beyond preconnect. PreloaderNetworkHintsMock networkHints; - OwnPtr<PreloadRequest> preloadRequest = PreloadRequest::create(String(), + std::unique_ptr<PreloadRequest> preloadRequest = PreloadRequest::create(String(), TextPosition(), testCase.url, KURL(ParsedURLStringTag(), testCase.baseURL), @@ -72,7 +73,7 @@ } private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; TEST_F(HTMLResourcePreloaderTest, testPreconnect)
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp index 70e4f9a..f5839e7 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp
@@ -30,9 +30,9 @@ #include "bindings/core/v8/V8PerIsolateData.h" #include "core/dom/DocumentParserTiming.h" #include "core/dom/Element.h" -#include "core/events/Event.h" #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" #include "core/dom/ScriptLoader.h" +#include "core/events/Event.h" #include "core/fetch/ScriptResource.h" #include "core/frame/LocalFrame.h" #include "core/html/parser/HTMLInputStream.h" @@ -44,6 +44,7 @@ #include "public/platform/Platform.h" #include "public/platform/WebFrameScheduler.h" #include <inttypes.h> +#include <memory> namespace blink { @@ -51,9 +52,9 @@ // TODO(bmcquade): move this to a shared location if we find ourselves wanting // to trace similar data elsewhere in the codebase. -PassOwnPtr<TracedValue> getTraceArgsForScriptElement(Element* element, const TextPosition& textPosition) +std::unique_ptr<TracedValue> getTraceArgsForScriptElement(Element* element, const TextPosition& textPosition) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element); if (scriptLoader && scriptLoader->resource()) value->setString("url", scriptLoader->resource()->url().getString());
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLToken.h b/third_party/WebKit/Source/core/html/parser/HTMLToken.h index 3c90de9d..679a187 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLToken.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLToken.h
@@ -29,7 +29,8 @@ #include "core/dom/Attribute.h" #include "core/html/parser/HTMLParserIdioms.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -199,7 +200,7 @@ { ASSERT(m_type == Uninitialized); m_type = DOCTYPE; - m_doctypeData = adoptPtr(new DoctypeData); + m_doctypeData = wrapUnique(new DoctypeData); } void beginDOCTYPE(UChar character) @@ -254,7 +255,7 @@ m_doctypeData->m_systemIdentifier.append(character); } - PassOwnPtr<DoctypeData> releaseDoctypeData() + std::unique_ptr<DoctypeData> releaseDoctypeData() { return std::move(m_doctypeData); } @@ -472,7 +473,7 @@ Attribute* m_currentAttribute; // For DOCTYPE - OwnPtr<DoctypeData> m_doctypeData; + std::unique_ptr<DoctypeData> m_doctypeData; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h b/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h index 09335ac..c7166a13 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h
@@ -31,6 +31,8 @@ #include "core/html/parser/HTMLToken.h" #include "core/html/parser/InputStreamPreprocessor.h" #include "platform/text/SegmentedString.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -38,7 +40,7 @@ WTF_MAKE_NONCOPYABLE(HTMLTokenizer); USING_FAST_MALLOC(HTMLTokenizer); public: - static PassOwnPtr<HTMLTokenizer> create(const HTMLParserOptions& options) { return adoptPtr(new HTMLTokenizer(options)); } + static std::unique_ptr<HTMLTokenizer> create(const HTMLParserOptions& options) { return wrapUnique(new HTMLTokenizer(options)); } ~HTMLTokenizer(); void reset();
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp index b8894f1..8ef2234e 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -46,6 +46,7 @@ #include "core/html/parser/HTMLTokenizer.h" #include "platform/text/PlatformLocale.h" #include "wtf/text/CharacterNames.h" +#include <memory> namespace blink { @@ -528,7 +529,7 @@ static PrefixedNameToQualifiedNameMap* caseMap = 0; if (!caseMap) { caseMap = new PrefixedNameToQualifiedNameMap; - OwnPtr<const SVGQualifiedName*[]> svgTags = SVGNames::getSVGTags(); + std::unique_ptr<const SVGQualifiedName*[]> svgTags = SVGNames::getSVGTags(); mapLoweredLocalNameToName(caseMap, svgTags.get(), SVGNames::SVGTagsCount); } @@ -538,13 +539,13 @@ token->setName(casedName.localName()); } -template<PassOwnPtr<const QualifiedName*[]> getAttrs(), unsigned length> +template<std::unique_ptr<const QualifiedName*[]> getAttrs(), unsigned length> static void adjustAttributes(AtomicHTMLToken* token) { static PrefixedNameToQualifiedNameMap* caseMap = 0; if (!caseMap) { caseMap = new PrefixedNameToQualifiedNameMap; - OwnPtr<const QualifiedName*[]> attrs = getAttrs(); + std::unique_ptr<const QualifiedName*[]> attrs = getAttrs(); mapLoweredLocalNameToName(caseMap, attrs.get(), length); } @@ -583,10 +584,10 @@ if (!map) { map = new PrefixedNameToQualifiedNameMap; - OwnPtr<const QualifiedName*[]> attrs = XLinkNames::getXLinkAttrs(); + std::unique_ptr<const QualifiedName*[]> attrs = XLinkNames::getXLinkAttrs(); addNamesWithPrefix(map, xlinkAtom, attrs.get(), XLinkNames::XLinkAttrsCount); - OwnPtr<const QualifiedName*[]> xmlAttrs = XMLNames::getXMLAttrs(); + std::unique_ptr<const QualifiedName*[]> xmlAttrs = XMLNames::getXMLAttrs(); addNamesWithPrefix(map, xmlAtom, xmlAttrs.get(), XMLNames::XMLAttrsCount); map->add(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr);
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h index 74ae5c6b..e9096c2 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h
@@ -32,7 +32,6 @@ #include "core/html/parser/HTMLParserOptions.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h"
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.cpp index ad5e3d8..b3f5675 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.cpp
@@ -30,6 +30,7 @@ #include "core/html/parser/HTMLParserOptions.h" #include "core/html/parser/HTMLToken.h" #include "core/html/parser/XSSAuditorDelegate.h" +#include <memory> namespace blink { @@ -51,7 +52,7 @@ return; m_sourceTracker.end(m_input.current(), m_tokenizer.get(), m_token); - OwnPtr<XSSInfo> xssInfo = m_xssAuditor.filterToken(FilterTokenRequest(m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA())); + std::unique_ptr<XSSInfo> xssInfo = m_xssAuditor.filterToken(FilterTokenRequest(m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA())); HTMLViewSourceDocument::SourceAnnotation annotation = xssInfo ? HTMLViewSourceDocument::AnnotateSourceAsXSS : HTMLViewSourceDocument::AnnotateSourceAsSafe; document()->addSource(m_sourceTracker.sourceForToken(m_token), m_token, annotation);
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.h b/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.h index 1aca1d2..907a57f 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLViewSourceParser.h
@@ -32,6 +32,7 @@ #include "core/html/parser/HTMLSourceTracker.h" #include "core/html/parser/HTMLTokenizer.h" #include "core/html/parser/XSSAuditor.h" +#include <memory> namespace blink { @@ -59,7 +60,7 @@ HTMLInputStream m_input; HTMLToken m_token; HTMLSourceTracker m_sourceTracker; - OwnPtr<HTMLTokenizer> m_tokenizer; + std::unique_ptr<HTMLTokenizer> m_tokenizer; XSSAuditor m_xssAuditor; };
diff --git a/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp b/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp index 263c9a9..913e2b0 100644 --- a/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp +++ b/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp
@@ -4,6 +4,8 @@ #include "core/html/parser/ParsedChunkQueue.h" +#include <memory> + namespace blink { ParsedChunkQueue::ParsedChunkQueue() @@ -14,7 +16,7 @@ { } -bool ParsedChunkQueue::enqueue(PassOwnPtr<HTMLDocumentParser::ParsedChunk> chunk) +bool ParsedChunkQueue::enqueue(std::unique_ptr<HTMLDocumentParser::ParsedChunk> chunk) { MutexLocker locker(m_mutex); @@ -30,7 +32,7 @@ m_pendingChunks.clear(); } -void ParsedChunkQueue::takeAll(Vector<OwnPtr<HTMLDocumentParser::ParsedChunk>>& vector) +void ParsedChunkQueue::takeAll(Vector<std::unique_ptr<HTMLDocumentParser::ParsedChunk>>& vector) { MutexLocker locker(m_mutex);
diff --git a/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.h b/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.h index 3c9c9a7c..d65f292 100644 --- a/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.h +++ b/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.h
@@ -7,12 +7,11 @@ #include "core/html/parser/HTMLDocumentParser.h" #include "wtf/Deque.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -33,16 +32,16 @@ ~ParsedChunkQueue(); - bool enqueue(PassOwnPtr<HTMLDocumentParser::ParsedChunk>); + bool enqueue(std::unique_ptr<HTMLDocumentParser::ParsedChunk>); void clear(); - void takeAll(Vector<OwnPtr<HTMLDocumentParser::ParsedChunk>>&); + void takeAll(Vector<std::unique_ptr<HTMLDocumentParser::ParsedChunk>>&); private: ParsedChunkQueue(); Mutex m_mutex; - Vector<OwnPtr<HTMLDocumentParser::ParsedChunk>> m_pendingChunks; + Vector<std::unique_ptr<HTMLDocumentParser::ParsedChunk>> m_pendingChunks; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/PreloadRequest.h b/third_party/WebKit/Source/core/html/parser/PreloadRequest.h index cb0932d..9154fff 100644 --- a/third_party/WebKit/Source/core/html/parser/PreloadRequest.h +++ b/third_party/WebKit/Source/core/html/parser/PreloadRequest.h
@@ -12,7 +12,9 @@ #include "platform/CrossOriginAttributeValue.h" #include "platform/weborigin/SecurityPolicy.h" #include "wtf/Allocator.h" +#include "wtf/PtrUtil.h" #include "wtf/text/TextPosition.h" +#include <memory> namespace blink { @@ -23,9 +25,9 @@ public: enum RequestType { RequestTypePreload, RequestTypePreconnect, RequestTypeLinkRelPreload }; - static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType, const ReferrerPolicy referrerPolicy, const FetchRequest::ResourceWidth& resourceWidth = FetchRequest::ResourceWidth(), const ClientHintsPreferences& clientHintsPreferences = ClientHintsPreferences(), RequestType requestType = RequestTypePreload) + static std::unique_ptr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType, const ReferrerPolicy referrerPolicy, const FetchRequest::ResourceWidth& resourceWidth = FetchRequest::ResourceWidth(), const ClientHintsPreferences& clientHintsPreferences = ClientHintsPreferences(), RequestType requestType = RequestTypePreload) { - return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, resourceURL, baseURL, resourceType, resourceWidth, clientHintsPreferences, requestType, referrerPolicy)); + return wrapUnique(new PreloadRequest(initiatorName, initiatorPosition, resourceURL, baseURL, resourceType, resourceWidth, clientHintsPreferences, requestType, referrerPolicy)); } bool isSafeToSendToAnotherThread() const; @@ -104,7 +106,7 @@ IntegrityMetadataSet m_integrityMetadata; }; -typedef Vector<OwnPtr<PreloadRequest>> PreloadRequestStream; +typedef Vector<std::unique_ptr<PreloadRequest>> PreloadRequestStream; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/ResourcePreloader.h b/third_party/WebKit/Source/core/html/parser/ResourcePreloader.h index 571eecf..5974d8a0 100644 --- a/third_party/WebKit/Source/core/html/parser/ResourcePreloader.h +++ b/third_party/WebKit/Source/core/html/parser/ResourcePreloader.h
@@ -7,6 +7,7 @@ #include "core/CoreExport.h" #include "core/html/parser/PreloadRequest.h" +#include <memory> namespace blink { @@ -16,7 +17,7 @@ public: virtual void takeAndPreload(PreloadRequestStream&); private: - virtual void preload(PassOwnPtr<PreloadRequest>, const NetworkHintsInterface&) = 0; + virtual void preload(std::unique_ptr<PreloadRequest>, const NetworkHintsInterface&) = 0; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h index 82411a7..e7d83108 100644 --- a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h +++ b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h
@@ -24,7 +24,9 @@ #define TextResourceDecoder_h #include "core/CoreExport.h" +#include "wtf/PtrUtil.h" #include "wtf/text/TextEncoding.h" +#include <memory> namespace blink { @@ -45,15 +47,15 @@ EncodingFromParentFrame }; - static PassOwnPtr<TextResourceDecoder> create(const String& mimeType, const WTF::TextEncoding& defaultEncoding = WTF::TextEncoding(), bool usesEncodingDetector = false) + static std::unique_ptr<TextResourceDecoder> create(const String& mimeType, const WTF::TextEncoding& defaultEncoding = WTF::TextEncoding(), bool usesEncodingDetector = false) { - return adoptPtr(new TextResourceDecoder(mimeType, defaultEncoding, usesEncodingDetector ? UseAllAutoDetection : UseContentAndBOMBasedDetection)); + return wrapUnique(new TextResourceDecoder(mimeType, defaultEncoding, usesEncodingDetector ? UseAllAutoDetection : UseContentAndBOMBasedDetection)); } // Corresponds to utf-8 decode in Encoding spec: // https://encoding.spec.whatwg.org/#utf-8-decode. - static PassOwnPtr<TextResourceDecoder> createAlwaysUseUTF8ForText() + static std::unique_ptr<TextResourceDecoder> createAlwaysUseUTF8ForText() { - return adoptPtr(new TextResourceDecoder("plain/text", UTF8Encoding(), AlwaysUseUTF8ForText)); + return wrapUnique(new TextResourceDecoder("plain/text", UTF8Encoding(), AlwaysUseUTF8ForText)); } ~TextResourceDecoder(); @@ -112,7 +114,7 @@ ContentType m_contentType; WTF::TextEncoding m_encoding; - OwnPtr<TextCodec> m_codec; + std::unique_ptr<TextCodec> m_codec; EncodingSource m_source; const char* m_hintEncoding; Vector<char> m_buffer; @@ -124,7 +126,7 @@ bool m_sawError; EncodingDetectionOption m_encodingDetectionOption; - OwnPtr<HTMLMetaCharsetParser> m_charsetParser; + std::unique_ptr<HTMLMetaCharsetParser> m_charsetParser; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp b/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp index f2fc50ca..80fb277 100644 --- a/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp +++ b/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp
@@ -45,6 +45,8 @@ #include "platform/network/EncodedFormData.h" #include "platform/text/DecodeEscapeSequences.h" #include "wtf/ASCIICType.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace { @@ -393,14 +395,14 @@ if (m_decodedHTTPBody.find(isRequiredForInjection) == kNotFound) m_decodedHTTPBody = String(); if (m_decodedHTTPBody.length() >= miniumLengthForSuffixTree) - m_decodedHTTPBodySuffixTree = adoptPtr(new SuffixTree<ASCIICodebook>(m_decodedHTTPBody, suffixTreeDepth)); + m_decodedHTTPBodySuffixTree = wrapUnique(new SuffixTree<ASCIICodebook>(m_decodedHTTPBody, suffixTreeDepth)); } if (m_decodedURL.isEmpty() && m_decodedHTTPBody.isEmpty()) m_isEnabled = false; } -PassOwnPtr<XSSInfo> XSSAuditor::filterToken(const FilterTokenRequest& request) +std::unique_ptr<XSSInfo> XSSAuditor::filterToken(const FilterTokenRequest& request) { ASSERT(m_state != Uninitialized); if (!m_isEnabled || m_xssProtection == AllowReflectedXSS) @@ -418,7 +420,7 @@ if (didBlockScript) { bool didBlockEntirePage = (m_xssProtection == BlockReflectedXSS); - OwnPtr<XSSInfo> xssInfo = XSSInfo::create(m_documentURL, didBlockEntirePage, m_didSendValidXSSProtectionHeader, m_didSendValidCSPHeader); + std::unique_ptr<XSSInfo> xssInfo = XSSInfo::create(m_documentURL, didBlockEntirePage, m_didSendValidXSSProtectionHeader, m_didSendValidCSPHeader); return xssInfo; } return nullptr;
diff --git a/third_party/WebKit/Source/core/html/parser/XSSAuditor.h b/third_party/WebKit/Source/core/html/parser/XSSAuditor.h index 0ff1aa2..88874b33 100644 --- a/third_party/WebKit/Source/core/html/parser/XSSAuditor.h +++ b/third_party/WebKit/Source/core/html/parser/XSSAuditor.h
@@ -31,8 +31,8 @@ #include "platform/text/SuffixTree.h" #include "platform/weborigin/KURL.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/TextEncoding.h" +#include <memory> namespace blink { @@ -63,7 +63,7 @@ void init(Document*, XSSAuditorDelegate*); void initForFragment(); - PassOwnPtr<XSSInfo> filterToken(const FilterTokenRequest&); + std::unique_ptr<XSSInfo> filterToken(const FilterTokenRequest&); bool isSafeToSendToAnotherThread() const; void setEncoding(const WTF::TextEncoding&); @@ -129,7 +129,7 @@ String m_decodedURL; String m_decodedHTTPBody; String m_httpBodyAsString; - OwnPtr<SuffixTree<ASCIICodebook>> m_decodedHTTPBodySuffixTree; + std::unique_ptr<SuffixTree<ASCIICodebook>> m_decodedHTTPBodySuffixTree; State m_state; bool m_scriptTagFoundInRequest;
diff --git a/third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.h b/third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.h index 87c593d..33e25ce 100644 --- a/third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.h +++ b/third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.h
@@ -28,11 +28,11 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/TextPosition.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -43,9 +43,9 @@ USING_FAST_MALLOC(XSSInfo); WTF_MAKE_NONCOPYABLE(XSSInfo); public: - static PassOwnPtr<XSSInfo> create(const String& originalURL, bool didBlockEntirePage, bool didSendXSSProtectionHeader, bool didSendCSPHeader) + static std::unique_ptr<XSSInfo> create(const String& originalURL, bool didBlockEntirePage, bool didSendXSSProtectionHeader, bool didSendCSPHeader) { - return adoptPtr(new XSSInfo(originalURL, didBlockEntirePage, didSendXSSProtectionHeader, didSendCSPHeader)); + return wrapUnique(new XSSInfo(originalURL, didBlockEntirePage, didSendXSSProtectionHeader, didSendCSPHeader)); } String buildConsoleError() const; @@ -84,7 +84,7 @@ KURL m_reportURL; }; -typedef Vector<OwnPtr<XSSInfo>> XSSInfoStream; +typedef Vector<std::unique_ptr<XSSInfo>> XSSInfoStream; } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp index f5ce2f8c..08cae76 100644 --- a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp +++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
@@ -14,6 +14,7 @@ #include "core/testing/DummyPageHolder.h" #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -84,7 +85,7 @@ Document& document() { return m_pageHolder->document(); } private: - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; Persistent<MediaControls> m_mediaControls; };
diff --git a/third_party/WebKit/Source/core/html/track/vtt/VTTParser.h b/third_party/WebKit/Source/core/html/track/vtt/VTTParser.h index f32234b21..cdfe4780 100644 --- a/third_party/WebKit/Source/core/html/track/vtt/VTTParser.h +++ b/third_party/WebKit/Source/core/html/track/vtt/VTTParser.h
@@ -39,8 +39,8 @@ #include "core/html/track/vtt/VTTRegion.h" #include "core/html/track/vtt/VTTTokenizer.h" #include "platform/heap/Handle.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -139,7 +139,7 @@ static bool collectTimeStamp(VTTScanner& input, double& timeStamp); BufferedLineReader m_lineReader; - OwnPtr<TextResourceDecoder> m_decoder; + std::unique_ptr<TextResourceDecoder> m_decoder; AtomicString m_currentId; double m_currentStartTime; double m_currentEndTime;
diff --git a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp index 86b14a70..af9291e 100644 --- a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp +++ b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
@@ -50,6 +50,7 @@ #include "public/platform/Platform.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" +#include <memory> #include <v8.h> namespace blink { @@ -234,7 +235,7 @@ ImageDecoder::GammaAndColorProfileOption colorSpaceOp = ImageDecoder::GammaAndColorProfileApplied; if (m_options.colorSpaceConversion() == "none") colorSpaceOp = ImageDecoder::GammaAndColorProfileIgnored; - OwnPtr<ImageDecoder> decoder(ImageDecoder::create(*sharedBuffer, alphaOp, colorSpaceOp)); + std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(*sharedBuffer, alphaOp, colorSpaceOp)); RefPtr<SkImage> frame; if (decoder) { decoder->setData(sharedBuffer.get(), true);
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp index a66c15d..04b488f 100644 --- a/third_party/WebKit/Source/core/input/EventHandler.cpp +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -100,8 +100,10 @@ #include "platform/scroll/Scrollbar.h" #include "wtf/Assertions.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/TemporaryChange.h" +#include <memory> namespace blink { @@ -1114,12 +1116,12 @@ if (!mouseEvent.fromTouch()) m_frame->selection().setCaretBlinkingSuspended(false); - OwnPtr<UserGestureIndicator> gestureIndicator; + std::unique_ptr<UserGestureIndicator> gestureIndicator; if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken) - gestureIndicator = adoptPtr(new UserGestureIndicator(m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken.release())); + gestureIndicator = wrapUnique(new UserGestureIndicator(m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken.release())); else - gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture)); + gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingUserGesture)); #if OS(WIN) if (Page* page = m_frame->page())
diff --git a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp index 0452500..5fa99f75 100644 --- a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp +++ b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
@@ -16,6 +16,7 @@ #include "core/testing/DummyPageHolder.h" #include "platform/PlatformMouseEvent.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -29,7 +30,7 @@ void setHtmlInnerHTML(const char* htmlContent); private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; class TapEventBuilder : public PlatformGestureEvent {
diff --git a/third_party/WebKit/Source/core/input/ScrollManager.cpp b/third_party/WebKit/Source/core/input/ScrollManager.cpp index d5b475c..9d7d5a8 100644 --- a/third_party/WebKit/Source/core/input/ScrollManager.cpp +++ b/third_party/WebKit/Source/core/input/ScrollManager.cpp
@@ -19,6 +19,8 @@ #include "core/page/scrolling/ScrollState.h" #include "core/paint/PaintLayer.h" #include "platform/PlatformGestureEvent.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -246,7 +248,7 @@ // using parts of the scroll customization framework on just this element. computeScrollChainForSingleNode(*node, m_currentScrollChain); - OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); + std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); scrollStateData->delta_x = delta.width(); scrollStateData->delta_y = delta.height(); scrollStateData->position_x = position.x(); @@ -326,7 +328,7 @@ passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->layoutObject()); if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { m_currentScrollChain.clear(); - OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); + std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); scrollStateData->position_x = gestureEvent.position().x(); scrollStateData->position_y = gestureEvent.position().y(); scrollStateData->is_beginning = true; @@ -380,7 +382,7 @@ } if (handleScrollCustomization) { - OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); + std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); scrollStateData->delta_x = delta.width(); scrollStateData->delta_y = delta.height(); scrollStateData->delta_granularity = ScrollByPrecisePixel; @@ -445,7 +447,7 @@ if (node) { passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { - OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); + std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); scrollStateData->is_ending = true; scrollStateData->is_in_inertial_phase = gestureEvent.inertialPhase() == ScrollInertialPhaseMomentum; scrollStateData->from_user_input = true;
diff --git a/third_party/WebKit/Source/core/input/TouchEventManager.cpp b/third_party/WebKit/Source/core/input/TouchEventManager.cpp index 7b6d67c..5971003 100644 --- a/third_party/WebKit/Source/core/input/TouchEventManager.cpp +++ b/third_party/WebKit/Source/core/input/TouchEventManager.cpp
@@ -18,6 +18,8 @@ #include "platform/Histogram.h" #include "platform/PlatformTouchEvent.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -469,7 +471,7 @@ isSameOrigin = true; } - OwnPtr<UserGestureIndicator> gestureIndicator; + std::unique_ptr<UserGestureIndicator> gestureIndicator; if (isTap || isSameOrigin) { UserGestureUtilizedCallback* callback = 0; // These are cases we'd like to migrate to not hold a user gesture. @@ -480,9 +482,9 @@ callback = this; } if (m_touchSequenceUserGestureToken) - gestureIndicator = adoptPtr(new UserGestureIndicator(m_touchSequenceUserGestureToken.release(), callback)); + gestureIndicator = wrapUnique(new UserGestureIndicator(m_touchSequenceUserGestureToken.release(), callback)); else - gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture, callback)); + gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingUserGesture, callback)); m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken(); }
diff --git a/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp b/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp index 4bb74a6c..19fa9dc 100644 --- a/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp +++ b/third_party/WebKit/Source/core/inspector/ConsoleMessage.cpp
@@ -8,7 +8,7 @@ #include "bindings/core/v8/SourceLocation.h" #include "core/inspector/ScriptArguments.h" #include "wtf/CurrentTime.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -40,7 +40,7 @@ } // static -ConsoleMessage* ConsoleMessage::create(MessageSource source, MessageLevel level, const String& message, PassOwnPtr<SourceLocation> location, ScriptArguments* arguments) +ConsoleMessage* ConsoleMessage::create(MessageSource source, MessageLevel level, const String& message, std::unique_ptr<SourceLocation> location, ScriptArguments* arguments) { return new ConsoleMessage(source, level, message, std::move(location), arguments); } @@ -54,7 +54,7 @@ ConsoleMessage::ConsoleMessage(MessageSource source, MessageLevel level, const String& message, - PassOwnPtr<SourceLocation> location, + std::unique_ptr<SourceLocation> location, ScriptArguments* arguments) : m_source(source) , m_level(level)
diff --git a/third_party/WebKit/Source/core/inspector/ConsoleMessage.h b/third_party/WebKit/Source/core/inspector/ConsoleMessage.h index 3fcc279..0df4f4f 100644 --- a/third_party/WebKit/Source/core/inspector/ConsoleMessage.h +++ b/third_party/WebKit/Source/core/inspector/ConsoleMessage.h
@@ -13,6 +13,7 @@ #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -24,7 +25,7 @@ class CORE_EXPORT ConsoleMessage final: public GarbageCollectedFinalized<ConsoleMessage> { public: // Location should not be null. Zero lineNumber or columnNumber means unknown. - static ConsoleMessage* create(MessageSource, MessageLevel, const String& message, PassOwnPtr<SourceLocation>, ScriptArguments* = nullptr); + static ConsoleMessage* create(MessageSource, MessageLevel, const String& message, std::unique_ptr<SourceLocation>, ScriptArguments* = nullptr); // Shortcut when location is unknown. Captures current location. static ConsoleMessage* create(MessageSource, MessageLevel, const String& message); @@ -56,13 +57,13 @@ DECLARE_TRACE(); private: - ConsoleMessage(MessageSource, MessageLevel, const String& message, PassOwnPtr<SourceLocation>, ScriptArguments*); + ConsoleMessage(MessageSource, MessageLevel, const String& message, std::unique_ptr<SourceLocation>, ScriptArguments*); MessageSource m_source; MessageLevel m_level; MessageType m_type; String m_message; - OwnPtr<SourceLocation> m_location; + std::unique_ptr<SourceLocation> m_location; Member<ScriptArguments> m_scriptArguments; unsigned long m_requestIdentifier; double m_timestamp;
diff --git a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp index 02f656a8..3115d97 100644 --- a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp +++ b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.cpp
@@ -53,6 +53,7 @@ #include "wtf/RefPtr.h" #include "wtf/text/Base64.h" #include "wtf/text/CString.h" +#include <memory> namespace blink { @@ -399,7 +400,7 @@ { Digest* digest = new Digest(node); - OwnPtr<WebCryptoDigestor> digestor = createDigestor(HashAlgorithmSha1); + std::unique_ptr<WebCryptoDigestor> digestor = createDigestor(HashAlgorithmSha1); DigestValue digestResult; Node::NodeType nodeType = node->getNodeType(); @@ -419,7 +420,7 @@ AttributeCollection attributes = element.attributesWithoutUpdate(); if (!attributes.isEmpty()) { - OwnPtr<WebCryptoDigestor> attrsDigestor = createDigestor(HashAlgorithmSha1); + std::unique_ptr<WebCryptoDigestor> attrsDigestor = createDigestor(HashAlgorithmSha1); for (auto& attribute : attributes) { addStringToDigestor(attrsDigestor.get(), attribute.name().toString()); addStringToDigestor(attrsDigestor.get(), attribute.value().getString());
diff --git a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.h b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.h index 68ba046..37155bf 100644 --- a/third_party/WebKit/Source/core/inspector/DOMPatchSupport.h +++ b/third_party/WebKit/Source/core/inspector/DOMPatchSupport.h
@@ -33,8 +33,6 @@ #include "platform/heap/Handle.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp index fadc5d0b..47e1b9e7 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
@@ -29,6 +29,7 @@ #include "platform/animation/TimingFunction.h" #include "platform/v8_inspector/public/V8InspectorSession.h" #include "wtf/text/Base64.h" +#include <memory> namespace AnimationAgentState { static const char animationAgentEnabled[] = "animationAgentEnabled"; @@ -425,7 +426,7 @@ Element* element = effect->target(); HeapVector<Member<CSSStyleDeclaration>> styles = m_cssAgent->matchingStyles(element); - OwnPtr<WebCryptoDigestor> digestor = createDigestor(HashAlgorithmSha1); + std::unique_ptr<WebCryptoDigestor> digestor = createDigestor(HashAlgorithmSha1); addStringToDigestor(digestor.get(), type); addStringToDigestor(digestor.get(), animation.id()); for (CSSPropertyID property : cssProperties) {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h index c8815ce..1e4e2b3 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h
@@ -10,7 +10,6 @@ #include "core/css/CSSKeyframesRule.h" #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Animation.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorApplicationCacheAgent.h b/third_party/WebKit/Source/core/inspector/InspectorApplicationCacheAgent.h index d19d368..2acbcdb4 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorApplicationCacheAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorApplicationCacheAgent.h
@@ -30,7 +30,6 @@ #include "core/inspector/protocol/ApplicationCache.h" #include "core/loader/appcache/ApplicationCacheHost.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp index c8bf64b..4c062559 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
@@ -78,8 +78,10 @@ #include "platform/PlatformTouchEvent.h" #include "platform/v8_inspector/public/V8InspectorSession.h" #include "wtf/ListHashSet.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -1089,7 +1091,7 @@ m_client->setInspectMode(searchMode, searchMode != NotSearching ? highlightConfigFromInspectorObject(errorString, highlightInspectorObject) : nullptr); } -PassOwnPtr<InspectorHighlightConfig> InspectorDOMAgent::highlightConfigFromInspectorObject(ErrorString* errorString, const Maybe<protocol::DOM::HighlightConfig>& highlightInspectorObject) +std::unique_ptr<InspectorHighlightConfig> InspectorDOMAgent::highlightConfigFromInspectorObject(ErrorString* errorString, const Maybe<protocol::DOM::HighlightConfig>& highlightInspectorObject) { if (!highlightInspectorObject.isJust()) { *errorString = "Internal error: highlight configuration parameter is missing"; @@ -1097,7 +1099,7 @@ } protocol::DOM::HighlightConfig* config = highlightInspectorObject.fromJust(); - OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHighlightConfig()); + std::unique_ptr<InspectorHighlightConfig> highlightConfig = wrapUnique(new InspectorHighlightConfig()); highlightConfig->showInfo = config->getShowInfo(false); highlightConfig->showRulers = config->getShowRulers(false); highlightConfig->showExtensionLines = config->getShowExtensionLines(false); @@ -1138,13 +1140,13 @@ void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int height, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor) { - OwnPtr<FloatQuad> quad = adoptPtr(new FloatQuad(FloatRect(x, y, width, height))); + std::unique_ptr<FloatQuad> quad = wrapUnique(new FloatQuad(FloatRect(x, y, width, height))); innerHighlightQuad(std::move(quad), color, outlineColor); } void InspectorDOMAgent::highlightQuad(ErrorString* errorString, std::unique_ptr<protocol::Array<double>> quadArray, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor) { - OwnPtr<FloatQuad> quad = adoptPtr(new FloatQuad()); + std::unique_ptr<FloatQuad> quad = wrapUnique(new FloatQuad()); if (!parseQuad(std::move(quadArray), quad.get())) { *errorString = "Invalid Quad format"; return; @@ -1152,9 +1154,9 @@ innerHighlightQuad(std::move(quad), color, outlineColor); } -void InspectorDOMAgent::innerHighlightQuad(PassOwnPtr<FloatQuad> quad, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor) +void InspectorDOMAgent::innerHighlightQuad(std::unique_ptr<FloatQuad> quad, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor) { - OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHighlightConfig()); + std::unique_ptr<InspectorHighlightConfig> highlightConfig = wrapUnique(new InspectorHighlightConfig()); highlightConfig->content = parseColor(color.fromMaybe(nullptr)); highlightConfig->contentOutline = parseColor(outlineColor.fromMaybe(nullptr)); if (m_client) @@ -1194,7 +1196,7 @@ if (!node) return; - OwnPtr<InspectorHighlightConfig> highlightConfig = highlightConfigFromInspectorObject(errorString, std::move(highlightInspectorObject)); + std::unique_ptr<InspectorHighlightConfig> highlightConfig = highlightConfigFromInspectorObject(errorString, std::move(highlightInspectorObject)); if (!highlightConfig) return; @@ -1211,7 +1213,7 @@ LocalFrame* frame = IdentifiersFactory::frameById(m_inspectedFrames, frameId); // FIXME: Inspector doesn't currently work cross process. if (frame && frame->deprecatedLocalOwner()) { - OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHighlightConfig()); + std::unique_ptr<InspectorHighlightConfig> highlightConfig = wrapUnique(new InspectorHighlightConfig()); highlightConfig->showInfo = true; // Always show tooltips for frames. highlightConfig->content = parseColor(color.fromMaybe(nullptr)); highlightConfig->contentOutline = parseColor(outlineColor.fromMaybe(nullptr));
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h index 68468d6d..84dc60e 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h
@@ -39,14 +39,12 @@ #include "platform/geometry/FloatQuad.h" #include "platform/inspector_protocol/Values.h" #include "platform/v8_inspector/public/V8InspectorSession.h" - #include "wtf/HashMap.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -89,8 +87,8 @@ virtual ~Client() { } virtual void hideHighlight() { } virtual void highlightNode(Node*, const InspectorHighlightConfig&, bool omitTooltip) { } - virtual void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlightConfig&) { } - virtual void setInspectMode(SearchMode searchMode, PassOwnPtr<InspectorHighlightConfig>) { } + virtual void highlightQuad(std::unique_ptr<FloatQuad>, const InspectorHighlightConfig&) { } + virtual void setInspectMode(SearchMode searchMode, std::unique_ptr<InspectorHighlightConfig>) { } virtual void setInspectedNode(Node*) { } }; @@ -200,7 +198,7 @@ void innerEnable(); void setSearchingForNode(ErrorString*, SearchMode, const Maybe<protocol::DOM::HighlightConfig>&); - PassOwnPtr<InspectorHighlightConfig> highlightConfigFromInspectorObject(ErrorString*, const Maybe<protocol::DOM::HighlightConfig>& highlightInspectorObject); + std::unique_ptr<InspectorHighlightConfig> highlightConfigFromInspectorObject(ErrorString*, const Maybe<protocol::DOM::HighlightConfig>& highlightInspectorObject); // Node-related methods. typedef HeapHashMap<Member<Node>, int> NodeToIdMap; @@ -228,7 +226,7 @@ void discardFrontendBindings(); - void innerHighlightQuad(PassOwnPtr<FloatQuad>, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor); + void innerHighlightQuad(std::unique_ptr<FloatQuad>, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGBA>& outlineColor); bool pushDocumentUponHandlelessOperation(ErrorString*);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.h b/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.h index 4bcddb7..844bae2 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorDOMDebuggerAgent.h
@@ -37,7 +37,6 @@ #include "core/inspector/InspectorDOMAgent.h" #include "core/inspector/protocol/DOMDebugger.h" #include "wtf/HashMap.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorInputAgent.h b/third_party/WebKit/Source/core/inspector/InspectorInputAgent.h index 0244a01..0d48264 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorInputAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorInputAgent.h
@@ -35,7 +35,6 @@ #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Input.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp index 688a196..4d2887f 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -57,6 +57,7 @@ #include "public/platform/WebLayer.h" #include "wtf/text/Base64.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -398,7 +399,7 @@ const PictureSnapshot* snapshot = snapshotById(errorString, snapshotId); if (!snapshot) return; - OwnPtr<Vector<char>> base64Data = snapshot->replay(fromStep.fromMaybe(0), toStep.fromMaybe(0), scale.fromMaybe(1.0)); + std::unique_ptr<Vector<char>> base64Data = snapshot->replay(fromStep.fromMaybe(0), toStep.fromMaybe(0), scale.fromMaybe(1.0)); if (!base64Data) { *errorString = "Image encoding failed"; return; @@ -423,7 +424,7 @@ FloatRect rect; if (clipRect.isJust()) parseRect(clipRect.fromJust(), &rect); - OwnPtr<PictureSnapshot::Timings> timings = snapshot->profile(minRepeatCount.fromMaybe(1), minDuration.fromMaybe(0), clipRect.isJust() ? &rect : 0); + std::unique_ptr<PictureSnapshot::Timings> timings = snapshot->profile(minRepeatCount.fromMaybe(1), minDuration.fromMaybe(0), clipRect.isJust() ? &rect : 0); *outTimings = Array<Array<double>>::create(); for (size_t i = 0; i < timings->size(); ++i) { const Vector<double>& row = (*timings)[i];
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h index 76db7d9..4f9ea48 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h
@@ -35,7 +35,6 @@ #include "core/inspector/protocol/LayerTree.h" #include "platform/Timer.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.cpp index 1d06a3d..0fd1bb3 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.cpp
@@ -31,7 +31,6 @@ #include "core/inspector/InspectorMemoryAgent.h" #include "core/inspector/InstanceCounters.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.h b/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.h index 05a2ee66..9acd5eb 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorMemoryAgent.h
@@ -34,7 +34,6 @@ #include "core/CoreExport.h" #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Memory.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp index 9171a7ce..31a9361 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -74,6 +74,7 @@ #include "wtf/CurrentTime.h" #include "wtf/RefPtr.h" #include "wtf/text/Base64.h" +#include <memory> namespace blink { @@ -183,7 +184,7 @@ String m_mimeType; String m_textEncodingName; std::unique_ptr<GetResponseBodyCallback> m_callback; - OwnPtr<FileReaderLoader> m_loader; + std::unique_ptr<FileReaderLoader> m_loader; RefPtr<SharedBuffer> m_rawData; };
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h index d787c07..eacb8c7e 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h
@@ -38,7 +38,6 @@ #include "core/inspector/protocol/Network.h" #include "platform/Timer.h" #include "platform/heap/Handle.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp index 174c351..375be28 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
@@ -71,6 +71,7 @@ #include "wtf/Vector.h" #include "wtf/text/Base64.h" #include "wtf/text/TextEncoding.h" +#include <memory> namespace blink { @@ -148,12 +149,12 @@ return type == Resource::CSSStyleSheet || type == Resource::XSLStyleSheet || type == Resource::Script || type == Resource::Raw || type == Resource::ImportResource || type == Resource::MainResource; } -static PassOwnPtr<TextResourceDecoder> createResourceTextDecoder(const String& mimeType, const String& textEncodingName) +static std::unique_ptr<TextResourceDecoder> createResourceTextDecoder(const String& mimeType, const String& textEncodingName) { if (!textEncodingName.isEmpty()) return TextResourceDecoder::create("text/plain", textEncodingName); if (DOMImplementation::isXMLMIMEType(mimeType)) { - OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); + std::unique_ptr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); decoder->useLenientXMLDecoding(); return decoder; } @@ -163,7 +164,7 @@ return TextResourceDecoder::create("text/plain", "UTF-8"); if (DOMImplementation::isTextMIMEType(mimeType)) return TextResourceDecoder::create("text/plain", "ISO-8859-1"); - return PassOwnPtr<TextResourceDecoder>(); + return std::unique_ptr<TextResourceDecoder>(); } static void maybeEncodeTextContent(const String& textContent, PassRefPtr<SharedBuffer> buffer, String* result, bool* base64Encoded) @@ -188,7 +189,7 @@ return false; String textContent; - OwnPtr<TextResourceDecoder> decoder = createResourceTextDecoder(mimeType, textEncodingName); + std::unique_ptr<TextResourceDecoder> decoder = createResourceTextDecoder(mimeType, textEncodingName); WTF::TextEncoding encoding(textEncodingName); if (decoder) {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorSession.h b/third_party/WebKit/Source/core/inspector/InspectorSession.h index 6628556..74bf806 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorSession.h +++ b/third_party/WebKit/Source/core/inspector/InspectorSession.h
@@ -12,7 +12,6 @@ #include "platform/inspector_protocol/Values.h" #include "platform/v8_inspector/public/V8InspectorSessionClient.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp index ace6c4d..2a95b4b 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
@@ -53,8 +53,7 @@ #include "core/inspector/InspectorResourceContainer.h" #include "core/svg/SVGStyleElement.h" #include "platform/v8_inspector/public/V8ContentSearchUtil.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/TextPosition.h" #include <algorithm> @@ -884,13 +883,13 @@ InspectorStyleSheetBase::InspectorStyleSheetBase(Listener* listener) : m_id(IdentifiersFactory::createIdentifier()) , m_listener(listener) - , m_lineEndings(adoptPtr(new LineEndings())) + , m_lineEndings(wrapUnique(new LineEndings())) { } void InspectorStyleSheetBase::onStyleSheetTextChanged() { - m_lineEndings = adoptPtr(new LineEndings()); + m_lineEndings = wrapUnique(new LineEndings()); if (listener()) listener()->styleSheetChanged(this); }
diff --git a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.h b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.h index 26d56ac6..c4be8519 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.h +++ b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.h
@@ -35,6 +35,7 @@ #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -116,7 +117,7 @@ String m_id; Listener* m_listener; - OwnPtr<LineEndings> m_lineEndings; + std::unique_ptr<LineEndings> m_lineEndings; }; class InspectorStyleSheet : public InspectorStyleSheetBase {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.h b/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.h index 84562608..235166d 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.h +++ b/third_party/WebKit/Source/core/inspector/InspectorTaskRunner.h
@@ -11,8 +11,6 @@ #include "wtf/Forward.h" #include "wtf/Functional.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" #include <v8.h>
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp index 073ed50..a3426f5 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
@@ -34,6 +34,7 @@ #include "wtf/Vector.h" #include "wtf/text/TextPosition.h" #include <inttypes.h> +#include <memory> #include <v8-profiler.h> #include <v8.h> @@ -167,9 +168,9 @@ } // namespace namespace InspectorScheduleStyleInvalidationTrackingEvent { -PassOwnPtr<TracedValue> fillCommonPart(Element& element, const InvalidationSet& invalidationSet, const char* invalidatedSelector) +std::unique_ptr<TracedValue> fillCommonPart(Element& element, const InvalidationSet& invalidationSet, const char* invalidatedSelector) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(element.document().frame())); setNodeInfo(value.get(), &element, "nodeId", "nodeName"); value->setString("invalidationSet", descendantInvalidationSetToIdString(invalidationSet)); @@ -198,30 +199,30 @@ return priorityString; } -PassOwnPtr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::idChange(Element& element, const InvalidationSet& invalidationSet, const AtomicString& id) +std::unique_ptr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::idChange(Element& element, const InvalidationSet& invalidationSet, const AtomicString& id) { - OwnPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Id); + std::unique_ptr<TracedValue> value = fillCommonPart(element, invalidationSet, Id); value->setString("changedId", id); return value; } -PassOwnPtr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::classChange(Element& element, const InvalidationSet& invalidationSet, const AtomicString& className) +std::unique_ptr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::classChange(Element& element, const InvalidationSet& invalidationSet, const AtomicString& className) { - OwnPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Class); + std::unique_ptr<TracedValue> value = fillCommonPart(element, invalidationSet, Class); value->setString("changedClass", className); return value; } -PassOwnPtr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::attributeChange(Element& element, const InvalidationSet& invalidationSet, const QualifiedName& attributeName) +std::unique_ptr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::attributeChange(Element& element, const InvalidationSet& invalidationSet, const QualifiedName& attributeName) { - OwnPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribute); + std::unique_ptr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribute); value->setString("changedAttribute", attributeName.toString()); return value; } -PassOwnPtr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::pseudoChange(Element& element, const InvalidationSet& invalidationSet, CSSSelector::PseudoType pseudoType) +std::unique_ptr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::pseudoChange(Element& element, const InvalidationSet& invalidationSet, CSSSelector::PseudoType pseudoType) { - OwnPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribute); + std::unique_ptr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribute); value->setString("changedPseudo", pseudoTypeToString(pseudoType)); return value; } @@ -240,9 +241,9 @@ const char InspectorStyleInvalidatorInvalidateEvent::PreventStyleSharingForParent[] = "Prevent style sharing for parent"; namespace InspectorStyleInvalidatorInvalidateEvent { -PassOwnPtr<TracedValue> fillCommonPart(Element& element, const char* reason) +std::unique_ptr<TracedValue> fillCommonPart(Element& element, const char* reason) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(element.document().frame())); setNodeInfo(value.get(), &element, "nodeId", "nodeName"); value->setString("reason", reason); @@ -250,14 +251,14 @@ } } // namespace InspectorStyleInvalidatorInvalidateEvent -PassOwnPtr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::data(Element& element, const char* reason) +std::unique_ptr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::data(Element& element, const char* reason) { return fillCommonPart(element, reason); } -PassOwnPtr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::selectorPart(Element& element, const char* reason, const InvalidationSet& invalidationSet, const String& selectorPart) +std::unique_ptr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::selectorPart(Element& element, const char* reason, const InvalidationSet& invalidationSet, const String& selectorPart) { - OwnPtr<TracedValue> value = fillCommonPart(element, reason); + std::unique_ptr<TracedValue> value = fillCommonPart(element, reason); value->beginArray("invalidationList"); invalidationSet.toTracedValue(value.get()); value->endArray(); @@ -265,9 +266,9 @@ return value; } -PassOwnPtr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::invalidationList(Element& element, const Vector<RefPtr<InvalidationSet>>& invalidationList) +std::unique_ptr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::invalidationList(Element& element, const Vector<RefPtr<InvalidationSet>>& invalidationList) { - OwnPtr<TracedValue> value = fillCommonPart(element, ElementHasPendingInvalidationList); + std::unique_ptr<TracedValue> value = fillCommonPart(element, ElementHasPendingInvalidationList); value->beginArray("invalidationList"); for (const auto& invalidationSet : invalidationList) invalidationSet->toTracedValue(value.get()); @@ -275,11 +276,11 @@ return value; } -PassOwnPtr<TracedValue> InspectorStyleRecalcInvalidationTrackingEvent::data(Node* node, const StyleChangeReasonForTracing& reason) +std::unique_ptr<TracedValue> InspectorStyleRecalcInvalidationTrackingEvent::data(Node* node, const StyleChangeReasonForTracing& reason) { ASSERT(node); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(node->document().frame())); setNodeInfo(value.get(), node, "nodeId", "nodeName"); value->setString("reason", reason.reasonString()); @@ -288,7 +289,7 @@ return value; } -PassOwnPtr<TracedValue> InspectorLayoutEvent::beginData(FrameView* frameView) +std::unique_ptr<TracedValue> InspectorLayoutEvent::beginData(FrameView* frameView) { bool isPartial; unsigned needsLayoutObjects; @@ -296,7 +297,7 @@ LocalFrame& frame = frameView->frame(); frame.view()->countObjectsNeedingLayout(needsLayoutObjects, totalObjects, isPartial); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setInteger("dirtyObjects", needsLayoutObjects); value->setInteger("totalObjects", totalObjects); value->setBoolean("partialLayout", isPartial); @@ -330,12 +331,12 @@ setNodeInfo(value, node, idFieldName, nameFieldName); } -PassOwnPtr<TracedValue> InspectorLayoutEvent::endData(LayoutObject* rootForThisLayout) +std::unique_ptr<TracedValue> InspectorLayoutEvent::endData(LayoutObject* rootForThisLayout) { Vector<FloatQuad> quads; rootForThisLayout->absoluteQuads(quads); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); if (quads.size() >= 1) { createQuad(value.get(), "root", quads[0]); setGeneratingNodeInfo(value.get(), rootForThisLayout, "rootNode"); @@ -381,10 +382,10 @@ const char ScrollbarChanged[] = "Scrollbar changed"; } // namespace LayoutInvalidationReason -PassOwnPtr<TracedValue> InspectorLayoutInvalidationTrackingEvent::data(const LayoutObject* layoutObject, LayoutInvalidationReasonForTracing reason) +std::unique_ptr<TracedValue> InspectorLayoutInvalidationTrackingEvent::data(const LayoutObject* layoutObject, LayoutInvalidationReasonForTracing reason) { ASSERT(layoutObject); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(layoutObject->frame())); setGeneratingNodeInfo(value.get(), layoutObject, "nodeId", "nodeName"); value->setString("reason", reason); @@ -392,21 +393,21 @@ return value; } -PassOwnPtr<TracedValue> InspectorPaintInvalidationTrackingEvent::data(const LayoutObject* layoutObject, const LayoutObject& paintContainer) +std::unique_ptr<TracedValue> InspectorPaintInvalidationTrackingEvent::data(const LayoutObject* layoutObject, const LayoutObject& paintContainer) { ASSERT(layoutObject); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(layoutObject->frame())); setGeneratingNodeInfo(value.get(), &paintContainer, "paintId"); setGeneratingNodeInfo(value.get(), layoutObject, "nodeId", "nodeName"); return value; } -PassOwnPtr<TracedValue> InspectorScrollInvalidationTrackingEvent::data(const LayoutObject& layoutObject) +std::unique_ptr<TracedValue> InspectorScrollInvalidationTrackingEvent::data(const LayoutObject& layoutObject) { static const char ScrollInvalidationReason[] = "Scroll with viewport-constrained element"; - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(layoutObject.frame())); value->setString("reason", ScrollInvalidationReason); setGeneratingNodeInfo(value.get(), &layoutObject, "nodeId", "nodeName"); @@ -414,21 +415,21 @@ return value; } -PassOwnPtr<TracedValue> InspectorChangeResourcePriorityEvent::data(unsigned long identifier, const ResourceLoadPriority& loadPriority) +std::unique_ptr<TracedValue> InspectorChangeResourcePriorityEvent::data(unsigned long identifier, const ResourceLoadPriority& loadPriority) { String requestId = IdentifiersFactory::requestId(identifier); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("priority", resourcePriorityString(loadPriority)); return value; } -PassOwnPtr<TracedValue> InspectorSendRequestEvent::data(unsigned long identifier, LocalFrame* frame, const ResourceRequest& request) +std::unique_ptr<TracedValue> InspectorSendRequestEvent::data(unsigned long identifier, LocalFrame* frame, const ResourceRequest& request) { String requestId = IdentifiersFactory::requestId(identifier); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("frame", toHexString(frame)); value->setString("url", request.url().getString()); @@ -440,11 +441,11 @@ return value; } -PassOwnPtr<TracedValue> InspectorReceiveResponseEvent::data(unsigned long identifier, LocalFrame* frame, const ResourceResponse& response) +std::unique_ptr<TracedValue> InspectorReceiveResponseEvent::data(unsigned long identifier, LocalFrame* frame, const ResourceResponse& response) { String requestId = IdentifiersFactory::requestId(identifier); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("frame", toHexString(frame)); value->setInteger("statusCode", response.httpStatusCode()); @@ -452,22 +453,22 @@ return value; } -PassOwnPtr<TracedValue> InspectorReceiveDataEvent::data(unsigned long identifier, LocalFrame* frame, int encodedDataLength) +std::unique_ptr<TracedValue> InspectorReceiveDataEvent::data(unsigned long identifier, LocalFrame* frame, int encodedDataLength) { String requestId = IdentifiersFactory::requestId(identifier); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("frame", toHexString(frame)); value->setInteger("encodedDataLength", encodedDataLength); return value; } -PassOwnPtr<TracedValue> InspectorResourceFinishEvent::data(unsigned long identifier, double finishTime, bool didFail) +std::unique_ptr<TracedValue> InspectorResourceFinishEvent::data(unsigned long identifier, double finishTime, bool didFail) { String requestId = IdentifiersFactory::requestId(identifier); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setBoolean("didFail", didFail); if (finishTime) @@ -483,39 +484,39 @@ return frame; } -static PassOwnPtr<TracedValue> genericTimerData(ExecutionContext* context, int timerId) +static std::unique_ptr<TracedValue> genericTimerData(ExecutionContext* context, int timerId) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setInteger("timerId", timerId); if (LocalFrame* frame = frameForExecutionContext(context)) value->setString("frame", toHexString(frame)); return value; } -PassOwnPtr<TracedValue> InspectorTimerInstallEvent::data(ExecutionContext* context, int timerId, int timeout, bool singleShot) +std::unique_ptr<TracedValue> InspectorTimerInstallEvent::data(ExecutionContext* context, int timerId, int timeout, bool singleShot) { - OwnPtr<TracedValue> value = genericTimerData(context, timerId); + std::unique_ptr<TracedValue> value = genericTimerData(context, timerId); value->setInteger("timeout", timeout); value->setBoolean("singleShot", singleShot); setCallStack(value.get()); return value; } -PassOwnPtr<TracedValue> InspectorTimerRemoveEvent::data(ExecutionContext* context, int timerId) +std::unique_ptr<TracedValue> InspectorTimerRemoveEvent::data(ExecutionContext* context, int timerId) { - OwnPtr<TracedValue> value = genericTimerData(context, timerId); + std::unique_ptr<TracedValue> value = genericTimerData(context, timerId); setCallStack(value.get()); return value; } -PassOwnPtr<TracedValue> InspectorTimerFireEvent::data(ExecutionContext* context, int timerId) +std::unique_ptr<TracedValue> InspectorTimerFireEvent::data(ExecutionContext* context, int timerId) { return genericTimerData(context, timerId); } -PassOwnPtr<TracedValue> InspectorAnimationFrameEvent::data(ExecutionContext* context, int callbackId) +std::unique_ptr<TracedValue> InspectorAnimationFrameEvent::data(ExecutionContext* context, int callbackId) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setInteger("id", callbackId); if (context->isDocument()) value->setString("frame", toHexString(toDocument(context)->frame())); @@ -525,9 +526,9 @@ return value; } -PassOwnPtr<TracedValue> genericIdleCallbackEvent(ExecutionContext* context, int id) +std::unique_ptr<TracedValue> genericIdleCallbackEvent(ExecutionContext* context, int id) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setInteger("id", id); if (LocalFrame* frame = frameForExecutionContext(context)) value->setString("frame", toHexString(frame)); @@ -535,29 +536,29 @@ return value; } -PassOwnPtr<TracedValue> InspectorIdleCallbackRequestEvent::data(ExecutionContext* context, int id, double timeout) +std::unique_ptr<TracedValue> InspectorIdleCallbackRequestEvent::data(ExecutionContext* context, int id, double timeout) { - OwnPtr<TracedValue> value = genericIdleCallbackEvent(context, id); + std::unique_ptr<TracedValue> value = genericIdleCallbackEvent(context, id); value->setInteger("timeout", timeout); return value; } -PassOwnPtr<TracedValue> InspectorIdleCallbackCancelEvent::data(ExecutionContext* context, int id) +std::unique_ptr<TracedValue> InspectorIdleCallbackCancelEvent::data(ExecutionContext* context, int id) { return genericIdleCallbackEvent(context, id); } -PassOwnPtr<TracedValue> InspectorIdleCallbackFireEvent::data(ExecutionContext* context, int id, double allottedMilliseconds, bool timedOut) +std::unique_ptr<TracedValue> InspectorIdleCallbackFireEvent::data(ExecutionContext* context, int id, double allottedMilliseconds, bool timedOut) { - OwnPtr<TracedValue> value = genericIdleCallbackEvent(context, id); + std::unique_ptr<TracedValue> value = genericIdleCallbackEvent(context, id); value->setDouble("allottedMilliseconds", allottedMilliseconds); value->setBoolean("timedOut", timedOut); return value; } -PassOwnPtr<TracedValue> InspectorParseHtmlEvent::beginData(Document* document, unsigned startLine) +std::unique_ptr<TracedValue> InspectorParseHtmlEvent::beginData(Document* document, unsigned startLine) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setInteger("startLine", startLine); value->setString("frame", toHexString(document->frame())); value->setString("url", document->url().getString()); @@ -565,23 +566,23 @@ return value; } -PassOwnPtr<TracedValue> InspectorParseHtmlEvent::endData(unsigned endLine) +std::unique_ptr<TracedValue> InspectorParseHtmlEvent::endData(unsigned endLine) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setInteger("endLine", endLine); return value; } -PassOwnPtr<TracedValue> InspectorParseAuthorStyleSheetEvent::data(const CSSStyleSheetResource* cachedStyleSheet) +std::unique_ptr<TracedValue> InspectorParseAuthorStyleSheetEvent::data(const CSSStyleSheetResource* cachedStyleSheet) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("styleSheetUrl", cachedStyleSheet->url().getString()); return value; } -PassOwnPtr<TracedValue> InspectorXhrReadyStateChangeEvent::data(ExecutionContext* context, XMLHttpRequest* request) +std::unique_ptr<TracedValue> InspectorXhrReadyStateChangeEvent::data(ExecutionContext* context, XMLHttpRequest* request) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("url", request->url().getString()); value->setInteger("readyState", request->readyState()); if (LocalFrame* frame = frameForExecutionContext(context)) @@ -590,9 +591,9 @@ return value; } -PassOwnPtr<TracedValue> InspectorXhrLoadEvent::data(ExecutionContext* context, XMLHttpRequest* request) +std::unique_ptr<TracedValue> InspectorXhrLoadEvent::data(ExecutionContext* context, XMLHttpRequest* request) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("url", request->url().getString()); if (LocalFrame* frame = frameForExecutionContext(context)) value->setString("frame", toHexString(frame)); @@ -617,20 +618,20 @@ const char InspectorLayerInvalidationTrackingEvent::ReflectionLayerChanged[] = "Reflection layer change"; const char InspectorLayerInvalidationTrackingEvent::NewCompositedLayer[] = "Assigned a new composited layer"; -PassOwnPtr<TracedValue> InspectorLayerInvalidationTrackingEvent::data(const PaintLayer* layer, const char* reason) +std::unique_ptr<TracedValue> InspectorLayerInvalidationTrackingEvent::data(const PaintLayer* layer, const char* reason) { const LayoutObject& paintInvalidationContainer = layer->layoutObject()->containerForPaintInvalidation(); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(paintInvalidationContainer.frame())); setGeneratingNodeInfo(value.get(), &paintInvalidationContainer, "paintId"); value->setString("reason", reason); return value; } -PassOwnPtr<TracedValue> InspectorPaintEvent::data(LayoutObject* layoutObject, const LayoutRect& clipRect, const GraphicsLayer* graphicsLayer) +std::unique_ptr<TracedValue> InspectorPaintEvent::data(LayoutObject* layoutObject, const LayoutRect& clipRect, const GraphicsLayer* graphicsLayer) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(layoutObject->frame())); FloatQuad quad; localToPageQuad(*layoutObject, clipRect, &quad); @@ -642,9 +643,9 @@ return value; } -PassOwnPtr<TracedValue> frameEventData(LocalFrame* frame) +std::unique_ptr<TracedValue> frameEventData(LocalFrame* frame) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(frame)); bool isMainFrame = frame && frame->isMainFrame(); value->setBoolean("isMainFrame", isMainFrame); @@ -653,35 +654,35 @@ } -PassOwnPtr<TracedValue> InspectorCommitLoadEvent::data(LocalFrame* frame) +std::unique_ptr<TracedValue> InspectorCommitLoadEvent::data(LocalFrame* frame) { return frameEventData(frame); } -PassOwnPtr<TracedValue> InspectorMarkLoadEvent::data(LocalFrame* frame) +std::unique_ptr<TracedValue> InspectorMarkLoadEvent::data(LocalFrame* frame) { return frameEventData(frame); } -PassOwnPtr<TracedValue> InspectorScrollLayerEvent::data(LayoutObject* layoutObject) +std::unique_ptr<TracedValue> InspectorScrollLayerEvent::data(LayoutObject* layoutObject) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(layoutObject->frame())); setGeneratingNodeInfo(value.get(), layoutObject, "nodeId"); return value; } -PassOwnPtr<TracedValue> InspectorUpdateLayerTreeEvent::data(LocalFrame* frame) +std::unique_ptr<TracedValue> InspectorUpdateLayerTreeEvent::data(LocalFrame* frame) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(frame)); return value; } namespace { -PassOwnPtr<TracedValue> fillLocation(const String& url, const TextPosition& textPosition) +std::unique_ptr<TracedValue> fillLocation(const String& url, const TextPosition& textPosition) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("url", url); value->setInteger("lineNumber", textPosition.m_line.oneBasedInt()); value->setInteger("columnNumber", textPosition.m_column.oneBasedInt()); @@ -689,31 +690,31 @@ } } -PassOwnPtr<TracedValue> InspectorEvaluateScriptEvent::data(LocalFrame* frame, const String& url, const TextPosition& textPosition) +std::unique_ptr<TracedValue> InspectorEvaluateScriptEvent::data(LocalFrame* frame, const String& url, const TextPosition& textPosition) { - OwnPtr<TracedValue> value = fillLocation(url, textPosition); + std::unique_ptr<TracedValue> value = fillLocation(url, textPosition); value->setString("frame", toHexString(frame)); setCallStack(value.get()); return value; } -PassOwnPtr<TracedValue> InspectorParseScriptEvent::data(unsigned long identifier, const String& url) +std::unique_ptr<TracedValue> InspectorParseScriptEvent::data(unsigned long identifier, const String& url) { String requestId = IdentifiersFactory::requestId(identifier); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("url", url); return value; } -PassOwnPtr<TracedValue> InspectorCompileScriptEvent::data(const String& url, const TextPosition& textPosition) +std::unique_ptr<TracedValue> InspectorCompileScriptEvent::data(const String& url, const TextPosition& textPosition) { return fillLocation(url, textPosition); } -PassOwnPtr<TracedValue> InspectorFunctionCallEvent::data(ExecutionContext* context, const v8::Local<v8::Function>& function) +std::unique_ptr<TracedValue> InspectorFunctionCallEvent::data(ExecutionContext* context, const v8::Local<v8::Function>& function) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); if (LocalFrame* frame = frameForExecutionContext(context)) value->setString("frame", toHexString(frame)); @@ -724,34 +725,34 @@ v8::Local<v8::Value> functionName = originalFunction->GetDebugName(); if (!functionName.IsEmpty() && functionName->IsString()) value->setString("functionName", toCoreString(functionName.As<v8::String>())); - OwnPtr<SourceLocation> location = SourceLocation::fromFunction(originalFunction); + std::unique_ptr<SourceLocation> location = SourceLocation::fromFunction(originalFunction); value->setString("scriptId", String::number(location->scriptId())); value->setString("scriptName", location->url()); value->setInteger("scriptLine", location->lineNumber()); return value; } -PassOwnPtr<TracedValue> InspectorPaintImageEvent::data(const LayoutImage& layoutImage) +std::unique_ptr<TracedValue> InspectorPaintImageEvent::data(const LayoutImage& layoutImage) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); setGeneratingNodeInfo(value.get(), &layoutImage, "nodeId"); if (const ImageResource* resource = layoutImage.cachedImage()) value->setString("url", resource->url().getString()); return value; } -PassOwnPtr<TracedValue> InspectorPaintImageEvent::data(const LayoutObject& owningLayoutObject, const StyleImage& styleImage) +std::unique_ptr<TracedValue> InspectorPaintImageEvent::data(const LayoutObject& owningLayoutObject, const StyleImage& styleImage) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); setGeneratingNodeInfo(value.get(), &owningLayoutObject, "nodeId"); if (const ImageResource* resource = styleImage.cachedImage()) value->setString("url", resource->url().getString()); return value; } -PassOwnPtr<TracedValue> InspectorPaintImageEvent::data(const LayoutObject* owningLayoutObject, const ImageResource& imageResource) +std::unique_ptr<TracedValue> InspectorPaintImageEvent::data(const LayoutObject* owningLayoutObject, const ImageResource& imageResource) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); setGeneratingNodeInfo(value.get(), owningLayoutObject, "nodeId"); value->setString("url", imageResource.url().getString()); return value; @@ -764,9 +765,9 @@ return heapStatistics.used_heap_size(); } -PassOwnPtr<TracedValue> InspectorUpdateCountersEvent::data() +std::unique_ptr<TracedValue> InspectorUpdateCountersEvent::data() { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); if (isMainThread()) { value->setInteger("documents", InstanceCounters::counterValue(InstanceCounters::DocumentCounter)); value->setInteger("nodes", InstanceCounters::counterValue(InstanceCounters::NodeCounter)); @@ -776,67 +777,67 @@ return value; } -PassOwnPtr<TracedValue> InspectorInvalidateLayoutEvent::data(LocalFrame* frame) +std::unique_ptr<TracedValue> InspectorInvalidateLayoutEvent::data(LocalFrame* frame) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(frame)); setCallStack(value.get()); return value; } -PassOwnPtr<TracedValue> InspectorRecalculateStylesEvent::data(LocalFrame* frame) +std::unique_ptr<TracedValue> InspectorRecalculateStylesEvent::data(LocalFrame* frame) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("frame", toHexString(frame)); setCallStack(value.get()); return value; } -PassOwnPtr<TracedValue> InspectorEventDispatchEvent::data(const Event& event) +std::unique_ptr<TracedValue> InspectorEventDispatchEvent::data(const Event& event) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("type", event.type()); setCallStack(value.get()); return value; } -PassOwnPtr<TracedValue> InspectorTimeStampEvent::data(ExecutionContext* context, const String& message) +std::unique_ptr<TracedValue> InspectorTimeStampEvent::data(ExecutionContext* context, const String& message) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("message", message); if (LocalFrame* frame = frameForExecutionContext(context)) value->setString("frame", toHexString(frame)); return value; } -PassOwnPtr<TracedValue> InspectorTracingSessionIdForWorkerEvent::data(const String& sessionId, const String& workerId, WorkerThread* workerThread) +std::unique_ptr<TracedValue> InspectorTracingSessionIdForWorkerEvent::data(const String& sessionId, const String& workerId, WorkerThread* workerThread) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("sessionId", sessionId); value->setString("workerId", workerId); value->setDouble("workerThreadId", workerThread->platformThreadId()); return value; } -PassOwnPtr<TracedValue> InspectorTracingStartedInFrame::data(const String& sessionId, LocalFrame* frame) +std::unique_ptr<TracedValue> InspectorTracingStartedInFrame::data(const String& sessionId, LocalFrame* frame) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("sessionId", sessionId); value->setString("page", toHexString(frame)); return value; } -PassOwnPtr<TracedValue> InspectorSetLayerTreeId::data(const String& sessionId, int layerTreeId) +std::unique_ptr<TracedValue> InspectorSetLayerTreeId::data(const String& sessionId, int layerTreeId) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("sessionId", sessionId); value->setInteger("layerTreeId", layerTreeId); return value; } -PassOwnPtr<TracedValue> InspectorAnimationEvent::data(const Animation& animation) +std::unique_ptr<TracedValue> InspectorAnimationEvent::data(const Animation& animation) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("id", String::number(animation.sequenceNumber())); value->setString("state", animation.playState()); if (const AnimationEffect* effect = animation.effect()) { @@ -849,16 +850,16 @@ return value; } -PassOwnPtr<TracedValue> InspectorAnimationStateEvent::data(const Animation& animation) +std::unique_ptr<TracedValue> InspectorAnimationStateEvent::data(const Animation& animation) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("state", animation.playState()); return value; } -PassOwnPtr<TracedValue> InspectorHitTestEvent::endData(const HitTestRequest& request, const HitTestLocation& location, const HitTestResult& result) +std::unique_ptr<TracedValue> InspectorHitTestEvent::endData(const HitTestRequest& request, const HitTestLocation& location, const HitTestResult& result) { - OwnPtr<TracedValue> value(TracedValue::create()); + std::unique_ptr<TracedValue> value(TracedValue::create()); value->setInteger("x", location.roundedPoint().x()); value->setInteger("y", location.roundedPoint().y()); if (location.isRectBasedTest())
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h index 07eeea2..5ec488c0 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h +++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h
@@ -13,6 +13,7 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/Functional.h" +#include <memory> namespace v8 { class Function; @@ -56,8 +57,8 @@ enum ResourceLoadPriority : int; namespace InspectorLayoutEvent { -PassOwnPtr<TracedValue> beginData(FrameView*); -PassOwnPtr<TracedValue> endData(LayoutObject* rootForThisLayout); +std::unique_ptr<TracedValue> beginData(FrameView*); +std::unique_ptr<TracedValue> endData(LayoutObject* rootForThisLayout); } namespace InspectorScheduleStyleInvalidationTrackingEvent { @@ -66,10 +67,10 @@ extern const char Id[]; extern const char Pseudo[]; -PassOwnPtr<TracedValue> attributeChange(Element&, const InvalidationSet&, const QualifiedName&); -PassOwnPtr<TracedValue> classChange(Element&, const InvalidationSet&, const AtomicString&); -PassOwnPtr<TracedValue> idChange(Element&, const InvalidationSet&, const AtomicString&); -PassOwnPtr<TracedValue> pseudoChange(Element&, const InvalidationSet&, CSSSelector::PseudoType); +std::unique_ptr<TracedValue> attributeChange(Element&, const InvalidationSet&, const QualifiedName&); +std::unique_ptr<TracedValue> classChange(Element&, const InvalidationSet&, const AtomicString&); +std::unique_ptr<TracedValue> idChange(Element&, const InvalidationSet&, const AtomicString&); +std::unique_ptr<TracedValue> pseudoChange(Element&, const InvalidationSet&, CSSSelector::PseudoType); } // namespace InspectorScheduleStyleInvalidationTrackingEvent #define TRACE_SCHEDULE_STYLE_INVALIDATION(element, invalidationSet, changeType, ...) \ @@ -81,7 +82,7 @@ InspectorScheduleStyleInvalidationTrackingEvent::changeType((element), (invalidationSet), __VA_ARGS__)); namespace InspectorStyleRecalcInvalidationTrackingEvent { -PassOwnPtr<TracedValue> data(Node*, const StyleChangeReasonForTracing&); +std::unique_ptr<TracedValue> data(Node*, const StyleChangeReasonForTracing&); } String descendantInvalidationSetToIdString(const InvalidationSet&); @@ -95,9 +96,9 @@ extern const char InvalidationSetMatchedTagName[]; extern const char PreventStyleSharingForParent[]; -PassOwnPtr<TracedValue> data(Element&, const char* reason); -PassOwnPtr<TracedValue> selectorPart(Element&, const char* reason, const InvalidationSet&, const String&); -PassOwnPtr<TracedValue> invalidationList(Element&, const Vector<RefPtr<InvalidationSet>>&); +std::unique_ptr<TracedValue> data(Element&, const char* reason); +std::unique_ptr<TracedValue> selectorPart(Element&, const char* reason, const InvalidationSet&, const String&); +std::unique_ptr<TracedValue> invalidationList(Element&, const Vector<RefPtr<InvalidationSet>>&); } // namespace InspectorStyleInvalidatorInvalidateEvent #define TRACE_STYLE_INVALIDATOR_INVALIDATION(element, reason) \ @@ -161,80 +162,80 @@ typedef const char LayoutInvalidationReasonForTracing[]; namespace InspectorLayoutInvalidationTrackingEvent { -PassOwnPtr<TracedValue> CORE_EXPORT data(const LayoutObject*, LayoutInvalidationReasonForTracing); +std::unique_ptr<TracedValue> CORE_EXPORT data(const LayoutObject*, LayoutInvalidationReasonForTracing); } namespace InspectorPaintInvalidationTrackingEvent { -PassOwnPtr<TracedValue> data(const LayoutObject*, const LayoutObject& paintContainer); +std::unique_ptr<TracedValue> data(const LayoutObject*, const LayoutObject& paintContainer); } namespace InspectorScrollInvalidationTrackingEvent { -PassOwnPtr<TracedValue> data(const LayoutObject&); +std::unique_ptr<TracedValue> data(const LayoutObject&); } namespace InspectorChangeResourcePriorityEvent { -PassOwnPtr<TracedValue> data(unsigned long identifier, const ResourceLoadPriority&); +std::unique_ptr<TracedValue> data(unsigned long identifier, const ResourceLoadPriority&); } namespace InspectorSendRequestEvent { -PassOwnPtr<TracedValue> data(unsigned long identifier, LocalFrame*, const ResourceRequest&); +std::unique_ptr<TracedValue> data(unsigned long identifier, LocalFrame*, const ResourceRequest&); } namespace InspectorReceiveResponseEvent { -PassOwnPtr<TracedValue> data(unsigned long identifier, LocalFrame*, const ResourceResponse&); +std::unique_ptr<TracedValue> data(unsigned long identifier, LocalFrame*, const ResourceResponse&); } namespace InspectorReceiveDataEvent { -PassOwnPtr<TracedValue> data(unsigned long identifier, LocalFrame*, int encodedDataLength); +std::unique_ptr<TracedValue> data(unsigned long identifier, LocalFrame*, int encodedDataLength); } namespace InspectorResourceFinishEvent { -PassOwnPtr<TracedValue> data(unsigned long identifier, double finishTime, bool didFail); +std::unique_ptr<TracedValue> data(unsigned long identifier, double finishTime, bool didFail); } namespace InspectorTimerInstallEvent { -PassOwnPtr<TracedValue> data(ExecutionContext*, int timerId, int timeout, bool singleShot); +std::unique_ptr<TracedValue> data(ExecutionContext*, int timerId, int timeout, bool singleShot); } namespace InspectorTimerRemoveEvent { -PassOwnPtr<TracedValue> data(ExecutionContext*, int timerId); +std::unique_ptr<TracedValue> data(ExecutionContext*, int timerId); } namespace InspectorTimerFireEvent { -PassOwnPtr<TracedValue> data(ExecutionContext*, int timerId); +std::unique_ptr<TracedValue> data(ExecutionContext*, int timerId); } namespace InspectorIdleCallbackRequestEvent { -PassOwnPtr<TracedValue> data(ExecutionContext*, int id, double timeout); +std::unique_ptr<TracedValue> data(ExecutionContext*, int id, double timeout); } namespace InspectorIdleCallbackCancelEvent { -PassOwnPtr<TracedValue> data(ExecutionContext*, int id); +std::unique_ptr<TracedValue> data(ExecutionContext*, int id); } namespace InspectorIdleCallbackFireEvent { -PassOwnPtr<TracedValue> data(ExecutionContext*, int id, double allottedMilliseconds, bool timedOut); +std::unique_ptr<TracedValue> data(ExecutionContext*, int id, double allottedMilliseconds, bool timedOut); } namespace InspectorAnimationFrameEvent { -PassOwnPtr<TracedValue> data(ExecutionContext*, int callbackId); +std::unique_ptr<TracedValue> data(ExecutionContext*, int callbackId); } namespace InspectorParseHtmlEvent { -PassOwnPtr<TracedValue> beginData(Document*, unsigned startLine); -PassOwnPtr<TracedValue> endData(unsigned endLine); +std::unique_ptr<TracedValue> beginData(Document*, unsigned startLine); +std::unique_ptr<TracedValue> endData(unsigned endLine); } namespace InspectorParseAuthorStyleSheetEvent { -PassOwnPtr<TracedValue> data(const CSSStyleSheetResource*); +std::unique_ptr<TracedValue> data(const CSSStyleSheetResource*); } namespace InspectorXhrReadyStateChangeEvent { -PassOwnPtr<TracedValue> data(ExecutionContext*, XMLHttpRequest*); +std::unique_ptr<TracedValue> data(ExecutionContext*, XMLHttpRequest*); } namespace InspectorXhrLoadEvent { -PassOwnPtr<TracedValue> data(ExecutionContext*, XMLHttpRequest*); +std::unique_ptr<TracedValue> data(ExecutionContext*, XMLHttpRequest*); } namespace InspectorLayerInvalidationTrackingEvent { @@ -244,7 +245,7 @@ extern const char ReflectionLayerChanged[]; extern const char NewCompositedLayer[]; -PassOwnPtr<TracedValue> data(const PaintLayer*, const char* reason); +std::unique_ptr<TracedValue> data(const PaintLayer*, const char* reason); } #define TRACE_LAYER_INVALIDATION(LAYER, REASON) \ @@ -256,89 +257,89 @@ InspectorLayerInvalidationTrackingEvent::data((LAYER), (REASON))); namespace InspectorPaintEvent { -PassOwnPtr<TracedValue> data(LayoutObject*, const LayoutRect& clipRect, const GraphicsLayer*); +std::unique_ptr<TracedValue> data(LayoutObject*, const LayoutRect& clipRect, const GraphicsLayer*); } namespace InspectorPaintImageEvent { -PassOwnPtr<TracedValue> data(const LayoutImage&); -PassOwnPtr<TracedValue> data(const LayoutObject&, const StyleImage&); -PassOwnPtr<TracedValue> data(const LayoutObject*, const ImageResource&); +std::unique_ptr<TracedValue> data(const LayoutImage&); +std::unique_ptr<TracedValue> data(const LayoutObject&, const StyleImage&); +std::unique_ptr<TracedValue> data(const LayoutObject*, const ImageResource&); } namespace InspectorCommitLoadEvent { -PassOwnPtr<TracedValue> data(LocalFrame*); +std::unique_ptr<TracedValue> data(LocalFrame*); } namespace InspectorMarkLoadEvent { -PassOwnPtr<TracedValue> data(LocalFrame*); +std::unique_ptr<TracedValue> data(LocalFrame*); } namespace InspectorScrollLayerEvent { -PassOwnPtr<TracedValue> data(LayoutObject*); +std::unique_ptr<TracedValue> data(LayoutObject*); } namespace InspectorUpdateLayerTreeEvent { -PassOwnPtr<TracedValue> data(LocalFrame*); +std::unique_ptr<TracedValue> data(LocalFrame*); } namespace InspectorEvaluateScriptEvent { -PassOwnPtr<TracedValue> data(LocalFrame*, const String& url, const WTF::TextPosition&); +std::unique_ptr<TracedValue> data(LocalFrame*, const String& url, const WTF::TextPosition&); } namespace InspectorParseScriptEvent { -PassOwnPtr<TracedValue> data(unsigned long identifier, const String& url); +std::unique_ptr<TracedValue> data(unsigned long identifier, const String& url); } namespace InspectorCompileScriptEvent { -PassOwnPtr<TracedValue> data(const String& url, const WTF::TextPosition&); +std::unique_ptr<TracedValue> data(const String& url, const WTF::TextPosition&); } namespace InspectorFunctionCallEvent { -PassOwnPtr<TracedValue> data(ExecutionContext*, const v8::Local<v8::Function>&); +std::unique_ptr<TracedValue> data(ExecutionContext*, const v8::Local<v8::Function>&); } namespace InspectorUpdateCountersEvent { -PassOwnPtr<TracedValue> data(); +std::unique_ptr<TracedValue> data(); } namespace InspectorInvalidateLayoutEvent { -PassOwnPtr<TracedValue> data(LocalFrame*); +std::unique_ptr<TracedValue> data(LocalFrame*); } namespace InspectorRecalculateStylesEvent { -PassOwnPtr<TracedValue> data(LocalFrame*); +std::unique_ptr<TracedValue> data(LocalFrame*); } namespace InspectorEventDispatchEvent { -PassOwnPtr<TracedValue> data(const Event&); +std::unique_ptr<TracedValue> data(const Event&); } namespace InspectorTimeStampEvent { -PassOwnPtr<TracedValue> data(ExecutionContext*, const String& message); +std::unique_ptr<TracedValue> data(ExecutionContext*, const String& message); } namespace InspectorTracingSessionIdForWorkerEvent { -PassOwnPtr<TracedValue> data(const String& sessionId, const String& workerId, WorkerThread*); +std::unique_ptr<TracedValue> data(const String& sessionId, const String& workerId, WorkerThread*); } namespace InspectorTracingStartedInFrame { -PassOwnPtr<TracedValue> data(const String& sessionId, LocalFrame*); +std::unique_ptr<TracedValue> data(const String& sessionId, LocalFrame*); } namespace InspectorSetLayerTreeId { -PassOwnPtr<TracedValue> data(const String& sessionId, int layerTreeId); +std::unique_ptr<TracedValue> data(const String& sessionId, int layerTreeId); } namespace InspectorAnimationEvent { -PassOwnPtr<TracedValue> data(const Animation&); +std::unique_ptr<TracedValue> data(const Animation&); } namespace InspectorAnimationStateEvent { -PassOwnPtr<TracedValue> data(const Animation&); +std::unique_ptr<TracedValue> data(const Animation&); } namespace InspectorHitTestEvent { -PassOwnPtr<TracedValue> endData(const HitTestRequest&, const HitTestLocation&, const HitTestResult&); +std::unique_ptr<TracedValue> endData(const HitTestRequest&, const HitTestLocation&, const HitTestResult&); } CORE_EXPORT String toHexString(const void* p);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h b/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h index fa3a077..0d338a1 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h
@@ -10,7 +10,6 @@ #include "core/CoreExport.h" #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Tracing.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp index 68263aa..3e627262 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorWorkerAgent.cpp
@@ -33,7 +33,6 @@ #include "core/dom/Document.h" #include "core/inspector/InspectedFrames.h" #include "platform/weborigin/KURL.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/inspector/LayoutEditor.h b/third_party/WebKit/Source/core/inspector/LayoutEditor.h index d93f7da1..ae2a279e 100644 --- a/third_party/WebKit/Source/core/inspector/LayoutEditor.h +++ b/third_party/WebKit/Source/core/inspector/LayoutEditor.h
@@ -12,7 +12,6 @@ #include "core/dom/Element.h" #include "platform/heap/Handle.h" #include "platform/inspector_protocol/Values.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp index dcd4d44..8927df9 100644 --- a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp +++ b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp
@@ -53,9 +53,9 @@ #include "core/xml/XPathResult.h" #include "platform/UserGestureIndicator.h" #include "platform/v8_inspector/public/V8Debugger.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> namespace blink { @@ -79,7 +79,7 @@ MainThreadDebugger::MainThreadDebugger(v8::Isolate* isolate) : ThreadDebugger(isolate) - , m_taskRunner(adoptPtr(new InspectorTaskRunner())) + , m_taskRunner(wrapUnique(new InspectorTaskRunner())) { MutexLocker locker(creationMutex()); ASSERT(!s_instance); @@ -93,7 +93,7 @@ s_instance = nullptr; } -void MainThreadDebugger::setClientMessageLoop(PassOwnPtr<ClientMessageLoop> clientMessageLoop) +void MainThreadDebugger::setClientMessageLoop(std::unique_ptr<ClientMessageLoop> clientMessageLoop) { ASSERT(!m_clientMessageLoop); ASSERT(clientMessageLoop);
diff --git a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.h b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.h index 343d364..d0a7046 100644 --- a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.h +++ b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.h
@@ -36,6 +36,7 @@ #include "core/inspector/InspectorTaskRunner.h" #include "core/inspector/ThreadDebugger.h" #include "platform/heap/Handle.h" +#include <memory> #include <v8.h> namespace blink { @@ -62,7 +63,7 @@ InspectorTaskRunner* taskRunner() const { return m_taskRunner.get(); } bool isWorker() override { return false; } - void setClientMessageLoop(PassOwnPtr<ClientMessageLoop>); + void setClientMessageLoop(std::unique_ptr<ClientMessageLoop>); int contextGroupId(LocalFrame*); void contextCreated(ScriptState*, LocalFrame*, SecurityOrigin*); void contextWillBeDestroyed(ScriptState*); @@ -84,8 +85,8 @@ bool callingContextCanAccessContext(v8::Local<v8::Context> calling, v8::Local<v8::Context> target) override; int ensureDefaultContextInGroup(int contextGroupId) override; - OwnPtr<ClientMessageLoop> m_clientMessageLoop; - OwnPtr<InspectorTaskRunner> m_taskRunner; + std::unique_ptr<ClientMessageLoop> m_clientMessageLoop; + std::unique_ptr<InspectorTaskRunner> m_taskRunner; static MainThreadDebugger* s_instance;
diff --git a/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp b/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp index 6e41c04..fd93123 100644 --- a/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp +++ b/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp
@@ -32,6 +32,7 @@ #include "core/fetch/Resource.h" #include "platform/SharedBuffer.h" #include "platform/network/ResourceResponse.h" +#include <memory> namespace blink { @@ -207,7 +208,7 @@ String filePath = response.downloadedFilePath(); if (!filePath.isEmpty()) { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->appendFile(filePath); AtomicString mimeType; if (response.isHTTP())
diff --git a/third_party/WebKit/Source/core/inspector/PageConsoleAgent.h b/third_party/WebKit/Source/core/inspector/PageConsoleAgent.h index 076700f1..9b21149 100644 --- a/third_party/WebKit/Source/core/inspector/PageConsoleAgent.h +++ b/third_party/WebKit/Source/core/inspector/PageConsoleAgent.h
@@ -33,7 +33,6 @@ #include "core/CoreExport.h" #include "core/inspector/InspectorConsoleAgent.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp index 1de42b5..abb5fe4c 100644 --- a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp +++ b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
@@ -22,7 +22,8 @@ #include "core/inspector/ScriptArguments.h" #include "platform/ScriptForbiddenScope.h" #include "wtf/CurrentTime.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -66,7 +67,7 @@ void ThreadDebugger::beginUserGesture() { - m_userGestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); + m_userGestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); } void ThreadDebugger::endUserGesture() @@ -322,7 +323,7 @@ m_timerData.append(data); m_timerCallbacks.append(callback); - OwnPtr<Timer<ThreadDebugger>> timer = adoptPtr(new Timer<ThreadDebugger>(this, &ThreadDebugger::onTimer)); + std::unique_ptr<Timer<ThreadDebugger>> timer = wrapUnique(new Timer<ThreadDebugger>(this, &ThreadDebugger::onTimer)); Timer<ThreadDebugger>* timerPtr = timer.get(); m_timers.append(std::move(timer)); timerPtr->startRepeating(interval, BLINK_FROM_HERE); @@ -344,7 +345,7 @@ void ThreadDebugger::onTimer(Timer<ThreadDebugger>* timer) { for (size_t index = 0; index < m_timers.size(); ++index) { - if (m_timers[index] == timer) { + if (m_timers[index].get() == timer) { m_timerCallbacks[index](m_timerData[index]); return; }
diff --git a/third_party/WebKit/Source/core/inspector/ThreadDebugger.h b/third_party/WebKit/Source/core/inspector/ThreadDebugger.h index 3c2aa536..766ef8e 100644 --- a/third_party/WebKit/Source/core/inspector/ThreadDebugger.h +++ b/third_party/WebKit/Source/core/inspector/ThreadDebugger.h
@@ -12,7 +12,7 @@ #include "platform/v8_inspector/public/V8DebuggerClient.h" #include "wtf/Forward.h" #include "wtf/Vector.h" - +#include <memory> #include <v8.h> namespace blink { @@ -67,10 +67,10 @@ static void getEventListenersCallback(const v8::FunctionCallbackInfo<v8::Value>&); - Vector<OwnPtr<Timer<ThreadDebugger>>> m_timers; + Vector<std::unique_ptr<Timer<ThreadDebugger>>> m_timers; Vector<V8DebuggerClient::TimerCallback> m_timerCallbacks; Vector<void*> m_timerData; - OwnPtr<UserGestureIndicator> m_userGestureIndicator; + std::unique_ptr<UserGestureIndicator> m_userGestureIndicator; v8::Global<v8::Function> m_eventLogFunction; };
diff --git a/third_party/WebKit/Source/core/inspector/WorkerConsoleAgent.h b/third_party/WebKit/Source/core/inspector/WorkerConsoleAgent.h index 309f9736..e2abc047 100644 --- a/third_party/WebKit/Source/core/inspector/WorkerConsoleAgent.h +++ b/third_party/WebKit/Source/core/inspector/WorkerConsoleAgent.h
@@ -32,7 +32,6 @@ #define WorkerConsoleAgent_h #include "core/inspector/InspectorConsoleAgent.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp index ca14f5f9..4e4d8d8 100644 --- a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp +++ b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp
@@ -41,7 +41,6 @@ #include "platform/inspector_protocol/DispatcherBase.h" #include "platform/v8_inspector/public/V8Debugger.h" #include "platform/v8_inspector/public/V8InspectorSession.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.h b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.h index 2121c14..3e0fcb3 100644 --- a/third_party/WebKit/Source/core/inspector/WorkerInspectorController.h +++ b/third_party/WebKit/Source/core/inspector/WorkerInspectorController.h
@@ -36,7 +36,6 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/ClipPathOperation.h b/third_party/WebKit/Source/core/layout/ClipPathOperation.h index 7258316..6edf717 100644 --- a/third_party/WebKit/Source/core/layout/ClipPathOperation.h +++ b/third_party/WebKit/Source/core/layout/ClipPathOperation.h
@@ -32,10 +32,10 @@ #include "core/style/BasicShapes.h" #include "platform/graphics/Path.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -105,7 +105,7 @@ { ASSERT(m_shape); m_path.reset(); - m_path = adoptPtr(new Path); + m_path = wrapUnique(new Path); m_shape->path(*m_path, boundingRect); m_path->setWindRule(m_shape->getWindRule()); return *m_path; @@ -121,7 +121,7 @@ } RefPtr<BasicShape> m_shape; - OwnPtr<Path> m_path; + std::unique_ptr<Path> m_path; }; DEFINE_TYPE_CASTS(ShapeClipPathOperation, ClipPathOperation, op, op->type() == ClipPathOperation::SHAPE, op.type() == ClipPathOperation::SHAPE);
diff --git a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp index eff3aae..3972c9d 100644 --- a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp +++ b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp
@@ -29,8 +29,9 @@ #include "core/layout/shapes/ShapeOutsideInfo.h" #include "core/paint/PaintLayer.h" #include "platform/RuntimeEnabledFeatures.h" - +#include "wtf/PtrUtil.h" #include <algorithm> +#include <memory> using namespace WTF; @@ -88,9 +89,9 @@ return m_layoutObject->layer() && m_layoutObject->layer()->isSelfPaintingOnlyBecauseIsCompositedPart() && !RuntimeEnabledFeatures::slimmingPaintV2Enabled(); } -PassOwnPtr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject) +std::unique_ptr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject) { - OwnPtr<FloatingObject> newObj = adoptPtr(new FloatingObject(layoutObject)); + std::unique_ptr<FloatingObject> newObj = wrapUnique(new FloatingObject(layoutObject)); // If a layer exists, the float will paint itself. Otherwise someone else will. newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer() || newObj->shouldPaintForCompositedLayoutPart()); @@ -105,14 +106,14 @@ return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer(); } -PassOwnPtr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const +std::unique_ptr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const { - return adoptPtr(new FloatingObject(layoutObject(), getType(), LayoutRect(frameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild())); + return wrapUnique(new FloatingObject(layoutObject(), getType(), LayoutRect(frameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild())); } -PassOwnPtr<FloatingObject> FloatingObject::unsafeClone() const +std::unique_ptr<FloatingObject> FloatingObject::unsafeClone() const { - OwnPtr<FloatingObject> cloneObject = adoptPtr(new FloatingObject(layoutObject(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false)); + std::unique_ptr<FloatingObject> cloneObject = wrapUnique(new FloatingObject(layoutObject(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false)); cloneObject->m_isPlaced = m_isPlaced; return cloneObject; } @@ -406,7 +407,7 @@ void FloatingObjects::moveAllToFloatInfoMap(LayoutBoxToFloatInfoMap& map) { while (!m_set.isEmpty()) { - OwnPtr<FloatingObject> floatingObject = m_set.takeFirst(); + std::unique_ptr<FloatingObject> floatingObject = m_set.takeFirst(); LayoutBox* layoutObject = floatingObject->layoutObject(); map.add(layoutObject, std::move(floatingObject)); } @@ -466,11 +467,11 @@ markLowestFloatLogicalBottomCacheAsDirty(); } -FloatingObject* FloatingObjects::add(PassOwnPtr<FloatingObject> floatingObject) +FloatingObject* FloatingObjects::add(std::unique_ptr<FloatingObject> floatingObject) { - FloatingObject* newObject = floatingObject.leakPtr(); + FloatingObject* newObject = floatingObject.release(); increaseObjectsCount(newObject->getType()); - m_set.add(adoptPtr(newObject)); + m_set.add(wrapUnique(newObject)); if (newObject->isPlaced()) addPlacedObject(*newObject); markLowestFloatLogicalBottomCacheAsDirty(); @@ -480,7 +481,7 @@ void FloatingObjects::remove(FloatingObject* toBeRemoved) { decreaseObjectsCount(toBeRemoved->getType()); - OwnPtr<FloatingObject> floatingObject = m_set.take(toBeRemoved); + std::unique_ptr<FloatingObject> floatingObject = m_set.take(toBeRemoved); ASSERT(floatingObject->isPlaced() || !floatingObject->isInPlacedTree()); if (floatingObject->isPlaced()) removePlacedObject(*floatingObject);
diff --git a/third_party/WebKit/Source/core/layout/FloatingObjects.h b/third_party/WebKit/Source/core/layout/FloatingObjects.h index 11f78d9..35fd6d6 100644 --- a/third_party/WebKit/Source/core/layout/FloatingObjects.h +++ b/third_party/WebKit/Source/core/layout/FloatingObjects.h
@@ -28,7 +28,7 @@ #include "platform/PODIntervalTree.h" #include "platform/geometry/LayoutRect.h" #include "wtf/ListHashSet.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -47,11 +47,11 @@ // Note that Type uses bits so you can use FloatLeftRight as a mask to query for both left and right. enum Type { FloatLeft = 1, FloatRight = 2, FloatLeftRight = 3 }; - static PassOwnPtr<FloatingObject> create(LayoutBox*); + static std::unique_ptr<FloatingObject> create(LayoutBox*); - PassOwnPtr<FloatingObject> copyToNewContainer(LayoutSize, bool shouldPaint = false, bool isDescendant = false) const; + std::unique_ptr<FloatingObject> copyToNewContainer(LayoutSize, bool shouldPaint = false, bool isDescendant = false) const; - PassOwnPtr<FloatingObject> unsafeClone() const; + std::unique_ptr<FloatingObject> unsafeClone() const; Type getType() const { return static_cast<Type>(m_type); } LayoutBox* layoutObject() const { return m_layoutObject; } @@ -112,9 +112,9 @@ struct FloatingObjectHashFunctions { STATIC_ONLY(FloatingObjectHashFunctions); static unsigned hash(FloatingObject* key) { return DefaultHash<LayoutBox*>::Hash::hash(key->layoutObject()); } - static unsigned hash(const OwnPtr<FloatingObject>& key) { return hash(key.get()); } - static bool equal(OwnPtr<FloatingObject>& a, FloatingObject* b) { return a->layoutObject() == b->layoutObject(); } - static bool equal(OwnPtr<FloatingObject>& a, const OwnPtr<FloatingObject>& b) { return equal(a, b.get()); } + static unsigned hash(const std::unique_ptr<FloatingObject>& key) { return hash(key.get()); } + static bool equal(std::unique_ptr<FloatingObject>& a, FloatingObject* b) { return a->layoutObject() == b->layoutObject(); } + static bool equal(std::unique_ptr<FloatingObject>& a, const std::unique_ptr<FloatingObject>& b) { return equal(a, b.get()); } static const bool safeToCompareToEmptyOrDeleted = true; }; @@ -122,14 +122,14 @@ STATIC_ONLY(FloatingObjectHashTranslator); static unsigned hash(LayoutBox* key) { return DefaultHash<LayoutBox*>::Hash::hash(key); } static bool equal(FloatingObject* a, LayoutBox* b) { return a->layoutObject() == b; } - static bool equal(const OwnPtr<FloatingObject>& a, LayoutBox* b) { return a->layoutObject() == b; } + static bool equal(const std::unique_ptr<FloatingObject>& a, LayoutBox* b) { return a->layoutObject() == b; } }; -typedef ListHashSet<OwnPtr<FloatingObject>, 4, FloatingObjectHashFunctions> FloatingObjectSet; +typedef ListHashSet<std::unique_ptr<FloatingObject>, 4, FloatingObjectHashFunctions> FloatingObjectSet; typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator; typedef PODInterval<LayoutUnit, FloatingObject*> FloatingObjectInterval; typedef PODIntervalTree<LayoutUnit, FloatingObject*> FloatingObjectTree; typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> IntervalArena; -typedef HashMap<LayoutBox*, OwnPtr<FloatingObject>> LayoutBoxToFloatInfoMap; +typedef HashMap<LayoutBox*, std::unique_ptr<FloatingObject>> LayoutBoxToFloatInfoMap; class FloatingObjects { WTF_MAKE_NONCOPYABLE(FloatingObjects); USING_FAST_MALLOC(FloatingObjects); @@ -139,7 +139,7 @@ void clear(); void moveAllToFloatInfoMap(LayoutBoxToFloatInfoMap&); - FloatingObject* add(PassOwnPtr<FloatingObject>); + FloatingObject* add(std::unique_ptr<FloatingObject>); void remove(FloatingObject*); void addPlacedObject(FloatingObject&); void removePlacedObject(FloatingObject&);
diff --git a/third_party/WebKit/Source/core/layout/HitTestLocation.h b/third_party/WebKit/Source/core/layout/HitTestLocation.h index 6fef9bd..b2597f0b 100644 --- a/third_party/WebKit/Source/core/layout/HitTestLocation.h +++ b/third_party/WebKit/Source/core/layout/HitTestLocation.h
@@ -29,7 +29,6 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/ListHashSet.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/HitTestResult.h b/third_party/WebKit/Source/core/layout/HitTestResult.h index 82da88f2..9e616bf 100644 --- a/third_party/WebKit/Source/core/layout/HitTestResult.h +++ b/third_party/WebKit/Source/core/layout/HitTestResult.h
@@ -32,7 +32,6 @@ #include "platform/text/TextDirection.h" #include "wtf/Forward.h" #include "wtf/ListHashSet.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/VectorTraits.h"
diff --git a/third_party/WebKit/Source/core/layout/HitTestingTransformState.cpp b/third_party/WebKit/Source/core/layout/HitTestingTransformState.cpp index 3b8e067..c6b9460 100644 --- a/third_party/WebKit/Source/core/layout/HitTestingTransformState.cpp +++ b/third_party/WebKit/Source/core/layout/HitTestingTransformState.cpp
@@ -26,7 +26,6 @@ #include "core/layout/HitTestingTransformState.h" #include "platform/geometry/LayoutRect.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/ImageQualityController.cpp b/third_party/WebKit/Source/core/layout/ImageQualityController.cpp index 429c944..56a93cb 100644 --- a/third_party/WebKit/Source/core/layout/ImageQualityController.cpp +++ b/third_party/WebKit/Source/core/layout/ImageQualityController.cpp
@@ -35,6 +35,7 @@ #include "core/frame/Settings.h" #include "core/page/ChromeClient.h" #include "core/page/Page.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -92,14 +93,14 @@ } ImageQualityController::ImageQualityController() - : m_timer(adoptPtr(new Timer<ImageQualityController>(this, &ImageQualityController::highQualityRepaintTimerFired))) + : m_timer(wrapUnique(new Timer<ImageQualityController>(this, &ImageQualityController::highQualityRepaintTimerFired))) , m_frameTimeWhenTimerStarted(0.0) { } void ImageQualityController::setTimer(Timer<ImageQualityController>* newTimer) { - m_timer = adoptPtr(newTimer); + m_timer = wrapUnique(newTimer); } void ImageQualityController::removeLayer(const LayoutObject& object, LayerSizeMap* innerMap, const void* layer)
diff --git a/third_party/WebKit/Source/core/layout/ImageQualityController.h b/third_party/WebKit/Source/core/layout/ImageQualityController.h index 7066d21..d6636b7 100644 --- a/third_party/WebKit/Source/core/layout/ImageQualityController.h +++ b/third_party/WebKit/Source/core/layout/ImageQualityController.h
@@ -37,6 +37,7 @@ #include "platform/geometry/LayoutSize.h" #include "platform/graphics/Image.h" #include "wtf/HashMap.h" +#include <memory> namespace blink { @@ -83,7 +84,7 @@ void setTimer(Timer<ImageQualityController>*); ObjectLayerSizeMap m_objectLayerSizeMap; - OwnPtr<Timer<ImageQualityController>> m_timer; + std::unique_ptr<Timer<ImageQualityController>> m_timer; double m_frameTimeWhenTimerStarted; // For calling set().
diff --git a/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp b/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp index 7ee78d39..4324de7f 100644 --- a/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp +++ b/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp
@@ -9,6 +9,7 @@ #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/paint/PaintController.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -170,7 +171,7 @@ LayoutImage* img = toLayoutImage(document().body()->firstChild()->layoutObject()); RefPtr<TestImageLowQuality> testImage = adoptRef(new TestImageLowQuality); - OwnPtr<PaintController> paintController = PaintController::create(); + std::unique_ptr<PaintController> paintController = PaintController::create(); GraphicsContext context(*paintController); // Paint once. This will kick off a timer to see if we resize it during that timer's execution. @@ -196,7 +197,7 @@ LayoutImage* nonAnimatingImage = toLayoutImage(document().getElementById("myNonAnimatingImage")->layoutObject()); RefPtr<TestImageLowQuality> testImage = adoptRef(new TestImageLowQuality); - OwnPtr<PaintController> paintController = PaintController::create(); + std::unique_ptr<PaintController> paintController = PaintController::create(); GraphicsContext context(*paintController); // Paint once. This will kick off a timer to see if we resize it during that timer's execution.
diff --git a/third_party/WebKit/Source/core/layout/LayoutAnalyzer.cpp b/third_party/WebKit/Source/core/layout/LayoutAnalyzer.cpp index 1f5b741..754a31c 100644 --- a/third_party/WebKit/Source/core/layout/LayoutAnalyzer.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutAnalyzer.cpp
@@ -9,6 +9,7 @@ #include "core/layout/LayoutObject.h" #include "core/layout/LayoutText.h" #include "platform/TracedValue.h" +#include <memory> namespace blink { @@ -104,9 +105,9 @@ --m_depth; } -PassOwnPtr<TracedValue> LayoutAnalyzer::toTracedValue() +std::unique_ptr<TracedValue> LayoutAnalyzer::toTracedValue() { - OwnPtr<TracedValue> tracedValue(TracedValue::create()); + std::unique_ptr<TracedValue> tracedValue(TracedValue::create()); for (size_t i = 0; i < NumCounters; ++i) { if (m_counters[i] > 0) tracedValue->setInteger(nameForCounter(static_cast<Counter>(i)), m_counters[i]);
diff --git a/third_party/WebKit/Source/core/layout/LayoutAnalyzer.h b/third_party/WebKit/Source/core/layout/LayoutAnalyzer.h index 00c7a0dd..cda9ffb1 100644 --- a/third_party/WebKit/Source/core/layout/LayoutAnalyzer.h +++ b/third_party/WebKit/Source/core/layout/LayoutAnalyzer.h
@@ -8,7 +8,7 @@ #include "platform/LayoutUnit.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -82,7 +82,7 @@ m_counters[counter] += delta; } - PassOwnPtr<TracedValue> toTracedValue(); + std::unique_ptr<TracedValue> toTracedValue(); private: const char* nameForCounter(Counter) const;
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp index a8bae52..fda8bbe 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -54,7 +54,9 @@ #include "core/paint/PaintLayer.h" #include "core/style/ComputedStyle.h" #include "platform/RuntimeEnabledFeatures.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { @@ -103,7 +105,7 @@ void LayoutBlock::removeFromGlobalMaps() { if (hasPositionedObjects()) { - OwnPtr<TrackedLayoutBoxListHashSet> descendants = gPositionedDescendantsMap->take(this); + std::unique_ptr<TrackedLayoutBoxListHashSet> descendants = gPositionedDescendantsMap->take(this); ASSERT(!descendants->isEmpty()); for (LayoutBox* descendant : *descendants) { ASSERT(gPositionedContainerMap->get(descendant) == this); @@ -111,7 +113,7 @@ } } if (hasPercentHeightDescendants()) { - OwnPtr<TrackedLayoutBoxListHashSet> descendants = gPercentHeightDescendantsMap->take(this); + std::unique_ptr<TrackedLayoutBoxListHashSet> descendants = gPercentHeightDescendantsMap->take(this); ASSERT(!descendants->isEmpty()); for (LayoutBox* descendant : *descendants) { ASSERT(descendant->percentHeightContainer() == this); @@ -874,7 +876,7 @@ TrackedLayoutBoxListHashSet* descendantSet = gPositionedDescendantsMap->get(this); if (!descendantSet) { descendantSet = new TrackedLayoutBoxListHashSet; - gPositionedDescendantsMap->set(this, adoptPtr(descendantSet)); + gPositionedDescendantsMap->set(this, wrapUnique(descendantSet)); } descendantSet->add(o); @@ -962,7 +964,7 @@ TrackedLayoutBoxListHashSet* descendantSet = gPercentHeightDescendantsMap->get(this); if (!descendantSet) { descendantSet = new TrackedLayoutBoxListHashSet; - gPercentHeightDescendantsMap->set(this, adoptPtr(descendantSet)); + gPercentHeightDescendantsMap->set(this, wrapUnique(descendantSet)); } descendantSet->add(descendant);
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.h b/third_party/WebKit/Source/core/layout/LayoutBlock.h index 59bcd53..89e0b4a 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.h +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.h
@@ -26,7 +26,7 @@ #include "core/CoreExport.h" #include "core/layout/LayoutBox.h" #include "wtf/ListHashSet.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -35,7 +35,7 @@ class WordMeasurement; typedef WTF::ListHashSet<LayoutBox*, 16> TrackedLayoutBoxListHashSet; -typedef WTF::HashMap<const LayoutBlock*, OwnPtr<TrackedLayoutBoxListHashSet>> TrackedDescendantsMap; +typedef WTF::HashMap<const LayoutBlock*, std::unique_ptr<TrackedLayoutBoxListHashSet>> TrackedDescendantsMap; typedef WTF::HashMap<const LayoutBox*, LayoutBlock*> TrackedContainerMap; typedef Vector<WordMeasurement, 64> WordMeasurements;
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp index 45536cf5..a7c3fbaa 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -49,6 +49,8 @@ #include "core/layout/line/LineWidth.h" #include "core/layout/shapes/ShapeOutsideInfo.h" #include "core/paint/PaintLayer.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -1124,7 +1126,7 @@ LayoutBoxToFloatInfoMap::iterator end = floatMap.end(); for (LayoutBoxToFloatInfoMap::iterator it = floatMap.begin(); it != end; ++it) { - OwnPtr<FloatingObject>& floatingObject = it->value; + std::unique_ptr<FloatingObject>& floatingObject = it->value; if (!floatingObject->isDescendant()) { changeLogicalTop = LayoutUnit(); changeLogicalBottom = std::max(changeLogicalBottom, logicalBottomForFloat(*floatingObject)); @@ -1762,7 +1764,7 @@ return; if (!m_rareData) - m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); + m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); m_rareData->m_discardMarginBefore = value; } @@ -1778,7 +1780,7 @@ return; if (!m_rareData) - m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); + m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); m_rareData->m_discardMarginAfter = value; } @@ -1823,7 +1825,7 @@ if (!m_rareData) { if (pos == LayoutBlockFlowRareData::positiveMarginBeforeDefault(this) && neg == LayoutBlockFlowRareData::negativeMarginBeforeDefault(this)) return; - m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); + m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); } m_rareData->m_margins.setPositiveMarginBefore(pos); m_rareData->m_margins.setNegativeMarginBefore(neg); @@ -1834,7 +1836,7 @@ if (!m_rareData) { if (pos == LayoutBlockFlowRareData::positiveMarginAfterDefault(this) && neg == LayoutBlockFlowRareData::negativeMarginAfterDefault(this)) return; - m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); + m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); } m_rareData->m_margins.setPositiveMarginAfter(pos); m_rareData->m_margins.setNegativeMarginAfter(neg); @@ -2198,7 +2200,7 @@ void LayoutBlockFlow::createFloatingObjects() { - m_floatingObjects = adoptPtr(new FloatingObjects(this, isHorizontalWritingMode())); + m_floatingObjects = wrapUnique(new FloatingObjects(this, isHorizontalWritingMode())); } void LayoutBlockFlow::willBeDestroyed() @@ -3003,7 +3005,7 @@ // Create the special object entry & append it to the list - OwnPtr<FloatingObject> newObj = FloatingObject::create(&floatBox); + std::unique_ptr<FloatingObject> newObj = FloatingObject::create(&floatBox); // Our location is irrelevant if we're unsplittable or no pagination is in effect. // Just go ahead and lay out the float. @@ -3461,7 +3463,7 @@ if (!m_rareData) { if (!strut) return; - m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); + m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); } m_rareData->m_paginationStrutPropagatedFromChild = strut; } @@ -3603,7 +3605,7 @@ if (m_rareData) return *m_rareData; - m_rareData = adoptPtr(new LayoutBlockFlowRareData(this)); + m_rareData = wrapUnique(new LayoutBlockFlowRareData(this)); return *m_rareData; }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h index 55c9f49..4734a25 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.h
@@ -43,6 +43,7 @@ #include "core/layout/line/LineBoxList.h" #include "core/layout/line/RootInlineBox.h" #include "core/layout/line/TrailingObjects.h" +#include <memory> namespace blink { @@ -615,8 +616,8 @@ bool checkIfIsSelfCollapsingBlock() const; protected: - OwnPtr<LayoutBlockFlowRareData> m_rareData; - OwnPtr<FloatingObjects> m_floatingObjects; + std::unique_ptr<LayoutBlockFlowRareData> m_rareData; + std::unique_ptr<FloatingObjects> m_floatingObjects; friend class MarginInfo; friend class LineWidth; // needs to know FloatingObject
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp index 0cda260..2dae9193 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -61,6 +61,7 @@ #include "platform/geometry/DoubleRect.h" #include "platform/geometry/FloatQuad.h" #include "platform/geometry/FloatRoundedRect.h" +#include "wtf/PtrUtil.h" #include <algorithm> #include <math.h> @@ -4199,7 +4200,7 @@ } if (!m_overflow) - m_overflow = adoptPtr(new BoxOverflowModel(clientBox, borderBoxRect())); + m_overflow = wrapUnique(new BoxOverflowModel(clientBox, borderBoxRect())); m_overflow->addLayoutOverflow(overflowRect); } @@ -4214,7 +4215,7 @@ return; if (!m_overflow) - m_overflow = adoptPtr(new BoxOverflowModel(noOverflowRect(), borderBox)); + m_overflow = wrapUnique(new BoxOverflowModel(noOverflowRect(), borderBox)); m_overflow->addSelfVisualOverflow(rect); } @@ -4232,7 +4233,7 @@ return; if (!m_overflow) - m_overflow = adoptPtr(new BoxOverflowModel(noOverflowRect(), borderBox)); + m_overflow = wrapUnique(new BoxOverflowModel(noOverflowRect(), borderBox)); m_overflow->addContentsVisualOverflow(rect); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.h b/third_party/WebKit/Source/core/layout/LayoutBox.h index 0f80c7e..5b41c529 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.h +++ b/third_party/WebKit/Source/core/layout/LayoutBox.h
@@ -28,6 +28,8 @@ #include "core/layout/OverflowModel.h" #include "core/layout/ScrollEnums.h" #include "platform/scroll/ScrollTypes.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -87,12 +89,12 @@ LayoutBox* m_snapContainer; // For snap container, the descendant snap areas that contribute snap // points. - OwnPtr<SnapAreaSet> m_snapAreas; + std::unique_ptr<SnapAreaSet> m_snapAreas; SnapAreaSet& ensureSnapAreas() { if (!m_snapAreas) - m_snapAreas = adoptPtr(new SnapAreaSet); + m_snapAreas = wrapUnique(new SnapAreaSet); return *m_snapAreas; } @@ -1059,7 +1061,7 @@ LayoutBoxRareData& ensureRareData() { if (!m_rareData) - m_rareData = adoptPtr(new LayoutBoxRareData()); + m_rareData = wrapUnique(new LayoutBoxRareData()); return *m_rareData.get(); } @@ -1122,13 +1124,13 @@ LayoutUnit m_maxPreferredLogicalWidth; // Our overflow information. - OwnPtr<BoxOverflowModel> m_overflow; + std::unique_ptr<BoxOverflowModel> m_overflow; private: // The inline box containing this LayoutBox, for atomic inline elements. InlineBox* m_inlineBoxWrapper; - OwnPtr<LayoutBoxRareData> m_rareData; + std::unique_ptr<LayoutBoxRareData> m_rareData; }; DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBox, isBox());
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp index fd76c7b..a9bafeec 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -39,6 +39,7 @@ #include "core/paint/PaintLayer.h" #include "core/style/ShadowList.h" #include "platform/LengthFunctions.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -326,7 +327,7 @@ void LayoutBoxModelObject::createLayer() { ASSERT(!m_layer); - m_layer = adoptPtr(new PaintLayer(this)); + m_layer = wrapUnique(new PaintLayer(this)); setHasLayer(true); m_layer->insertOnlyThisLayerAfterStyleChange(); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h index df963367..f61090f4 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h +++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
@@ -30,6 +30,8 @@ #include "core/layout/LayoutObject.h" #include "core/page/scrolling/StickyPositionScrollingConstraints.h" #include "platform/geometry/LayoutRect.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -370,15 +372,15 @@ LayoutBoxModelObjectRareData& ensureRareData() { if (!m_rareData) - m_rareData = adoptPtr(new LayoutBoxModelObjectRareData()); + m_rareData = wrapUnique(new LayoutBoxModelObjectRareData()); return *m_rareData.get(); } // The PaintLayer associated with this object. // |m_layer| can be nullptr depending on the return value of layerTypeRequired(). - OwnPtr<PaintLayer> m_layer; + std::unique_ptr<PaintLayer> m_layer; - OwnPtr<LayoutBoxModelObjectRareData> m_rareData; + std::unique_ptr<LayoutBoxModelObjectRareData> m_rareData; }; DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject());
diff --git a/third_party/WebKit/Source/core/layout/LayoutCounter.cpp b/third_party/WebKit/Source/core/layout/LayoutCounter.cpp index 8f48f65..d652693 100644 --- a/third_party/WebKit/Source/core/layout/LayoutCounter.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutCounter.cpp
@@ -30,7 +30,9 @@ #include "core/layout/LayoutView.h" #include "core/layout/ListMarkerText.h" #include "core/style/ComputedStyle.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" +#include <memory> #ifndef NDEBUG #include <stdio.h> @@ -41,7 +43,7 @@ using namespace HTMLNames; typedef HashMap<AtomicString, RefPtr<CounterNode>> CounterMap; -typedef HashMap<const LayoutObject*, OwnPtr<CounterMap>> CounterMaps; +typedef HashMap<const LayoutObject*, std::unique_ptr<CounterMap>> CounterMaps; static CounterNode* makeCounterNodeIfNeeded(LayoutObject&, const AtomicString& identifier, bool alwaysCreateCounter); @@ -339,7 +341,7 @@ nodeMap = counterMaps().get(&object); } else { nodeMap = new CounterMap; - counterMaps().set(&object, adoptPtr(nodeMap)); + counterMaps().set(&object, wrapUnique(nodeMap)); object.setHasCounterNodeMap(true); } nodeMap->set(identifier, newNode);
diff --git a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h index ed6666c..c18e95c 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h +++ b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h
@@ -34,7 +34,6 @@ #include "platform/geometry/IntSize.h" #include "platform/geometry/LayoutSize.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/LayoutGeometryMapStep.h b/third_party/WebKit/Source/core/layout/LayoutGeometryMapStep.h index 6b4350d..4f60d33 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGeometryMapStep.h +++ b/third_party/WebKit/Source/core/layout/LayoutGeometryMapStep.h
@@ -30,7 +30,7 @@ #include "platform/geometry/LayoutSize.h" #include "platform/transforms/TransformationMatrix.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -63,7 +63,7 @@ } const LayoutObject* m_layoutObject; LayoutSize m_offset; - OwnPtr<TransformationMatrix> m_transform; // Includes offset if non-null. + std::unique_ptr<TransformationMatrix> m_transform; // Includes offset if non-null. // If m_offsetForFixedPosition could only apply to the fixed position steps, we may be able to merge // with m_offsetForStickyPosition and simplify mapping. LayoutSize m_offsetForFixedPosition;
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp index 1ac1d2d3..b2639b5b 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -32,7 +32,9 @@ #include "core/style/ComputedStyle.h" #include "core/style/GridArea.h" #include "platform/LengthFunctions.h" +#include "wtf/PtrUtil.h" #include <algorithm> +#include <memory> namespace blink { @@ -199,7 +201,7 @@ return true; } - PassOwnPtr<GridArea> nextEmptyGridArea(size_t fixedTrackSpan, size_t varyingTrackSpan) + std::unique_ptr<GridArea> nextEmptyGridArea(size_t fixedTrackSpan, size_t varyingTrackSpan) { DCHECK(!m_grid.isEmpty()); DCHECK(!m_grid[0].isEmpty()); @@ -212,7 +214,7 @@ const size_t endOfVaryingTrackIndex = (m_direction == ForColumns) ? m_grid.size() : m_grid[0].size(); for (; varyingTrackIndex < endOfVaryingTrackIndex; ++varyingTrackIndex) { if (checkEmptyCells(rowSpan, columnSpan)) { - OwnPtr<GridArea> result = adoptPtr(new GridArea(GridSpan::translatedDefiniteGridSpan(m_rowIndex, m_rowIndex + rowSpan), GridSpan::translatedDefiniteGridSpan(m_columnIndex, m_columnIndex + columnSpan))); + std::unique_ptr<GridArea> result = wrapUnique(new GridArea(GridSpan::translatedDefiniteGridSpan(m_rowIndex, m_rowIndex + rowSpan), GridSpan::translatedDefiniteGridSpan(m_columnIndex, m_columnIndex + columnSpan))); // Advance the iterator to avoid an infinite loop where we would return the same grid area over and over. ++varyingTrackIndex; return result; @@ -634,13 +636,13 @@ return LayoutUnit(infinity); } -double LayoutGrid::computeFlexFactorUnitSize(const Vector<GridTrack>& tracks, GridTrackSizingDirection direction, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8>& flexibleTracksIndexes, PassOwnPtr<TrackIndexSet> tracksToTreatAsInflexible) const +double LayoutGrid::computeFlexFactorUnitSize(const Vector<GridTrack>& tracks, GridTrackSizingDirection direction, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8>& flexibleTracksIndexes, std::unique_ptr<TrackIndexSet> tracksToTreatAsInflexible) const { // We want to avoid the effect of flex factors sum below 1 making the factor unit size to grow exponentially. double hypotheticalFactorUnitSize = leftOverSpace / std::max<double>(1, flexFactorSum); // product of the hypothetical "flex factor unit" and any flexible track's "flex factor" must be grater than such track's "base size". - OwnPtr<TrackIndexSet> additionalTracksToTreatAsInflexible = std::move(tracksToTreatAsInflexible); + std::unique_ptr<TrackIndexSet> additionalTracksToTreatAsInflexible = std::move(tracksToTreatAsInflexible); bool validFlexFactorUnit = true; for (auto index : flexibleTracksIndexes) { if (additionalTracksToTreatAsInflexible && additionalTracksToTreatAsInflexible->contains(index)) @@ -652,7 +654,7 @@ leftOverSpace -= baseSize; flexFactorSum -= flexFactor; if (!additionalTracksToTreatAsInflexible) - additionalTracksToTreatAsInflexible = adoptPtr(new TrackIndexSet()); + additionalTracksToTreatAsInflexible = wrapUnique(new TrackIndexSet()); additionalTracksToTreatAsInflexible->add(index); validFlexFactorUnit = false; } @@ -1413,13 +1415,13 @@ column.grow(maximumColumnIndex + abs(m_smallestColumnStart)); } -PassOwnPtr<GridArea> LayoutGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const LayoutBox& gridItem, GridTrackSizingDirection specifiedDirection, const GridSpan& specifiedPositions) const +std::unique_ptr<GridArea> LayoutGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const LayoutBox& gridItem, GridTrackSizingDirection specifiedDirection, const GridSpan& specifiedPositions) const { GridTrackSizingDirection crossDirection = specifiedDirection == ForColumns ? ForRows : ForColumns; const size_t endOfCrossDirection = crossDirection == ForColumns ? gridColumnCount() : gridRowCount(); size_t crossDirectionSpanSize = GridPositionsResolver::spanSizeForAutoPlacedItem(*style(), gridItem, crossDirection); GridSpan crossDirectionPositions = GridSpan::translatedDefiniteGridSpan(endOfCrossDirection, endOfCrossDirection + crossDirectionSpanSize); - return adoptPtr(new GridArea(specifiedDirection == ForColumns ? crossDirectionPositions : specifiedPositions, specifiedDirection == ForColumns ? specifiedPositions : crossDirectionPositions)); + return wrapUnique(new GridArea(specifiedDirection == ForColumns ? crossDirectionPositions : specifiedPositions, specifiedDirection == ForColumns ? specifiedPositions : crossDirectionPositions)); } void LayoutGrid::placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>& autoGridItems) @@ -1440,7 +1442,7 @@ unsigned majorAxisInitialPosition = majorAxisPositions.startLine(); GridIterator iterator(m_grid, autoPlacementMajorAxisDirection(), majorAxisPositions.startLine(), isGridAutoFlowDense ? 0 : minorAxisCursors.get(majorAxisInitialPosition)); - OwnPtr<GridArea> emptyGridArea = iterator.nextEmptyGridArea(majorAxisPositions.integerSpan(), minorAxisSpanSize); + std::unique_ptr<GridArea> emptyGridArea = iterator.nextEmptyGridArea(majorAxisPositions.integerSpan(), minorAxisSpanSize); if (!emptyGridArea) emptyGridArea = createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(*autoGridItem, autoPlacementMajorAxisDirection(), majorAxisPositions); @@ -1478,7 +1480,7 @@ size_t majorAxisAutoPlacementCursor = autoPlacementMajorAxisDirection() == ForColumns ? autoPlacementCursor.second : autoPlacementCursor.first; size_t minorAxisAutoPlacementCursor = autoPlacementMajorAxisDirection() == ForColumns ? autoPlacementCursor.first : autoPlacementCursor.second; - OwnPtr<GridArea> emptyGridArea; + std::unique_ptr<GridArea> emptyGridArea; if (minorAxisPositions.isTranslatedDefinite()) { // Move to the next track in major axis if initial position in minor axis is before auto-placement cursor. if (minorAxisPositions.startLine() < minorAxisAutoPlacementCursor)
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.h b/third_party/WebKit/Source/core/layout/LayoutGrid.h index 335e18ba..01c34999 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGrid.h +++ b/third_party/WebKit/Source/core/layout/LayoutGrid.h
@@ -29,6 +29,7 @@ #include "core/layout/LayoutBlock.h" #include "core/layout/OrderIterator.h" #include "core/style/GridPositionsResolver.h" +#include <memory> namespace blink { @@ -132,7 +133,7 @@ void placeItemsOnGrid(); void populateExplicitGridAndOrderIterator(); - PassOwnPtr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions) const; + std::unique_ptr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(const LayoutBox&, GridTrackSizingDirection, const GridSpan& specifiedPositions) const; void placeSpecifiedMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); void placeAutoMajorAxisItemsOnGrid(const Vector<LayoutBox*>&); void placeAutoMajorAxisItemOnGrid(LayoutBox&, std::pair<size_t, size_t>& autoPlacementCursor); @@ -156,7 +157,7 @@ template <TrackSizeComputationPhase> void distributeSpaceToTracks(Vector<GridTrack*>&, const Vector<GridTrack*>* growBeyondGrowthLimitsTracks, GridSizingData&, LayoutUnit& availableLogicalSpace); typedef HashSet<size_t, DefaultHash<size_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<size_t>> TrackIndexSet; - double computeFlexFactorUnitSize(const Vector<GridTrack>&, GridTrackSizingDirection, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8>& flexibleTracksIndexes, PassOwnPtr<TrackIndexSet> tracksToTreatAsInflexible = nullptr) const; + double computeFlexFactorUnitSize(const Vector<GridTrack>&, GridTrackSizingDirection, double flexFactorSum, LayoutUnit& leftOverSpace, const Vector<size_t, 8>& flexibleTracksIndexes, std::unique_ptr<TrackIndexSet> tracksToTreatAsInflexible = nullptr) const; double findFlexFactorUnitSize(const Vector<GridTrack>&, const GridSpan&, GridTrackSizingDirection, LayoutUnit leftOverSpace) const; const GridTrackSize& rawGridTrackSize(GridTrackSizingDirection, size_t) const;
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp index 8263e0f5..c5b4180 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -80,6 +80,7 @@ #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" #include <algorithm> +#include <memory> #ifndef NDEBUG #include <stdio.h> #endif @@ -137,7 +138,7 @@ // The pointer to paint properties is implemented as a global hash map temporarily, // to avoid memory regression during the transition towards SPv2. -typedef HashMap<const LayoutObject*, OwnPtr<ObjectPaintProperties>> ObjectPaintPropertiesMap; +typedef HashMap<const LayoutObject*, std::unique_ptr<ObjectPaintProperties>> ObjectPaintPropertiesMap; static ObjectPaintPropertiesMap& objectPaintPropertiesMap() { DEFINE_STATIC_LOCAL(ObjectPaintPropertiesMap, staticObjectPaintPropertiesMap, ()); @@ -1170,9 +1171,9 @@ value->endDictionary(); } -static PassOwnPtr<TracedValue> jsonObjectForPaintInvalidationInfo(const LayoutRect& rect, const String& invalidationReason) +static std::unique_ptr<TracedValue> jsonObjectForPaintInvalidationInfo(const LayoutRect& rect, const String& invalidationReason) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); addJsonObjectForRect(value.get(), "rect", rect); value->setString("invalidation_reason", invalidationReason); return value; @@ -1327,9 +1328,9 @@ } } -static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoint& newLocation) +static std::unique_ptr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRect, const LayoutPoint& oldLocation, const LayoutRect& newRect, const LayoutPoint& newLocation) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); addJsonObjectForRect(value.get(), "oldRect", oldRect); addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); addJsonObjectForRect(value.get(), "newRect", newRect);
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp index 8d24d01..00f82f5 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -44,6 +44,7 @@ #include "core/paint/PaintLayer.h" #include "core/paint/TablePainter.h" #include "core/style/StyleInheritedData.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -91,9 +92,9 @@ // According to the CSS2 spec, you only use fixed table layout if an // explicit width is specified on the table. Auto width implies auto table layout. if (style()->isFixedTableLayout()) - m_tableLayout = adoptPtr(new TableLayoutAlgorithmFixed(this)); + m_tableLayout = wrapUnique(new TableLayoutAlgorithmFixed(this)); else - m_tableLayout = adoptPtr(new TableLayoutAlgorithmAuto(this)); + m_tableLayout = wrapUnique(new TableLayoutAlgorithmAuto(this)); } // If border was changed, invalidate collapsed borders cache.
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.h b/third_party/WebKit/Source/core/layout/LayoutTable.h index b969dc6..2c0f062 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTable.h +++ b/third_party/WebKit/Source/core/layout/LayoutTable.h
@@ -30,6 +30,7 @@ #include "core/layout/LayoutBlock.h" #include "core/style/CollapsedBorderValue.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -474,7 +475,7 @@ // // As the algorithm is dependent on the style, this field is nullptr before // the first style is applied in styleDidChange(). - OwnPtr<TableLayoutAlgorithm> m_tableLayout; + std::unique_ptr<TableLayoutAlgorithm> m_tableLayout; // A sorted list of all unique border values that we want to paint. //
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp index 9adadc04..e6fa743 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
@@ -34,6 +34,7 @@ #include "core/style/CollapsedBorderValue.h" #include "platform/geometry/FloatQuad.h" #include "platform/geometry/TransformState.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -922,7 +923,7 @@ m_collapsedBorderValues = nullptr; } else if (!m_collapsedBorderValues) { changed = true; - m_collapsedBorderValues = adoptPtr(new CollapsedBorderValues(newValues)); + m_collapsedBorderValues = wrapUnique(new CollapsedBorderValues(newValues)); } else { // We check visuallyEquals so that the table cell is invalidated only if a changed // collapsed border is visible in the first place.
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.h b/third_party/WebKit/Source/core/layout/LayoutTableCell.h index 023f92db..dba89847 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableCell.h +++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.h
@@ -30,6 +30,7 @@ #include "core/layout/LayoutTableRow.h" #include "core/layout/LayoutTableSection.h" #include "platform/LengthFunctions.h" +#include <memory> namespace blink { @@ -366,7 +367,7 @@ int m_intrinsicPaddingBefore; int m_intrinsicPaddingAfter; - OwnPtr<CollapsedBorderValues> m_collapsedBorderValues; + std::unique_ptr<CollapsedBorderValues> m_collapsedBorderValues; }; DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell());
diff --git a/third_party/WebKit/Source/core/layout/LayoutTestHelper.h b/third_party/WebKit/Source/core/layout/LayoutTestHelper.h index a6c0c6c..189a8d87d 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTestHelper.h +++ b/third_party/WebKit/Source/core/layout/LayoutTestHelper.h
@@ -13,8 +13,8 @@ #include "core/loader/EmptyClients.h" #include "core/testing/DummyPageHolder.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" #include <gtest/gtest.h> +#include <memory> namespace blink { @@ -60,7 +60,7 @@ Persistent<LocalFrame> m_subframe; Persistent<FrameLoaderClient> m_frameLoaderClient; Persistent<FrameLoaderClient> m_childFrameLoaderClient; - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; }; class SingleChildFrameLoaderClient final : public EmptyFrameLoaderClient {
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp b/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp index 240020a..f3039dfa 100644 --- a/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutThemeTest.cpp
@@ -14,6 +14,7 @@ #include "core/testing/DummyPageHolder.h" #include "platform/graphics/Color.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -24,7 +25,7 @@ void setHtmlInnerHTML(const char* htmlContent); private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp index 3c6836a5..f71ba49 100644 --- a/third_party/WebKit/Source/core/layout/LayoutView.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -44,6 +44,7 @@ #include "platform/geometry/TransformState.h" #include "platform/graphics/paint/PaintController.h" #include "public/platform/Platform.h" +#include "wtf/PtrUtil.h" #include <inttypes.h> namespace blink { @@ -243,7 +244,7 @@ if (pageLogicalHeight() && shouldUsePrintingLayout()) { m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth(); if (!m_fragmentationContext) - m_fragmentationContext = adoptPtr(new ViewFragmentationContext(*this)); + m_fragmentationContext = wrapUnique(new ViewFragmentationContext(*this)); } else if (m_fragmentationContext) { m_fragmentationContext.reset(); } @@ -952,7 +953,7 @@ PaintLayerCompositor* LayoutView::compositor() { if (!m_compositor) - m_compositor = adoptPtr(new PaintLayerCompositor(*this)); + m_compositor = wrapUnique(new PaintLayerCompositor(*this)); return m_compositor.get(); } @@ -961,6 +962,12 @@ { if (m_compositor) m_compositor->setIsInWindow(isInWindow); +#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS + // We don't invalidate layers during document detach(), so must clear the should-keep-alive + // DisplayItemClients which may be deleted before the layers being subsequence owners. + if (!isInWindow && layer()) + layer()->endShouldKeepAliveAllClientsRecursive(); +#endif } IntervalArena* LayoutView::intervalArena()
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.h b/third_party/WebKit/Source/core/layout/LayoutView.h index 0441c81..6a123a2 100644 --- a/third_party/WebKit/Source/core/layout/LayoutView.h +++ b/third_party/WebKit/Source/core/layout/LayoutView.h
@@ -32,7 +32,7 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/heap/Handle.h" #include "platform/scroll/ScrollableArea.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -262,8 +262,8 @@ // See the class comment for more details. LayoutState* m_layoutState; - OwnPtr<ViewFragmentationContext> m_fragmentationContext; - OwnPtr<PaintLayerCompositor> m_compositor; + std::unique_ptr<ViewFragmentationContext> m_fragmentationContext; + std::unique_ptr<PaintLayerCompositor> m_compositor; RefPtr<IntervalArena> m_intervalArena; LayoutQuote* m_layoutQuoteHead;
diff --git a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp index 9ce514ca..3f6ee8e 100644 --- a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp +++ b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
@@ -47,6 +47,8 @@ #include "core/layout/api/LayoutAPIShim.h" #include "core/layout/api/LayoutViewItem.h" #include "core/page/Page.h" +#include "wtf/PtrUtil.h" +#include <memory> #ifdef AUTOSIZING_DOM_DEBUG_INFO #include "core/dom/ExecutionContextTask.h" @@ -82,7 +84,7 @@ node = toDocument(node)->documentElement(); if (!node->isElementNode()) return; - node->document().postTask(adoptPtr(new WriteDebugInfoTask(toElement(node), output))); + node->document().postTask(wrapUnique(new WriteDebugInfoTask(toElement(node), output))); } void TextAutosizer::writeClusterDebugInfo(Cluster* cluster) @@ -361,7 +363,7 @@ m_blocksThatHaveBegunLayout.add(block); #endif if (Cluster* cluster = maybeCreateCluster(block)) - m_clusterStack.append(adoptPtr(cluster)); + m_clusterStack.append(wrapUnique(cluster)); } } @@ -375,7 +377,7 @@ ASSERT(!m_clusterStack.isEmpty() || block->isLayoutView()); if (Cluster* cluster = maybeCreateCluster(block)) - m_clusterStack.append(adoptPtr(cluster)); + m_clusterStack.append(wrapUnique(cluster)); ASSERT(!m_clusterStack.isEmpty()); @@ -765,12 +767,12 @@ if (!roots || roots->size() < 2 || !roots->contains(block)) return nullptr; - SuperclusterMap::AddResult addResult = m_superclusters.add(fingerprint, PassOwnPtr<Supercluster>()); + SuperclusterMap::AddResult addResult = m_superclusters.add(fingerprint, std::unique_ptr<Supercluster>()); if (!addResult.isNewEntry) return addResult.storedValue->value.get(); Supercluster* supercluster = new Supercluster(roots); - addResult.storedValue->value = adoptPtr(supercluster); + addResult.storedValue->value = wrapUnique(supercluster); return supercluster; } @@ -1093,9 +1095,9 @@ { add(block, fingerprint); - ReverseFingerprintMap::AddResult addResult = m_blocksForFingerprint.add(fingerprint, PassOwnPtr<BlockSet>()); + ReverseFingerprintMap::AddResult addResult = m_blocksForFingerprint.add(fingerprint, std::unique_ptr<BlockSet>()); if (addResult.isNewEntry) - addResult.storedValue->value = adoptPtr(new BlockSet); + addResult.storedValue->value = wrapUnique(new BlockSet); addResult.storedValue->value->add(block); #if ENABLE(ASSERT) assertMapsAreConsistent();
diff --git a/third_party/WebKit/Source/core/layout/TextAutosizer.h b/third_party/WebKit/Source/core/layout/TextAutosizer.h index 4f3a2a6..c680135 100644 --- a/third_party/WebKit/Source/core/layout/TextAutosizer.h +++ b/third_party/WebKit/Source/core/layout/TextAutosizer.h
@@ -36,8 +36,7 @@ #include "wtf/HashMap.h" #include "wtf/HashSet.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" - +#include <memory> #include <unicode/uchar.h> namespace blink { @@ -207,8 +206,8 @@ "sizeof(FingerprintSourceData) must be a multiple of UChar"); typedef unsigned Fingerprint; - typedef HashMap<Fingerprint, OwnPtr<Supercluster>> SuperclusterMap; - typedef Vector<OwnPtr<Cluster>> ClusterStack; + typedef HashMap<Fingerprint, std::unique_ptr<Supercluster>> SuperclusterMap; + typedef Vector<std::unique_ptr<Cluster>> ClusterStack; // Fingerprints are computed during style recalc, for (some subset of) // blocks that will become cluster roots. @@ -224,7 +223,7 @@ bool hasFingerprints() const { return !m_fingerprints.isEmpty(); } private: typedef HashMap<const LayoutObject*, Fingerprint> FingerprintMap; - typedef HashMap<Fingerprint, OwnPtr<BlockSet>> ReverseFingerprintMap; + typedef HashMap<Fingerprint, std::unique_ptr<BlockSet>> ReverseFingerprintMap; FingerprintMap m_fingerprints; ReverseFingerprintMap m_blocksForFingerprint;
diff --git a/third_party/WebKit/Source/core/layout/TracedLayoutObject.cpp b/third_party/WebKit/Source/core/layout/TracedLayoutObject.cpp index fddb6c4..efc34549d 100644 --- a/third_party/WebKit/Source/core/layout/TracedLayoutObject.cpp +++ b/third_party/WebKit/Source/core/layout/TracedLayoutObject.cpp
@@ -9,6 +9,7 @@ #include "core/layout/LayoutText.h" #include "core/layout/LayoutView.h" #include <inttypes.h> +#include <memory> namespace blink { @@ -99,9 +100,9 @@ } // namespace -PassOwnPtr<TracedValue> TracedLayoutObject::create(const LayoutView& view, bool traceGeometry) +std::unique_ptr<TracedValue> TracedLayoutObject::create(const LayoutView& view, bool traceGeometry) { - OwnPtr<TracedValue> tracedValue = TracedValue::create(); + std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); dumpToTracedValue(view, traceGeometry, tracedValue.get()); return tracedValue; }
diff --git a/third_party/WebKit/Source/core/layout/TracedLayoutObject.h b/third_party/WebKit/Source/core/layout/TracedLayoutObject.h index 4f03b9b..085b558b 100644 --- a/third_party/WebKit/Source/core/layout/TracedLayoutObject.h +++ b/third_party/WebKit/Source/core/layout/TracedLayoutObject.h
@@ -6,6 +6,7 @@ #define TracedLayoutObject_h #include "platform/TracedValue.h" +#include <memory> namespace blink { @@ -13,7 +14,7 @@ class TracedLayoutObject { public: - static PassOwnPtr<TracedValue> create(const LayoutView&, bool traceGeometry = true); + static std::unique_ptr<TracedValue> create(const LayoutView&, bool traceGeometry = true); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/api/LineLayoutSVGTextPath.h b/third_party/WebKit/Source/core/layout/api/LineLayoutSVGTextPath.h index a7973d8..a9a7076 100644 --- a/third_party/WebKit/Source/core/layout/api/LineLayoutSVGTextPath.h +++ b/third_party/WebKit/Source/core/layout/api/LineLayoutSVGTextPath.h
@@ -7,6 +7,7 @@ #include "core/layout/api/LineLayoutSVGInline.h" #include "core/layout/svg/LayoutSVGTextPath.h" +#include <memory> namespace blink { @@ -27,7 +28,7 @@ LineLayoutSVGTextPath() { } - PassOwnPtr<PathPositionMapper> layoutPath() const + std::unique_ptr<PathPositionMapper> layoutPath() const { return toSVGTextPath()->layoutPath(); }
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp index 78d921f..315a6b0 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -70,6 +70,7 @@ #include "platform/graphics/paint/TransformDisplayItem.h" #include "wtf/CurrentTime.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -221,9 +222,9 @@ destroyGraphicsLayers(); } -PassOwnPtr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(CompositingReasons reasons, SquashingDisallowedReasons squashingDisallowedReasons) +std::unique_ptr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(CompositingReasons reasons, SquashingDisallowedReasons squashingDisallowedReasons) { - OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(this); + std::unique_ptr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(this); graphicsLayer->setCompositingReasons(reasons); graphicsLayer->setSquashingDisallowedReasons(squashingDisallowedReasons); @@ -501,7 +502,7 @@ updateChildClippingMaskLayer(needsChildClippingMask); - if (layerToApplyChildClippingMask == m_graphicsLayer) { + if (layerToApplyChildClippingMask == m_graphicsLayer.get()) { if (m_graphicsLayer->maskLayer() != m_childClippingMaskLayer.get()) { m_graphicsLayer->setMaskLayer(m_childClippingMaskLayer.get()); maskLayerChanged = true; @@ -1329,7 +1330,7 @@ m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootBackground; } -bool CompositedLayerMapping::toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>& layer, bool needsLayer, CompositingReasons reason) +bool CompositedLayerMapping::toggleScrollbarLayerIfNeeded(std::unique_ptr<GraphicsLayer>& layer, bool needsLayer, CompositingReasons reason) { if (needsLayer == !!layer) return false; @@ -2249,7 +2250,7 @@ IntSize offsetFromAnchorLayoutObject; const LayoutBoxModelObject* anchorLayoutObject; - if (graphicsLayer == m_squashingLayer) { + if (graphicsLayer == m_squashingLayer.get()) { // TODO(chrishtr): this is a speculative fix for crbug.com/561306. However, it should never be the case that // m_squashingLayer exists yet m_squashedLayers.size() == 0. There must be a bug elsewhere. if (m_squashedLayers.size() == 0) @@ -2260,7 +2261,7 @@ anchorLayoutObject = m_squashedLayers[0].paintLayer->layoutObject(); offsetFromAnchorLayoutObject = m_squashedLayers[0].offsetFromLayoutObject; } else { - ASSERT(graphicsLayer == m_graphicsLayer || graphicsLayer == m_scrollingContentsLayer); + ASSERT(graphicsLayer == m_graphicsLayer.get() || graphicsLayer == m_scrollingContentsLayer.get()); anchorLayoutObject = m_owningLayer.layoutObject(); offsetFromAnchorLayoutObject = graphicsLayer->offsetFromLayoutObject(); adjustForCompositedScrolling(graphicsLayer, offsetFromAnchorLayoutObject); @@ -2345,7 +2346,7 @@ // Paint the whole layer if "mainFrameClipsContent" is false, meaning that WebPreferences::record_whole_document is true. bool shouldPaintWholePage = !m_owningLayer.layoutObject()->document().settings()->mainFrameClipsContent(); if (shouldPaintWholePage - || (graphicsLayer != m_graphicsLayer && graphicsLayer != m_squashingLayer && graphicsLayer != m_squashingLayer && graphicsLayer != m_scrollingContentsLayer)) + || (graphicsLayer != m_graphicsLayer.get() && graphicsLayer != m_squashingLayer.get() && graphicsLayer != m_squashingLayer.get() && graphicsLayer != m_scrollingContentsLayer.get())) return wholeLayerRect; IntRect newInterestRect = recomputeInterestRect(graphicsLayer); @@ -2404,7 +2405,7 @@ if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase; - if (graphicsLayer == m_backgroundLayer) + if (graphicsLayer == m_backgroundLayer.get()) paintLayerFlags |= (PaintLayerPaintingRootBackgroundOnly | PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroundPhase to walk child layers. else if (compositor()->fixedRootBackgroundLayer()) paintLayerFlags |= PaintLayerPaintingSkipRootBackground;
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h index ffe6c9c..93154db8f 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h
@@ -33,6 +33,7 @@ #include "platform/graphics/GraphicsLayer.h" #include "platform/graphics/GraphicsLayerClient.h" #include "wtf/Allocator.h" +#include <memory> namespace blink { @@ -248,8 +249,8 @@ void createPrimaryGraphicsLayer(); void destroyGraphicsLayers(); - PassOwnPtr<GraphicsLayer> createGraphicsLayer(CompositingReasons, SquashingDisallowedReasons = SquashingDisallowedReasonsNone); - bool toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>&, bool needsLayer, CompositingReasons); + std::unique_ptr<GraphicsLayer> createGraphicsLayer(CompositingReasons, SquashingDisallowedReasons = SquashingDisallowedReasonsNone); + bool toggleScrollbarLayerIfNeeded(std::unique_ptr<GraphicsLayer>&, bool needsLayer, CompositingReasons); LayoutBoxModelObject* layoutObject() const { return m_owningLayer.layoutObject(); } PaintLayerCompositor* compositor() const { return m_owningLayer.compositor(); } @@ -363,18 +364,18 @@ // In this case B is clipped by another layer that doesn't happen to be its ancestor: A. // So we create an ancestor clipping layer for B, [+], which ensures that B is clipped // as if it had been A's descendant. - OwnPtr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context. - OwnPtr<GraphicsLayer> m_graphicsLayer; - OwnPtr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipping on a stacking context with compositing children. - OwnPtr<GraphicsLayer> m_childTransformLayer; // Only used if we have perspective. - OwnPtr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling. - OwnPtr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling. + std::unique_ptr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context. + std::unique_ptr<GraphicsLayer> m_graphicsLayer; + std::unique_ptr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipping on a stacking context with compositing children. + std::unique_ptr<GraphicsLayer> m_childTransformLayer; // Only used if we have perspective. + std::unique_ptr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling. + std::unique_ptr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling. // This layer is also added to the hierarchy by the RLB, but in a different way than // the layers above. It's added to m_graphicsLayer as its mask layer (naturally) if // we have a mask, and isn't part of the typical hierarchy (it has no children). - OwnPtr<GraphicsLayer> m_maskLayer; // Only used if we have a mask. - OwnPtr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path. + std::unique_ptr<GraphicsLayer> m_maskLayer; // Only used if we have a mask. + std::unique_ptr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path. // There are two other (optional) layers whose painting is managed by the CompositedLayerMapping, // but whose position in the hierarchy is maintained by the PaintLayerCompositor. These @@ -398,17 +399,17 @@ // // With the hierarchy set up like this, the root content layer is able to scroll without affecting // the background layer (or paint invalidation). - OwnPtr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately. - OwnPtr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately. + std::unique_ptr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately. + std::unique_ptr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately. - OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar; - OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar; - OwnPtr<GraphicsLayer> m_layerForScrollCorner; + std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar; + std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar; + std::unique_ptr<GraphicsLayer> m_layerForScrollCorner; // This layer contains the scrollbar and scroll corner layers and clips them to the border box // bounds of our LayoutObject. It is usually added to m_graphicsLayer, but may be reparented by // GraphicsLayerTreeBuilder to ensure that scrollbars appear above scrolling content. - OwnPtr<GraphicsLayer> m_overflowControlsHostLayer; + std::unique_ptr<GraphicsLayer> m_overflowControlsHostLayer; // The reparented overflow controls sometimes need to be clipped by a non-ancestor. In just the same // way we need an ancestor clipping layer to clip this CLM's internal hierarchy, we add another layer @@ -416,7 +417,7 @@ // would require manually intersecting their clips, and shifting the overflow controls to compensate // for this clip's offset. By using a separate layer, the overflow controls can remain ignorant of // ancestor clipping. - OwnPtr<GraphicsLayer> m_overflowControlsAncestorClippingLayer; + std::unique_ptr<GraphicsLayer> m_overflowControlsAncestorClippingLayer; // A squashing CLM has two possible squashing-related structures. // @@ -434,8 +435,8 @@ // // Stacking children of a squashed layer receive graphics layers that are parented to the compositd ancestor of the // squashed layer (i.e. nearest enclosing composited layer that is not squashed). - OwnPtr<GraphicsLayer> m_squashingContainmentLayer; // Only used if any squashed layers exist and m_squashingContainmentLayer is not present, to contain the squashed layers as siblings to the rest of the GraphicsLayer tree chunk. - OwnPtr<GraphicsLayer> m_squashingLayer; // Only used if any squashed layers exist, this is the backing that squashed layers paint into. + std::unique_ptr<GraphicsLayer> m_squashingContainmentLayer; // Only used if any squashed layers exist and m_squashingContainmentLayer is not present, to contain the squashed layers as siblings to the rest of the GraphicsLayer tree chunk. + std::unique_ptr<GraphicsLayer> m_squashingLayer; // Only used if any squashed layers exist, this is the backing that squashed layers paint into. Vector<GraphicsLayerPaintInfo> m_squashedLayers; LayoutPoint m_squashingLayerOffsetFromTransformedAncestor;
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h index 0ccd54c..95cf7561 100644 --- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h +++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h
@@ -30,6 +30,7 @@ #include "core/layout/compositing/CompositingReasonFinder.h" #include "platform/graphics/GraphicsLayerClient.h" #include "wtf/HashMap.h" +#include <memory> namespace blink { @@ -219,7 +220,7 @@ Scrollbar* graphicsLayerToScrollbar(const GraphicsLayer*) const; LayoutView& m_layoutView; - OwnPtr<GraphicsLayer> m_rootContentLayer; + std::unique_ptr<GraphicsLayer> m_rootContentLayer; CompositingReasonFinder m_compositingReasonFinder; @@ -244,16 +245,16 @@ RootLayerAttachment m_rootLayerAttachment; // Enclosing container layer, which clips for iframe content - OwnPtr<GraphicsLayer> m_containerLayer; - OwnPtr<GraphicsLayer> m_scrollLayer; + std::unique_ptr<GraphicsLayer> m_containerLayer; + std::unique_ptr<GraphicsLayer> m_scrollLayer; // Enclosing layer for overflow controls and the clipping layer - OwnPtr<GraphicsLayer> m_overflowControlsHostLayer; + std::unique_ptr<GraphicsLayer> m_overflowControlsHostLayer; // Layers for overflow controls - OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar; - OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar; - OwnPtr<GraphicsLayer> m_layerForScrollCorner; + std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar; + std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar; + std::unique_ptr<GraphicsLayer> m_layerForScrollCorner; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp index 1767ac8..13a0d46 100644 --- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp +++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
@@ -36,6 +36,7 @@ #include "core/paint/InlineFlowBoxPainter.h" #include "core/style/ShadowList.h" #include "platform/fonts/Font.h" +#include "wtf/PtrUtil.h" #include <algorithm> #include <math.h> @@ -952,7 +953,7 @@ return; if (!m_overflow) - m_overflow = adoptPtr(new SimpleOverflowModel(frameBox, frameBox)); + m_overflow = wrapUnique(new SimpleOverflowModel(frameBox, frameBox)); m_overflow->setLayoutOverflow(rect); } @@ -964,7 +965,7 @@ return; if (!m_overflow) - m_overflow = adoptPtr(new SimpleOverflowModel(frameBox, frameBox)); + m_overflow = wrapUnique(new SimpleOverflowModel(frameBox, frameBox)); m_overflow->setVisualOverflow(rect); }
diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h index d1dd6e3..2b55056 100644 --- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h +++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h
@@ -25,6 +25,7 @@ #include "core/layout/api/SelectionState.h" #include "core/layout/line/InlineBox.h" #include "core/style/ShadowData.h" +#include <memory> namespace blink { @@ -310,7 +311,7 @@ void setOverflowFromLogicalRects(const LayoutRect& logicalLayoutOverflow, const LayoutRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom); protected: - OwnPtr<SimpleOverflowModel> m_overflow; + std::unique_ptr<SimpleOverflowModel> m_overflow; bool isInlineFlowBox() const final { return true; }
diff --git a/third_party/WebKit/Source/core/layout/line/RootInlineBox.h b/third_party/WebKit/Source/core/layout/line/RootInlineBox.h index 09df02a..538b0def 100644 --- a/third_party/WebKit/Source/core/layout/line/RootInlineBox.h +++ b/third_party/WebKit/Source/core/layout/line/RootInlineBox.h
@@ -25,6 +25,8 @@ #include "core/layout/api/SelectionState.h" #include "core/layout/line/InlineFlowBox.h" #include "platform/text/BidiContext.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -124,7 +126,7 @@ if (m_floats) m_floats->append(floatingBox); else - m_floats= adoptPtr(new Vector<LayoutBox*>(1, floatingBox)); + m_floats= wrapUnique(new Vector<LayoutBox*>(1, floatingBox)); } Vector<LayoutBox*>* floatsPtr() { ASSERT(!isDirty()); return m_floats.get(); } @@ -182,7 +184,7 @@ // Floats hanging off the line are pushed into this vector during layout. It is only // good for as long as the line has not been marked dirty. - OwnPtr<Vector<LayoutBox*>> m_floats; + std::unique_ptr<Vector<LayoutBox*>> m_floats; LayoutUnit m_lineTop; LayoutUnit m_lineBottom;
diff --git a/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp b/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp index ee06118..0c707169 100644 --- a/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp
@@ -31,6 +31,7 @@ #include "platform/geometry/FloatRoundedRect.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -38,7 +39,7 @@ protected: BoxShapeTest() { } - PassOwnPtr<Shape> createBoxShape(const FloatRoundedRect& bounds, float shapeMargin) + std::unique_ptr<Shape> createBoxShape(const FloatRoundedRect& bounds, float shapeMargin) { return Shape::createLayoutBoxShape(bounds, TopToBottomWritingMode, shapeMargin); } @@ -73,7 +74,7 @@ */ TEST_F(BoxShapeTest, zeroRadii) { - OwnPtr<Shape> shape = createBoxShape(FloatRoundedRect(0, 0, 100, 50), 10); + std::unique_ptr<Shape> shape = createBoxShape(FloatRoundedRect(0, 0, 100, 50), 10); EXPECT_FALSE(shape->isEmpty()); EXPECT_EQ(LayoutRect(-10, -10, 120, 70), shape->shapeMarginLogicalBoundingBox()); @@ -118,7 +119,7 @@ TEST_F(BoxShapeTest, getIntervals) { const FloatRoundedRect::Radii cornerRadii(FloatSize(10, 15), FloatSize(10, 20), FloatSize(25, 15), FloatSize(20, 30)); - OwnPtr<Shape> shape = createBoxShape(FloatRoundedRect(IntRect(0, 0, 100, 100), cornerRadii), 0); + std::unique_ptr<Shape> shape = createBoxShape(FloatRoundedRect(IntRect(0, 0, 100, 100), cornerRadii), 0); EXPECT_FALSE(shape->isEmpty()); EXPECT_EQ(LayoutRect(0, 0, 100, 100), shape->shapeMarginLogicalBoundingBox());
diff --git a/third_party/WebKit/Source/core/layout/shapes/PolygonShape.h b/third_party/WebKit/Source/core/layout/shapes/PolygonShape.h index 62dd4a6..f238812 100644 --- a/third_party/WebKit/Source/core/layout/shapes/PolygonShape.h +++ b/third_party/WebKit/Source/core/layout/shapes/PolygonShape.h
@@ -33,6 +33,7 @@ #include "core/layout/shapes/Shape.h" #include "core/layout/shapes/ShapeInterval.h" #include "platform/geometry/FloatPolygon.h" +#include <memory> namespace blink { @@ -61,7 +62,7 @@ class PolygonShape final : public Shape { WTF_MAKE_NONCOPYABLE(PolygonShape); public: - PolygonShape(PassOwnPtr<Vector<FloatPoint>> vertices, WindRule fillRule) + PolygonShape(std::unique_ptr<Vector<FloatPoint>> vertices, WindRule fillRule) : Shape() , m_polygon(std::move(vertices), fillRule) {
diff --git a/third_party/WebKit/Source/core/layout/shapes/RasterShape.cpp b/third_party/WebKit/Source/core/layout/shapes/RasterShape.cpp index a1c420632..a4a1cc3b 100644 --- a/third_party/WebKit/Source/core/layout/shapes/RasterShape.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/RasterShape.cpp
@@ -30,6 +30,8 @@ #include "core/layout/shapes/RasterShape.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -72,10 +74,10 @@ return IntShapeInterval(m_x1 - dx, m_x2 + dx); } -PassOwnPtr<RasterShapeIntervals> RasterShapeIntervals::computeShapeMarginIntervals(int shapeMargin) const +std::unique_ptr<RasterShapeIntervals> RasterShapeIntervals::computeShapeMarginIntervals(int shapeMargin) const { int marginIntervalsSize = (offset() > shapeMargin) ? size() : size() - offset() * 2 + shapeMargin * 2; - OwnPtr<RasterShapeIntervals> result = adoptPtr(new RasterShapeIntervals(marginIntervalsSize, std::max(shapeMargin, offset()))); + std::unique_ptr<RasterShapeIntervals> result = wrapUnique(new RasterShapeIntervals(marginIntervalsSize, std::max(shapeMargin, offset()))); MarginIntervalGenerator marginIntervalGenerator(shapeMargin); for (int y = bounds().y(); y < bounds().maxY(); ++y) {
diff --git a/third_party/WebKit/Source/core/layout/shapes/RasterShape.h b/third_party/WebKit/Source/core/layout/shapes/RasterShape.h index e9d262e3..e43e9e8 100644 --- a/third_party/WebKit/Source/core/layout/shapes/RasterShape.h +++ b/third_party/WebKit/Source/core/layout/shapes/RasterShape.h
@@ -35,6 +35,7 @@ #include "platform/geometry/FloatRect.h" #include "wtf/Assertions.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -63,7 +64,7 @@ return m_intervals[y + m_offset]; } - PassOwnPtr<RasterShapeIntervals> computeShapeMarginIntervals(int shapeMargin) const; + std::unique_ptr<RasterShapeIntervals> computeShapeMarginIntervals(int shapeMargin) const; void buildBoundsPath(Path&) const; @@ -81,7 +82,7 @@ class RasterShape final : public Shape { WTF_MAKE_NONCOPYABLE(RasterShape); public: - RasterShape(PassOwnPtr<RasterShapeIntervals> intervals, const IntSize& marginRectSize) + RasterShape(std::unique_ptr<RasterShapeIntervals> intervals, const IntSize& marginRectSize) : m_intervals(std::move(intervals)) , m_marginRectSize(marginRectSize) { @@ -101,8 +102,8 @@ private: const RasterShapeIntervals& marginIntervals() const; - OwnPtr<RasterShapeIntervals> m_intervals; - mutable OwnPtr<RasterShapeIntervals> m_marginIntervals; + std::unique_ptr<RasterShapeIntervals> m_intervals; + mutable std::unique_ptr<RasterShapeIntervals> m_marginIntervals; IntSize m_marginRectSize; };
diff --git a/third_party/WebKit/Source/core/layout/shapes/Shape.cpp b/third_party/WebKit/Source/core/layout/shapes/Shape.cpp index 76e973ce..37602c62 100644 --- a/third_party/WebKit/Source/core/layout/shapes/Shape.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/Shape.cpp
@@ -45,32 +45,33 @@ #include "platform/graphics/GraphicsTypes.h" #include "platform/graphics/ImageBuffer.h" #include "wtf/MathExtras.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/typed_arrays/ArrayBufferContents.h" +#include <memory> namespace blink { -static PassOwnPtr<Shape> createInsetShape(const FloatRoundedRect& bounds) +static std::unique_ptr<Shape> createInsetShape(const FloatRoundedRect& bounds) { ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0); - return adoptPtr(new BoxShape(bounds)); + return wrapUnique(new BoxShape(bounds)); } -static PassOwnPtr<Shape> createCircleShape(const FloatPoint& center, float radius) +static std::unique_ptr<Shape> createCircleShape(const FloatPoint& center, float radius) { ASSERT(radius >= 0); - return adoptPtr(new RectangleShape(FloatRect(center.x() - radius, center.y() - radius, radius*2, radius*2), FloatSize(radius, radius))); + return wrapUnique(new RectangleShape(FloatRect(center.x() - radius, center.y() - radius, radius*2, radius*2), FloatSize(radius, radius))); } -static PassOwnPtr<Shape> createEllipseShape(const FloatPoint& center, const FloatSize& radii) +static std::unique_ptr<Shape> createEllipseShape(const FloatPoint& center, const FloatSize& radii) { ASSERT(radii.width() >= 0 && radii.height() >= 0); - return adoptPtr(new RectangleShape(FloatRect(center.x() - radii.width(), center.y() - radii.height(), radii.width()*2, radii.height()*2), radii)); + return wrapUnique(new RectangleShape(FloatRect(center.x() - radii.width(), center.y() - radii.height(), radii.width()*2, radii.height()*2), radii)); } -static PassOwnPtr<Shape> createPolygonShape(PassOwnPtr<Vector<FloatPoint>> vertices, WindRule fillRule) +static std::unique_ptr<Shape> createPolygonShape(std::unique_ptr<Vector<FloatPoint>> vertices, WindRule fillRule) { - return adoptPtr(new PolygonShape(std::move(vertices), fillRule)); + return wrapUnique(new PolygonShape(std::move(vertices), fillRule)); } static inline FloatRect physicalRectToLogical(const FloatRect& rect, float logicalBoxHeight, WritingMode writingMode) @@ -98,14 +99,14 @@ return size.transposedSize(); } -PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, float margin) +std::unique_ptr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutSize& logicalBoxSize, WritingMode writingMode, float margin) { ASSERT(basicShape); bool horizontalWritingMode = isHorizontalWritingMode(writingMode); float boxWidth = horizontalWritingMode ? logicalBoxSize.width().toFloat() : logicalBoxSize.height().toFloat(); float boxHeight = horizontalWritingMode ? logicalBoxSize.height().toFloat() : logicalBoxSize.width().toFloat(); - OwnPtr<Shape> shape; + std::unique_ptr<Shape> shape; switch (basicShape->type()) { @@ -135,7 +136,7 @@ const Vector<Length>& values = polygon->values(); size_t valuesSize = values.size(); ASSERT(!(valuesSize % 2)); - OwnPtr<Vector<FloatPoint>> vertices = adoptPtr(new Vector<FloatPoint>(valuesSize / 2)); + std::unique_ptr<Vector<FloatPoint>> vertices = wrapUnique(new Vector<FloatPoint>(valuesSize / 2)); for (unsigned i = 0; i < valuesSize; i += 2) { FloatPoint vertex( floatValueForLength(values.at(i), boxWidth), @@ -179,22 +180,22 @@ return shape; } -PassOwnPtr<Shape> Shape::createEmptyRasterShape(WritingMode writingMode, float margin) +std::unique_ptr<Shape> Shape::createEmptyRasterShape(WritingMode writingMode, float margin) { - OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(0, 0)); - OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(std::move(intervals), IntSize())); + std::unique_ptr<RasterShapeIntervals> intervals = wrapUnique(new RasterShapeIntervals(0, 0)); + std::unique_ptr<RasterShape> rasterShape = wrapUnique(new RasterShape(std::move(intervals), IntSize())); rasterShape->m_writingMode = writingMode; rasterShape->m_margin = margin; return std::move(rasterShape); } -PassOwnPtr<Shape> Shape::createRasterShape(Image* image, float threshold, const LayoutRect& imageR, const LayoutRect& marginR, WritingMode writingMode, float margin) +std::unique_ptr<Shape> Shape::createRasterShape(Image* image, float threshold, const LayoutRect& imageR, const LayoutRect& marginR, WritingMode writingMode, float margin) { IntRect imageRect = pixelSnappedIntRect(imageR); IntRect marginRect = pixelSnappedIntRect(marginR); - OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(marginRect.height(), -marginRect.y())); - OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageRect.size()); + std::unique_ptr<RasterShapeIntervals> intervals = wrapUnique(new RasterShapeIntervals(marginRect.height(), -marginRect.y())); + std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(imageRect.size()); if (image && imageBuffer) { // FIXME: This is not totally correct but it is needed to prevent shapes @@ -234,17 +235,17 @@ } } - OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(std::move(intervals), marginRect.size())); + std::unique_ptr<RasterShape> rasterShape = wrapUnique(new RasterShape(std::move(intervals), marginRect.size())); rasterShape->m_writingMode = writingMode; rasterShape->m_margin = margin; return std::move(rasterShape); } -PassOwnPtr<Shape> Shape::createLayoutBoxShape(const FloatRoundedRect& roundedRect, WritingMode writingMode, float margin) +std::unique_ptr<Shape> Shape::createLayoutBoxShape(const FloatRoundedRect& roundedRect, WritingMode writingMode, float margin) { FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height()); FloatRoundedRect bounds(rect, roundedRect.getRadii()); - OwnPtr<Shape> shape = createInsetShape(bounds); + std::unique_ptr<Shape> shape = createInsetShape(bounds); shape->m_writingMode = writingMode; shape->m_margin = margin;
diff --git a/third_party/WebKit/Source/core/layout/shapes/Shape.h b/third_party/WebKit/Source/core/layout/shapes/Shape.h index 59002f0..f6cff72d 100644 --- a/third_party/WebKit/Source/core/layout/shapes/Shape.h +++ b/third_party/WebKit/Source/core/layout/shapes/Shape.h
@@ -36,7 +36,7 @@ #include "platform/geometry/LayoutRect.h" #include "platform/graphics/Path.h" #include "platform/text/WritingMode.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -76,10 +76,10 @@ Path shape; Path marginShape; }; - static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& logicalBoxSize, WritingMode, float margin); - static PassOwnPtr<Shape> createRasterShape(Image*, float threshold, const LayoutRect& imageRect, const LayoutRect& marginRect, WritingMode, float margin); - static PassOwnPtr<Shape> createEmptyRasterShape(WritingMode, float margin); - static PassOwnPtr<Shape> createLayoutBoxShape(const FloatRoundedRect&, WritingMode, float margin); + static std::unique_ptr<Shape> createShape(const BasicShape*, const LayoutSize& logicalBoxSize, WritingMode, float margin); + static std::unique_ptr<Shape> createRasterShape(Image*, float threshold, const LayoutRect& imageRect, const LayoutRect& marginRect, WritingMode, float margin); + static std::unique_ptr<Shape> createEmptyRasterShape(WritingMode, float margin); + static std::unique_ptr<Shape> createLayoutBoxShape(const FloatRoundedRect&, WritingMode, float margin); virtual ~Shape() { }
diff --git a/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp b/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp index 3ddffa0..6b388d21 100644 --- a/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp
@@ -36,6 +36,7 @@ #include "core/layout/LayoutImage.h" #include "platform/LengthFunctions.h" #include "public/platform/Platform.h" +#include <memory> namespace blink { @@ -119,7 +120,7 @@ return (rect.width().toFloat() * rect.height().toFloat() * 4.0) < maxImageSizeBytes; } -PassOwnPtr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const +std::unique_ptr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const { const LayoutSize& imageSize = styleImage->imageSize(m_layoutBox, m_layoutBox.style()->effectiveZoom(), m_referenceBoxLogicalSize);
diff --git a/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.h b/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.h index 56f27f27e..0dc4a70c 100644 --- a/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.h +++ b/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.h
@@ -36,7 +36,8 @@ #include "core/style/ShapeValue.h" #include "platform/geometry/FloatRect.h" #include "platform/geometry/LayoutSize.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -93,7 +94,7 @@ LayoutUnit shapeLogicalWidth() const { return computedShape().shapeMarginLogicalBoundingBox().width(); } LayoutUnit shapeLogicalHeight() const { return computedShape().shapeMarginLogicalBoundingBox().height(); } - static PassOwnPtr<ShapeOutsideInfo> createInfo(const LayoutBox& layoutBox) { return adoptPtr(new ShapeOutsideInfo(layoutBox)); } + static std::unique_ptr<ShapeOutsideInfo> createInfo(const LayoutBox& layoutBox) { return wrapUnique(new ShapeOutsideInfo(layoutBox)); } static bool isEnabledFor(const LayoutBox&); ShapeOutsideDeltas computeDeltasForContainingBlockLine(const LineLayoutBlockFlow&, const FloatingObject&, LayoutUnit lineTop, LayoutUnit lineHeight); @@ -126,12 +127,12 @@ { } private: - PassOwnPtr<Shape> createShapeForImage(StyleImage*, float shapeImageThreshold, WritingMode, float margin) const; + std::unique_ptr<Shape> createShapeForImage(StyleImage*, float shapeImageThreshold, WritingMode, float margin) const; LayoutUnit logicalTopOffset() const; LayoutUnit logicalLeftOffset() const; - typedef HashMap<const LayoutBox*, OwnPtr<ShapeOutsideInfo>> InfoMap; + typedef HashMap<const LayoutBox*, std::unique_ptr<ShapeOutsideInfo>> InfoMap; static InfoMap& infoMap() { DEFINE_STATIC_LOCAL(InfoMap, staticInfoMap, ()); @@ -139,7 +140,7 @@ } const LayoutBox& m_layoutBox; - mutable OwnPtr<Shape> m_shape; + mutable std::unique_ptr<Shape> m_shape; LayoutSize m_referenceBoxLogicalSize; ShapeOutsideDeltas m_shapeOutsideDeltas; mutable bool m_isComputingShape;
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp index 2f56243e..0c957d3f 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp
@@ -22,6 +22,9 @@ #include "core/layout/svg/LayoutSVGResourceGradient.h" +#include "wtf/PtrUtil.h" +#include <memory> + namespace blink { LayoutSVGResourceGradient::LayoutSVGResourceGradient(SVGGradientElement* node) @@ -70,9 +73,9 @@ if (gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && objectBoundingBox.isEmpty()) return SVGPaintServer::invalid(); - OwnPtr<GradientData>& gradientData = m_gradientMap.add(&object, nullptr).storedValue->value; + std::unique_ptr<GradientData>& gradientData = m_gradientMap.add(&object, nullptr).storedValue->value; if (!gradientData) - gradientData = adoptPtr(new GradientData); + gradientData = wrapUnique(new GradientData); // Create gradient object if (!gradientData->gradient) {
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.h index 5f2bffc..ccfcb20 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.h +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.h
@@ -28,6 +28,7 @@ #include "platform/graphics/Gradient.h" #include "platform/transforms/AffineTransform.h" #include "wtf/HashMap.h" +#include <memory> namespace blink { @@ -61,7 +62,7 @@ private: bool m_shouldCollectGradientAttributes : 1; - HashMap<const LayoutObject*, OwnPtr<GradientData>> m_gradientMap; + HashMap<const LayoutObject*, std::unique_ptr<GradientData>> m_gradientMap; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.cpp index c8311c0..3b9d2ebf 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.cpp
@@ -31,6 +31,8 @@ #include "platform/graphics/paint/PaintController.h" #include "platform/graphics/paint/SkPictureBuilder.h" #include "third_party/skia/include/core/SkPicture.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -75,7 +77,7 @@ return m_patternMap.set(&object, buildPatternData(object)).storedValue->value.get(); } -PassOwnPtr<PatternData> LayoutSVGResourcePattern::buildPatternData(const LayoutObject& object) +std::unique_ptr<PatternData> LayoutSVGResourcePattern::buildPatternData(const LayoutObject& object) { // If we couldn't determine the pattern content element root, stop here. const PatternAttributes& attributes = this->attributes(); @@ -107,7 +109,7 @@ tileTransform.scale(clientBoundingBox.width(), clientBoundingBox.height()); } - OwnPtr<PatternData> patternData = adoptPtr(new PatternData); + std::unique_ptr<PatternData> patternData = wrapUnique(new PatternData); patternData->pattern = Pattern::createPicturePattern(asPicture(tileBounds, tileTransform)); // Compute pattern space transformation.
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.h index e4709b16..0c18098 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.h +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.h
@@ -26,8 +26,8 @@ #include "core/svg/PatternAttributes.h" #include "platform/heap/Handle.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> class SkPicture; @@ -53,7 +53,7 @@ LayoutSVGResourceType resourceType() const override { return s_resourceType; } private: - PassOwnPtr<PatternData> buildPatternData(const LayoutObject&); + std::unique_ptr<PatternData> buildPatternData(const LayoutObject&); PassRefPtr<SkPicture> asPicture(const FloatRect& tile, const AffineTransform&) const; PatternData* patternForLayoutObject(const LayoutObject&); @@ -71,7 +71,7 @@ // should be able to cache a single display list per LayoutSVGResourcePattern + one // Pattern(shader) for each client -- this would avoid re-recording when multiple clients // share the same pattern. - HashMap<const LayoutObject*, OwnPtr<PatternData>> m_patternMap; + HashMap<const LayoutObject*, std::unique_ptr<PatternData>> m_patternMap; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp index a049d043..32f65ee 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
@@ -41,6 +41,7 @@ #include "platform/geometry/FloatPoint.h" #include "platform/graphics/StrokeData.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -59,7 +60,7 @@ void LayoutSVGShape::createPath() { if (!m_path) - m_path = adoptPtr(new Path()); + m_path = wrapUnique(new Path()); *m_path = toSVGGeometryElement(element())->asPath(); if (m_rareData.get()) m_rareData->m_cachedNonScalingStrokePath.clear(); @@ -301,7 +302,7 @@ LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const { if (!m_rareData) - m_rareData = adoptPtr(new LayoutSVGShapeRareData()); + m_rareData = wrapUnique(new LayoutSVGShapeRareData()); return *m_rareData.get(); }
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h index 2e4899c1..a7b3fde9 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h
@@ -30,8 +30,8 @@ #include "core/layout/svg/SVGMarkerData.h" #include "platform/geometry/FloatRect.h" #include "platform/transforms/AffineTransform.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -131,8 +131,8 @@ // TODO(fmalita): the Path is now cached in SVGPath; while this additional cache is just a // shallow copy, it certainly has a complexity/state management cost (plus allocation & storage // overhead) - so we should look into removing it. - OwnPtr<Path> m_path; - mutable OwnPtr<LayoutSVGShapeRareData> m_rareData; + std::unique_ptr<Path> m_path; + mutable std::unique_ptr<LayoutSVGShapeRareData> m_rareData; bool m_needsBoundariesUpdate : 1; bool m_needsShapeUpdate : 1;
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp index 261e9c4..d3222d48 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp
@@ -23,6 +23,7 @@ #include "core/svg/SVGPathElement.h" #include "core/svg/SVGTextPathElement.h" #include "platform/graphics/Path.h" +#include <memory> namespace blink { @@ -64,7 +65,7 @@ return child->isSVGInline() && !child->isSVGTextPath(); } -PassOwnPtr<PathPositionMapper> LayoutSVGTextPath::layoutPath() const +std::unique_ptr<PathPositionMapper> LayoutSVGTextPath::layoutPath() const { const SVGTextPathElement& textPathElement = toSVGTextPathElement(*node()); Element* targetElement = SVGURIReference::targetElementFromIRIString(
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.h index 1fd09f0..897583b 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.h +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.h
@@ -22,6 +22,8 @@ #define LayoutSVGTextPath_h #include "core/layout/svg/LayoutSVGInline.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -31,9 +33,9 @@ class PathPositionMapper { USING_FAST_MALLOC(PathPositionMapper); public: - static PassOwnPtr<PathPositionMapper> create(const Path& path) + static std::unique_ptr<PathPositionMapper> create(const Path& path) { - return adoptPtr(new PathPositionMapper(path)); + return wrapUnique(new PathPositionMapper(path)); } enum PositionType { @@ -55,7 +57,7 @@ public: explicit LayoutSVGTextPath(Element*); - PassOwnPtr<PathPositionMapper> layoutPath() const; + std::unique_ptr<PathPositionMapper> layoutPath() const; float calculateStartOffset(float) const; bool isChildAllowed(LayoutObject*, const ComputedStyle&) const override;
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp b/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp index fe15b73..3f90215 100644 --- a/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp +++ b/third_party/WebKit/Source/core/layout/svg/SVGResources.cpp
@@ -30,6 +30,8 @@ #include "core/svg/SVGGradientElement.h" #include "core/svg/SVGPatternElement.h" #include "core/svg/SVGURIReference.h" +#include "wtf/PtrUtil.h" +#include <memory> #ifndef NDEBUG #include <stdio.h> @@ -195,15 +197,15 @@ || m_linkedResource; } -static inline SVGResources& ensureResources(OwnPtr<SVGResources>& resources) +static inline SVGResources& ensureResources(std::unique_ptr<SVGResources>& resources) { if (!resources) - resources = adoptPtr(new SVGResources); + resources = wrapUnique(new SVGResources); return *resources.get(); } -PassOwnPtr<SVGResources> SVGResources::buildResources(const LayoutObject* object, const SVGComputedStyle& style) +std::unique_ptr<SVGResources> SVGResources::buildResources(const LayoutObject* object, const SVGComputedStyle& style) { ASSERT(object); @@ -220,7 +222,7 @@ TreeScope& treeScope = element->treeScope(); SVGDocumentExtensions& extensions = element->document().accessSVGExtensions(); - OwnPtr<SVGResources> resources; + std::unique_ptr<SVGResources> resources; if (clipperFilterMaskerTags().contains(tagName)) { if (style.hasClipper()) { AtomicString id = style.clipperResource();
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResources.h b/third_party/WebKit/Source/core/layout/svg/SVGResources.h index d3b806e..03842305 100644 --- a/third_party/WebKit/Source/core/layout/svg/SVGResources.h +++ b/third_party/WebKit/Source/core/layout/svg/SVGResources.h
@@ -23,8 +23,8 @@ #include "wtf/Allocator.h" #include "wtf/HashSet.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -44,7 +44,7 @@ public: SVGResources(); - static PassOwnPtr<SVGResources> buildResources(const LayoutObject*, const SVGComputedStyle&); + static std::unique_ptr<SVGResources> buildResources(const LayoutObject*, const SVGComputedStyle&); void layoutIfNeeded(); static bool supportsMarkers(const SVGElement&); @@ -121,9 +121,9 @@ { } - static PassOwnPtr<ClipperFilterMaskerData> create() + static std::unique_ptr<ClipperFilterMaskerData> create() { - return adoptPtr(new ClipperFilterMaskerData); + return wrapUnique(new ClipperFilterMaskerData); } LayoutSVGResourceClipper* clipper; @@ -143,9 +143,9 @@ { } - static PassOwnPtr<MarkerData> create() + static std::unique_ptr<MarkerData> create() { - return adoptPtr(new MarkerData); + return wrapUnique(new MarkerData); } LayoutSVGResourceMarker* markerStart; @@ -166,18 +166,18 @@ { } - static PassOwnPtr<FillStrokeData> create() + static std::unique_ptr<FillStrokeData> create() { - return adoptPtr(new FillStrokeData); + return wrapUnique(new FillStrokeData); } LayoutSVGResourcePaintServer* fill; LayoutSVGResourcePaintServer* stroke; }; - OwnPtr<ClipperFilterMaskerData> m_clipperFilterMaskerData; - OwnPtr<MarkerData> m_markerData; - OwnPtr<FillStrokeData> m_fillStrokeData; + std::unique_ptr<ClipperFilterMaskerData> m_clipperFilterMaskerData; + std::unique_ptr<MarkerData> m_markerData; + std::unique_ptr<FillStrokeData> m_fillStrokeData; LayoutSVGResourceContainer* m_linkedResource; };
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp b/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp index 1e120bf..c222134 100644 --- a/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp +++ b/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.cpp
@@ -24,6 +24,7 @@ #include "core/layout/svg/SVGResources.h" #include "core/layout/svg/SVGResourcesCycleSolver.h" #include "core/svg/SVGDocumentExtensions.h" +#include <memory> namespace blink { @@ -43,7 +44,7 @@ const SVGComputedStyle& svgStyle = style.svgStyle(); // Build a list of all resources associated with the passed LayoutObject. - OwnPtr<SVGResources> newResources = SVGResources::buildResources(object, svgStyle); + std::unique_ptr<SVGResources> newResources = SVGResources::buildResources(object, svgStyle); if (!newResources) return; @@ -64,7 +65,7 @@ void SVGResourcesCache::removeResourcesFromLayoutObject(LayoutObject* object) { - OwnPtr<SVGResources> resources = m_cache.take(object); + std::unique_ptr<SVGResources> resources = m_cache.take(object); if (!resources) return;
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.h b/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.h index 433a95e..db57752 100644 --- a/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.h +++ b/third_party/WebKit/Source/core/layout/svg/SVGResourcesCache.h
@@ -24,7 +24,7 @@ #include "wtf/Allocator.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -60,7 +60,7 @@ void addResourcesFromLayoutObject(LayoutObject*, const ComputedStyle&); void removeResourcesFromLayoutObject(LayoutObject*); - typedef HashMap<const LayoutObject*, OwnPtr<SVGResources>> CacheMap; + typedef HashMap<const LayoutObject*, std::unique_ptr<SVGResources>> CacheMap; CacheMap m_cache; };
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.h b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.h index 5e61b74..5e2de72 100644 --- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.h +++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.h
@@ -25,6 +25,7 @@ #include "core/layout/svg/SVGTextFragment.h" #include "wtf/Allocator.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -88,7 +89,7 @@ bool m_textLengthSpacingInEffect; // Text on path layout - OwnPtr<PathPositionMapper> m_textPath; + std::unique_ptr<PathPositionMapper> m_textPath; float m_textPathStartOffset; float m_textPathCurrentOffset; float m_textPathDisplacement;
diff --git a/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.cpp b/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.cpp index 0b8713a..9006fa5 100644 --- a/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.cpp +++ b/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.cpp
@@ -31,6 +31,7 @@ #include "platform/network/ResourceResponse.h" #include "wtf/CurrentTime.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { @@ -151,7 +152,7 @@ return cache; } -void CrossOriginPreflightResultCache::appendEntry(const String& origin, const KURL& url, PassOwnPtr<CrossOriginPreflightResultCacheItem> preflightResult) +void CrossOriginPreflightResultCache::appendEntry(const String& origin, const KURL& url, std::unique_ptr<CrossOriginPreflightResultCacheItem> preflightResult) { ASSERT(isMainThread()); m_preflightHashMap.set(std::make_pair(origin, url), std::move(preflightResult));
diff --git a/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h b/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h index b5cb30a..7f8c2d7 100644 --- a/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h +++ b/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h
@@ -31,8 +31,8 @@ #include "platform/weborigin/KURLHash.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/StringHash.h" +#include <memory> namespace blink { @@ -70,13 +70,13 @@ public: static CrossOriginPreflightResultCache& shared(); - void appendEntry(const String& origin, const KURL&, PassOwnPtr<CrossOriginPreflightResultCacheItem>); + void appendEntry(const String& origin, const KURL&, std::unique_ptr<CrossOriginPreflightResultCacheItem>); bool canSkipPreflight(const String& origin, const KURL&, StoredCredentials, const String& method, const HTTPHeaderMap& requestHeaders); private: CrossOriginPreflightResultCache() { } - typedef HashMap<std::pair<String, KURL>, OwnPtr<CrossOriginPreflightResultCacheItem>> CrossOriginPreflightResultHashMap; + typedef HashMap<std::pair<String, KURL>, std::unique_ptr<CrossOriginPreflightResultCacheItem>> CrossOriginPreflightResultHashMap; CrossOriginPreflightResultHashMap m_preflightHashMap; };
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp b/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp index d775ffb..b8db10de 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp
@@ -7,6 +7,7 @@ #include "core/loader/DocumentLoader.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -15,7 +16,7 @@ TEST_F(DocumentLoadTimingTest, ensureValidNavigationStartAfterEmbedder) { - OwnPtr<DummyPageHolder> dummyPage = DummyPageHolder::create(); + std::unique_ptr<DummyPageHolder> dummyPage = DummyPageHolder::create(); DocumentLoadTiming timing(*(dummyPage->document().loader())); double delta = -1000; @@ -30,7 +31,7 @@ TEST_F(DocumentLoadTimingTest, correctTimingDeltas) { - OwnPtr<DummyPageHolder> dummyPage = DummyPageHolder::create(); + std::unique_ptr<DummyPageHolder> dummyPage = DummyPageHolder::create(); DocumentLoadTiming timing(*(dummyPage->document().loader())); double navigationStartDelta = -456;
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp index 8f11b8e5..10b44fc 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -75,6 +75,7 @@ #include "wtf/Assertions.h" #include "wtf/TemporaryChange.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -165,7 +166,7 @@ return m_request.url(); } -void DocumentLoader::setSubresourceFilter(PassOwnPtr<WebDocumentSubresourceFilter> subresourceFilter) +void DocumentLoader::setSubresourceFilter(std::unique_ptr<WebDocumentSubresourceFilter> subresourceFilter) { m_subresourceFilter = std::move(subresourceFilter); } @@ -370,7 +371,7 @@ return; } -void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(resource, m_mainResource == resource); ASSERT_UNUSED(handle, !handle);
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.h b/third_party/WebKit/Source/core/loader/DocumentLoader.h index acdd1ef..9bf58f7f 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoader.h +++ b/third_party/WebKit/Source/core/loader/DocumentLoader.h
@@ -49,6 +49,7 @@ #include "public/platform/WebLoadingBehaviorFlag.h" #include "wtf/HashSet.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -84,7 +85,7 @@ ResourceFetcher* fetcher() const { return m_fetcher.get(); } - void setSubresourceFilter(PassOwnPtr<WebDocumentSubresourceFilter>); + void setSubresourceFilter(std::unique_ptr<WebDocumentSubresourceFilter>); WebDocumentSubresourceFilter* subresourceFilter() const { return m_subresourceFilter.get(); } const SubstituteData& substituteData() const { return m_substituteData; } @@ -170,7 +171,7 @@ void finishedLoading(double finishTime); void cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse&); void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) final; - void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) final; + void responseReceived(Resource*, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) final; void dataReceived(Resource*, const char* data, size_t length) final; void processData(const char* data, size_t length); void notifyFinished(Resource*) final; @@ -184,7 +185,7 @@ Member<LocalFrame> m_frame; Member<ResourceFetcher> m_fetcher; - OwnPtr<WebDocumentSubresourceFilter> m_subresourceFilter; + std::unique_ptr<WebDocumentSubresourceFilter> m_subresourceFilter; Member<RawResource> m_mainResource;
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp index bce49a4..3ccae82 100644 --- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -55,6 +55,8 @@ #include "public/platform/Platform.h" #include "public/platform/WebURLRequest.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -124,13 +126,13 @@ void DocumentThreadableLoader::loadResourceSynchronously(Document& document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) { // The loader will be deleted as soon as this function exits. - OwnPtr<DocumentThreadableLoader> loader = adoptPtr(new DocumentThreadableLoader(document, &client, LoadSynchronously, options, resourceLoaderOptions)); + std::unique_ptr<DocumentThreadableLoader> loader = wrapUnique(new DocumentThreadableLoader(document, &client, LoadSynchronously, options, resourceLoaderOptions)); loader->start(request); } -PassOwnPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document& document, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) +std::unique_ptr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document& document, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) { - return adoptPtr(new DocumentThreadableLoader(document, client, LoadAsynchronously, options, resourceLoaderOptions)); + return wrapUnique(new DocumentThreadableLoader(document, client, LoadAsynchronously, options, resourceLoaderOptions)); } DocumentThreadableLoader::DocumentThreadableLoader(Document& document, ThreadableLoaderClient* client, BlockingBehavior blockingBehavior, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) @@ -451,7 +453,7 @@ // TODO(horo): If we support any API which expose the internal body, we // will have to read the body. And also HTTPCache changes will be needed // because it doesn't store the body of redirect responses. - responseReceived(resource, redirectResponse, adoptPtr(new EmptyDataHandle())); + responseReceived(resource, redirectResponse, wrapUnique(new EmptyDataHandle())); if (!self) { request = ResourceRequest(); @@ -596,7 +598,7 @@ // |this| may be dead here. } -void DocumentThreadableLoader::responseReceived(Resource* resource, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void DocumentThreadableLoader::responseReceived(Resource* resource, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(resource, resource == this->resource()); ASSERT(m_async); @@ -630,7 +632,7 @@ return; } - OwnPtr<CrossOriginPreflightResultCacheItem> preflightResult = adoptPtr(new CrossOriginPreflightResultCacheItem(effectiveAllowCredentials())); + std::unique_ptr<CrossOriginPreflightResultCacheItem> preflightResult = wrapUnique(new CrossOriginPreflightResultCacheItem(effectiveAllowCredentials())); if (!preflightResult->parse(response, accessControlErrorDescription) || !preflightResult->allowsCrossOriginMethod(m_actualRequest.httpMethod(), accessControlErrorDescription) || !preflightResult->allowsCrossOriginHeaders(m_actualRequest.httpHeaderFields(), accessControlErrorDescription)) { @@ -656,7 +658,7 @@ frame->console().reportResourceResponseReceived(loader, identifier, response); } -void DocumentThreadableLoader::handleResponse(unsigned long identifier, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void DocumentThreadableLoader::handleResponse(unsigned long identifier, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { ASSERT(m_client);
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h index e0eda8e..9729960 100644 --- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h +++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h
@@ -41,10 +41,9 @@ #include "platform/network/HTTPHeaderMap.h" #include "platform/network/ResourceError.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/WeakPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -58,7 +57,7 @@ USING_FAST_MALLOC(DocumentThreadableLoader); public: static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); - static PassOwnPtr<DocumentThreadableLoader> create(Document&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); + static std::unique_ptr<DocumentThreadableLoader> create(Document&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); ~DocumentThreadableLoader() override; void start(const ResourceRequest&) override; @@ -90,7 +89,7 @@ // // |this| may be dead after calling these methods. void dataSent(Resource*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; - void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; + void responseReceived(Resource*, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; void setSerializedCachedMetadata(Resource*, const char*, size_t) override; void dataReceived(Resource*, const char* data, size_t dataLength) override; void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) override; @@ -109,7 +108,7 @@ // common to both sync and async mode. // // |this| may be dead after calling these method in async mode. - void handleResponse(unsigned long identifier, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>); + void handleResponse(unsigned long identifier, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>); void handleReceivedData(const char* data, size_t dataLength); void handleSuccessfulFinish(unsigned long identifier, double finishTime);
diff --git a/third_party/WebKit/Source/core/loader/DocumentWriter.cpp b/third_party/WebKit/Source/core/loader/DocumentWriter.cpp index 5cfca6d3..7d1ae825 100644 --- a/third_party/WebKit/Source/core/loader/DocumentWriter.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentWriter.cpp
@@ -39,7 +39,7 @@ #include "core/loader/FrameLoaderStateMachine.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -86,7 +86,7 @@ { ASSERT(m_parser); if (m_parser->needsDecoder() && 0 < length) { - OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_document); + std::unique_ptr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_document); m_parser->setDecoder(std::move(decoder)); } // appendBytes() can result replacing DocumentLoader::m_writer. @@ -101,7 +101,7 @@ return; if (m_parser->needsDecoder()) { - OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_document); + std::unique_ptr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_document); m_parser->setDecoder(std::move(decoder)); }
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.cpp b/third_party/WebKit/Source/core/loader/EmptyClients.cpp index 51f7127..3a74c62 100644 --- a/third_party/WebKit/Source/core/loader/EmptyClients.cpp +++ b/third_party/WebKit/Source/core/loader/EmptyClients.cpp
@@ -40,6 +40,8 @@ #include "public/platform/modules/mediasession/WebMediaSession.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -111,9 +113,9 @@ return String(); } -PassOwnPtr<WebFrameScheduler> EmptyChromeClient::createFrameScheduler(BlameContext*) +std::unique_ptr<WebFrameScheduler> EmptyChromeClient::createFrameScheduler(BlameContext*) { - return adoptPtr(new EmptyFrameScheduler()); + return wrapUnique(new EmptyFrameScheduler()); } NavigationPolicy EmptyFrameLoaderClient::decidePolicyForNavigation(const ResourceRequest&, DocumentLoader*, NavigationType, NavigationPolicy, bool, bool) @@ -149,12 +151,12 @@ return nullptr; } -PassOwnPtr<WebMediaPlayer> EmptyFrameLoaderClient::createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) +std::unique_ptr<WebMediaPlayer> EmptyFrameLoaderClient::createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) { return nullptr; } -PassOwnPtr<WebMediaSession> EmptyFrameLoaderClient::createWebMediaSession() +std::unique_ptr<WebMediaSession> EmptyFrameLoaderClient::createWebMediaSession() { return nullptr; } @@ -163,12 +165,12 @@ { } -PassOwnPtr<WebServiceWorkerProvider> EmptyFrameLoaderClient::createServiceWorkerProvider() +std::unique_ptr<WebServiceWorkerProvider> EmptyFrameLoaderClient::createServiceWorkerProvider() { return nullptr; } -PassOwnPtr<WebApplicationCacheHost> EmptyFrameLoaderClient::createApplicationCacheHost(WebApplicationCacheHostClient*) +std::unique_ptr<WebApplicationCacheHost> EmptyFrameLoaderClient::createApplicationCacheHost(WebApplicationCacheHostClient*) { return nullptr; }
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.h b/third_party/WebKit/Source/core/loader/EmptyClients.h index 97882afb..72b4525 100644 --- a/third_party/WebKit/Source/core/loader/EmptyClients.h +++ b/third_party/WebKit/Source/core/loader/EmptyClients.h
@@ -48,6 +48,7 @@ #include "public/platform/WebFrameScheduler.h" #include "public/platform/WebScreenInfo.h" #include "wtf/Forward.h" +#include <memory> #include <v8.h> /* @@ -176,7 +177,7 @@ void registerPopupOpeningObserver(PopupOpeningObserver*) override {} void unregisterPopupOpeningObserver(PopupOpeningObserver*) override {} - PassOwnPtr<WebFrameScheduler> createFrameScheduler(BlameContext*) override; + std::unique_ptr<WebFrameScheduler> createFrameScheduler(BlameContext*) override; }; class CORE_EXPORT EmptyFrameLoaderClient : public FrameLoaderClient { @@ -251,8 +252,8 @@ LocalFrame* createFrame(const FrameLoadRequest&, const AtomicString&, HTMLFrameOwnerElement*) override; Widget* createPlugin(HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool, DetachedPluginPolicy) override; bool canCreatePluginWithoutRenderer(const String& mimeType) const override { return false; } - PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override; - PassOwnPtr<WebMediaSession> createWebMediaSession() override; + std::unique_ptr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override; + std::unique_ptr<WebMediaSession> createWebMediaSession() override; ObjectContentType getObjectContentType(const KURL&, const String&, bool) override { return ObjectContentType(); } @@ -268,10 +269,10 @@ WebCookieJar* cookieJar() const override { return 0; } - PassOwnPtr<WebServiceWorkerProvider> createServiceWorkerProvider() override; + std::unique_ptr<WebServiceWorkerProvider> createServiceWorkerProvider() override; bool isControlledByServiceWorker(DocumentLoader&) override { return false; } int64_t serviceWorkerID(DocumentLoader&) override { return -1; } - PassOwnPtr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) override; + std::unique_ptr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) override; protected: EmptyFrameLoaderClient() {}
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp index f09d2ece..9166180 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -73,8 +73,8 @@ #include "public/platform/WebDocumentSubresourceFilter.h" #include "public/platform/WebFrameScheduler.h" #include "public/platform/WebInsecureRequestPolicy.h" - #include <algorithm> +#include <memory> namespace blink { @@ -397,11 +397,11 @@ return m_documentLoader == frame()->loader().documentLoader(); } -static PassOwnPtr<TracedValue> loadResourceTraceData(unsigned long identifier, const KURL& url, int priority) +static std::unique_ptr<TracedValue> loadResourceTraceData(unsigned long identifier, const KURL& url, int priority) { String requestId = IdentifiersFactory::requestId(identifier); - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("requestId", requestId); value->setString("url", url.getString()); value->setInteger("priority", priority);
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.h b/third_party/WebKit/Source/core/loader/FrameFetchContext.h index 3f7ed4b..e04fd81 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.h +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.h
@@ -37,7 +37,6 @@ #include "core/frame/csp/ContentSecurityPolicy.h" #include "platform/heap/Handle.h" #include "platform/network/ResourceRequest.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp index e8ee435..8e8aa81b 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
@@ -48,6 +48,7 @@ #include "public/platform/WebInsecureRequestPolicy.h" #include "testing/gmock/include/gmock/gmock-generated-function-mockers.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -122,7 +123,7 @@ return childFetchContext; } - OwnPtr<DummyPageHolder> dummyPageHolder; + std::unique_ptr<DummyPageHolder> dummyPageHolder; // We don't use the DocumentLoader directly in any tests, but need to keep it around as long // as the ResourceFetcher and Document live due to indirect usage. Persistent<DocumentLoader> documentLoader;
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp index 4f8c4d0a..8be7514c 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp +++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -99,6 +99,7 @@ #include "wtf/TemporaryChange.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" +#include <memory> using blink::WebURLRequest; @@ -1597,9 +1598,9 @@ return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade(); } -PassOwnPtr<TracedValue> FrameLoader::toTracedValue() const +std::unique_ptr<TracedValue> FrameLoader::toTracedValue() const { - OwnPtr<TracedValue> tracedValue = TracedValue::create(); + std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); tracedValue->beginDictionary("frame"); tracedValue->setString("id_ref", String::format("0x%" PRIx64, static_cast<uint64_t>(reinterpret_cast<uintptr_t>(m_frame.get())))); tracedValue->endDictionary();
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.h b/third_party/WebKit/Source/core/loader/FrameLoader.h index 7334fb6..127d12b 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.h +++ b/third_party/WebKit/Source/core/loader/FrameLoader.h
@@ -49,6 +49,7 @@ #include "public/platform/WebInsecureRequestPolicy.h" #include "wtf/Forward.h" #include "wtf/HashSet.h" +#include <memory> namespace blink { @@ -221,12 +222,12 @@ void detachDocumentLoader(Member<DocumentLoader>&); - PassOwnPtr<TracedValue> toTracedValue() const; + std::unique_ptr<TracedValue> toTracedValue() const; void takeObjectSnapshot() const; Member<LocalFrame> m_frame; - // FIXME: These should be OwnPtr<T> to reduce build times and simplify + // FIXME: These should be std::unique_ptr<T> to reduce build times and simplify // header dependencies unless performance testing proves otherwise. // Some of these could be lazily created for memory savings on devices. mutable FrameLoaderStateMachine m_stateMachine;
diff --git a/third_party/WebKit/Source/core/loader/FrameLoaderClient.h b/third_party/WebKit/Source/core/loader/FrameLoaderClient.h index 4135098..d16e979 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoaderClient.h +++ b/third_party/WebKit/Source/core/loader/FrameLoaderClient.h
@@ -48,6 +48,7 @@ #include "public/platform/WebLoadingBehaviorFlag.h" #include "wtf/Forward.h" #include "wtf/Vector.h" +#include <memory> #include <v8.h> namespace blink { @@ -174,9 +175,9 @@ virtual bool canCreatePluginWithoutRenderer(const String& mimeType) const = 0; virtual Widget* createPlugin(HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually, DetachedPluginPolicy) = 0; - virtual PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) = 0; + virtual std::unique_ptr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) = 0; - virtual PassOwnPtr<WebMediaSession> createWebMediaSession() = 0; + virtual std::unique_ptr<WebMediaSession> createWebMediaSession() = 0; virtual ObjectContentType getObjectContentType(const KURL&, const String& mimeType, bool shouldPreferPlugInsForImages) = 0; @@ -243,7 +244,7 @@ virtual void dispatchDidChangeResourcePriority(unsigned long identifier, ResourceLoadPriority, int intraPriorityValue) { } - virtual PassOwnPtr<WebServiceWorkerProvider> createServiceWorkerProvider() = 0; + virtual std::unique_ptr<WebServiceWorkerProvider> createServiceWorkerProvider() = 0; virtual bool isControlledByServiceWorker(DocumentLoader&) = 0; @@ -251,7 +252,7 @@ virtual SharedWorkerRepositoryClient* sharedWorkerRepositoryClient() { return 0; } - virtual PassOwnPtr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; + virtual std::unique_ptr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; virtual void dispatchDidChangeManifest() { }
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.cpp b/third_party/WebKit/Source/core/loader/ImageLoader.cpp index 66d5f545..4f38a21 100644 --- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp +++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
@@ -51,6 +51,7 @@ #include "public/platform/WebCachePolicy.h" #include "public/platform/WebURLRequest.h" #include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -262,7 +263,7 @@ // m_pendingTask to null). m_pendingTask.clear(); // Make sure to only decrement the count when we exit this function - OwnPtr<IncrementLoadEventDelayCount> loadDelayCounter; + std::unique_ptr<IncrementLoadEventDelayCount> loadDelayCounter; loadDelayCounter.swap(m_loadDelayCounter); Document& document = m_element->document();
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.h b/third_party/WebKit/Source/core/loader/ImageLoader.h index b7fa112..5ac085d 100644 --- a/third_party/WebKit/Source/core/loader/ImageLoader.h +++ b/third_party/WebKit/Source/core/loader/ImageLoader.h
@@ -31,6 +31,7 @@ #include "wtf/HashSet.h" #include "wtf/WeakPtr.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -158,7 +159,7 @@ Timer<ImageLoader> m_derefElementTimer; AtomicString m_failedLoadURL; WeakPtr<Task> m_pendingTask; // owned by Microtask - OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounter; + std::unique_ptr<IncrementLoadEventDelayCount> m_loadDelayCounter; bool m_hasPendingLoadEvent : 1; bool m_hasPendingErrorEvent : 1; bool m_imageComplete : 1;
diff --git a/third_party/WebKit/Source/core/loader/LinkLoader.h b/third_party/WebKit/Source/core/loader/LinkLoader.h index 0e0004a..a9f0b1dd 100644 --- a/third_party/WebKit/Source/core/loader/LinkLoader.h +++ b/third_party/WebKit/Source/core/loader/LinkLoader.h
@@ -41,7 +41,6 @@ #include "platform/PrerenderClient.h" #include "platform/Timer.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp index e43d2e1c..6a6913a 100644 --- a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp +++ b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
@@ -18,6 +18,7 @@ #include "public/platform/WebURLLoaderMockFactory.h" #include "testing/gtest/include/gtest/gtest.h" #include <base/macros.h> +#include <memory> namespace blink { @@ -135,7 +136,7 @@ // Test the cases with a single header for (const auto& testCase : cases) { - OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); + std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); dummyPageHolder->frame().settings()->setScriptEnabled(true); Persistent<MockLinkLoaderClient> loaderClient = MockLinkLoaderClient::create(testCase.linkLoaderShouldLoadValue); LinkLoader* loader = LinkLoader::create(loaderClient.get()); @@ -191,7 +192,7 @@ // Test the cases with a single header for (const auto& testCase : cases) { - OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); + std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); dummyPageHolder->document().settings()->setDNSPrefetchingEnabled(true); Persistent<MockLinkLoaderClient> loaderClient = MockLinkLoaderClient::create(testCase.shouldLoad); LinkLoader* loader = LinkLoader::create(loaderClient.get()); @@ -227,7 +228,7 @@ // Test the cases with a single header for (const auto& testCase : cases) { - OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); + std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); Persistent<MockLinkLoaderClient> loaderClient = MockLinkLoaderClient::create(testCase.shouldLoad); LinkLoader* loader = LinkLoader::create(loaderClient.get()); KURL hrefURL = KURL(KURL(ParsedURLStringTag(), String("http://example.com")), testCase.href);
diff --git a/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp b/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp index f6b321589..5d59282 100644 --- a/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp +++ b/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp
@@ -14,6 +14,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/RefPtr.h" #include <base/macros.h> +#include <memory> namespace blink { @@ -48,7 +49,7 @@ TEST(MixedContentCheckerTest, ContextTypeForInspector) { - OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(1, 1)); + std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(1, 1)); dummyPageHolder->frame().document()->setSecurityOrigin(SecurityOrigin::createFromString("http://example.test")); ResourceRequest notMixedContent("https://example.test/foo.jpg"); @@ -87,7 +88,7 @@ TEST(MixedContentCheckerTest, HandleCertificateError) { MockFrameLoaderClient* client = new MockFrameLoaderClient; - OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(1, 1), nullptr, client); + std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(1, 1), nullptr, client); KURL mainResourceUrl(KURL(), "https://example.test"); KURL displayedUrl(KURL(), "https://example-displayed.test");
diff --git a/third_party/WebKit/Source/core/loader/MockThreadableLoader.h b/third_party/WebKit/Source/core/loader/MockThreadableLoader.h index dd05e484..4769196 100644 --- a/third_party/WebKit/Source/core/loader/MockThreadableLoader.h +++ b/third_party/WebKit/Source/core/loader/MockThreadableLoader.h
@@ -7,13 +7,14 @@ #include "core/loader/ThreadableLoader.h" #include "testing/gmock/include/gmock/gmock.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { class MockThreadableLoader : public ThreadableLoader { public: - static PassOwnPtr<MockThreadableLoader> create() { return adoptPtr(new testing::StrictMock<MockThreadableLoader>); } + static std::unique_ptr<MockThreadableLoader> create() { return wrapUnique(new testing::StrictMock<MockThreadableLoader>); } MOCK_METHOD1(start, void(const ResourceRequest&)); MOCK_METHOD1(overrideTimeout, void(unsigned long));
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp index bbb1429..f687976 100644 --- a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp +++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
@@ -55,6 +55,8 @@ #include "public/platform/WebCachePolicy.h" #include "public/platform/WebScheduler.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -120,11 +122,11 @@ Document* originDocument() const { return m_originDocument.get(); } bool replacesCurrentItem() const { return m_replacesCurrentItem; } bool isLocationChange() const { return m_isLocationChange; } - PassOwnPtr<UserGestureIndicator> createUserGestureIndicator() + std::unique_ptr<UserGestureIndicator> createUserGestureIndicator() { if (m_wasUserGesture && m_userGestureToken) - return adoptPtr(new UserGestureIndicator(m_userGestureToken)); - return adoptPtr(new UserGestureIndicator(DefinitelyNotProcessingUserGesture)); + return wrapUnique(new UserGestureIndicator(m_userGestureToken)); + return wrapUnique(new UserGestureIndicator(DefinitelyNotProcessingUserGesture)); } DEFINE_INLINE_VIRTUAL_TRACE() @@ -157,7 +159,7 @@ void fire(LocalFrame* frame) override { - OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); + std::unique_ptr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); FrameLoadRequest request(originDocument(), m_url, "_self", m_shouldCheckMainWorldContentSecurityPolicy); request.setReplacesCurrentItem(replacesCurrentItem()); request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); @@ -185,7 +187,7 @@ void fire(LocalFrame* frame) override { - OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); + std::unique_ptr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); FrameLoadRequest request(originDocument(), url(), "_self"); request.setReplacesCurrentItem(replacesCurrentItem()); if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.resourceRequest().url())) @@ -224,7 +226,7 @@ void fire(LocalFrame* frame) override { - OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); + std::unique_ptr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); ResourceRequest resourceRequest = frame->loader().resourceRequestForReload(FrameLoadTypeReload, KURL(), ClientRedirectPolicy::ClientRedirect); if (resourceRequest.isNull()) return; @@ -250,7 +252,7 @@ void fire(LocalFrame* frame) override { - OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); + std::unique_ptr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); SubstituteData substituteData(SharedBuffer::create(), "text/plain", "UTF-8", KURL(), ForceSynchronousLoad); FrameLoadRequest request(originDocument(), url(), substituteData); request.setReplacesCurrentItem(true); @@ -275,7 +277,7 @@ void fire(LocalFrame* frame) override { - OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); + std::unique_ptr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator(); FrameLoadRequest frameRequest = m_submission->createFrameLoadRequest(originDocument()); frameRequest.setReplacesCurrentItem(replacesCurrentItem()); maybeLogScheduledNavigationClobber(ScheduledNavigationType::ScheduledFormSubmission, frame, frameRequest, gestureIndicator.get());
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.h b/third_party/WebKit/Source/core/loader/NavigationScheduler.h index bdb9a25d..cc8f867 100644 --- a/third_party/WebKit/Source/core/loader/NavigationScheduler.h +++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.h
@@ -37,10 +37,9 @@ #include "wtf/Forward.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -86,7 +85,7 @@ static bool mustReplaceCurrentItem(LocalFrame* targetFrame); Member<LocalFrame> m_frame; - OwnPtr<CancellableTaskFactory> m_navigateTaskFactory; + std::unique_ptr<CancellableTaskFactory> m_navigateTaskFactory; Member<ScheduledNavigation> m_redirect; WebScheduler::NavigatingFrameType m_frameType; // Exists because we can't deref m_frame in destructor. };
diff --git a/third_party/WebKit/Source/core/loader/PingLoader.cpp b/third_party/WebKit/Source/core/loader/PingLoader.cpp index 9a5050cb3..83ae268e 100644 --- a/third_party/WebKit/Source/core/loader/PingLoader.cpp +++ b/third_party/WebKit/Source/core/loader/PingLoader.cpp
@@ -54,7 +54,7 @@ #include "public/platform/WebURLLoader.h" #include "public/platform/WebURLRequest.h" #include "public/platform/WebURLResponse.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -141,7 +141,7 @@ frame->document()->fetcher()->context().willStartLoadingResource(m_identifier, request, Resource::Image); frame->document()->fetcher()->context().dispatchWillSendRequest(m_identifier, request, ResourceResponse(), initiatorInfo); - m_loader = adoptPtr(Platform::current()->createURLLoader()); + m_loader = wrapUnique(Platform::current()->createURLLoader()); ASSERT(m_loader); WrappedResourceRequest wrappedRequest(request); wrappedRequest.setAllowStoredCredentials(credentialsAllowed == AllowStoredCredentials);
diff --git a/third_party/WebKit/Source/core/loader/PingLoader.h b/third_party/WebKit/Source/core/loader/PingLoader.h index cd6ba0a..58b1806 100644 --- a/third_party/WebKit/Source/core/loader/PingLoader.h +++ b/third_party/WebKit/Source/core/loader/PingLoader.h
@@ -41,6 +41,7 @@ #include "public/platform/WebURLLoaderClient.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -95,7 +96,7 @@ void didFailLoading(LocalFrame*); - OwnPtr<WebURLLoader> m_loader; + std::unique_ptr<WebURLLoader> m_loader; Timer<PingLoader> m_timeout; String m_url; unsigned long m_identifier;
diff --git a/third_party/WebKit/Source/core/loader/PrerenderHandle.h b/third_party/WebKit/Source/core/loader/PrerenderHandle.h index 7e432f8..432456d 100644 --- a/third_party/WebKit/Source/core/loader/PrerenderHandle.h +++ b/third_party/WebKit/Source/core/loader/PrerenderHandle.h
@@ -35,7 +35,6 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/loader/ProgressTracker.cpp b/third_party/WebKit/Source/core/loader/ProgressTracker.cpp index 66c8517a..da475fa 100644 --- a/third_party/WebKit/Source/core/loader/ProgressTracker.cpp +++ b/third_party/WebKit/Source/core/loader/ProgressTracker.cpp
@@ -36,6 +36,7 @@ #include "platform/Logging.h" #include "platform/network/ResourceResponse.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" using namespace std; @@ -168,7 +169,7 @@ item->bytesReceived = 0; item->estimatedLength = estimatedLength; } else { - m_progressItems.set(identifier, adoptPtr(new ProgressItem(estimatedLength))); + m_progressItems.set(identifier, wrapUnique(new ProgressItem(estimatedLength))); } }
diff --git a/third_party/WebKit/Source/core/loader/ProgressTracker.h b/third_party/WebKit/Source/core/loader/ProgressTracker.h index 705badc..a5198095 100644 --- a/third_party/WebKit/Source/core/loader/ProgressTracker.h +++ b/third_party/WebKit/Source/core/loader/ProgressTracker.h
@@ -32,7 +32,7 @@ #include "wtf/Forward.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -84,7 +84,7 @@ bool m_finalProgressChangedSent; double m_progressValue; - HashMap<unsigned long, OwnPtr<ProgressItem>> m_progressItems; + HashMap<unsigned long, std::unique_ptr<ProgressItem>> m_progressItems; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp index 655aa28..86189fbc 100644 --- a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp +++ b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp
@@ -34,6 +34,7 @@ #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" #include "platform/weborigin/SecurityOrigin.h" +#include <memory> namespace blink { @@ -128,7 +129,7 @@ } -inline PassOwnPtr<TextResourceDecoder> TextResourceDecoderBuilder::createDecoderInstance(Document* document) +inline std::unique_ptr<TextResourceDecoder> TextResourceDecoderBuilder::createDecoderInstance(Document* document) { const WTF::TextEncoding encodingFromDomain = getEncodingFromDomain(document->url()); if (LocalFrame* frame = document->frame()) { @@ -167,9 +168,9 @@ } } -PassOwnPtr<TextResourceDecoder> TextResourceDecoderBuilder::buildFor(Document* document) +std::unique_ptr<TextResourceDecoder> TextResourceDecoderBuilder::buildFor(Document* document) { - OwnPtr<TextResourceDecoder> decoder = createDecoderInstance(document); + std::unique_ptr<TextResourceDecoder> decoder = createDecoderInstance(document); setupEncoding(decoder.get(), document); return decoder; }
diff --git a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.h b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.h index ba9d1fc..37f32d5 100644 --- a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.h +++ b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.h
@@ -35,6 +35,7 @@ #include "wtf/Allocator.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -47,7 +48,7 @@ TextResourceDecoderBuilder(const AtomicString& mimeType, const AtomicString& encoding); ~TextResourceDecoderBuilder(); - PassOwnPtr<TextResourceDecoder> buildFor(Document*); + std::unique_ptr<TextResourceDecoder> buildFor(Document*); const AtomicString& mimeType() const { return m_mimeType; } const AtomicString& encoding() const { return m_encoding; } @@ -55,7 +56,7 @@ void clear(); private: - PassOwnPtr<TextResourceDecoder> createDecoderInstance(Document*); + std::unique_ptr<TextResourceDecoder> createDecoderInstance(Document*); void setupEncoding(TextResourceDecoder*, Document*); AtomicString m_mimeType;
diff --git a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilderTest.cpp b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilderTest.cpp index eaf7950b..611d4674 100644 --- a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilderTest.cpp +++ b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilderTest.cpp
@@ -6,12 +6,13 @@ #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { static const WTF::TextEncoding defaultEncodingForURL(const char* url) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(0, 0)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(0, 0)); Document& document = pageHolder->document(); document.setURL(KURL(KURL(), url)); TextResourceDecoderBuilder decoderBuilder("text/html", nullAtom);
diff --git a/third_party/WebKit/Source/core/loader/TextTrackLoader.h b/third_party/WebKit/Source/core/loader/TextTrackLoader.h index 3ec27cd2..6d7665c 100644 --- a/third_party/WebKit/Source/core/loader/TextTrackLoader.h +++ b/third_party/WebKit/Source/core/loader/TextTrackLoader.h
@@ -32,7 +32,6 @@ #include "platform/CrossOriginAttributeValue.h" #include "platform/Timer.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp index 325030f..16f78451 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp +++ b/third_party/WebKit/Source/core/loader/ThreadableLoader.cpp
@@ -37,10 +37,11 @@ #include "core/loader/WorkerThreadableLoader.h" #include "core/workers/WorkerGlobalScope.h" #include "core/workers/WorkerThread.h" +#include <memory> namespace blink { -PassOwnPtr<ThreadableLoader> ThreadableLoader::create(ExecutionContext& context, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) +std::unique_ptr<ThreadableLoader> ThreadableLoader::create(ExecutionContext& context, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) { ASSERT(client);
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoader.h b/third_party/WebKit/Source/core/loader/ThreadableLoader.h index fc360b1..3d2b2d2 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoader.h +++ b/third_party/WebKit/Source/core/loader/ThreadableLoader.h
@@ -36,7 +36,7 @@ #include "platform/CrossThreadCopier.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -166,8 +166,8 @@ // ThreadableLoaderClient methods: // - may call cancel() // - can destroy the ThreadableLoader instance in them (by clearing - // OwnPtr<ThreadableLoader>). - static PassOwnPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); + // std::unique_ptr<ThreadableLoader>). + static std::unique_ptr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); // The methods on the ThreadableLoaderClient passed on create() call // may be called synchronous to start() call.
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoaderClient.h b/third_party/WebKit/Source/core/loader/ThreadableLoaderClient.h index 2d641cdc..a159447 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoaderClient.h +++ b/third_party/WebKit/Source/core/loader/ThreadableLoaderClient.h
@@ -35,7 +35,7 @@ #include "platform/heap/Handle.h" #include "public/platform/WebDataConsumerHandle.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -48,7 +48,7 @@ public: virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { } - virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) { } + virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) { } virtual void didReceiveData(const char*, unsigned /*dataLength*/) { } virtual void didReceiveCachedMetadata(const char*, int /*dataLength*/) { } virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) { }
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoaderClientWrapper.h b/third_party/WebKit/Source/core/loader/ThreadableLoaderClientWrapper.h index 4de6111..e70a1d6 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoaderClientWrapper.h +++ b/third_party/WebKit/Source/core/loader/ThreadableLoaderClientWrapper.h
@@ -35,11 +35,11 @@ #include "platform/network/ResourceResponse.h" #include "platform/network/ResourceTimingInfo.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/Threading.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -83,7 +83,7 @@ m_client->didSendData(bytesSent, totalBytesToBeSent); } - void didReceiveResponse(unsigned long identifier, PassOwnPtr<CrossThreadResourceResponseData> responseData, PassOwnPtr<WebDataConsumerHandle> handle) + void didReceiveResponse(unsigned long identifier, std::unique_ptr<CrossThreadResourceResponseData> responseData, std::unique_ptr<WebDataConsumerHandle> handle) { ResourceResponse response(responseData.get()); @@ -91,7 +91,7 @@ m_client->didReceiveResponse(identifier, response, std::move(handle)); } - void didReceiveData(PassOwnPtr<Vector<char>> data) + void didReceiveData(std::unique_ptr<Vector<char>> data) { RELEASE_ASSERT(data->size() <= std::numeric_limits<unsigned>::max()); @@ -99,7 +99,7 @@ m_client->didReceiveData(data->data(), data->size()); } - void didReceiveCachedMetadata(PassOwnPtr<Vector<char>> data) + void didReceiveCachedMetadata(std::unique_ptr<Vector<char>> data) { if (m_client) m_client->didReceiveCachedMetadata(data->data(), data->size()); @@ -139,9 +139,9 @@ m_client->didDownloadData(dataLength); } - void didReceiveResourceTiming(PassOwnPtr<CrossThreadResourceTimingInfoData> timingData) + void didReceiveResourceTiming(std::unique_ptr<CrossThreadResourceTimingInfoData> timingData) { - OwnPtr<ResourceTimingInfo> info(ResourceTimingInfo::adopt(std::move(timingData))); + std::unique_ptr<ResourceTimingInfo> info(ResourceTimingInfo::adopt(std::move(timingData))); if (m_resourceTimingClient) m_resourceTimingClient->didReceiveResourceTiming(*info);
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp b/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp index b2a664b6..39e72b0f 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp +++ b/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
@@ -30,9 +30,9 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/Assertions.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -47,13 +47,13 @@ class MockThreadableLoaderClient : public ThreadableLoaderClient { public: - static PassOwnPtr<MockThreadableLoaderClient> create() + static std::unique_ptr<MockThreadableLoaderClient> create() { - return adoptPtr(new ::testing::StrictMock<MockThreadableLoaderClient>); + return wrapUnique(new ::testing::StrictMock<MockThreadableLoaderClient>); } MOCK_METHOD2(didSendData, void(unsigned long long, unsigned long long)); MOCK_METHOD3(didReceiveResponseMock, void(unsigned long, const ResourceResponse&, WebDataConsumerHandle*)); - void didReceiveResponse(unsigned long identifier, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) + void didReceiveResponse(unsigned long identifier, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { didReceiveResponseMock(identifier, response, handle.get()); } @@ -146,9 +146,9 @@ private: Document& document() { return m_dummyPageHolder->document(); } - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Checkpoint m_checkpoint; - OwnPtr<DocumentThreadableLoader> m_loader; + std::unique_ptr<DocumentThreadableLoader> m_loader; }; class WorkerThreadableLoaderTestHelper : public ThreadableLoaderTestHelper, public WorkerLoaderProxyProvider { @@ -160,7 +160,7 @@ void createLoader(ThreadableLoaderClient* client, CrossOriginRequestPolicy crossOriginRequestPolicy) override { - OwnPtr<WaitableEvent> completionEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent()); postTaskToWorkerGlobalScope(createCrossThreadTask( &WorkerThreadableLoaderTestHelper::workerCreateLoader, AllowCrossThreadAccess(this), @@ -172,7 +172,7 @@ void startLoader(const ResourceRequest& request) override { - OwnPtr<WaitableEvent> completionEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent()); postTaskToWorkerGlobalScope(createCrossThreadTask( &WorkerThreadableLoaderTestHelper::workerStartLoader, AllowCrossThreadAccess(this), @@ -206,7 +206,7 @@ { testing::runPendingTasks(); - OwnPtr<WaitableEvent> completionEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent()); postTaskToWorkerGlobalScope(createCrossThreadTask( &WorkerThreadableLoaderTestHelper::workerCallCheckpoint, AllowCrossThreadAccess(this), @@ -217,9 +217,9 @@ void onSetUp() override { - m_mockWorkerReportingProxy = adoptPtr(new MockWorkerReportingProxy()); + m_mockWorkerReportingProxy = wrapUnique(new MockWorkerReportingProxy()); m_securityOrigin = document().getSecurityOrigin(); - m_workerThread = adoptPtr(new WorkerThreadForTest( + m_workerThread = wrapUnique(new WorkerThreadForTest( this, *m_mockWorkerReportingProxy)); @@ -276,7 +276,7 @@ event->signal(); } - void workerStartLoader(WaitableEvent* event, PassOwnPtr<CrossThreadResourceRequestData> requestData) + void workerStartLoader(WaitableEvent* event, std::unique_ptr<CrossThreadResourceRequestData> requestData) { ASSERT(m_workerThread); ASSERT(m_workerThread->isCurrentThread()); @@ -310,13 +310,13 @@ } RefPtr<SecurityOrigin> m_securityOrigin; - OwnPtr<MockWorkerReportingProxy> m_mockWorkerReportingProxy; - OwnPtr<WorkerThreadForTest> m_workerThread; + std::unique_ptr<MockWorkerReportingProxy> m_mockWorkerReportingProxy; + std::unique_ptr<WorkerThreadForTest> m_workerThread; - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Checkpoint m_checkpoint; // |m_loader| must be touched only from the worker thread only. - OwnPtr<ThreadableLoader> m_loader; + std::unique_ptr<ThreadableLoader> m_loader; }; class ThreadableLoaderTest : public ::testing::TestWithParam<ThreadableLoaderToTest> { @@ -325,10 +325,10 @@ { switch (GetParam()) { case DocumentThreadableLoaderTest: - m_helper = adoptPtr(new DocumentThreadableLoaderTestHelper); + m_helper = wrapUnique(new DocumentThreadableLoaderTestHelper); break; case WorkerThreadableLoaderTest: - m_helper = adoptPtr(new WorkerThreadableLoaderTestHelper); + m_helper = wrapUnique(new WorkerThreadableLoaderTestHelper); break; } } @@ -424,8 +424,8 @@ URLTestHelpers::registerMockedURLLoadWithCustomResponse(url, "fox-null-terminated.html", "", response); } - OwnPtr<MockThreadableLoaderClient> m_client; - OwnPtr<ThreadableLoaderTestHelper> m_helper; + std::unique_ptr<MockThreadableLoaderClient> m_client; + std::unique_ptr<ThreadableLoaderTestHelper> m_helper; }; INSTANTIATE_TEST_CASE_P(Document,
diff --git a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp index 796d3fe..e90b4c5 100644 --- a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp +++ b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp
@@ -46,14 +46,15 @@ #include "platform/network/ResourceTimingInfo.h" #include "platform/weborigin/SecurityPolicy.h" #include "public/platform/Platform.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { -static PassOwnPtr<Vector<char>> createVectorFromMemoryRegion(const char* data, unsigned dataLength) +static std::unique_ptr<Vector<char>> createVectorFromMemoryRegion(const char* data, unsigned dataLength) { - OwnPtr<Vector<char>> buffer = adoptPtr(new Vector<char>(dataLength)); + std::unique_ptr<Vector<char>> buffer = wrapUnique(new Vector<char>(dataLength)); memcpy(buffer->data(), data, dataLength); return buffer; } @@ -72,7 +73,7 @@ void WorkerThreadableLoader::loadResourceSynchronously(WorkerGlobalScope& workerGlobalScope, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) { - OwnPtr<WorkerThreadableLoader> loader = adoptPtr(new WorkerThreadableLoader(workerGlobalScope, &client, options, resourceLoaderOptions, LoadSynchronously)); + std::unique_ptr<WorkerThreadableLoader> loader = wrapUnique(new WorkerThreadableLoader(workerGlobalScope, &client, options, resourceLoaderOptions, LoadSynchronously)); loader->start(request); } @@ -133,7 +134,7 @@ ASSERT(m_mainThreadLoader); } -void WorkerThreadableLoader::MainThreadBridgeBase::mainThreadStart(PassOwnPtr<CrossThreadResourceRequestData> requestData) +void WorkerThreadableLoader::MainThreadBridgeBase::mainThreadStart(std::unique_ptr<CrossThreadResourceRequestData> requestData) { ASSERT(isMainThread()); ASSERT(m_mainThreadLoader); @@ -216,7 +217,7 @@ forwardTaskToWorker(createCrossThreadTask(&ThreadableLoaderClientWrapper::didSendData, m_workerClientWrapper, bytesSent, totalBytesToBeSent)); } -void WorkerThreadableLoader::MainThreadBridgeBase::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void WorkerThreadableLoader::MainThreadBridgeBase::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { forwardTaskToWorker(createCrossThreadTask(&ThreadableLoaderClientWrapper::didReceiveResponse, m_workerClientWrapper, identifier, response, passed(std::move(handle)))); } @@ -304,7 +305,7 @@ void WorkerThreadableLoader::MainThreadSyncBridge::start(const ResourceRequest& request, const WorkerGlobalScope& workerGlobalScope) { WaitableEvent* terminationEvent = workerGlobalScope.thread()->terminationEvent(); - m_loaderDoneEvent = adoptPtr(new WaitableEvent()); + m_loaderDoneEvent = wrapUnique(new WaitableEvent()); startInMainThread(request, workerGlobalScope);
diff --git a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h index e30a4bd..d841549 100644 --- a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h +++ b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.h
@@ -37,14 +37,14 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/Referrer.h" #include "wtf/Functional.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/Threading.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -61,9 +61,9 @@ USING_FAST_MALLOC(WorkerThreadableLoader); public: static void loadResourceSynchronously(WorkerGlobalScope&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); - static PassOwnPtr<WorkerThreadableLoader> create(WorkerGlobalScope& workerGlobalScope, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) + static std::unique_ptr<WorkerThreadableLoader> create(WorkerGlobalScope& workerGlobalScope, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) { - return adoptPtr(new WorkerThreadableLoader(workerGlobalScope, client, options, resourceLoaderOptions, LoadAsynchronously)); + return wrapUnique(new WorkerThreadableLoader(workerGlobalScope, client, options, resourceLoaderOptions, LoadAsynchronously)); } ~WorkerThreadableLoader() override; @@ -110,7 +110,7 @@ // All executed on the main thread. void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) final; - void didReceiveResponse(unsigned long identifier, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) final; + void didReceiveResponse(unsigned long identifier, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) final; void didReceiveData(const char*, unsigned dataLength) final; void didDownloadData(int dataLength) final; void didReceiveCachedMetadata(const char*, int dataLength) final; @@ -142,13 +142,13 @@ // All executed on the main thread. void mainThreadCreateLoader(ThreadableLoaderOptions, ResourceLoaderOptions, ExecutionContext*); - void mainThreadStart(PassOwnPtr<CrossThreadResourceRequestData>); + void mainThreadStart(std::unique_ptr<CrossThreadResourceRequestData>); void mainThreadDestroy(ExecutionContext*); void mainThreadOverrideTimeout(unsigned long timeoutMilliseconds, ExecutionContext*); void mainThreadCancel(ExecutionContext*); // Only to be used on the main thread. - OwnPtr<ThreadableLoader> m_mainThreadLoader; + std::unique_ptr<ThreadableLoader> m_mainThreadLoader; // ThreadableLoaderClientWrapper is to be used on the worker context thread. // The ref counting is done on either thread: @@ -185,7 +185,7 @@ void forwardTaskToWorkerOnLoaderDone(std::unique_ptr<ExecutionContextTask>) override; bool m_done; - OwnPtr<WaitableEvent> m_loaderDoneEvent; + std::unique_ptr<WaitableEvent> m_loaderDoneEvent; // Thread-safety: |m_clientTasks| can be written (i.e. Closures are added) // on the main thread only before |m_loaderDoneEvent| is signaled and can be read // on the worker context thread only after |m_loaderDoneEvent| is signaled.
diff --git a/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.h b/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.h index 524e86ee..ad1267b 100644 --- a/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.h +++ b/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.h
@@ -35,8 +35,8 @@ #include "platform/weborigin/KURL.h" #include "public/platform/WebApplicationCacheHostClient.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { class ApplicationCache; @@ -175,7 +175,7 @@ void dispatchDOMEvent(EventID, int progressTotal, int progressDone, WebApplicationCacheHost::ErrorReason, const String& errorURL, int errorStatus, const String& errorMessage); - OwnPtr<WebApplicationCacheHost> m_host; + std::unique_ptr<WebApplicationCacheHost> m_host; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp index b10144a..ddd9976 100644 --- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp +++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
@@ -9,6 +9,7 @@ #include "core/html/canvas/CanvasRenderingContext.h" #include "core/html/canvas/CanvasRenderingContextFactory.h" #include "wtf/MathExtras.h" +#include <memory> namespace blink { @@ -95,7 +96,7 @@ return renderingContextFactories()[type].get(); } -void OffscreenCanvas::registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContextFactory> renderingContextFactory) +void OffscreenCanvas::registerRenderingContextFactory(std::unique_ptr<CanvasRenderingContextFactory> renderingContextFactory) { CanvasRenderingContext::ContextType type = renderingContextFactory->getContextType(); ASSERT(type < CanvasRenderingContext::ContextTypeCount);
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h index f6e592a7..7025234c 100644 --- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h +++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h
@@ -11,6 +11,7 @@ #include "core/html/HTMLCanvasElement.h" #include "platform/geometry/IntSize.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -41,7 +42,7 @@ CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String&, const CanvasContextCreationAttributes&); CanvasRenderingContext* renderingContext() { return m_context; } - static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContextFactory>); + static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingContextFactory>); bool originClean() const; void setOriginTainted() { m_originClean = false; } @@ -51,7 +52,7 @@ private: explicit OffscreenCanvas(const IntSize&); - using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; + using ContextFactoryVector = Vector<std::unique_ptr<CanvasRenderingContextFactory>>; static ContextFactoryVector& renderingContextFactories(); static CanvasRenderingContextFactory* getRenderingContextFactory(int);
diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp b/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp index 6029493..5d37016 100644 --- a/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp +++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp
@@ -18,7 +18,9 @@ #include "public/platform/WebOriginTrialTokenStatus.h" #include "public/platform/WebTrialTokenValidator.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { namespace { @@ -79,7 +81,7 @@ OriginTrialContextTest() : m_frameworkWasEnabled(RuntimeEnabledFeatures::originTrialsEnabled()) , m_executionContext(new NullExecutionContext()) - , m_tokenValidator(adoptPtr(new MockTokenValidator())) + , m_tokenValidator(wrapUnique(new MockTokenValidator())) , m_originTrialContext(new OriginTrialContext(m_executionContext.get(), m_tokenValidator.get())) , m_histogramTester(new HistogramTester()) { @@ -139,7 +141,7 @@ private: const bool m_frameworkWasEnabled; Persistent<NullExecutionContext> m_executionContext; - OwnPtr<MockTokenValidator> m_tokenValidator; + std::unique_ptr<MockTokenValidator> m_tokenValidator; Persistent<OriginTrialContext> m_originTrialContext; std::unique_ptr<HistogramTester> m_histogramTester; };
diff --git a/third_party/WebKit/Source/core/page/AutoscrollController.h b/third_party/WebKit/Source/core/page/AutoscrollController.h index 794a460..3c19a2ee 100644 --- a/third_party/WebKit/Source/core/page/AutoscrollController.h +++ b/third_party/WebKit/Source/core/page/AutoscrollController.h
@@ -29,7 +29,6 @@ #include "core/CoreExport.h" #include "platform/geometry/IntPoint.h" #include "platform/heap/Handle.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/page/ChromeClient.h b/third_party/WebKit/Source/core/page/ChromeClient.h index 7d5752ce..6f55c92a 100644 --- a/third_party/WebKit/Source/core/page/ChromeClient.h +++ b/third_party/WebKit/Source/core/page/ChromeClient.h
@@ -39,8 +39,8 @@ #include "public/platform/WebEventListenerProperties.h" #include "public/platform/WebFocusType.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -279,7 +279,7 @@ // that this is comprehensive. virtual void didObserveNonGetFetchFromScript() const {} - virtual PassOwnPtr<WebFrameScheduler> createFrameScheduler(BlameContext*) = 0; + virtual std::unique_ptr<WebFrameScheduler> createFrameScheduler(BlameContext*) = 0; // Returns the time of the beginning of the last beginFrame, in seconds, if any, and 0.0 otherwise. virtual double lastFrameTimeMonotonic() const { return 0.0; }
diff --git a/third_party/WebKit/Source/core/page/ContextMenuController.cpp b/third_party/WebKit/Source/core/page/ContextMenuController.cpp index d388d1e..97f5b89 100644 --- a/third_party/WebKit/Source/core/page/ContextMenuController.cpp +++ b/third_party/WebKit/Source/core/page/ContextMenuController.cpp
@@ -39,6 +39,8 @@ #include "core/page/CustomContextMenuProvider.h" #include "platform/ContextMenu.h" #include "platform/ContextMenuItem.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -144,7 +146,7 @@ showContextMenu(nullptr); } -PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(Event* event) +std::unique_ptr<ContextMenu> ContextMenuController::createContextMenu(Event* event) { ASSERT(event); @@ -155,7 +157,7 @@ return createContextMenu(event->target()->toNode()->document().frame(), mouseEvent->absoluteLocation()); } -PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(LocalFrame* frame, const LayoutPoint& location) +std::unique_ptr<ContextMenu> ContextMenuController::createContextMenu(LocalFrame* frame, const LayoutPoint& location) { HitTestRequest::HitTestRequestType type = HitTestRequest::ReadOnly | HitTestRequest::Active; HitTestResult result(type, location); @@ -168,7 +170,7 @@ m_hitTestResult = result; - return adoptPtr(new ContextMenu); + return wrapUnique(new ContextMenu); } void ContextMenuController::showContextMenu(Event* event)
diff --git a/third_party/WebKit/Source/core/page/ContextMenuController.h b/third_party/WebKit/Source/core/page/ContextMenuController.h index fadbade..3f62e0a 100644 --- a/third_party/WebKit/Source/core/page/ContextMenuController.h +++ b/third_party/WebKit/Source/core/page/ContextMenuController.h
@@ -30,9 +30,9 @@ #include "core/layout/HitTestResult.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -68,13 +68,13 @@ private: ContextMenuController(Page*, ContextMenuClient*); - PassOwnPtr<ContextMenu> createContextMenu(Event*); - PassOwnPtr<ContextMenu> createContextMenu(LocalFrame*, const LayoutPoint&); + std::unique_ptr<ContextMenu> createContextMenu(Event*); + std::unique_ptr<ContextMenu> createContextMenu(LocalFrame*, const LayoutPoint&); void populateCustomContextMenu(const Event&); void showContextMenu(Event*); ContextMenuClient* m_client; - OwnPtr<ContextMenu> m_contextMenu; + std::unique_ptr<ContextMenu> m_contextMenu; Member<ContextMenuProvider> m_menuProvider; HitTestResult m_hitTestResult; };
diff --git a/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp b/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp index f6270fd0..752ed69 100644 --- a/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp +++ b/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp
@@ -12,7 +12,7 @@ #include "core/testing/DummyPageHolder.h" #include "platform/ContextMenu.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -32,7 +32,7 @@ } private: - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; }; TEST_F(ContextMenuControllerTest, TestCustomMenu)
diff --git a/third_party/WebKit/Source/core/page/DragController.cpp b/third_party/WebKit/Source/core/page/DragController.cpp index 04f89281..c6cae63 100644 --- a/third_party/WebKit/Source/core/page/DragController.cpp +++ b/third_party/WebKit/Source/core/page/DragController.cpp
@@ -83,9 +83,8 @@ #include "public/platform/WebScreenInfo.h" #include "wtf/Assertions.h" #include "wtf/CurrentTime.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> #if OS(WIN) #include <windows.h> @@ -801,9 +800,9 @@ return maxSizeInPixels; } -static PassOwnPtr<DragImage> dragImageForImage(Element* element, Image* image, float deviceScaleFactor, const IntPoint& dragOrigin, const IntPoint& imageElementLocation, const IntSize& imageElementSizeInPixels, IntPoint& dragLocation) +static std::unique_ptr<DragImage> dragImageForImage(Element* element, Image* image, float deviceScaleFactor, const IntPoint& dragOrigin, const IntPoint& imageElementLocation, const IntSize& imageElementSizeInPixels, IntPoint& dragLocation) { - OwnPtr<DragImage> dragImage; + std::unique_ptr<DragImage> dragImage; IntPoint origin; InterpolationQuality interpolationQuality = element->ensureComputedStyle()->imageRendering() == ImageRenderingPixelated ? InterpolationNone : InterpolationHigh; @@ -839,11 +838,11 @@ return dragImage; } -static PassOwnPtr<DragImage> dragImageForLink(const KURL& linkURL, const String& linkText, float deviceScaleFactor, const IntPoint& mouseDraggedPoint, IntPoint& dragLoc) +static std::unique_ptr<DragImage> dragImageForLink(const KURL& linkURL, const String& linkText, float deviceScaleFactor, const IntPoint& mouseDraggedPoint, IntPoint& dragLoc) { FontDescription fontDescription; LayoutTheme::theme().systemFont(blink::CSSValueNone, fontDescription); - OwnPtr<DragImage> dragImage = DragImage::create(linkURL, linkText, fontDescription, deviceScaleFactor); + std::unique_ptr<DragImage> dragImage = DragImage::create(linkURL, linkText, fontDescription, deviceScaleFactor); IntSize size = dragImage ? dragImage->size() : IntSize(); IntPoint dragImageOffset(-size.width() / 2, -LinkDragBorderInset); @@ -877,7 +876,7 @@ DataTransfer* dataTransfer = state.m_dragDataTransfer.get(); // We allow DHTML/JS to set the drag image, even if its a link, image or text we're dragging. // This is in the spirit of the IE API, which allows overriding of pasteboard data and DragOp. - OwnPtr<DragImage> dragImage = dataTransfer->createDragImage(dragOffset, src); + std::unique_ptr<DragImage> dragImage = dataTransfer->createDragImage(dragOffset, src); if (dragImage) { dragLocation = dragLocationForDHTMLDrag(mouseDraggedPoint, dragOrigin, dragOffset, !linkURL.isEmpty()); }
diff --git a/third_party/WebKit/Source/core/page/EventSource.cpp b/third_party/WebKit/Source/core/page/EventSource.cpp index dfa1f82..77c3b18 100644 --- a/third_party/WebKit/Source/core/page/EventSource.cpp +++ b/third_party/WebKit/Source/core/page/EventSource.cpp
@@ -55,6 +55,7 @@ #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/WebURLRequest.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -221,7 +222,7 @@ return ActiveDOMObject::getExecutionContext(); } -void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(handle, !handle); ASSERT(m_state == CONNECTING);
diff --git a/third_party/WebKit/Source/core/page/EventSource.h b/third_party/WebKit/Source/core/page/EventSource.h index c49ac87..e44530e43 100644 --- a/third_party/WebKit/Source/core/page/EventSource.h +++ b/third_party/WebKit/Source/core/page/EventSource.h
@@ -42,7 +42,7 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -95,7 +95,7 @@ private: EventSource(ExecutionContext*, const KURL&, const EventSourceInit&); - void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; void didReceiveData(const char*, unsigned) override; void didFinishLoading(unsigned long, double) override; void didFail(const ResourceError&) override; @@ -122,7 +122,7 @@ State m_state; Member<EventSourceParser> m_parser; - OwnPtr<ThreadableLoader> m_loader; + std::unique_ptr<ThreadableLoader> m_loader; Timer<EventSource> m_connectTimer; unsigned long long m_reconnectDelay;
diff --git a/third_party/WebKit/Source/core/page/EventSourceParser.h b/third_party/WebKit/Source/core/page/EventSourceParser.h index 7629b68..ffe8145 100644 --- a/third_party/WebKit/Source/core/page/EventSourceParser.h +++ b/third_party/WebKit/Source/core/page/EventSourceParser.h
@@ -7,11 +7,11 @@ #include "core/CoreExport.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/TextCodec.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -49,7 +49,7 @@ AtomicString m_lastEventId; Member<Client> m_client; - OwnPtr<TextCodec> m_codec; + std::unique_ptr<TextCodec> m_codec; bool m_isRecognizingCRLF = false; bool m_isRecognizingBOM = true;
diff --git a/third_party/WebKit/Source/core/page/FocusControllerTest.cpp b/third_party/WebKit/Source/core/page/FocusControllerTest.cpp index 9dd4120..a36f5a91 100644 --- a/third_party/WebKit/Source/core/page/FocusControllerTest.cpp +++ b/third_party/WebKit/Source/core/page/FocusControllerTest.cpp
@@ -8,6 +8,7 @@ #include "core/html/HTMLElement.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -19,7 +20,7 @@ private: void SetUp() override { m_pageHolder = DummyPageHolder::create(); } - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; }; TEST_F(FocusControllerTest, SetInitialFocus)
diff --git a/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp b/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp index 26fe7a4..e6658bd 100644 --- a/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp +++ b/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp
@@ -30,6 +30,7 @@ #include "core/page/Page.h" #include "wtf/Assertions.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/Threading.h" @@ -73,7 +74,7 @@ MutexLocker locker(m_mutex); ObserverListMap::AddResult result = m_observers.add(context, nullptr); if (result.isNewEntry) - result.storedValue->value = adoptPtr(new ObserverList); + result.storedValue->value = wrapUnique(new ObserverList); ASSERT(result.storedValue->value->observers.find(observer) == kNotFound); result.storedValue->value->observers.append(observer);
diff --git a/third_party/WebKit/Source/core/page/NetworkStateNotifier.h b/third_party/WebKit/Source/core/page/NetworkStateNotifier.h index 955284c0e..f2534832 100644 --- a/third_party/WebKit/Source/core/page/NetworkStateNotifier.h +++ b/third_party/WebKit/Source/core/page/NetworkStateNotifier.h
@@ -34,6 +34,7 @@ #include "wtf/Noncopyable.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -142,7 +143,7 @@ // The ObserverListMap is cross-thread accessed, adding/removing Observers running // within an ExecutionContext. Kept off-heap to ease cross-thread allocation and use; // the observers are (already) responsible for explicitly unregistering while finalizing. - using ObserverListMap = HashMap<UntracedMember<ExecutionContext>, OwnPtr<ObserverList>>; + using ObserverListMap = HashMap<UntracedMember<ExecutionContext>, std::unique_ptr<ObserverList>>; void notifyObserversOfConnectionChangeOnContext(WebConnectionType, double maxBandwidthMbps, ExecutionContext*);
diff --git a/third_party/WebKit/Source/core/page/PrintContextTest.cpp b/third_party/WebKit/Source/core/page/PrintContextTest.cpp index 922a629..8ecda1ee 100644 --- a/third_party/WebKit/Source/core/page/PrintContextTest.cpp +++ b/third_party/WebKit/Source/core/page/PrintContextTest.cpp
@@ -19,6 +19,7 @@ #include "platform/text/TextStream.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkCanvas.h" +#include <memory> namespace blink { @@ -128,7 +129,7 @@ } private: - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; Persistent<MockPrintContext> m_printContext; };
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp index e8caada..d08fd308 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp
@@ -7,6 +7,8 @@ #include "core/dom/DOMNodeIds.h" #include "core/dom/Element.h" #include "core/dom/ExceptionCode.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -26,7 +28,7 @@ ScrollState* ScrollState::create(ScrollStateInit init) { - OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); + std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); scrollStateData->delta_x = init.deltaX(); scrollStateData->delta_y = init.deltaY(); scrollStateData->position_x = init.positionX(); @@ -44,13 +46,13 @@ return scrollState; } -ScrollState* ScrollState::create(PassOwnPtr<ScrollStateData> data) +ScrollState* ScrollState::create(std::unique_ptr<ScrollStateData> data) { ScrollState* scrollState = new ScrollState(std::move(data)); return scrollState; } -ScrollState::ScrollState(PassOwnPtr<ScrollStateData> data) +ScrollState::ScrollState(std::unique_ptr<ScrollStateData> data) : m_data(std::move(data)) { }
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollState.h b/third_party/WebKit/Source/core/page/scrolling/ScrollState.h index 050ee6b..65f164d 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollState.h +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollState.h
@@ -12,6 +12,7 @@ #include "platform/scroll/ScrollStateData.h" #include "wtf/Forward.h" #include <deque> +#include <memory> namespace blink { @@ -22,7 +23,7 @@ public: static ScrollState* create(ScrollStateInit); - static ScrollState* create(PassOwnPtr<ScrollStateData>); + static ScrollState* create(std::unique_ptr<ScrollStateData>); ~ScrollState() { @@ -92,9 +93,9 @@ private: ScrollState(); - explicit ScrollState(PassOwnPtr<ScrollStateData>); + explicit ScrollState(std::unique_ptr<ScrollStateData>); - OwnPtr<ScrollStateData> m_data; + std::unique_ptr<ScrollStateData> m_data; std::deque<int> m_scrollChain; };
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp index e79dce5..5b84165 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollStateTest.cpp
@@ -7,6 +7,8 @@ #include "core/dom/Document.h" #include "core/dom/Element.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -14,7 +16,7 @@ ScrollState* CreateScrollState(double deltaX, double deltaY, bool beginning, bool ending) { - OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); + std::unique_ptr<ScrollStateData> scrollStateData = wrapUnique(new ScrollStateData()); scrollStateData->delta_x = deltaX; scrollStateData->delta_y = deltaY; scrollStateData->is_beginning = beginning;
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp index 88221d0a..ee69398 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -63,7 +63,9 @@ #include "public/platform/WebScrollbarLayer.h" #include "public/platform/WebScrollbarThemeGeometry.h" #include "public/platform/WebScrollbarThemePainter.h" +#include "wtf/PtrUtil.h" #include "wtf/text/StringBuilder.h" +#include <memory> using blink::WebLayer; using blink::WebLayerPositionConstraint; @@ -273,25 +275,25 @@ void ScrollingCoordinator::removeWebScrollbarLayer(ScrollableArea* scrollableArea, ScrollbarOrientation orientation) { ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontalScrollbars : m_verticalScrollbars; - if (OwnPtr<WebScrollbarLayer> scrollbarLayer = scrollbars.take(scrollableArea)) + if (std::unique_ptr<WebScrollbarLayer> scrollbarLayer = scrollbars.take(scrollableArea)) GraphicsLayer::unregisterContentsLayer(scrollbarLayer->layer()); } -static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar& scrollbar, float deviceScaleFactor) +static std::unique_ptr<WebScrollbarLayer> createScrollbarLayer(Scrollbar& scrollbar, float deviceScaleFactor) { ScrollbarTheme& theme = scrollbar.theme(); WebScrollbarThemePainter painter(theme, scrollbar, deviceScaleFactor); - OwnPtr<WebScrollbarThemeGeometry> geometry(WebScrollbarThemeGeometryNative::create(theme)); + std::unique_ptr<WebScrollbarThemeGeometry> geometry(WebScrollbarThemeGeometryNative::create(theme)); - OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(Platform::current()->compositorSupport()->createScrollbarLayer(WebScrollbarImpl::create(&scrollbar), painter, geometry.leakPtr())); + std::unique_ptr<WebScrollbarLayer> scrollbarLayer = wrapUnique(Platform::current()->compositorSupport()->createScrollbarLayer(WebScrollbarImpl::create(&scrollbar), painter, geometry.release())); GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); return scrollbarLayer; } -PassOwnPtr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLayer(ScrollbarOrientation orientation, int thumbThickness, int trackStart, bool isLeftSideVerticalScrollbar) +std::unique_ptr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLayer(ScrollbarOrientation orientation, int thumbThickness, int trackStart, bool isLeftSideVerticalScrollbar) { WebScrollbar::Orientation webOrientation = (orientation == HorizontalScrollbar) ? WebScrollbar::Horizontal : WebScrollbar::Vertical; - OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(Platform::current()->compositorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThickness, trackStart, isLeftSideVerticalScrollbar)); + std::unique_ptr<WebScrollbarLayer> scrollbarLayer = wrapUnique(Platform::current()->compositorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThickness, trackStart, isLeftSideVerticalScrollbar)); GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); return scrollbarLayer; } @@ -318,7 +320,7 @@ scrollbarGraphicsLayer->setDrawsContent(false); } -WebScrollbarLayer* ScrollingCoordinator::addWebScrollbarLayer(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, PassOwnPtr<WebScrollbarLayer> scrollbarLayer) +WebScrollbarLayer* ScrollingCoordinator::addWebScrollbarLayer(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, std::unique_ptr<WebScrollbarLayer> scrollbarLayer) { ScrollbarMap& scrollbars = orientation == HorizontalScrollbar ? m_horizontalScrollbars : m_verticalScrollbars; return scrollbars.add(scrollableArea, std::move(scrollbarLayer)).storedValue->value.get(); @@ -348,7 +350,7 @@ if (!scrollbarLayer) { Settings* settings = m_page->mainFrame()->settings(); - OwnPtr<WebScrollbarLayer> webScrollbarLayer; + std::unique_ptr<WebScrollbarLayer> webScrollbarLayer; if (settings->useSolidColorScrollbars()) { ASSERT(RuntimeEnabledFeatures::overlayScrollbarsEnabled()); webScrollbarLayer = createSolidColorScrollbarLayer(orientation, scrollbar.theme().thumbThickness(scrollbar), scrollbar.theme().trackPosition(scrollbar), scrollableArea->shouldPlaceVerticalScrollbarOnLeft());
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h index f503f8f7..f9d5dd4a42 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h
@@ -34,6 +34,7 @@ #include "platform/scroll/ScrollTypes.h" #include "wtf/Noncopyable.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { class WebScrollbarLayer; @@ -95,7 +96,7 @@ MainThreadScrollingReasons mainThreadScrollingReasons() const; bool shouldUpdateScrollLayerPositionOnMainThread() const { return mainThreadScrollingReasons() != 0; } - PassOwnPtr<WebScrollbarLayer> createSolidColorScrollbarLayer(ScrollbarOrientation, int thumbThickness, int trackStart, bool isLeftSideVerticalScrollbar); + std::unique_ptr<WebScrollbarLayer> createSolidColorScrollbarLayer(ScrollbarOrientation, int thumbThickness, int trackStart, bool isLeftSideVerticalScrollbar); void willDestroyScrollableArea(ScrollableArea*); // Returns true if the coordinator handled this change. @@ -146,15 +147,15 @@ void setTouchEventTargetRects(LayerHitTestRects&); void computeTouchEventTargetRects(LayerHitTestRects&); - WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation, PassOwnPtr<WebScrollbarLayer>); + WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation, std::unique_ptr<WebScrollbarLayer>); WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); bool frameViewIsDirty() const; - OwnPtr<CompositorAnimationTimeline> m_programmaticScrollAnimatorTimeline; + std::unique_ptr<CompositorAnimationTimeline> m_programmaticScrollAnimatorTimeline; - using ScrollbarMap = HeapHashMap<Member<ScrollableArea>, OwnPtr<WebScrollbarLayer>>; + using ScrollbarMap = HeapHashMap<Member<ScrollableArea>, std::unique_ptr<WebScrollbarLayer>>; ScrollbarMap m_horizontalScrollbars; ScrollbarMap m_verticalScrollbars; HashSet<const PaintLayer*> m_layersWithTouchRects;
diff --git a/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp b/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp index bcebdc8..1b854d9 100644 --- a/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp
@@ -10,8 +10,8 @@ #include "core/style/ComputedStyle.h" #include "core/testing/DummyPageHolder.h" #include "platform/scroll/ScrollTypes.h" - #include <gtest/gtest.h> +#include <memory> namespace blink { @@ -82,7 +82,7 @@ return coordinator().snapOffsets(node, orientation); } - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; }; INSTANTIATE_TEST_CASE_P(All, SnapCoordinatorTest, ::testing::Values(
diff --git a/third_party/WebKit/Source/core/paint/FilterPainter.cpp b/third_party/WebKit/Source/core/paint/FilterPainter.cpp index 41b9732..bccab959 100644 --- a/third_party/WebKit/Source/core/paint/FilterPainter.cpp +++ b/third_party/WebKit/Source/core/paint/FilterPainter.cpp
@@ -17,6 +17,8 @@ #include "platform/graphics/paint/PaintController.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -54,13 +56,13 @@ paintingInfo.clipToDirtyRect = false; if (clipRect.rect() != paintingInfo.paintDirtyRect || clipRect.hasRadius()) { - m_clipRecorder = adoptPtr(new LayerClipRecorder(context, *layer.layoutObject(), DisplayItem::ClipLayerFilter, clipRect, &paintingInfo, LayoutPoint(), paintFlags)); + m_clipRecorder = wrapUnique(new LayerClipRecorder(context, *layer.layoutObject(), DisplayItem::ClipLayerFilter, clipRect, &paintingInfo, LayoutPoint(), paintFlags)); } ASSERT(m_layoutObject); if (!context.getPaintController().displayItemConstructionIsDisabled()) { FilterOperations filterOperations(layer.computeFilterOperations(m_layoutObject->styleRef())); - OwnPtr<CompositorFilterOperations> compositorFilterOperations = CompositorFilterOperations::create(); + std::unique_ptr<CompositorFilterOperations> compositorFilterOperations = CompositorFilterOperations::create(); SkiaImageFilterBuilder::buildFilterOperations(filterOperations, compositorFilterOperations.get()); // FIXME: It's possible to have empty CompositorFilterOperations here even // though the SkImageFilter produced above is non-null, since the
diff --git a/third_party/WebKit/Source/core/paint/FilterPainter.h b/third_party/WebKit/Source/core/paint/FilterPainter.h index c178b70..966827a8 100644 --- a/third_party/WebKit/Source/core/paint/FilterPainter.h +++ b/third_party/WebKit/Source/core/paint/FilterPainter.h
@@ -7,7 +7,7 @@ #include "core/paint/PaintLayerPaintingInfo.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -25,7 +25,7 @@ private: bool m_filterInProgress; GraphicsContext& m_context; - OwnPtr<LayerClipRecorder> m_clipRecorder; + std::unique_ptr<LayerClipRecorder> m_clipRecorder; LayoutObject* m_layoutObject; };
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h index 525c5aa..3ebd68e 100644 --- a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h +++ b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
@@ -10,9 +10,10 @@ #include "platform/graphics/paint/EffectPaintPropertyNode.h" #include "platform/graphics/paint/PaintChunkProperties.h" #include "platform/graphics/paint/TransformPaintPropertyNode.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -27,9 +28,9 @@ public: struct LocalBorderBoxProperties; - static PassOwnPtr<ObjectPaintProperties> create() + static std::unique_ptr<ObjectPaintProperties> create() { - return adoptPtr(new ObjectPaintProperties()); + return wrapUnique(new ObjectPaintProperties()); } // The hierarchy of transform subtree created by a LayoutObject. @@ -96,7 +97,7 @@ m_scrollTranslation = translation; } void setScrollbarPaintOffset(PassRefPtr<TransformPaintPropertyNode> paintOffset) { m_scrollbarPaintOffset = paintOffset; } - void setLocalBorderBoxProperties(PassOwnPtr<LocalBorderBoxProperties> properties) { m_localBorderBoxProperties = std::move(properties); } + void setLocalBorderBoxProperties(std::unique_ptr<LocalBorderBoxProperties> properties) { m_localBorderBoxProperties = std::move(properties); } RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; RefPtr<TransformPaintPropertyNode> m_transform; @@ -110,7 +111,7 @@ RefPtr<TransformPaintPropertyNode> m_scrollTranslation; RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; - OwnPtr<LocalBorderBoxProperties> m_localBorderBoxProperties; + std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp b/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp index b6aad442..781b3a3f 100644 --- a/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp
@@ -6,6 +6,7 @@ #include "platform/graphics/paint/PaintController.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -16,7 +17,7 @@ , m_context(*m_paintController) { } - OwnPtr<PaintController> m_paintController; + std::unique_ptr<PaintController> m_paintController; GraphicsContext m_context; };
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp index 4677310c..37f7d4a 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -83,6 +83,7 @@ #include "platform/transforms/TransformationMatrix.h" #include "platform/transforms/TranslateTransformOperation.h" #include "public/platform/Platform.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/allocator/Partitions.h" #include "wtf/text/CString.h" @@ -982,7 +983,7 @@ if (rareCompositingInputs.isDefault()) m_rareAncestorDependentCompositingInputs.reset(); else - m_rareAncestorDependentCompositingInputs = adoptPtr(new RareAncestorDependentCompositingInputs(rareCompositingInputs)); + m_rareAncestorDependentCompositingInputs = wrapUnique(new RareAncestorDependentCompositingInputs(rareCompositingInputs)); m_hasAncestorWithClipPath = hasAncestorWithClipPath; m_needsAncestorDependentCompositingInputsUpdate = false; } @@ -1451,7 +1452,7 @@ ASSERT(!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldStyle)); if (layoutObject()->hasReflection()) { if (!ensureRareData().reflectionInfo) - m_rareData->reflectionInfo = adoptPtr(new PaintLayerReflectionInfo(*layoutBox())); + m_rareData->reflectionInfo = wrapUnique(new PaintLayerReflectionInfo(*layoutBox())); m_rareData->reflectionInfo->updateAfterStyleChange(oldStyle); } else if (m_rareData && m_rareData->reflectionInfo) { m_rareData->reflectionInfo = nullptr; @@ -1462,7 +1463,7 @@ { ASSERT(!m_stackingNode); if (requiresStackingNode()) - m_stackingNode = adoptPtr(new PaintLayerStackingNode(this)); + m_stackingNode = wrapUnique(new PaintLayerStackingNode(this)); else m_stackingNode = nullptr; } @@ -2333,7 +2334,7 @@ if (m_rareData && m_rareData->compositedLayerMapping) return; - ensureRareData().compositedLayerMapping = adoptPtr(new CompositedLayerMapping(*this)); + ensureRareData().compositedLayerMapping = wrapUnique(new CompositedLayerMapping(*this)); m_rareData->compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree); updateOrRemoveFilterEffectBuilder(); @@ -2853,12 +2854,18 @@ void PaintLayer::setNeedsRepaint() { - m_needsRepaint = true; + setNeedsRepaintInternal(); // Do this unconditionally to ensure container chain is marked when compositing status of the layer changes. markCompositingContainerChainForNeedsRepaint(); } +void PaintLayer::setNeedsRepaintInternal() +{ + m_needsRepaint = true; + setDisplayItemsUncached(); // Invalidate as a display item client. +} + void PaintLayer::markCompositingContainerChainForNeedsRepaint() { // Need to access compositingState(). We've ensured correct flag setting when compositingState() changes. @@ -2882,9 +2889,11 @@ break; container = owner->enclosingLayer(); } + if (container->m_needsRepaint) break; - container->m_needsRepaint = true; + + container->setNeedsRepaintInternal(); layer = container; } } @@ -2903,6 +2912,15 @@ return nullptr; } +void PaintLayer::endShouldKeepAliveAllClientsRecursive() +{ + for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) + child->endShouldKeepAliveAllClientsRecursive(); +#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS + DisplayItemClient::endShouldKeepAliveAllClients(this); +#endif +} + DisableCompositingQueryAsserts::DisableCompositingQueryAsserts() : m_disabler(gCompositingQueryMode, CompositingQueriesAreAllowed) { }
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.h b/third_party/WebKit/Source/core/paint/PaintLayer.h index f7115c5..7511da5 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.h +++ b/third_party/WebKit/Source/core/paint/PaintLayer.h
@@ -60,7 +60,8 @@ #include "platform/graphics/SquashingDisallowedReasons.h" #include "public/platform/WebBlendMode.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -99,7 +100,7 @@ // Our current relative position offset. LayoutSize offsetForInFlowPosition; - OwnPtr<TransformationMatrix> transform; + std::unique_ptr<TransformationMatrix> transform; // Pointer to the enclosing Layer that caused us to be paginated. It is 0 if we are not paginated. // @@ -124,14 +125,14 @@ // If the layer paints into its own backings, this keeps track of the backings. // It's nullptr if the layer is not composited or paints into grouped backing. - OwnPtr<CompositedLayerMapping> compositedLayerMapping; + std::unique_ptr<CompositedLayerMapping> compositedLayerMapping; // If the layer paints into grouped backing (i.e. squashed), this points to the // grouped CompositedLayerMapping. It's null if the layer is not composited or // paints into its own backing. CompositedLayerMapping* groupedMapping; - OwnPtr<PaintLayerReflectionInfo> reflectionInfo; + std::unique_ptr<PaintLayerReflectionInfo> reflectionInfo; Persistent<PaintLayerFilterInfo> filterInfo; @@ -695,7 +696,7 @@ ClipRectsCache& ensureClipRectsCache() const { if (!m_clipRectsCache) - m_clipRectsCache = adoptPtr(new ClipRectsCache); + m_clipRectsCache = wrapUnique(new ClipRectsCache); return *m_clipRectsCache; } void clearClipRectsCache() const { m_clipRectsCache.reset(); } @@ -705,6 +706,10 @@ bool update3DTransformedDescendantStatus(); bool has3DTransformedDescendant() const { DCHECK(!m_3DTransformedDescendantStatusDirty); return m_has3DTransformedDescendant; } +#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS + void endShouldKeepAliveAllClientsRecursive(); +#endif + private: // Bounding box in the coordinates of this layer. LayoutRect logicalBoundingBox() const; @@ -772,12 +777,13 @@ void updatePaginationRecursive(bool needsPaginationUpdate = false); void clearPaginationRecursive(); + void setNeedsRepaintInternal(); void markCompositingContainerChainForNeedsRepaint(); PaintLayerRareData& ensureRareData() { if (!m_rareData) - m_rareData = adoptPtr(new PaintLayerRareData); + m_rareData = wrapUnique(new PaintLayerRareData); return *m_rareData; } @@ -877,19 +883,19 @@ const PaintLayer* m_ancestorOverflowLayer; AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; - OwnPtr<RareAncestorDependentCompositingInputs> m_rareAncestorDependentCompositingInputs; + std::unique_ptr<RareAncestorDependentCompositingInputs> m_rareAncestorDependentCompositingInputs; Persistent<PaintLayerScrollableArea> m_scrollableArea; - mutable OwnPtr<ClipRectsCache> m_clipRectsCache; + mutable std::unique_ptr<ClipRectsCache> m_clipRectsCache; - OwnPtr<PaintLayerStackingNode> m_stackingNode; + std::unique_ptr<PaintLayerStackingNode> m_stackingNode; IntSize m_previousScrollOffsetAccumulationForPainting; RefPtr<ClipRects> m_previousPaintingClipRects; LayoutRect m_previousPaintDirtyRect; - OwnPtr<PaintLayerRareData> m_rareData; + std::unique_ptr<PaintLayerRareData> m_rareData; DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION };
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h index a0d4db07..59776ed 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
@@ -50,6 +50,8 @@ #include "core/paint/PaintInvalidationCapableScrollableArea.h" #include "core/paint/PaintLayerFragment.h" #include "platform/heap/Handle.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -457,7 +459,7 @@ PaintLayerScrollableAreaRareData& ensureRareData() { if (!m_rareData) - m_rareData = adoptPtr(new PaintLayerScrollableAreaRareData()); + m_rareData = wrapUnique(new PaintLayerScrollableAreaRareData()); return *m_rareData.get(); } @@ -509,7 +511,7 @@ ScrollAnchor m_scrollAnchor; - OwnPtr<PaintLayerScrollableAreaRareData> m_rareData; + std::unique_ptr<PaintLayerScrollableAreaRareData> m_rareData; #if ENABLE(ASSERT) bool m_hasBeenDisposed;
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp index 8489a69..747674a 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp
@@ -48,7 +48,9 @@ #include "core/layout/compositing/PaintLayerCompositor.h" #include "core/paint/PaintLayer.h" #include "public/platform/Platform.h" +#include "wtf/PtrUtil.h" #include <algorithm> +#include <memory> namespace blink { @@ -148,7 +150,7 @@ PaintLayer* layer = toLayoutBoxModelObject(child)->layer(); // Create the buffer if it doesn't exist yet. if (!m_posZOrderList) - m_posZOrderList = adoptPtr(new Vector<PaintLayerStackingNode*>); + m_posZOrderList = wrapUnique(new Vector<PaintLayerStackingNode*>); m_posZOrderList->append(layer->stackingNode()); } } @@ -161,15 +163,15 @@ m_zOrderListsDirty = false; } -void PaintLayerStackingNode::collectLayers(OwnPtr<Vector<PaintLayerStackingNode*>>& posBuffer, OwnPtr<Vector<PaintLayerStackingNode*>>& negBuffer) +void PaintLayerStackingNode::collectLayers(std::unique_ptr<Vector<PaintLayerStackingNode*>>& posBuffer, std::unique_ptr<Vector<PaintLayerStackingNode*>>& negBuffer) { if (layer()->isInTopLayer()) return; if (isStacked()) { - OwnPtr<Vector<PaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posBuffer : negBuffer; + std::unique_ptr<Vector<PaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posBuffer : negBuffer; if (!buffer) - buffer = adoptPtr(new Vector<PaintLayerStackingNode*>); + buffer = wrapUnique(new Vector<PaintLayerStackingNode*>); buffer->append(this); }
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h index 977f7be..9da7094 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h +++ b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h
@@ -48,8 +48,8 @@ #include "core/CoreExport.h" #include "core/layout/LayoutBoxModelObject.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -149,7 +149,7 @@ } void rebuildZOrderLists(); - void collectLayers(OwnPtr<Vector<PaintLayerStackingNode*>>& posZOrderList, OwnPtr<Vector<PaintLayerStackingNode*>>& negZOrderList); + void collectLayers(std::unique_ptr<Vector<PaintLayerStackingNode*>>& posZOrderList, std::unique_ptr<Vector<PaintLayerStackingNode*>>& negZOrderList); #if ENABLE(ASSERT) bool isInStackingParentZOrderLists() const; @@ -169,8 +169,8 @@ // that have z-indices of 0 (or is treated as 0 for positioned objects) or greater. // m_negZOrderList holds descendants within our stacking context with // negative z-indices. - OwnPtr<Vector<PaintLayerStackingNode*>> m_posZOrderList; - OwnPtr<Vector<PaintLayerStackingNode*>> m_negZOrderList; + std::unique_ptr<Vector<PaintLayerStackingNode*>> m_posZOrderList; + std::unique_ptr<Vector<PaintLayerStackingNode*>> m_negZOrderList; // This boolean caches whether the z-order lists above are dirty. // It is only ever set for stacking contexts, as no other element can
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp index 3c9c9a31..be3393e 100644 --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -13,6 +13,8 @@ #include "core/paint/ObjectPaintProperties.h" #include "core/paint/PaintLayer.h" #include "platform/transforms/TransformationMatrix.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -164,8 +166,8 @@ if (!object.hasLayer()) return; - OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxContext = - adoptPtr(new ObjectPaintProperties::LocalBorderBoxProperties); + std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxContext = + wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties); borderBoxContext->paintOffset = context.paintOffset; borderBoxContext->transform = context.currentTransform; borderBoxContext->clip = context.currentClip;
diff --git a/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp b/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp index a98c0c6..0bf5781 100644 --- a/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp +++ b/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp
@@ -9,6 +9,7 @@ #include "core/paint/LayoutObjectDrawingRecorder.h" #include "platform/graphics/filters/SkiaImageFilterBuilder.h" #include "platform/graphics/filters/SourceGraphic.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -18,7 +19,7 @@ // Create a new context so the contents of the filter can be drawn and cached. m_paintController = PaintController::create(); - m_context = adoptPtr(new GraphicsContext(*m_paintController)); + m_context = wrapUnique(new GraphicsContext(*m_paintController)); filterData->m_state = FilterData::RecordingContent; return m_context.get();
diff --git a/third_party/WebKit/Source/core/paint/SVGFilterPainter.h b/third_party/WebKit/Source/core/paint/SVGFilterPainter.h index 1d650365..ffbdac3 100644 --- a/third_party/WebKit/Source/core/paint/SVGFilterPainter.h +++ b/third_party/WebKit/Source/core/paint/SVGFilterPainter.h
@@ -8,7 +8,7 @@ #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/paint/PaintController.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -28,8 +28,8 @@ GraphicsContext& paintingContext() const { return m_initialContext; } private: - OwnPtr<PaintController> m_paintController; - OwnPtr<GraphicsContext> m_context; + std::unique_ptr<PaintController> m_paintController; + std::unique_ptr<GraphicsContext> m_context; GraphicsContext& m_initialContext; };
diff --git a/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp index 9cc33a14..93f1068 100644 --- a/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp +++ b/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
@@ -22,6 +22,7 @@ #include "core/paint/SVGPaintContext.h" #include "core/style/ShadowList.h" #include "platform/graphics/GraphicsContextStateSaver.h" +#include <memory> namespace blink { @@ -313,7 +314,7 @@ paint.setAntiAlias(true); if (hasShadow) { - OwnPtr<DrawLooperBuilder> drawLooperBuilder = shadowList->createDrawLooper(DrawLooperBuilder::ShadowRespectsAlpha, style.visitedDependentColor(CSSPropertyColor)); + std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = shadowList->createDrawLooper(DrawLooperBuilder::ShadowRespectsAlpha, style.visitedDependentColor(CSSPropertyColor)); paint.setLooper(toSkSp(drawLooperBuilder->detachDrawLooper())); }
diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp index c595c9c..e080d68 100644 --- a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp +++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
@@ -32,6 +32,7 @@ #include "core/layout/svg/SVGResourcesCache.h" #include "core/paint/SVGMaskPainter.h" #include "platform/FloatConversion.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -89,7 +90,7 @@ return false; if (!isIsolationInstalled() && SVGLayoutSupport::isIsolationRequired(&m_object)) - m_compositingRecorder = adoptPtr(new CompositingRecorder(paintInfo().context, m_object, SkXfermode::kSrcOver_Mode, 1)); + m_compositingRecorder = wrapUnique(new CompositingRecorder(paintInfo().context, m_object, SkXfermode::kSrcOver_Mode, 1)); return true; } @@ -108,7 +109,7 @@ style.blendMode() : WebBlendModeNormal; if (opacity < 1 || blendMode != WebBlendModeNormal) { const FloatRect compositingBounds = m_object.paintInvalidationRectInLocalSVGCoordinates(); - m_compositingRecorder = adoptPtr(new CompositingRecorder(paintInfo().context, m_object, + m_compositingRecorder = wrapUnique(new CompositingRecorder(paintInfo().context, m_object, WebCoreCompositeToSkiaComposite(CompositeSourceOver, blendMode), opacity, &compositingBounds)); } } @@ -128,7 +129,7 @@ ShapeClipPathOperation* clipPath = toShapeClipPathOperation(clipPathOperation); if (!clipPath->isValid()) return false; - m_clipPathRecorder = adoptPtr(new ClipPathRecorder(paintInfo().context, m_object, clipPath->path(m_object.objectBoundingBox()))); + m_clipPathRecorder = wrapUnique(new ClipPathRecorder(paintInfo().context, m_object, clipPath->path(m_object.objectBoundingBox()))); } } return true; @@ -150,7 +151,7 @@ if (m_object.style()->svgStyle().hasFilter()) return false; } else if (LayoutSVGResourceFilter* filter = resources->filter()) { - m_filterRecordingContext = adoptPtr(new SVGFilterRecordingContext(paintInfo().context)); + m_filterRecordingContext = wrapUnique(new SVGFilterRecordingContext(paintInfo().context)); m_filter = filter; GraphicsContext* filterContext = SVGFilterPainter(*filter).prepareEffect(m_object, *m_filterRecordingContext); if (!filterContext) @@ -158,7 +159,7 @@ // Because the filter needs to cache its contents we replace the context // during filtering with the filter's context. - m_filterPaintInfo = adoptPtr(new PaintInfo(*filterContext, m_paintInfo)); + m_filterPaintInfo = wrapUnique(new PaintInfo(*filterContext, m_paintInfo)); // Because we cache the filter contents and do not invalidate on paint // invalidation rect changes, we need to paint the entire filter region
diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.h b/third_party/WebKit/Source/core/paint/SVGPaintContext.h index d8f1a18..b493dde8 100644 --- a/third_party/WebKit/Source/core/paint/SVGPaintContext.h +++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.h
@@ -33,6 +33,7 @@ #include "platform/graphics/paint/ClipPathRecorder.h" #include "platform/graphics/paint/CompositingRecorder.h" #include "platform/transforms/AffineTransform.h" +#include <memory> namespace blink { @@ -85,14 +86,14 @@ const LayoutObject& m_object; PaintInfo m_paintInfo; - OwnPtr<PaintInfo> m_filterPaintInfo; + std::unique_ptr<PaintInfo> m_filterPaintInfo; LayoutSVGResourceFilter* m_filter; LayoutSVGResourceClipper* m_clipper; SVGClipPainter::ClipperState m_clipperState; LayoutSVGResourceMasker* m_masker; - OwnPtr<CompositingRecorder> m_compositingRecorder; - OwnPtr<ClipPathRecorder> m_clipPathRecorder; - OwnPtr<SVGFilterRecordingContext> m_filterRecordingContext; + std::unique_ptr<CompositingRecorder> m_compositingRecorder; + std::unique_ptr<ClipPathRecorder> m_clipPathRecorder; + std::unique_ptr<SVGFilterRecordingContext> m_filterRecordingContext; #if ENABLE(ASSERT) bool m_applyClipMaskAndFilterIfNecessaryCalled; #endif
diff --git a/third_party/WebKit/Source/core/paint/TextPainterTest.cpp b/third_party/WebKit/Source/core/paint/TextPainterTest.cpp index 807f57e7..cf65e59 100644 --- a/third_party/WebKit/Source/core/paint/TextPainterTest.cpp +++ b/third_party/WebKit/Source/core/paint/TextPainterTest.cpp
@@ -15,6 +15,7 @@ #include "core/style/ShadowList.h" #include "platform/graphics/paint/PaintController.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { namespace { @@ -46,7 +47,7 @@ } LayoutText* m_layoutText; - OwnPtr<PaintController> m_paintController; + std::unique_ptr<PaintController> m_paintController; GraphicsContext m_context; };
diff --git a/third_party/WebKit/Source/core/paint/ThemePainterMac.mm b/third_party/WebKit/Source/core/paint/ThemePainterMac.mm index 5daffb72..a71ea3a 100644 --- a/third_party/WebKit/Source/core/paint/ThemePainterMac.mm +++ b/third_party/WebKit/Source/core/paint/ThemePainterMac.mm
@@ -224,7 +224,7 @@ trackInfo.reserved = 0; trackInfo.filler1 = 0; - OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(inflatedRect.size()); + std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(inflatedRect.size()); if (!imageBuffer) return true;
diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp b/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp index af7b78e..9004c71 100644 --- a/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp +++ b/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp
@@ -16,6 +16,7 @@ #include "core/streams/UnderlyingSource.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -150,7 +151,7 @@ return ReadResultCapturingFunction::createFunction(getScriptState(), value); } - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; Persistent<StringStream> m_stream; };
diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp b/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp index 8ee42c8..dc0a0d70 100644 --- a/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp +++ b/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp
@@ -19,6 +19,7 @@ #include "testing/gmock/include/gmock/gmock-more-actions.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -153,7 +154,7 @@ return stream; } - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; Persistent<MockUnderlyingSource> m_underlyingSource; };
diff --git a/third_party/WebKit/Source/core/style/CachedUAStyle.h b/third_party/WebKit/Source/core/style/CachedUAStyle.h index f9cadf8b..347b4fe2 100644 --- a/third_party/WebKit/Source/core/style/CachedUAStyle.h +++ b/third_party/WebKit/Source/core/style/CachedUAStyle.h
@@ -25,6 +25,8 @@ #include "core/style/ComputedStyle.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -36,9 +38,9 @@ USING_FAST_MALLOC(CachedUAStyle); WTF_MAKE_NONCOPYABLE(CachedUAStyle); public: - static PassOwnPtr<CachedUAStyle> create(const ComputedStyle* style) + static std::unique_ptr<CachedUAStyle> create(const ComputedStyle* style) { - return adoptPtr(new CachedUAStyle(style)); + return wrapUnique(new CachedUAStyle(style)); } BorderData border;
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp index aedf1102..ed7babe 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp +++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -32,10 +32,10 @@ #include "core/layout/TextAutosizer.h" #include "core/style/AppliedTextDecoration.h" #include "core/style/BorderEdge.h" -#include "core/style/ContentData.h" -#include "core/style/DataEquivalency.h" #include "core/style/ComputedStyleConstants.h" +#include "core/style/ContentData.h" #include "core/style/CursorData.h" +#include "core/style/DataEquivalency.h" #include "core/style/QuotesData.h" #include "core/style/ShadowList.h" #include "core/style/StyleImage.h" @@ -52,8 +52,8 @@ #include "platform/transforms/TranslateTransformOperation.h" #include "wtf/MathExtras.h" #include "wtf/PtrUtil.h" - #include <algorithm> +#include <memory> namespace blink { @@ -406,7 +406,7 @@ ComputedStyle* result = pseudo.get(); if (!m_cachedPseudoStyles) - m_cachedPseudoStyles = adoptPtr(new PseudoStyleCache); + m_cachedPseudoStyles = wrapUnique(new PseudoStyleCache); m_cachedPseudoStyles->append(pseudo); @@ -1149,9 +1149,9 @@ CounterDirectiveMap& ComputedStyle::accessCounterDirectives() { - OwnPtr<CounterDirectiveMap>& map = rareNonInheritedData.access()->m_counterDirectives; + std::unique_ptr<CounterDirectiveMap>& map = rareNonInheritedData.access()->m_counterDirectives; if (!map) - map = adoptPtr(new CounterDirectiveMap); + map = wrapUnique(new CounterDirectiveMap); return *map; }
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h index c058e29..4e50f80 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.h +++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -28,9 +28,9 @@ #include "core/CSSPropertyNames.h" #include "core/CoreExport.h" #include "core/style/BorderValue.h" +#include "core/style/ComputedStyleConstants.h" #include "core/style/CounterDirectives.h" #include "core/style/DataRef.h" -#include "core/style/ComputedStyleConstants.h" #include "core/style/LineClampValue.h" #include "core/style/NinePieceImage.h" #include "core/style/SVGComputedStyle.h" @@ -71,9 +71,9 @@ #include "platform/transforms/TransformOperations.h" #include "wtf/Forward.h" #include "wtf/LeakAnnotations.h" -#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" +#include <memory> template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); } @@ -153,7 +153,7 @@ DataRef<StyleInheritedData> inherited; // list of associated pseudo styles - OwnPtr<PseudoStyleCache> m_cachedPseudoStyles; + std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles; DataRef<SVGComputedStyle> m_svgStyle;
diff --git a/third_party/WebKit/Source/core/style/ContentData.cpp b/third_party/WebKit/Source/core/style/ContentData.cpp index 7689ff27..6ea4e4d 100644 --- a/third_party/WebKit/Source/core/style/ContentData.cpp +++ b/third_party/WebKit/Source/core/style/ContentData.cpp
@@ -28,6 +28,7 @@ #include "core/layout/LayoutQuote.h" #include "core/layout/LayoutTextFragment.h" #include "core/style/ComputedStyle.h" +#include <memory> namespace blink { @@ -41,7 +42,7 @@ return new TextContentData(text); } -ContentData* ContentData::create(PassOwnPtr<CounterContent> counter) +ContentData* ContentData::create(std::unique_ptr<CounterContent> counter) { return new CounterContentData(std::move(counter)); }
diff --git a/third_party/WebKit/Source/core/style/ContentData.h b/third_party/WebKit/Source/core/style/ContentData.h index 683319d..4ed54df 100644 --- a/third_party/WebKit/Source/core/style/ContentData.h +++ b/third_party/WebKit/Source/core/style/ContentData.h
@@ -27,8 +27,8 @@ #include "core/style/CounterContent.h" #include "core/style/StyleImage.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -40,7 +40,7 @@ public: static ContentData* create(StyleImage*); static ContentData* create(const String&); - static ContentData* create(PassOwnPtr<CounterContent>); + static ContentData* create(std::unique_ptr<CounterContent>); static ContentData* create(QuoteType); virtual ~ContentData() { } @@ -140,20 +140,20 @@ friend class ContentData; public: const CounterContent* counter() const { return m_counter.get(); } - void setCounter(PassOwnPtr<CounterContent> counter) { m_counter = std::move(counter); } + void setCounter(std::unique_ptr<CounterContent> counter) { m_counter = std::move(counter); } bool isCounter() const override { return true; } LayoutObject* createLayoutObject(Document&, ComputedStyle&) const override; private: - CounterContentData(PassOwnPtr<CounterContent> counter) + CounterContentData(std::unique_ptr<CounterContent> counter) : m_counter(std::move(counter)) { } ContentData* cloneInternal() const override { - OwnPtr<CounterContent> counterData = adoptPtr(new CounterContent(*counter())); + std::unique_ptr<CounterContent> counterData = wrapUnique(new CounterContent(*counter())); return create(std::move(counterData)); } @@ -164,7 +164,7 @@ return *static_cast<const CounterContentData&>(data).counter() == *counter(); } - OwnPtr<CounterContent> m_counter; + std::unique_ptr<CounterContent> m_counter; }; DEFINE_CONTENT_DATA_TYPE_CASTS(Counter);
diff --git a/third_party/WebKit/Source/core/style/CounterDirectives.cpp b/third_party/WebKit/Source/core/style/CounterDirectives.cpp index ce9d391cb..bbb3526 100644 --- a/third_party/WebKit/Source/core/style/CounterDirectives.cpp +++ b/third_party/WebKit/Source/core/style/CounterDirectives.cpp
@@ -21,7 +21,8 @@ #include "core/style/CounterDirectives.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -33,9 +34,9 @@ && a.resetValue() == b.resetValue(); } -PassOwnPtr<CounterDirectiveMap> clone(const CounterDirectiveMap& counterDirectives) +std::unique_ptr<CounterDirectiveMap> clone(const CounterDirectiveMap& counterDirectives) { - OwnPtr<CounterDirectiveMap> result = adoptPtr(new CounterDirectiveMap); + std::unique_ptr<CounterDirectiveMap> result = wrapUnique(new CounterDirectiveMap); *result = counterDirectives; return result; }
diff --git a/third_party/WebKit/Source/core/style/CounterDirectives.h b/third_party/WebKit/Source/core/style/CounterDirectives.h index 6e6de38..a7205990 100644 --- a/third_party/WebKit/Source/core/style/CounterDirectives.h +++ b/third_party/WebKit/Source/core/style/CounterDirectives.h
@@ -31,6 +31,7 @@ #include "wtf/RefPtr.h" #include "wtf/text/AtomicString.h" #include "wtf/text/AtomicStringHash.h" +#include <memory> namespace blink { @@ -106,7 +107,7 @@ typedef HashMap<AtomicString, CounterDirectives> CounterDirectiveMap; -PassOwnPtr<CounterDirectiveMap> clone(const CounterDirectiveMap&); +std::unique_ptr<CounterDirectiveMap> clone(const CounterDirectiveMap&); } // namespace blink
diff --git a/third_party/WebKit/Source/core/style/DataEquivalency.h b/third_party/WebKit/Source/core/style/DataEquivalency.h index b9b49370..b37b626 100644 --- a/third_party/WebKit/Source/core/style/DataEquivalency.h +++ b/third_party/WebKit/Source/core/style/DataEquivalency.h
@@ -5,8 +5,8 @@ #ifndef DataEquivalency_h #define DataEquivalency_h -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -44,7 +44,7 @@ } template <typename T> -bool dataEquivalent(const OwnPtr<T>& a, const OwnPtr<T>& b) +bool dataEquivalent(const std::unique_ptr<T>& a, const std::unique_ptr<T>& b) { return dataEquivalent(a.get(), b.get()); }
diff --git a/third_party/WebKit/Source/core/style/DataPersistent.h b/third_party/WebKit/Source/core/style/DataPersistent.h index b97a41a..e2a3118c7 100644 --- a/third_party/WebKit/Source/core/style/DataPersistent.h +++ b/third_party/WebKit/Source/core/style/DataPersistent.h
@@ -7,7 +7,8 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -36,7 +37,7 @@ : m_ownCopy(false) { if (other.m_data) - m_data = adoptPtr(new Persistent<T>(other.m_data->get())); + m_data = wrapUnique(new Persistent<T>(other.m_data->get())); // Invalidated, subsequent mutations will happen on a new copy. // @@ -62,7 +63,7 @@ void init() { ASSERT(!m_data); - m_data = adoptPtr(new Persistent<T>(T::create())); + m_data = wrapUnique(new Persistent<T>(T::create())); m_ownCopy = true; } @@ -83,7 +84,7 @@ void operator=(std::nullptr_t) { m_data.clear(); } private: // Reduce size of DataPersistent<> by delaying creation of Persistent<>. - OwnPtr<Persistent<T>> m_data; + std::unique_ptr<Persistent<T>> m_data; unsigned m_ownCopy:1; };
diff --git a/third_party/WebKit/Source/core/style/GridArea.h b/third_party/WebKit/Source/core/style/GridArea.h index 52c3d03..7a4e37ae 100644 --- a/third_party/WebKit/Source/core/style/GridArea.h +++ b/third_party/WebKit/Source/core/style/GridArea.h
@@ -34,7 +34,6 @@ #include "core/style/GridPositionsResolver.h" #include "wtf/Allocator.h" #include "wtf/HashMap.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" #include <algorithm>
diff --git a/third_party/WebKit/Source/core/style/SVGComputedStyleDefs.h b/third_party/WebKit/Source/core/style/SVGComputedStyleDefs.h index e2447cd..fc171a1 100644 --- a/third_party/WebKit/Source/core/style/SVGComputedStyleDefs.h +++ b/third_party/WebKit/Source/core/style/SVGComputedStyleDefs.h
@@ -33,8 +33,6 @@ #include "platform/Length.h" #include "platform/graphics/Color.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" #include "wtf/RefVector.h"
diff --git a/third_party/WebKit/Source/core/style/ShadowList.cpp b/third_party/WebKit/Source/core/style/ShadowList.cpp index 281d415..126b909 100644 --- a/third_party/WebKit/Source/core/style/ShadowList.cpp +++ b/third_party/WebKit/Source/core/style/ShadowList.cpp
@@ -31,7 +31,7 @@ #include "core/style/ShadowList.h" #include "platform/geometry/FloatRect.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -77,9 +77,9 @@ return ShadowList::adopt(shadows); } -PassOwnPtr<DrawLooperBuilder> ShadowList::createDrawLooper(DrawLooperBuilder::ShadowAlphaMode alphaMode, const Color& currentColor, bool isHorizontal) const +std::unique_ptr<DrawLooperBuilder> ShadowList::createDrawLooper(DrawLooperBuilder::ShadowAlphaMode alphaMode, const Color& currentColor, bool isHorizontal) const { - OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); for (size_t i = shadows().size(); i--; ) { const ShadowData& shadow = shadows()[i]; float shadowX = isHorizontal ? shadow.x() : shadow.y();
diff --git a/third_party/WebKit/Source/core/style/ShadowList.h b/third_party/WebKit/Source/core/style/ShadowList.h index 5172e92..0ddd80e 100644 --- a/third_party/WebKit/Source/core/style/ShadowList.h +++ b/third_party/WebKit/Source/core/style/ShadowList.h
@@ -36,9 +36,9 @@ #include "platform/geometry/FloatRectOutsets.h" #include "platform/geometry/LayoutRect.h" #include "platform/graphics/DrawLooperBuilder.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -68,7 +68,7 @@ void adjustRectForShadow(FloatRect&) const; - PassOwnPtr<DrawLooperBuilder> createDrawLooper(DrawLooperBuilder::ShadowAlphaMode, const Color& currentColor, bool isHorizontal = true) const; + std::unique_ptr<DrawLooperBuilder> createDrawLooper(DrawLooperBuilder::ShadowAlphaMode, const Color& currentColor, bool isHorizontal = true) const; private: ShadowList(ShadowDataVector& shadows)
diff --git a/third_party/WebKit/Source/core/style/StylePath.cpp b/third_party/WebKit/Source/core/style/StylePath.cpp index 397bc12..147919ac 100644 --- a/third_party/WebKit/Source/core/style/StylePath.cpp +++ b/third_party/WebKit/Source/core/style/StylePath.cpp
@@ -8,10 +8,12 @@ #include "core/svg/SVGPathByteStream.h" #include "core/svg/SVGPathUtilities.h" #include "platform/graphics/Path.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -StylePath::StylePath(PassOwnPtr<SVGPathByteStream> pathByteStream) +StylePath::StylePath(std::unique_ptr<SVGPathByteStream> pathByteStream) : m_byteStream(std::move(pathByteStream)) , m_pathLength(std::numeric_limits<float>::quiet_NaN()) { @@ -22,7 +24,7 @@ { } -PassRefPtr<StylePath> StylePath::create(PassOwnPtr<SVGPathByteStream> pathByteStream) +PassRefPtr<StylePath> StylePath::create(std::unique_ptr<SVGPathByteStream> pathByteStream) { return adoptRef(new StylePath(std::move(pathByteStream))); } @@ -36,7 +38,7 @@ const Path& StylePath::path() const { if (!m_path) { - m_path = adoptPtr(new Path); + m_path = wrapUnique(new Path); buildPathFromByteStream(*m_byteStream, *m_path); } return *m_path;
diff --git a/third_party/WebKit/Source/core/style/StylePath.h b/third_party/WebKit/Source/core/style/StylePath.h index 763caab..6fb672e 100644 --- a/third_party/WebKit/Source/core/style/StylePath.h +++ b/third_party/WebKit/Source/core/style/StylePath.h
@@ -6,10 +6,10 @@ #define StylePath_h #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -19,7 +19,7 @@ class StylePath : public RefCounted<StylePath> { public: - static PassRefPtr<StylePath> create(PassOwnPtr<SVGPathByteStream>); + static PassRefPtr<StylePath> create(std::unique_ptr<SVGPathByteStream>); ~StylePath(); static StylePath* emptyPath(); @@ -35,10 +35,10 @@ bool operator==(const StylePath&) const; private: - explicit StylePath(PassOwnPtr<SVGPathByteStream>); + explicit StylePath(std::unique_ptr<SVGPathByteStream>); - OwnPtr<SVGPathByteStream> m_byteStream; - mutable OwnPtr<Path> m_path; + std::unique_ptr<SVGPathByteStream> m_byteStream; + mutable std::unique_ptr<Path> m_path; mutable float m_pathLength; };
diff --git a/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h b/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h index 5f6563a7..5d9b9e2e4 100644 --- a/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h +++ b/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h
@@ -28,11 +28,11 @@ #include "core/CoreExport.h" #include "core/css/StyleColor.h" #include "core/layout/ClipPathOperation.h" +#include "core/style/ComputedStyleConstants.h" #include "core/style/CounterDirectives.h" #include "core/style/DataPersistent.h" #include "core/style/DataRef.h" #include "core/style/FillLayer.h" -#include "core/style/ComputedStyleConstants.h" #include "core/style/LineClampValue.h" #include "core/style/NinePieceImage.h" #include "core/style/ShapeValue.h" @@ -40,10 +40,10 @@ #include "core/style/StyleScrollSnapData.h" #include "core/style/StyleSelfAlignmentData.h" #include "platform/LengthPoint.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -123,9 +123,9 @@ DataRef<StyleScrollSnapData> m_scrollSnap; Persistent<ContentData> m_content; - OwnPtr<CounterDirectiveMap> m_counterDirectives; - OwnPtr<CSSAnimationData> m_animations; - OwnPtr<CSSTransitionData> m_transitions; + std::unique_ptr<CounterDirectiveMap> m_counterDirectives; + std::unique_ptr<CSSAnimationData> m_animations; + std::unique_ptr<CSSTransitionData> m_transitions; RefPtr<ShadowList> m_boxShadow;
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimateElement.h b/third_party/WebKit/Source/core/svg/SVGAnimateElement.h index 7a40781..b9d1c953 100644 --- a/third_party/WebKit/Source/core/svg/SVGAnimateElement.h +++ b/third_party/WebKit/Source/core/svg/SVGAnimateElement.h
@@ -28,7 +28,6 @@ #include "core/svg/SVGAnimatedTypeAnimator.h" #include "core/svg/SVGAnimationElement.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" #include <base/gtest_prod_util.h> namespace blink {
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.h b/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.h index 37eabf60..5f2cbca 100644 --- a/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.h +++ b/third_party/WebKit/Source/core/svg/SVGAnimatedTypeAnimator.h
@@ -23,7 +23,6 @@ #include "core/svg/properties/SVGPropertyInfo.h" #include "platform/heap/Handle.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.h b/third_party/WebKit/Source/core/svg/SVGElement.h index 4f68a87..a134ab3d 100644 --- a/third_party/WebKit/Source/core/svg/SVGElement.h +++ b/third_party/WebKit/Source/core/svg/SVGElement.h
@@ -30,7 +30,6 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/svg/SVGPath.cpp b/third_party/WebKit/Source/core/svg/SVGPath.cpp index 4784626..e9f3137 100644 --- a/third_party/WebKit/Source/core/svg/SVGPath.cpp +++ b/third_party/WebKit/Source/core/svg/SVGPath.cpp
@@ -30,14 +30,15 @@ #include "core/svg/SVGPathByteStreamSource.h" #include "core/svg/SVGPathUtilities.h" #include "platform/graphics/Path.h" +#include <memory> namespace blink { namespace { -PassOwnPtr<SVGPathByteStream> blendPathByteStreams(const SVGPathByteStream& fromStream, const SVGPathByteStream& toStream, float progress) +std::unique_ptr<SVGPathByteStream> blendPathByteStreams(const SVGPathByteStream& fromStream, const SVGPathByteStream& toStream, float progress) { - OwnPtr<SVGPathByteStream> resultStream = SVGPathByteStream::create(); + std::unique_ptr<SVGPathByteStream> resultStream = SVGPathByteStream::create(); SVGPathByteStreamBuilder builder(*resultStream); SVGPathByteStreamSource fromSource(fromStream); SVGPathByteStreamSource toSource(toStream); @@ -46,9 +47,9 @@ return resultStream; } -PassOwnPtr<SVGPathByteStream> addPathByteStreams(const SVGPathByteStream& fromStream, const SVGPathByteStream& byStream, unsigned repeatCount = 1) +std::unique_ptr<SVGPathByteStream> addPathByteStreams(const SVGPathByteStream& fromStream, const SVGPathByteStream& byStream, unsigned repeatCount = 1) { - OwnPtr<SVGPathByteStream> resultStream = SVGPathByteStream::create(); + std::unique_ptr<SVGPathByteStream> resultStream = SVGPathByteStream::create(); SVGPathByteStreamBuilder builder(*resultStream); SVGPathByteStreamSource fromSource(fromStream); SVGPathByteStreamSource bySource(byStream); @@ -57,7 +58,7 @@ return resultStream; } -PassOwnPtr<SVGPathByteStream> conditionallyAddPathByteStreams(PassOwnPtr<SVGPathByteStream> fromStream, const SVGPathByteStream& byStream, unsigned repeatCount = 1) +std::unique_ptr<SVGPathByteStream> conditionallyAddPathByteStreams(std::unique_ptr<SVGPathByteStream> fromStream, const SVGPathByteStream& byStream, unsigned repeatCount = 1) { if (fromStream->isEmpty() || byStream.isEmpty()) return fromStream; @@ -91,7 +92,7 @@ SVGParsingError SVGPath::setValueAsString(const String& string) { - OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); + std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); SVGParsingError parseStatus = buildByteStreamFromString(string, *byteStream); m_pathValue = CSSPathValue::create(std::move(byteStream)); return parseStatus; @@ -99,7 +100,7 @@ SVGPropertyBase* SVGPath::cloneForAnimation(const String& value) const { - OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); + std::unique_ptr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); buildByteStreamFromString(value, *byteStream); return SVGPath::create(CSSPathValue::create(std::move(byteStream))); } @@ -130,7 +131,7 @@ const SVGPath& from = toSVGPath(*fromValue); const SVGPathByteStream* fromStream = &from.byteStream(); - OwnPtr<SVGPathByteStream> copy; + std::unique_ptr<SVGPathByteStream> copy; if (isToAnimation) { copy = byteStream().clone(); fromStream = copy.get(); @@ -149,7 +150,7 @@ } } - OwnPtr<SVGPathByteStream> newStream = blendPathByteStreams(*fromStream, toStream, percentage); + std::unique_ptr<SVGPathByteStream> newStream = blendPathByteStreams(*fromStream, toStream, percentage); // Handle additive='sum'. if (animationElement->isAdditive() && !isToAnimation)
diff --git a/third_party/WebKit/Source/core/svg/SVGPathByteStream.h b/third_party/WebKit/Source/core/svg/SVGPathByteStream.h index 31ac395..980bc20c 100644 --- a/third_party/WebKit/Source/core/svg/SVGPathByteStream.h +++ b/third_party/WebKit/Source/core/svg/SVGPathByteStream.h
@@ -21,8 +21,9 @@ #define SVGPathByteStream_h #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -35,14 +36,14 @@ class SVGPathByteStream { USING_FAST_MALLOC(SVGPathByteStream); public: - static PassOwnPtr<SVGPathByteStream> create() + static std::unique_ptr<SVGPathByteStream> create() { - return adoptPtr(new SVGPathByteStream); + return wrapUnique(new SVGPathByteStream); } - PassOwnPtr<SVGPathByteStream> clone() const + std::unique_ptr<SVGPathByteStream> clone() const { - return adoptPtr(new SVGPathByteStream(m_data)); + return wrapUnique(new SVGPathByteStream(m_data)); } typedef Vector<unsigned char> Data;
diff --git a/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp b/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp index 27cccf53a..8a8aaea 100644 --- a/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp +++ b/third_party/WebKit/Source/core/svg/UnsafeSVGAttributeSanitizationTest.cpp
@@ -27,6 +27,7 @@ #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/WTFString.h" +#include <memory> // Test that SVG content with JavaScript URLs is sanitized by removing // the URLs. This sanitization happens when the content is pasted or @@ -76,7 +77,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptHrefIsStripped) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " width='1cm' height='1cm'>" @@ -98,7 +99,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptXlinkHrefIsStripped) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " xmlns:xlink='http://www.w3.org/1999/xlink'" @@ -121,7 +122,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptHrefIsStripped_caseAndEntityInProtocol) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " width='1cm' height='1cm'>" @@ -143,7 +144,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptXlinkHrefIsStripped_caseAndEntityInProtocol) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " xmlns:xlink='http://www.w3.org/1999/xlink'" @@ -166,7 +167,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptHrefIsStripped_entityWithoutSemicolonInProtocol) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " width='1cm' height='1cm'>" @@ -188,7 +189,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnchor_javaScriptXlinkHrefIsStripped_entityWithoutSemicolonInProtocol) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " xmlns:xlink='http://www.w3.org/1999/xlink'" @@ -216,7 +217,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnimatedAnchor_javaScriptHrefIsStripped_caseAndEntityInProtocol) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " width='1cm' height='1cm'>" @@ -240,7 +241,7 @@ UnsafeSVGAttributeSanitizationTest, pasteAnimatedAnchor_javaScriptXlinkHrefIsStripped_caseAndEntityInProtocol) { - OwnPtr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); + std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(IntSize(1, 1)); static const char unsafeContent[] = "<svg xmlns='http://www.w3.org/2000/svg' " " xmlns:xlink='http://www.w3.org/1999/xlink'"
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp index 2893343..0a9074f 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp
@@ -31,6 +31,7 @@ #include "core/svg/graphics/SVGImage.h" #include "platform/graphics/ImageObserver.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -39,7 +40,7 @@ SVGImageChromeClient::SVGImageChromeClient(SVGImage* image) : m_image(image) , m_animationTimer( - adoptPtr(new Timer<SVGImageChromeClient>( + wrapUnique(new Timer<SVGImageChromeClient>( this, &SVGImageChromeClient::animationTimerFired))) , m_timelineState(Running) { @@ -113,7 +114,7 @@ void SVGImageChromeClient::setTimer(Timer<SVGImageChromeClient>* timer) { - m_animationTimer = adoptPtr(timer); + m_animationTimer = wrapUnique(timer); } void SVGImageChromeClient::animationTimerFired(Timer<SVGImageChromeClient>*)
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h index 32a2a3b..35e6148 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h
@@ -33,6 +33,7 @@ #include "core/CoreExport.h" #include "core/loader/EmptyClients.h" #include "platform/Timer.h" +#include <memory> namespace blink { @@ -61,7 +62,7 @@ void animationTimerFired(Timer<SVGImageChromeClient>*); SVGImage* m_image; - OwnPtr<Timer<SVGImageChromeClient>> m_animationTimer; + std::unique_ptr<Timer<SVGImageChromeClient>> m_animationTimer; enum { Running, Suspended,
diff --git a/third_party/WebKit/Source/core/testing/DummyPageHolder.cpp b/third_party/WebKit/Source/core/testing/DummyPageHolder.cpp index 6747c7ee..a95add4 100644 --- a/third_party/WebKit/Source/core/testing/DummyPageHolder.cpp +++ b/third_party/WebKit/Source/core/testing/DummyPageHolder.cpp
@@ -38,6 +38,8 @@ #include "core/frame/VisualViewport.h" #include "core/loader/EmptyClients.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -46,12 +48,12 @@ settings.setRootLayerScrolls(true); } -PassOwnPtr<DummyPageHolder> DummyPageHolder::create( +std::unique_ptr<DummyPageHolder> DummyPageHolder::create( const IntSize& initialViewSize, Page::PageClients* pageClients, FrameLoaderClient* frameLoaderClient, FrameSettingOverrideFunction settingOverrider) { - return adoptPtr(new DummyPageHolder(initialViewSize, pageClients, frameLoaderClient, settingOverrider)); + return wrapUnique(new DummyPageHolder(initialViewSize, pageClients, frameLoaderClient, settingOverrider)); } DummyPageHolder::DummyPageHolder(
diff --git a/third_party/WebKit/Source/core/testing/DummyPageHolder.h b/third_party/WebKit/Source/core/testing/DummyPageHolder.h index 67257e8..5704e1ef 100644 --- a/third_party/WebKit/Source/core/testing/DummyPageHolder.h +++ b/third_party/WebKit/Source/core/testing/DummyPageHolder.h
@@ -37,8 +37,7 @@ #include "platform/heap/Handle.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -65,7 +64,7 @@ WTF_MAKE_NONCOPYABLE(DummyPageHolder); USING_FAST_MALLOC(DummyPageHolder); public: - static PassOwnPtr<DummyPageHolder> create( + static std::unique_ptr<DummyPageHolder> create( const IntSize& initialViewSize = IntSize(), Page::PageClients* = 0, FrameLoaderClient* = nullptr,
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp index 20d5a45..8e01970 100644 --- a/third_party/WebKit/Source/core/testing/Internals.cpp +++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -145,10 +145,11 @@ #include "public/platform/WebGraphicsContext3DProvider.h" #include "public/platform/WebLayer.h" #include "wtf/InstanceCounter.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/dtoa.h" #include "wtf/text/StringBuffer.h" #include <deque> +#include <memory> #include <v8.h> namespace blink { @@ -1473,7 +1474,7 @@ Vector<AtomicString> Internals::htmlTags() { Vector<AtomicString> tags(HTMLNames::HTMLTagsCount); - OwnPtr<const HTMLQualifiedName*[]> qualifiedNames = HTMLNames::getHTMLTags(); + std::unique_ptr<const HTMLQualifiedName*[]> qualifiedNames = HTMLNames::getHTMLTags(); for (size_t i = 0; i < HTMLNames::HTMLTagsCount; ++i) tags[i] = qualifiedNames[i]->localName(); return tags; @@ -1487,7 +1488,7 @@ Vector<AtomicString> Internals::svgTags() { Vector<AtomicString> tags(SVGNames::SVGTagsCount); - OwnPtr<const SVGQualifiedName*[]> qualifiedNames = SVGNames::getSVGTags(); + std::unique_ptr<const SVGQualifiedName*[]> qualifiedNames = SVGNames::getSVGTags(); for (size_t i = 0; i < SVGNames::SVGTagsCount; ++i) tags[i] = qualifiedNames[i]->localName(); return tags; @@ -2219,7 +2220,7 @@ bool Internals::loseSharedGraphicsContext3D() { - OwnPtr<WebGraphicsContext3DProvider> sharedProvider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + std::unique_ptr<WebGraphicsContext3DProvider> sharedProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!sharedProvider) return false; gpu::gles2::GLES2Interface* sharedGL = sharedProvider->contextGL();
diff --git a/third_party/WebKit/Source/core/testing/NullExecutionContext.h b/third_party/WebKit/Source/core/testing/NullExecutionContext.h index 10a4500f..f9847e99 100644 --- a/third_party/WebKit/Source/core/testing/NullExecutionContext.h +++ b/third_party/WebKit/Source/core/testing/NullExecutionContext.h
@@ -12,6 +12,7 @@ #include "core/inspector/ConsoleMessage.h" #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" +#include <memory> namespace blink { @@ -37,7 +38,7 @@ DOMTimerCoordinator* timers() override { return nullptr; } void addConsoleMessage(ConsoleMessage*) override { } - void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) override { } + void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) override { } void setIsSecureContext(bool); bool isSecureContext(String& errorMessage, const SecureContextCheck = StandardSecureContextCheck) const override;
diff --git a/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp b/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp index d45a90db..2c71ba8 100644 --- a/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp +++ b/third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp
@@ -10,6 +10,7 @@ #include "bindings/core/v8/V8PrivateScriptTest.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> // PrivateScriptTest.js is available only in debug builds. #ifndef NDEBUG
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp index 846935f..d0f92280 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp
@@ -41,10 +41,11 @@ #include "core/workers/InProcessWorkerObjectProxy.h" #include "core/workers/WorkerClients.h" #include "core/workers/WorkerThreadStartupData.h" +#include <memory> namespace blink { -DedicatedWorkerGlobalScope* DedicatedWorkerGlobalScope::create(DedicatedWorkerThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData, double timeOrigin) +DedicatedWorkerGlobalScope* DedicatedWorkerGlobalScope::create(DedicatedWorkerThread* thread, std::unique_ptr<WorkerThreadStartupData> startupData, double timeOrigin) { // Note: startupData is finalized on return. After the relevant parts has been // passed along to the created 'context'. @@ -55,7 +56,7 @@ return context; } -DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) +DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) : WorkerGlobalScope(url, userAgent, thread, timeOrigin, std::move(starterOriginPrivilegeData), workerClients) { } @@ -72,7 +73,7 @@ void DedicatedWorkerGlobalScope::postMessage(ExecutionContext* context, PassRefPtr<SerializedScriptValue> message, const MessagePortArray& ports, ExceptionState& exceptionState) { // Disentangle the port in preparation for sending it to the remote context. - OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); + std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); if (exceptionState.hadException()) return; thread()->workerObjectProxy().postMessageToWorkerObject(message, std::move(channels));
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h index a933cd50..5628e4f 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h
@@ -35,6 +35,7 @@ #include "core/dom/MessagePort.h" #include "core/workers/WorkerGlobalScope.h" #include "platform/heap/Visitor.h" +#include <memory> namespace blink { @@ -44,7 +45,7 @@ class CORE_EXPORT DedicatedWorkerGlobalScope final : public WorkerGlobalScope { DEFINE_WRAPPERTYPEINFO(); public: - static DedicatedWorkerGlobalScope* create(DedicatedWorkerThread*, PassOwnPtr<WorkerThreadStartupData>, double timeOrigin); + static DedicatedWorkerGlobalScope* create(DedicatedWorkerThread*, std::unique_ptr<WorkerThreadStartupData>, double timeOrigin); ~DedicatedWorkerGlobalScope() override; bool isDedicatedWorkerGlobalScope() const override { return true; } @@ -63,7 +64,7 @@ DECLARE_VIRTUAL_TRACE(); private: - DedicatedWorkerGlobalScope(const KURL&, const String& userAgent, DedicatedWorkerThread*, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData>, WorkerClients*); + DedicatedWorkerGlobalScope(const KURL&, const String& userAgent, DedicatedWorkerThread*, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp index 8df33e8f..41b1db6 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp
@@ -6,6 +6,7 @@ #include "core/workers/DedicatedWorkerThread.h" #include "core/workers/WorkerClients.h" +#include <memory> namespace blink { @@ -18,7 +19,7 @@ { } -PassOwnPtr<WorkerThread> DedicatedWorkerMessagingProxy::createWorkerThread(double originTime) +std::unique_ptr<WorkerThread> DedicatedWorkerMessagingProxy::createWorkerThread(double originTime) { return DedicatedWorkerThread::create(loaderProxy(), workerObjectProxy(), originTime); }
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h index 941e069..3824a390 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.h
@@ -7,6 +7,7 @@ #include "core/CoreExport.h" #include "core/workers/InProcessWorkerMessagingProxy.h" +#include <memory> namespace blink { @@ -17,7 +18,7 @@ DedicatedWorkerMessagingProxy(InProcessWorkerBase*, WorkerClients*); ~DedicatedWorkerMessagingProxy() override; - PassOwnPtr<WorkerThread> createWorkerThread(double originTime) override; + std::unique_ptr<WorkerThread> createWorkerThread(double originTime) override; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp index 896d18da..7f74489 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp
@@ -34,12 +34,14 @@ #include "core/workers/InProcessWorkerObjectProxy.h" #include "core/workers/WorkerBackingThread.h" #include "core/workers/WorkerThreadStartupData.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<DedicatedWorkerThread> DedicatedWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) +std::unique_ptr<DedicatedWorkerThread> DedicatedWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) { - return adoptPtr(new DedicatedWorkerThread(workerLoaderProxy, workerObjectProxy, timeOrigin)); + return wrapUnique(new DedicatedWorkerThread(workerLoaderProxy, workerObjectProxy, timeOrigin)); } DedicatedWorkerThread::DedicatedWorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) @@ -54,7 +56,7 @@ { } -WorkerGlobalScope* DedicatedWorkerThread::createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData> startupData) +WorkerGlobalScope* DedicatedWorkerThread::createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData> startupData) { return DedicatedWorkerGlobalScope::create(this, std::move(startupData), m_timeOrigin); }
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h index a6fa87d..bc062678 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h
@@ -31,6 +31,7 @@ #define DedicatedWorkerThread_h #include "core/workers/WorkerThread.h" +#include <memory> namespace blink { @@ -39,20 +40,20 @@ class DedicatedWorkerThread final : public WorkerThread { public: - static PassOwnPtr<DedicatedWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); + static std::unique_ptr<DedicatedWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); ~DedicatedWorkerThread() override; WorkerBackingThread& workerBackingThread() override { return *m_workerBackingThread; } InProcessWorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; } protected: - WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override; + WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) override; void postInitialize() override; private: DedicatedWorkerThread(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); - OwnPtr<WorkerBackingThread> m_workerBackingThread; + std::unique_ptr<WorkerBackingThread> m_workerBackingThread; InProcessWorkerObjectProxy& m_workerObjectProxy; double m_timeOrigin; };
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerBase.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerBase.cpp index 472928b..6990487f 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerBase.cpp +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerBase.cpp
@@ -14,6 +14,7 @@ #include "core/workers/WorkerScriptLoader.h" #include "core/workers/WorkerThread.h" #include "platform/network/ContentSecurityPolicyResponseHeaders.h" +#include <memory> namespace blink { @@ -36,7 +37,7 @@ { DCHECK(m_contextProxy); // Disentangle the port in preparation for sending it to the remote context. - OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); + std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); if (exceptionState.hadException()) return; m_contextProxy->postMessageToWorkerGlobalScope(message, std::move(channels));
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerGlobalScopeProxy.h b/third_party/WebKit/Source/core/workers/InProcessWorkerGlobalScopeProxy.h index 419ae2d..0022c07 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerGlobalScopeProxy.h +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerGlobalScopeProxy.h
@@ -35,7 +35,7 @@ #include "core/dom/MessagePort.h" #include "core/workers/WorkerThread.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -51,7 +51,7 @@ virtual void terminateWorkerGlobalScope() = 0; - virtual void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>) = 0; + virtual void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue>, std::unique_ptr<MessagePortChannelArray>) = 0; virtual bool hasPendingActivity() const = 0;
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp index 29f1480..efc696f2 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp
@@ -47,18 +47,19 @@ #include "core/workers/WorkerInspectorProxy.h" #include "core/workers/WorkerThreadStartupData.h" #include "wtf/WTF.h" +#include <memory> namespace blink { namespace { -void processUnhandledExceptionOnWorkerGlobalScope(const String& errorMessage, PassOwnPtr<SourceLocation> location, ExecutionContext* scriptContext) +void processUnhandledExceptionOnWorkerGlobalScope(const String& errorMessage, std::unique_ptr<SourceLocation> location, ExecutionContext* scriptContext) { WorkerGlobalScope* globalScope = toWorkerGlobalScope(scriptContext); globalScope->exceptionUnhandled(errorMessage, std::move(location)); } -void processMessageOnWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels, InProcessWorkerObjectProxy* workerObjectProxy, ExecutionContext* scriptContext) +void processMessageOnWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels, InProcessWorkerObjectProxy* workerObjectProxy, ExecutionContext* scriptContext) { WorkerGlobalScope* globalScope = toWorkerGlobalScope(scriptContext); MessagePortArray* ports = MessagePort::entanglePorts(*scriptContext, std::move(channels)); @@ -117,7 +118,7 @@ DCHECK(csp); WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(document); - OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode, nullptr, startMode, csp->headers().get(), starterOrigin, m_workerClients.release(), document->addressSpace(), OriginTrialContext::getTokens(document).get()); + std::unique_ptr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode, nullptr, startMode, csp->headers().get(), starterOrigin, m_workerClients.release(), document->addressSpace(), OriginTrialContext::getTokens(document).get()); double originTime = document->loader() ? document->loader()->timing().referenceMonotonicTime() : monotonicallyIncreasingTime(); m_loaderProxy = WorkerLoaderProxy::create(this); @@ -127,7 +128,7 @@ m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL); } -void InProcessWorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels) +void InProcessWorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels) { DCHECK(isParentContextThread()); if (!m_workerObject || m_askedToTerminate) @@ -137,7 +138,7 @@ m_workerObject->dispatchEvent(MessageEvent::create(ports, message)); } -void InProcessWorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels) +void InProcessWorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels) { DCHECK(isParentContextThread()); if (m_askedToTerminate) @@ -168,7 +169,7 @@ getExecutionContext()->postTask(BLINK_FROM_HERE, std::move(task)); } -void InProcessWorkerMessagingProxy::reportException(const String& errorMessage, PassOwnPtr<SourceLocation> location) +void InProcessWorkerMessagingProxy::reportException(const String& errorMessage, std::unique_ptr<SourceLocation> location) { DCHECK(isParentContextThread()); if (!m_workerObject) @@ -185,7 +186,7 @@ postTaskToWorkerGlobalScope(createCrossThreadTask(&processUnhandledExceptionOnWorkerGlobalScope, errorMessage, passed(std::move(location)))); } -void InProcessWorkerMessagingProxy::reportConsoleMessage(MessageSource source, MessageLevel level, const String& message, PassOwnPtr<SourceLocation> location) +void InProcessWorkerMessagingProxy::reportConsoleMessage(MessageSource source, MessageLevel level, const String& message, std::unique_ptr<SourceLocation> location) { DCHECK(isParentContextThread()); if (m_askedToTerminate)
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h index 54543993..27722da 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h
@@ -34,10 +34,10 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -60,15 +60,15 @@ // (Only use these methods in the parent context thread.) void startWorkerGlobalScope(const KURL& scriptURL, const String& userAgent, const String& sourceCode) override; void terminateWorkerGlobalScope() override; - void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>) override; + void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue>, std::unique_ptr<MessagePortChannelArray>) override; bool hasPendingActivity() const final; void workerObjectDestroyed() override; // These methods come from worker context thread via // InProcessWorkerObjectProxy and are called on the parent context thread. - void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>); - void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>); - void reportConsoleMessage(MessageSource, MessageLevel, const String& message, PassOwnPtr<SourceLocation>); + void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, std::unique_ptr<MessagePortChannelArray>); + void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>); + void reportConsoleMessage(MessageSource, MessageLevel, const String& message, std::unique_ptr<SourceLocation>); void postMessageToPageInspector(const String&); void postWorkerConsoleAgentEnabled(); void confirmMessageFromWorkerObject(bool hasPendingActivity); @@ -85,7 +85,7 @@ InProcessWorkerMessagingProxy(InProcessWorkerBase*, WorkerClients*); ~InProcessWorkerMessagingProxy() override; - virtual PassOwnPtr<WorkerThread> createWorkerThread(double originTime) = 0; + virtual std::unique_ptr<WorkerThread> createWorkerThread(double originTime) = 0; PassRefPtr<WorkerLoaderProxy> loaderProxy() { return m_loaderProxy; } InProcessWorkerObjectProxy& workerObjectProxy() { return *m_workerObjectProxy.get(); } @@ -104,10 +104,10 @@ bool isParentContextThread() const; Persistent<ExecutionContext> m_executionContext; - OwnPtr<InProcessWorkerObjectProxy> m_workerObjectProxy; + std::unique_ptr<InProcessWorkerObjectProxy> m_workerObjectProxy; WeakPersistent<InProcessWorkerBase> m_workerObject; bool m_mayBeDestroyed; - OwnPtr<WorkerThread> m_workerThread; + std::unique_ptr<WorkerThread> m_workerThread; // Unconfirmed messages from the parent context thread to the worker thread. unsigned m_unconfirmedMessageCount;
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp index 83d8baedd..d183e1e 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
@@ -37,16 +37,18 @@ #include "core/inspector/ConsoleMessage.h" #include "core/workers/InProcessWorkerMessagingProxy.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<InProcessWorkerObjectProxy> InProcessWorkerObjectProxy::create(InProcessWorkerMessagingProxy* messagingProxy) +std::unique_ptr<InProcessWorkerObjectProxy> InProcessWorkerObjectProxy::create(InProcessWorkerMessagingProxy* messagingProxy) { DCHECK(messagingProxy); - return adoptPtr(new InProcessWorkerObjectProxy(messagingProxy)); + return wrapUnique(new InProcessWorkerObjectProxy(messagingProxy)); } -void InProcessWorkerObjectProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels) +void InProcessWorkerObjectProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels) { getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::postMessageToWorkerObject, AllowCrossThreadAccess(m_messagingProxy), message, passed(std::move(channels)))); } @@ -66,7 +68,7 @@ getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportPendingActivity, AllowCrossThreadAccess(m_messagingProxy), hasPendingActivity)); } -void InProcessWorkerObjectProxy::reportException(const String& errorMessage, PassOwnPtr<SourceLocation> location) +void InProcessWorkerObjectProxy::reportException(const String& errorMessage, std::unique_ptr<SourceLocation> location) { getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportException, AllowCrossThreadAccess(m_messagingProxy), errorMessage, passed(std::move(location)))); }
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h index 111f10e..1bfe52a 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
@@ -35,8 +35,8 @@ #include "core/dom/MessagePort.h" #include "core/workers/WorkerReportingProxy.h" #include "platform/heap/Handle.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include <memory> namespace blink { @@ -55,16 +55,16 @@ USING_FAST_MALLOC(InProcessWorkerObjectProxy); WTF_MAKE_NONCOPYABLE(InProcessWorkerObjectProxy); public: - static PassOwnPtr<InProcessWorkerObjectProxy> create(InProcessWorkerMessagingProxy*); + static std::unique_ptr<InProcessWorkerObjectProxy> create(InProcessWorkerMessagingProxy*); ~InProcessWorkerObjectProxy() override { } - void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>); + void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, std::unique_ptr<MessagePortChannelArray>); void postTaskToMainExecutionContext(std::unique_ptr<ExecutionContextTask>); void confirmMessageFromWorkerObject(bool hasPendingActivity); void reportPendingActivity(bool hasPendingActivity); // WorkerReportingProxy overrides. - void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) override; + void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) override; void reportConsoleMessage(ConsoleMessage*) override; void postMessageToPageInspector(const String&) override; void postWorkerConsoleAgentEnabled() override;
diff --git a/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.cpp b/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.cpp index b299a80..e3fd264b 100644 --- a/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.cpp
@@ -32,12 +32,13 @@ #include "bindings/core/v8/SourceLocation.h" #include "core/events/MessageEvent.h" -#include "core/inspector/ConsoleMessage.h" #include "core/frame/LocalDOMWindow.h" +#include "core/inspector/ConsoleMessage.h" #include "core/origin_trials/OriginTrialContext.h" #include "core/workers/SharedWorkerThread.h" #include "core/workers/WorkerClients.h" #include "wtf/CurrentTime.h" +#include <memory> namespace blink { @@ -49,7 +50,7 @@ } // static -SharedWorkerGlobalScope* SharedWorkerGlobalScope::create(const String& name, SharedWorkerThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData) +SharedWorkerGlobalScope* SharedWorkerGlobalScope::create(const String& name, SharedWorkerThread* thread, std::unique_ptr<WorkerThreadStartupData> startupData) { // Note: startupData is finalized on return. After the relevant parts has been // passed along to the created 'context'. @@ -60,7 +61,7 @@ return context; } -SharedWorkerGlobalScope::SharedWorkerGlobalScope(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) +SharedWorkerGlobalScope::SharedWorkerGlobalScope(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) : WorkerGlobalScope(url, userAgent, thread, monotonicallyIncreasingTime(), std::move(starterOriginPrivilegeData), workerClients) , m_name(name) { @@ -80,7 +81,7 @@ return static_cast<SharedWorkerThread*>(Base::thread()); } -void SharedWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation> location) +void SharedWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation> location) { WorkerGlobalScope::logExceptionToConsole(errorMessage, location->clone()); ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location));
diff --git a/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.h b/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.h index 22bcfb0..4879f9a 100644 --- a/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.h +++ b/third_party/WebKit/Source/core/workers/SharedWorkerGlobalScope.h
@@ -36,6 +36,7 @@ #include "core/workers/WorkerGlobalScope.h" #include "core/workers/WorkerThreadStartupData.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -46,7 +47,7 @@ DEFINE_WRAPPERTYPEINFO(); public: typedef WorkerGlobalScope Base; - static SharedWorkerGlobalScope* create(const String& name, SharedWorkerThread*, PassOwnPtr<WorkerThreadStartupData>); + static SharedWorkerGlobalScope* create(const String& name, SharedWorkerThread*, std::unique_ptr<WorkerThreadStartupData>); ~SharedWorkerGlobalScope() override; bool isSharedWorkerGlobalScope() const override { return true; } @@ -63,8 +64,8 @@ DECLARE_VIRTUAL_TRACE(); private: - SharedWorkerGlobalScope(const String& name, const KURL&, const String& userAgent, SharedWorkerThread*, PassOwnPtr<SecurityOrigin::PrivilegeData>, WorkerClients*); - void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) override; + SharedWorkerGlobalScope(const String& name, const KURL&, const String& userAgent, SharedWorkerThread*, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); + void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) override; String m_name; };
diff --git a/third_party/WebKit/Source/core/workers/SharedWorkerThread.cpp b/third_party/WebKit/Source/core/workers/SharedWorkerThread.cpp index 14c6875f..2b7b851f 100644 --- a/third_party/WebKit/Source/core/workers/SharedWorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/SharedWorkerThread.cpp
@@ -33,12 +33,14 @@ #include "core/workers/SharedWorkerGlobalScope.h" #include "core/workers/WorkerBackingThread.h" #include "core/workers/WorkerThreadStartupData.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) +std::unique_ptr<SharedWorkerThread> SharedWorkerThread::create(const String& name, PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) { - return adoptPtr(new SharedWorkerThread(name, workerLoaderProxy, workerReportingProxy)); + return wrapUnique(new SharedWorkerThread(name, workerLoaderProxy, workerReportingProxy)); } SharedWorkerThread::SharedWorkerThread(const String& name, PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) @@ -52,7 +54,7 @@ { } -WorkerGlobalScope* SharedWorkerThread::createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData> startupData) +WorkerGlobalScope* SharedWorkerThread::createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData> startupData) { return SharedWorkerGlobalScope::create(m_name, this, std::move(startupData)); }
diff --git a/third_party/WebKit/Source/core/workers/SharedWorkerThread.h b/third_party/WebKit/Source/core/workers/SharedWorkerThread.h index 0945805..c0286d0 100644 --- a/third_party/WebKit/Source/core/workers/SharedWorkerThread.h +++ b/third_party/WebKit/Source/core/workers/SharedWorkerThread.h
@@ -33,6 +33,7 @@ #include "core/CoreExport.h" #include "core/frame/csp/ContentSecurityPolicy.h" #include "core/workers/WorkerThread.h" +#include <memory> namespace blink { @@ -40,18 +41,18 @@ class CORE_EXPORT SharedWorkerThread : public WorkerThread { public: - static PassOwnPtr<SharedWorkerThread> create(const String& name, PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); + static std::unique_ptr<SharedWorkerThread> create(const String& name, PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); ~SharedWorkerThread() override; WorkerBackingThread& workerBackingThread() override { return *m_workerBackingThread; } protected: - WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override; + WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) override; private: SharedWorkerThread(const String& name, PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); - OwnPtr<WorkerBackingThread> m_workerBackingThread; + std::unique_ptr<WorkerBackingThread> m_workerBackingThread; String m_name; };
diff --git a/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp b/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp index 0c7ae4e..168e6d3 100644 --- a/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp
@@ -14,6 +14,8 @@ #include "platform/WebThreadSupportingGC.h" #include "public/platform/Platform.h" #include "public/platform/WebTraceLocation.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -71,13 +73,13 @@ V8Initializer::initializeWorker(m_isolate); m_backingThread->initialize(); - OwnPtr<V8IsolateInterruptor> interruptor = adoptPtr(new V8IsolateInterruptor(m_isolate)); + std::unique_ptr<V8IsolateInterruptor> interruptor = wrapUnique(new V8IsolateInterruptor(m_isolate)); ThreadState::current()->addInterruptor(std::move(interruptor)); ThreadState::current()->registerTraceDOMWrappers(m_isolate, V8GCController::traceDOMWrappers, nullptr); if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) - V8PerIsolateData::enableIdleTasks(m_isolate, adoptPtr(new V8IdleTaskRunner(backingThread().platformThread().scheduler()))); + V8PerIsolateData::enableIdleTasks(m_isolate, wrapUnique(new V8IdleTaskRunner(backingThread().platformThread().scheduler()))); if (m_isOwningThread) Platform::current()->didStartWorkerThread(); }
diff --git a/third_party/WebKit/Source/core/workers/WorkerBackingThread.h b/third_party/WebKit/Source/core/workers/WorkerBackingThread.h index 389586706..6fc1627 100644 --- a/third_party/WebKit/Source/core/workers/WorkerBackingThread.h +++ b/third_party/WebKit/Source/core/workers/WorkerBackingThread.h
@@ -7,9 +7,9 @@ #include "core/CoreExport.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> #include <v8.h> namespace blink { @@ -27,13 +27,13 @@ // WorkerGlobalScopes) can share one WorkerBackingThread. class CORE_EXPORT WorkerBackingThread final { public: - static PassOwnPtr<WorkerBackingThread> create(const char* name) { return adoptPtr(new WorkerBackingThread(name, false)); } - static PassOwnPtr<WorkerBackingThread> create(WebThread* thread) { return adoptPtr(new WorkerBackingThread(thread, false)); } + static std::unique_ptr<WorkerBackingThread> create(const char* name) { return wrapUnique(new WorkerBackingThread(name, false)); } + static std::unique_ptr<WorkerBackingThread> create(WebThread* thread) { return wrapUnique(new WorkerBackingThread(thread, false)); } // These are needed to suppress leak reports. See // https://crbug.com/590802 and https://crbug.com/v8/1428. - static PassOwnPtr<WorkerBackingThread> createForTest(const char* name) { return adoptPtr(new WorkerBackingThread(name, true)); } - static PassOwnPtr<WorkerBackingThread> createForTest(WebThread* thread) { return adoptPtr(new WorkerBackingThread(thread, true)); } + static std::unique_ptr<WorkerBackingThread> createForTest(const char* name) { return wrapUnique(new WorkerBackingThread(name, true)); } + static std::unique_ptr<WorkerBackingThread> createForTest(WebThread* thread) { return wrapUnique(new WorkerBackingThread(thread, true)); } ~WorkerBackingThread(); @@ -59,7 +59,7 @@ WorkerBackingThread(const char* name, bool shouldCallGCOnShutdown); WorkerBackingThread(WebThread*, bool shouldCallGCOnSHutdown); - OwnPtr<WebThreadSupportingGC> m_backingThread; + std::unique_ptr<WebThreadSupportingGC> m_backingThread; v8::Isolate* m_isolate = nullptr; bool m_isOwningThread; bool m_shouldCallGCOnShutdown;
diff --git a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp index c1b11f5..e5b8fe1 100644 --- a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
@@ -53,7 +53,6 @@ #include "core/inspector/InspectorConsoleInstrumentation.h" #include "core/inspector/WorkerInspectorController.h" #include "core/loader/WorkerThreadableLoader.h" -#include "core/workers/WorkerNavigator.h" #include "core/workers/WorkerClients.h" #include "core/workers/WorkerLoaderProxy.h" #include "core/workers/WorkerLocation.h" @@ -67,10 +66,11 @@ #include "public/platform/Platform.h" #include "public/platform/WebScheduler.h" #include "public/platform/WebURLRequest.h" +#include <memory> namespace blink { -WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThread* thread, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilageData, WorkerClients* workerClients) +WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThread* thread, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilageData, WorkerClients* workerClients) : m_url(url) , m_userAgent(userAgent) , m_v8CacheOptions(V8CacheOptionsDefault) @@ -253,7 +253,7 @@ scriptLoaded(scriptLoader->script().length(), scriptLoader->cachedMetadata() ? scriptLoader->cachedMetadata()->size() : 0); ErrorEvent* errorEvent = nullptr; - OwnPtr<Vector<char>> cachedMetaData(scriptLoader->releaseCachedMetadata()); + std::unique_ptr<Vector<char>> cachedMetaData(scriptLoader->releaseCachedMetadata()); CachedMetadataHandler* handler(createWorkerScriptCachedMetadataHandler(completeURL, cachedMetaData.get())); m_scriptController->evaluate(ScriptSourceCode(scriptLoader->script(), scriptLoader->responseURL()), &errorEvent, handler, m_v8CacheOptions); if (errorEvent) { @@ -268,7 +268,7 @@ return this; } -void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation> location) +void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation> location) { thread()->workerReportingProxy().reportException(errorMessage, std::move(location)); } @@ -346,7 +346,7 @@ return m_messageStorage.get(); } -void WorkerGlobalScope::exceptionUnhandled(const String& errorMessage, PassOwnPtr<SourceLocation> location) +void WorkerGlobalScope::exceptionUnhandled(const String& errorMessage, std::unique_ptr<SourceLocation> location) { addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location))); }
diff --git a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h index ff21f438..1117ef4 100644 --- a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h +++ b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h
@@ -45,10 +45,10 @@ #include "wtf/Assertions.h" #include "wtf/HashMap.h" #include "wtf/ListHashSet.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/AtomicStringHash.h" +#include <memory> namespace blink { @@ -141,7 +141,7 @@ void addConsoleMessage(ConsoleMessage*) final; ConsoleMessageStorage* messageStorage(); - void exceptionUnhandled(const String& errorMessage, PassOwnPtr<SourceLocation>); + void exceptionUnhandled(const String& errorMessage, std::unique_ptr<SourceLocation>); virtual void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) { } @@ -153,10 +153,10 @@ DECLARE_VIRTUAL_TRACE(); protected: - WorkerGlobalScope(const KURL&, const String& userAgent, WorkerThread*, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData>, WorkerClients*); + WorkerGlobalScope(const KURL&, const String& userAgent, WorkerThread*, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); void applyContentSecurityPolicyFromVector(const Vector<CSPHeaderAndType>& headers); - void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) override; + void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) override; void addMessageToWorkerConsole(ConsoleMessage*); void setV8CacheOptions(V8CacheOptions v8CacheOptions) { m_v8CacheOptions = v8CacheOptions; }
diff --git a/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h b/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h index a05f0cb6..62af4c7 100644 --- a/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h +++ b/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h
@@ -34,7 +34,6 @@ #include "core/CoreExport.h" #include "core/dom/ExecutionContext.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" #include "wtf/ThreadSafeRefCounted.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h b/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h index ea14f923..7e9d343 100644 --- a/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h +++ b/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h
@@ -34,7 +34,7 @@ #include "core/CoreExport.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -47,7 +47,7 @@ public: virtual ~WorkerReportingProxy() { } - virtual void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) = 0; + virtual void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) = 0; virtual void reportConsoleMessage(ConsoleMessage*) = 0; virtual void postMessageToPageInspector(const String&) = 0; virtual void postWorkerConsoleAgentEnabled() = 0;
diff --git a/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp b/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp index e8087ae..7bdabf14 100644 --- a/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp
@@ -39,8 +39,9 @@ #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/WebAddressSpace.h" #include "public/platform/WebURLRequest.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -125,7 +126,7 @@ return request; } -void WorkerScriptLoader::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void WorkerScriptLoader::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { DCHECK(!handle); if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode()) { @@ -169,7 +170,7 @@ void WorkerScriptLoader::didReceiveCachedMetadata(const char* data, int size) { - m_cachedMetadata = adoptPtr(new Vector<char>(size)); + m_cachedMetadata = wrapUnique(new Vector<char>(size)); memcpy(m_cachedMetadata->data(), data, size); }
diff --git a/third_party/WebKit/Source/core/workers/WorkerScriptLoader.h b/third_party/WebKit/Source/core/workers/WorkerScriptLoader.h index 0b46670..eae83c0 100644 --- a/third_party/WebKit/Source/core/workers/WorkerScriptLoader.h +++ b/third_party/WebKit/Source/core/workers/WorkerScriptLoader.h
@@ -37,10 +37,10 @@ #include "public/platform/WebURLRequest.h" #include "wtf/Allocator.h" #include "wtf/Functional.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -76,7 +76,7 @@ unsigned long identifier() const { return m_identifier; } long long appCacheID() const { return m_appCacheID; } - PassOwnPtr<Vector<char>> releaseCachedMetadata() { return std::move(m_cachedMetadata); } + std::unique_ptr<Vector<char>> releaseCachedMetadata() { return std::move(m_cachedMetadata); } const Vector<char>* cachedMetadata() const { return m_cachedMetadata.get(); } ContentSecurityPolicy* contentSecurityPolicy() { return m_contentSecurityPolicy.get(); } @@ -87,7 +87,7 @@ const Vector<String>* originTrialTokens() const { return m_originTrialTokens.get(); } // ThreadableLoaderClient - void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; void didReceiveData(const char* data, unsigned dataLength) override; void didReceiveCachedMetadata(const char*, int /*dataLength*/) override; void didFinishLoading(unsigned long identifier, double) override; @@ -112,9 +112,9 @@ std::unique_ptr<SameThreadClosure> m_responseCallback; std::unique_ptr<SameThreadClosure> m_finishedCallback; - OwnPtr<ThreadableLoader> m_threadableLoader; + std::unique_ptr<ThreadableLoader> m_threadableLoader; String m_responseEncoding; - OwnPtr<TextResourceDecoder> m_decoder; + std::unique_ptr<TextResourceDecoder> m_decoder; StringBuilder m_script; KURL m_url; KURL m_responseURL; @@ -122,7 +122,7 @@ bool m_needToCancel; unsigned long m_identifier; long long m_appCacheID; - OwnPtr<Vector<char>> m_cachedMetadata; + std::unique_ptr<Vector<char>> m_cachedMetadata; WebURLRequest::RequestContext m_requestContext; Persistent<ContentSecurityPolicy> m_contentSecurityPolicy; WebAddressSpace m_responseAddressSpace;
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp index 4c9fd41..f789496 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -49,9 +49,11 @@ #include "public/platform/WebThread.h" #include "wtf/Functional.h" #include "wtf/Noncopyable.h" +#include "wtf/PtrUtil.h" #include "wtf/Threading.h" #include "wtf/text/WTFString.h" #include <limits.h> +#include <memory> namespace blink { @@ -65,9 +67,9 @@ // started before this task runs, the task is simply cancelled. class WorkerThread::ForceTerminationTask final { public: - static PassOwnPtr<ForceTerminationTask> create(WorkerThread* workerThread) + static std::unique_ptr<ForceTerminationTask> create(WorkerThread* workerThread) { - return adoptPtr(new ForceTerminationTask(workerThread)); + return wrapUnique(new ForceTerminationTask(workerThread)); } void schedule() @@ -104,7 +106,7 @@ } WorkerThread* m_workerThread; - OwnPtr<CancellableTaskFactory> m_cancellableTaskFactory; + std::unique_ptr<CancellableTaskFactory> m_cancellableTaskFactory; }; class WorkerThread::WorkerMicrotaskRunner final : public WebThread::TaskObserver { @@ -184,7 +186,7 @@ exitCodeHistogram.count(static_cast<int>(m_exitCode)); } -void WorkerThread::start(PassOwnPtr<WorkerThreadStartupData> startupData) +void WorkerThread::start(std::unique_ptr<WorkerThreadStartupData> startupData) { DCHECK(isMainThread()); @@ -322,13 +324,13 @@ WorkerThread::WorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) : m_forceTerminationDelayInMs(kForceTerminationDelayInMs) - , m_inspectorTaskRunner(adoptPtr(new InspectorTaskRunner())) + , m_inspectorTaskRunner(wrapUnique(new InspectorTaskRunner())) , m_workerLoaderProxy(workerLoaderProxy) , m_workerReportingProxy(workerReportingProxy) - , m_terminationEvent(adoptPtr(new WaitableEvent( + , m_terminationEvent(wrapUnique(new WaitableEvent( WaitableEvent::ResetPolicy::Manual, WaitableEvent::InitialState::NonSignaled))) - , m_shutdownEvent(adoptPtr(new WaitableEvent( + , m_shutdownEvent(wrapUnique(new WaitableEvent( WaitableEvent::ResetPolicy::Manual, WaitableEvent::InitialState::NonSignaled))) , m_workerThreadLifecycleContext(new WorkerThreadLifecycleContext) @@ -428,12 +430,12 @@ isolate()->TerminateExecution(); } -void WorkerThread::initializeOnWorkerThread(PassOwnPtr<WorkerThreadStartupData> startupData) +void WorkerThread::initializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupData> startupData) { KURL scriptURL = startupData->m_scriptURL; String sourceCode = startupData->m_sourceCode; WorkerThreadStartMode startMode = startupData->m_startMode; - OwnPtr<Vector<char>> cachedMetaData = std::move(startupData->m_cachedMetaData); + std::unique_ptr<Vector<char>> cachedMetaData = std::move(startupData->m_cachedMetaData); V8CacheOptions v8CacheOptions = startupData->m_v8CacheOptions; { @@ -458,8 +460,8 @@ workerBackingThread().initialize(); if (shouldAttachThreadDebugger()) - V8PerIsolateData::from(isolate())->setThreadDebugger(adoptPtr(new WorkerThreadDebugger(this, isolate()))); - m_microtaskRunner = adoptPtr(new WorkerMicrotaskRunner(this)); + V8PerIsolateData::from(isolate())->setThreadDebugger(wrapUnique(new WorkerThreadDebugger(this, isolate()))); + m_microtaskRunner = wrapUnique(new WorkerMicrotaskRunner(this)); workerBackingThread().backingThread().addTaskObserver(m_microtaskRunner.get()); // Optimize for memory usage instead of latency for the worker isolate.
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.h b/third_party/WebKit/Source/core/workers/WorkerThread.h index 556c934..0309cae 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThread.h +++ b/third_party/WebKit/Source/core/workers/WorkerThread.h
@@ -37,8 +37,8 @@ #include "platform/WaitableEvent.h" #include "wtf/Forward.h" #include "wtf/Functional.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" +#include <memory> #include <v8.h> namespace blink { @@ -100,7 +100,7 @@ virtual ~WorkerThread(); // Called on the main thread. - void start(PassOwnPtr<WorkerThreadStartupData>); + void start(std::unique_ptr<WorkerThreadStartupData>); void terminate(); // Called on the main thread. Internally calls terminateInternal() and wait @@ -159,7 +159,7 @@ // Factory method for creating a new worker context for the thread. // Called on the worker thread. - virtual WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) = 0; + virtual WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) = 0; // Returns true when this WorkerThread owns the associated // WorkerBackingThread exclusively. If this function returns true, the @@ -193,7 +193,7 @@ void terminateInternal(TerminationMode); void forciblyTerminateExecution(); - void initializeOnWorkerThread(PassOwnPtr<WorkerThreadStartupData>); + void initializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupData>); void prepareForShutdownOnWorkerThread(); void performShutdownOnWorkerThread(); void performTaskOnWorkerThread(std::unique_ptr<ExecutionContextTask>, bool isInstrumented); @@ -209,8 +209,8 @@ long long m_forceTerminationDelayInMs; - OwnPtr<InspectorTaskRunner> m_inspectorTaskRunner; - OwnPtr<WorkerMicrotaskRunner> m_microtaskRunner; + std::unique_ptr<InspectorTaskRunner> m_inspectorTaskRunner; + std::unique_ptr<WorkerMicrotaskRunner> m_microtaskRunner; RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; WorkerReportingProxy& m_workerReportingProxy; @@ -223,14 +223,14 @@ Persistent<WorkerGlobalScope> m_workerGlobalScope; // Signaled when the thread starts termination on the main thread. - OwnPtr<WaitableEvent> m_terminationEvent; + std::unique_ptr<WaitableEvent> m_terminationEvent; // Signaled when the thread completes termination on the worker thread. - OwnPtr<WaitableEvent> m_shutdownEvent; + std::unique_ptr<WaitableEvent> m_shutdownEvent; // Scheduled when termination starts with TerminationMode::Force, and // cancelled when the worker thread is gracefully shut down. - OwnPtr<ForceTerminationTask> m_scheduledForceTerminationTask; + std::unique_ptr<ForceTerminationTask> m_scheduledForceTerminationTask; Persistent<WorkerThreadLifecycleContext> m_workerThreadLifecycleContext; };
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.cpp b/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.cpp index e9b767ca..659d28b 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.cpp
@@ -31,10 +31,12 @@ #include "core/workers/WorkerThreadStartupData.h" #include "platform/network/ContentSecurityPolicyParsers.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, PassOwnPtr<Vector<char>> cachedMetaData, WorkerThreadStartMode startMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin* starterOrigin, WorkerClients* workerClients, WebAddressSpace addressSpace, const Vector<String>* originTrialTokens, V8CacheOptions v8CacheOptions) +WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, std::unique_ptr<Vector<char>> cachedMetaData, WorkerThreadStartMode startMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin* starterOrigin, WorkerClients* workerClients, WebAddressSpace addressSpace, const Vector<String>* originTrialTokens, V8CacheOptions v8CacheOptions) : m_scriptURL(scriptURL.copy()) , m_userAgent(userAgent.isolatedCopy()) , m_sourceCode(sourceCode.isolatedCopy()) @@ -45,7 +47,7 @@ , m_addressSpace(addressSpace) , m_v8CacheOptions(v8CacheOptions) { - m_contentSecurityPolicyHeaders = adoptPtr(new Vector<CSPHeaderAndType>()); + m_contentSecurityPolicyHeaders = wrapUnique(new Vector<CSPHeaderAndType>()); if (contentSecurityPolicyHeaders) { for (const auto& header : *contentSecurityPolicyHeaders) { CSPHeaderAndType copiedHeader(header.first.isolatedCopy(), header.second);
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.h b/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.h index fb5fad7..c26db13 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.h +++ b/third_party/WebKit/Source/core/workers/WorkerThreadStartupData.h
@@ -41,6 +41,8 @@ #include "public/platform/WebAddressSpace.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -50,9 +52,9 @@ WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); USING_FAST_MALLOC(WorkerThreadStartupData); public: - static PassOwnPtr<WorkerThreadStartupData> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, PassOwnPtr<Vector<char>> cachedMetaData, WorkerThreadStartMode startMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin* starterOrigin, WorkerClients* workerClients, WebAddressSpace addressSpace, const Vector<String>* originTrialTokens, V8CacheOptions v8CacheOptions = V8CacheOptionsDefault) + static std::unique_ptr<WorkerThreadStartupData> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode, std::unique_ptr<Vector<char>> cachedMetaData, WorkerThreadStartMode startMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin* starterOrigin, WorkerClients* workerClients, WebAddressSpace addressSpace, const Vector<String>* originTrialTokens, V8CacheOptions v8CacheOptions = V8CacheOptionsDefault) { - return adoptPtr(new WorkerThreadStartupData(scriptURL, userAgent, sourceCode, std::move(cachedMetaData), startMode, contentSecurityPolicyHeaders, starterOrigin, workerClients, addressSpace, originTrialTokens, v8CacheOptions)); + return wrapUnique(new WorkerThreadStartupData(scriptURL, userAgent, sourceCode, std::move(cachedMetaData), startMode, contentSecurityPolicyHeaders, starterOrigin, workerClients, addressSpace, originTrialTokens, v8CacheOptions)); } ~WorkerThreadStartupData(); @@ -60,9 +62,9 @@ KURL m_scriptURL; String m_userAgent; String m_sourceCode; - OwnPtr<Vector<char>> m_cachedMetaData; + std::unique_ptr<Vector<char>> m_cachedMetaData; WorkerThreadStartMode m_startMode; - OwnPtr<Vector<CSPHeaderAndType>> m_contentSecurityPolicyHeaders; + std::unique_ptr<Vector<CSPHeaderAndType>> m_contentSecurityPolicyHeaders; std::unique_ptr<Vector<String>> m_originTrialTokens; @@ -75,7 +77,7 @@ // // See SecurityOrigin::transferPrivilegesFrom() for details on what // privileges are transferred. - OwnPtr<SecurityOrigin::PrivilegeData> m_starterOriginPrivilegeData; + std::unique_ptr<SecurityOrigin::PrivilegeData> m_starterOriginPrivilegeData; // This object is created and initialized on the thread creating // a new worker context, but ownership of it and this WorkerThreadStartupData @@ -92,7 +94,7 @@ V8CacheOptions m_v8CacheOptions; private: - WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, PassOwnPtr<Vector<char>> cachedMetaData, WorkerThreadStartMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin*, WorkerClients*, WebAddressSpace, const Vector<String>* originTrialTokens, V8CacheOptions); + WorkerThreadStartupData(const KURL& scriptURL, const String& userAgent, const String& sourceCode, std::unique_ptr<Vector<char>> cachedMetaData, WorkerThreadStartMode, const Vector<CSPHeaderAndType>* contentSecurityPolicyHeaders, const SecurityOrigin*, WorkerClients*, WebAddressSpace, const Vector<String>* originTrialTokens, V8CacheOptions); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp index 3552cf9..e1c372d 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
@@ -8,6 +8,8 @@ #include "platform/testing/UnitTestHelpers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> using testing::_; using testing::AtMost; @@ -18,10 +20,10 @@ public: void SetUp() override { - m_mockWorkerLoaderProxyProvider = adoptPtr(new MockWorkerLoaderProxyProvider()); - m_mockWorkerReportingProxy = adoptPtr(new MockWorkerReportingProxy()); + m_mockWorkerLoaderProxyProvider = wrapUnique(new MockWorkerLoaderProxyProvider()); + m_mockWorkerReportingProxy = wrapUnique(new MockWorkerReportingProxy()); m_securityOrigin = SecurityOrigin::create(KURL(ParsedURLString, "http://fake.url/")); - m_workerThread = adoptPtr(new WorkerThreadForTest( + m_workerThread = wrapUnique(new WorkerThreadForTest( m_mockWorkerLoaderProxyProvider.get(), *m_mockWorkerReportingProxy)); m_mockWorkerThreadLifecycleObserver = new MockWorkerThreadLifecycleObserver(m_workerThread->getWorkerThreadLifecycleContext()); @@ -83,9 +85,9 @@ } RefPtr<SecurityOrigin> m_securityOrigin; - OwnPtr<MockWorkerLoaderProxyProvider> m_mockWorkerLoaderProxyProvider; - OwnPtr<MockWorkerReportingProxy> m_mockWorkerReportingProxy; - OwnPtr<WorkerThreadForTest> m_workerThread; + std::unique_ptr<MockWorkerLoaderProxyProvider> m_mockWorkerLoaderProxyProvider; + std::unique_ptr<MockWorkerReportingProxy> m_mockWorkerReportingProxy; + std::unique_ptr<WorkerThreadForTest> m_workerThread; Persistent<MockWorkerThreadLifecycleObserver> m_mockWorkerThreadLifecycleObserver; };
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h b/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h index 3513c64..bd35df2 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h +++ b/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h
@@ -25,9 +25,9 @@ #include "testing/gmock/include/gmock/gmock.h" #include "wtf/CurrentTime.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> #include <v8.h> namespace blink { @@ -55,7 +55,7 @@ ~MockWorkerReportingProxy() override { } MOCK_METHOD2(reportExceptionMock, void(const String& errorMessage, SourceLocation*)); - void reportException(const String& errorMessage, PassOwnPtr<SourceLocation> location) + void reportException(const String& errorMessage, std::unique_ptr<SourceLocation> location) { reportExceptionMock(errorMessage, location.get()); } @@ -86,7 +86,7 @@ WorkerReportingProxy& mockWorkerReportingProxy) : WorkerThread(WorkerLoaderProxy::create(mockWorkerLoaderProxyProvider), mockWorkerReportingProxy) , m_workerBackingThread(WorkerBackingThread::createForTest("Test thread")) - , m_scriptLoadedEvent(adoptPtr(new WaitableEvent())) + , m_scriptLoadedEvent(wrapUnique(new WaitableEvent())) { } @@ -94,7 +94,7 @@ WorkerBackingThread& workerBackingThread() override { return *m_workerBackingThread; } - WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override; + WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) override; void waitUntilScriptLoaded() { @@ -108,7 +108,7 @@ void startWithSourceCode(SecurityOrigin* securityOrigin, const String& source) { - OwnPtr<Vector<CSPHeaderAndType>> headers = adoptPtr(new Vector<CSPHeaderAndType>()); + std::unique_ptr<Vector<CSPHeaderAndType>> headers = wrapUnique(new Vector<CSPHeaderAndType>()); CSPHeaderAndType headerAndType("contentSecurityPolicy", ContentSecurityPolicyHeaderTypeReport); headers->append(headerAndType); @@ -130,19 +130,19 @@ void waitForInit() { - OwnPtr<WaitableEvent> completionEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> completionEvent = wrapUnique(new WaitableEvent()); workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WaitableEvent::signal, AllowCrossThreadAccess(completionEvent.get()))); completionEvent->wait(); } private: - OwnPtr<WorkerBackingThread> m_workerBackingThread; - OwnPtr<WaitableEvent> m_scriptLoadedEvent; + std::unique_ptr<WorkerBackingThread> m_workerBackingThread; + std::unique_ptr<WaitableEvent> m_scriptLoadedEvent; }; class FakeWorkerGlobalScope : public WorkerGlobalScope { public: - FakeWorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThreadForTest* thread, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) + FakeWorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThreadForTest* thread, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) : WorkerGlobalScope(url, userAgent, thread, monotonicallyIncreasingTime(), std::move(starterOriginPrivilegeData), workerClients) , m_thread(thread) { @@ -163,7 +163,7 @@ return EventTargetNames::DedicatedWorkerGlobalScope; } - void logExceptionToConsole(const String&, PassOwnPtr<SourceLocation>) override + void logExceptionToConsole(const String&, std::unique_ptr<SourceLocation>) override { } @@ -171,7 +171,7 @@ WorkerThreadForTest* m_thread; }; -inline WorkerGlobalScope* WorkerThreadForTest::createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData> startupData) +inline WorkerGlobalScope* WorkerThreadForTest::createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData> startupData) { return new FakeWorkerGlobalScope(startupData->m_scriptURL, startupData->m_userAgent, this, std::move(startupData->m_starterOriginPrivilegeData), std::move(startupData->m_workerClients)); }
diff --git a/third_party/WebKit/Source/core/workers/WorkletGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkletGlobalScope.cpp index e6cc221..9a5d5da2 100644 --- a/third_party/WebKit/Source/core/workers/WorkletGlobalScope.cpp +++ b/third_party/WebKit/Source/core/workers/WorkletGlobalScope.cpp
@@ -8,6 +8,7 @@ #include "bindings/core/v8/WorkerOrWorkletScriptController.h" #include "core/inspector/InspectorInstrumentation.h" #include "core/inspector/MainThreadDebugger.h" +#include <memory> namespace blink { @@ -68,7 +69,7 @@ InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); } -void WorkletGlobalScope::logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation> location) +void WorkletGlobalScope::logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation> location) { ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location)); addConsoleMessage(consoleMessage);
diff --git a/third_party/WebKit/Source/core/workers/WorkletGlobalScope.h b/third_party/WebKit/Source/core/workers/WorkletGlobalScope.h index a89c07f..c9693716 100644 --- a/third_party/WebKit/Source/core/workers/WorkletGlobalScope.h +++ b/third_party/WebKit/Source/core/workers/WorkletGlobalScope.h
@@ -13,6 +13,7 @@ #include "core/inspector/ConsoleMessage.h" #include "core/workers/WorkerOrWorkletGlobalScope.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -54,7 +55,7 @@ } void reportBlockedScriptExecutionToInspector(const String& directiveText) final; - void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) final; + void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) final; DECLARE_VIRTUAL_TRACE();
diff --git a/third_party/WebKit/Source/core/xml/XPathParser.cpp b/third_party/WebKit/Source/core/xml/XPathParser.cpp index bd9e093..3d2a055c 100644 --- a/third_party/WebKit/Source/core/xml/XPathParser.cpp +++ b/third_party/WebKit/Source/core/xml/XPathParser.cpp
@@ -33,6 +33,7 @@ #include "core/xml/XPathEvaluator.h" #include "core/xml/XPathNSResolver.h" #include "core/xml/XPathPath.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/text/StringHash.h" @@ -500,7 +501,7 @@ ASSERT(!m_strings.contains(s)); - m_strings.add(adoptPtr(s)); + m_strings.add(wrapUnique(s)); } void Parser::deleteString(String* s)
diff --git a/third_party/WebKit/Source/core/xml/XPathParser.h b/third_party/WebKit/Source/core/xml/XPathParser.h index 7e9228a..dcf7aa8 100644 --- a/third_party/WebKit/Source/core/xml/XPathParser.h +++ b/third_party/WebKit/Source/core/xml/XPathParser.h
@@ -30,6 +30,7 @@ #include "core/xml/XPathPredicate.h" #include "core/xml/XPathStep.h" #include "wtf/Allocator.h" +#include <memory> namespace blink { @@ -108,7 +109,7 @@ int m_lastTokenType; Member<XPathNSResolver> m_resolver; - HashSet<OwnPtr<String>> m_strings; + HashSet<std::unique_ptr<String>> m_strings; }; } // namespace XPath
diff --git a/third_party/WebKit/Source/core/xml/XSLImportRule.h b/third_party/WebKit/Source/core/xml/XSLImportRule.h index 349166b..1cc23b6 100644 --- a/third_party/WebKit/Source/core/xml/XSLImportRule.h +++ b/third_party/WebKit/Source/core/xml/XSLImportRule.h
@@ -25,7 +25,6 @@ #include "core/xml/XSLStyleSheet.h" #include "platform/RuntimeEnabledFeatures.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp index a8511a0..cb1c994 100644 --- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp +++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -67,6 +67,7 @@ #include "platform/network/ResourceResponse.h" #include "platform/v8_inspector/public/ConsoleTypes.h" #include "platform/weborigin/SecurityOrigin.h" +#include "wtf/PtrUtil.h" #include "wtf/StringExtras.h" #include "wtf/TemporaryChange.h" #include "wtf/Threading.h" @@ -76,6 +77,7 @@ #include <libxml/parser.h> #include <libxml/parserInternals.h> #include <libxslt/xslt.h> +#include <memory> namespace blink { @@ -960,7 +962,7 @@ if (m_parserPaused) { m_scriptStartPosition = textPosition(); - m_pendingCallbacks.append(adoptPtr(new PendingStartElementNSCallback(localName, prefix, uri, nbNamespaces, libxmlNamespaces, + m_pendingCallbacks.append(wrapUnique(new PendingStartElementNSCallback(localName, prefix, uri, nbNamespaces, libxmlNamespaces, nbAttributes, nbDefaulted, libxmlAttributes))); return; } @@ -1039,7 +1041,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(adoptPtr(new PendingEndElementNSCallback(m_scriptStartPosition))); + m_pendingCallbacks.append(wrapUnique(new PendingEndElementNSCallback(m_scriptStartPosition))); return; } @@ -1121,7 +1123,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(adoptPtr(new PendingCharactersCallback(chars, length))); + m_pendingCallbacks.append(wrapUnique(new PendingCharactersCallback(chars, length))); return; } @@ -1138,7 +1140,7 @@ vsnprintf(formattedMessage, sizeof(formattedMessage) - 1, message, args); if (m_parserPaused) { - m_pendingCallbacks.append(adoptPtr(new PendingErrorCallback(type, reinterpret_cast<const xmlChar*>(formattedMessage), lineNumber(), columnNumber()))); + m_pendingCallbacks.append(wrapUnique(new PendingErrorCallback(type, reinterpret_cast<const xmlChar*>(formattedMessage), lineNumber(), columnNumber()))); return; } @@ -1151,7 +1153,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(adoptPtr(new PendingProcessingInstructionCallback(target, data))); + m_pendingCallbacks.append(wrapUnique(new PendingProcessingInstructionCallback(target, data))); return; } @@ -1190,7 +1192,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(adoptPtr(new PendingCDATABlockCallback(text))); + m_pendingCallbacks.append(wrapUnique(new PendingCDATABlockCallback(text))); return; } @@ -1206,7 +1208,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(adoptPtr(new PendingCommentCallback(text))); + m_pendingCallbacks.append(wrapUnique(new PendingCommentCallback(text))); return; } @@ -1251,7 +1253,7 @@ return; if (m_parserPaused) { - m_pendingCallbacks.append(adoptPtr(new PendingInternalSubsetCallback(name, externalID, systemID))); + m_pendingCallbacks.append(wrapUnique(new PendingInternalSubsetCallback(name, externalID, systemID))); return; } @@ -1489,7 +1491,7 @@ V8Document::PrivateScript::transformDocumentToTreeViewMethod(document()->frame(), document(), noStyleMessage); } else if (m_sawXSLTransform) { xmlDocPtr doc = xmlDocPtrForString(document(), m_originalSourceForTransform.toString(), document()->url().getString()); - document()->setTransformSource(adoptPtr(new TransformSource(doc))); + document()->setTransformSource(wrapUnique(new TransformSource(doc))); DocumentParser::stopParsing(); } } @@ -1540,7 +1542,7 @@ // First, execute any pending callbacks while (!m_pendingCallbacks.isEmpty()) { - OwnPtr<PendingCallback> callback = m_pendingCallbacks.takeFirst(); + std::unique_ptr<PendingCallback> callback = m_pendingCallbacks.takeFirst(); callback->call(this); // A callback paused the parser
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h index b8b84bd..8a21eb1 100644 --- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h +++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h
@@ -33,11 +33,11 @@ #include "platform/heap/Handle.h" #include "platform/text/SegmentedString.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/CString.h" #include "wtf/text/StringHash.h" #include <libxml/tree.h> +#include <memory> namespace blink { @@ -165,7 +165,7 @@ xmlParserCtxtPtr context() const { return m_context ? m_context->context() : 0; } RefPtr<XMLParserContext> m_context; - Deque<OwnPtr<PendingCallback>> m_pendingCallbacks; + Deque<std::unique_ptr<PendingCallback>> m_pendingCallbacks; Vector<xmlChar> m_bufferedText; Member<ContainerNode> m_currentNode;
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp index eab81df..10c60eda8 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -77,6 +77,7 @@ #include "wtf/Assertions.h" #include "wtf/StdLibExtras.h" #include "wtf/text/CString.h" +#include <memory> namespace blink { @@ -334,7 +335,7 @@ // copying the bytes between the browser and the renderer. m_responseBlob = Blob::create(createBlobDataHandleFromResponse()); } else { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); size_t size = 0; if (m_binaryResponseBuilder && m_binaryResponseBuilder->size()) { size = m_binaryResponseBuilder->size(); @@ -1023,7 +1024,7 @@ // If, window.onload contains open() and send(), m_loader will be set to // non 0 value. So, we cannot continue the outer open(). In such case, // just abort the outer open() by returning false. - OwnPtr<ThreadableLoader> loader = std::move(m_loader); + std::unique_ptr<ThreadableLoader> loader = std::move(m_loader); loader->cancel(); // If abort() called internalAbort() and a nested open() ended up @@ -1436,7 +1437,7 @@ PassRefPtr<BlobDataHandle> XMLHttpRequest::createBlobDataHandleFromResponse() { ASSERT(m_downloadingToFile); - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); String filePath = m_response.downloadedFilePath(); // If we errored out or got no data, we return an empty handle. if (!filePath.isEmpty() && m_lengthDownloadedToFile) { @@ -1509,7 +1510,7 @@ } } -void XMLHttpRequest::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void XMLHttpRequest::didReceiveResponse(unsigned long identifier, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(handle, !handle); WTF_LOG(Network, "XMLHttpRequest %p didReceiveResponse(%lu)", this, identifier); @@ -1544,7 +1545,7 @@ m_responseDocumentParser->appendBytes(data, len); } -PassOwnPtr<TextResourceDecoder> XMLHttpRequest::createDecoder() const +std::unique_ptr<TextResourceDecoder> XMLHttpRequest::createDecoder() const { if (m_responseTypeCode == ResponseTypeJSON) return TextResourceDecoder::create("application/json", "UTF-8"); @@ -1554,7 +1555,7 @@ // allow TextResourceDecoder to look inside the m_response if it's XML or HTML if (responseIsXML()) { - OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); + std::unique_ptr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); // Don't stop on encoding errors, unlike it is done for other kinds // of XML resources. This matches the behavior of previous WebKit // versions, Firefox and Opera.
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h index 4b33c0e8..453404e 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h
@@ -37,13 +37,12 @@ #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/AtomicString.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -157,7 +156,7 @@ SecurityOrigin* getSecurityOrigin() const; void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; - void didReceiveResponse(unsigned long identifier, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long identifier, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; void didReceiveData(const char* data, unsigned dataLength) override; // When responseType is set to "blob", didDownloadData() is called instead // of didReceiveData(). @@ -193,7 +192,7 @@ bool responseIsXML() const; bool responseIsHTML() const; - PassOwnPtr<TextResourceDecoder> createDecoder() const; + std::unique_ptr<TextResourceDecoder> createDecoder() const; void initResponseDocument(); void parseDocumentChunk(const char* data, unsigned dataLength); @@ -265,13 +264,13 @@ Member<Blob> m_responseBlob; Member<Stream> m_responseLegacyStream; - OwnPtr<ThreadableLoader> m_loader; + std::unique_ptr<ThreadableLoader> m_loader; State m_state; ResourceResponse m_response; String m_finalResponseCharset; - OwnPtr<TextResourceDecoder> m_decoder; + std::unique_ptr<TextResourceDecoder> m_decoder; ScriptString m_responseText; Member<Document> m_responseDocument;
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.h b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.h index 3d30862..293fbb48 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.h +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.h
@@ -31,7 +31,6 @@ #include "core/xmlhttprequest/XMLHttpRequestEventTarget.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/modules/EventModulesFactory.h b/third_party/WebKit/Source/modules/EventModulesFactory.h index e4691214..cf5aa10 100644 --- a/third_party/WebKit/Source/modules/EventModulesFactory.h +++ b/third_party/WebKit/Source/modules/EventModulesFactory.h
@@ -8,7 +8,9 @@ #include "core/events/EventFactory.h" #include "platform/heap/Handle.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -16,9 +18,9 @@ class EventModulesFactory final : public EventFactoryBase { public: - static PassOwnPtr<EventModulesFactory> create() + static std::unique_ptr<EventModulesFactory> create() { - return adoptPtr(new EventModulesFactory()); + return wrapUnique(new EventModulesFactory()); } Event* create(ExecutionContext*, const String& eventType) override;
diff --git a/third_party/WebKit/Source/modules/ModulesInitializer.cpp b/third_party/WebKit/Source/modules/ModulesInitializer.cpp index b04f7fca..f83ea2ba 100644 --- a/third_party/WebKit/Source/modules/ModulesInitializer.cpp +++ b/third_party/WebKit/Source/modules/ModulesInitializer.cpp
@@ -24,6 +24,7 @@ #include "modules/webdatabase/DatabaseManager.h" #include "modules/webgl/WebGL2RenderingContext.h" #include "modules/webgl/WebGLRenderingContext.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -49,14 +50,14 @@ CoreInitializer::initialize(); // Canvas context types must be registered with the HTMLCanvasElement. - HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new CanvasRenderingContext2D::Factory())); - HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGLRenderingContext::Factory())); - HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGL2RenderingContext::Factory())); - HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new ImageBitmapRenderingContext::Factory())); + HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new CanvasRenderingContext2D::Factory())); + HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new WebGLRenderingContext::Factory())); + HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new WebGL2RenderingContext::Factory())); + HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new ImageBitmapRenderingContext::Factory())); // OffscreenCanvas context types must be registered with the OffscreenCanvas. - OffscreenCanvas::registerRenderingContextFactory(adoptPtr(new OffscreenCanvasRenderingContext2D::Factory())); - OffscreenCanvas::registerRenderingContextFactory(adoptPtr(new WebGLRenderingContext::Factory())); + OffscreenCanvas::registerRenderingContextFactory(wrapUnique(new OffscreenCanvasRenderingContext2D::Factory())); + OffscreenCanvas::registerRenderingContextFactory(wrapUnique(new WebGLRenderingContext::Factory())); ASSERT(isInitialized()); }
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp index 04665908..0aff29dd 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp
@@ -77,6 +77,7 @@ #include "modules/accessibility/AXTableHeaderContainer.h" #include "modules/accessibility/AXTableRow.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -736,7 +737,7 @@ HashSet<AXID>* owners = m_idToAriaOwnersMapping.get(id); if (!owners) { owners = new HashSet<AXID>(); - m_idToAriaOwnersMapping.set(id, adoptPtr(owners)); + m_idToAriaOwnersMapping.set(id, wrapUnique(owners)); } owners->add(owner->axObjectID()); }
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h index a8ed70a..166ade3 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h
@@ -36,6 +36,7 @@ #include "wtf/Forward.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" +#include <memory> namespace blink { @@ -227,7 +228,7 @@ // want to own that ID. This is *unvalidated*, it includes possible duplicates. // This is used so that when an element with an ID is added to the tree or changes // its ID, we can quickly determine if it affects an aria-owns relationship. - HashMap<String, OwnPtr<HashSet<AXID>>> m_idToAriaOwnersMapping; + HashMap<String, std::unique_ptr<HashSet<AXID>>> m_idToAriaOwnersMapping; Timer<AXObjectCacheImpl> m_notificationPostTimer; HeapVector<std::pair<Member<AXObject>, AXNotification>> m_notificationsToPost;
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp index c3afc19..dd49114b 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectTest.cpp
@@ -8,6 +8,7 @@ #include "core/dom/Element.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -18,7 +19,7 @@ private: void SetUp() override; - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; }; void AXObjectTest::SetUp()
diff --git a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp index f0ad546..78b6bf0 100644 --- a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp +++ b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.cpp
@@ -15,6 +15,7 @@ #include "modules/accessibility/AXObjectCacheImpl.h" #include "modules/accessibility/InspectorTypeBuilderHelper.h" #include "platform/inspector_protocol/Values.h" +#include <memory> namespace blink { @@ -381,7 +382,7 @@ return; Document& document = node->document(); - OwnPtr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document); + std::unique_ptr<ScopedAXObjectCache> cache = ScopedAXObjectCache::create(document); AXObjectCacheImpl* cacheImpl = toAXObjectCacheImpl(cache->get()); AXObject* axObject = cacheImpl->getOrCreate(node); if (!axObject || axObject->accessibilityIsIgnored()) {
diff --git a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h index bed0ecd6..6a808c8 100644 --- a/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h +++ b/third_party/WebKit/Source/modules/accessibility/InspectorAccessibilityAgent.h
@@ -8,7 +8,6 @@ #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/Accessibility.h" #include "modules/ModulesExport.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/app_banner/AppBannerPromptResult.h b/third_party/WebKit/Source/modules/app_banner/AppBannerPromptResult.h index d1d475d..ba5e6cf 100644 --- a/third_party/WebKit/Source/modules/app_banner/AppBannerPromptResult.h +++ b/third_party/WebKit/Source/modules/app_banner/AppBannerPromptResult.h
@@ -8,7 +8,6 @@ #include "bindings/core/v8/ScriptWrappable.h" #include "public/platform/modules/app_banner/WebAppBannerPromptResult.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/audio_output_devices/AudioOutputDeviceClient.h b/third_party/WebKit/Source/modules/audio_output_devices/AudioOutputDeviceClient.h index 616b823..7d824bd 100644 --- a/third_party/WebKit/Source/modules/audio_output_devices/AudioOutputDeviceClient.h +++ b/third_party/WebKit/Source/modules/audio_output_devices/AudioOutputDeviceClient.h
@@ -8,7 +8,7 @@ #include "modules/ModulesExport.h" #include "platform/Supplementable.h" #include "public/platform/WebSetSinkIdCallbacks.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -22,7 +22,7 @@ virtual ~AudioOutputDeviceClient() {} // Checks that a given sink exists and has permissions to be used from the origin of the current frame. - virtual void checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext*, const WebString& sinkId, PassOwnPtr<WebSetSinkIdCallbacks>) = 0; + virtual void checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext*, const WebString& sinkId, std::unique_ptr<WebSetSinkIdCallbacks>) = 0; // Supplement requirements. static AudioOutputDeviceClient* from(ExecutionContext*);
diff --git a/third_party/WebKit/Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp b/third_party/WebKit/Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp index f231e65..6d94fe7 100644 --- a/third_party/WebKit/Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp +++ b/third_party/WebKit/Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp
@@ -11,6 +11,8 @@ #include "modules/audio_output_devices/AudioOutputDeviceClient.h" #include "modules/audio_output_devices/SetSinkIdCallbacks.h" #include "public/platform/WebSecurityOrigin.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -59,11 +61,11 @@ { ExecutionContext* context = getExecutionContext(); ASSERT(context && context->isDocument()); - OwnPtr<SetSinkIdCallbacks> callbacks = adoptPtr(new SetSinkIdCallbacks(this, *m_element, m_sinkId)); + std::unique_ptr<SetSinkIdCallbacks> callbacks = wrapUnique(new SetSinkIdCallbacks(this, *m_element, m_sinkId)); WebMediaPlayer* webMediaPlayer = m_element->webMediaPlayer(); if (webMediaPlayer) { - // Using leakPtr() to transfer ownership because |webMediaPlayer| is a platform object that takes raw pointers - webMediaPlayer->setSinkId(m_sinkId, WebSecurityOrigin(context->getSecurityOrigin()), callbacks.leakPtr()); + // Using release() to transfer ownership because |webMediaPlayer| is a platform object that takes raw pointers + webMediaPlayer->setSinkId(m_sinkId, WebSecurityOrigin(context->getSecurityOrigin()), callbacks.release()); } else { if (AudioOutputDeviceClient* client = AudioOutputDeviceClient::from(context)) { client->checkIfAudioSinkExistsAndIsAuthorized(context, m_sinkId, std::move(callbacks));
diff --git a/third_party/WebKit/Source/modules/background_sync/SyncCallbacks.cpp b/third_party/WebKit/Source/modules/background_sync/SyncCallbacks.cpp index 9b6e3e7..b25dae94 100644 --- a/third_party/WebKit/Source/modules/background_sync/SyncCallbacks.cpp +++ b/third_party/WebKit/Source/modules/background_sync/SyncCallbacks.cpp
@@ -7,8 +7,8 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "modules/background_sync/SyncError.h" #include "modules/serviceworkers/ServiceWorkerRegistration.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -30,7 +30,7 @@ return; } - OwnPtr<WebSyncRegistration> registration = adoptPtr(webSyncRegistration.release()); + std::unique_ptr<WebSyncRegistration> registration = wrapUnique(webSyncRegistration.release()); if (!registration) { m_resolver->resolve(v8::Null(m_resolver->getScriptState()->isolate())); return;
diff --git a/third_party/WebKit/Source/modules/background_sync/SyncError.cpp b/third_party/WebKit/Source/modules/background_sync/SyncError.cpp index e5dfc82..4cefecf 100644 --- a/third_party/WebKit/Source/modules/background_sync/SyncError.cpp +++ b/third_party/WebKit/Source/modules/background_sync/SyncError.cpp
@@ -6,7 +6,6 @@ #include "core/dom/DOMException.h" #include "core/dom/ExceptionCode.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp index 23653f1..0483c6a 100644 --- a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp +++ b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp
@@ -8,7 +8,6 @@ #include "public/platform/Platform.h" #include "public/platform/ServiceRegistry.h" #include "wtf/Assertions.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h index 134b484..5bf039f 100644 --- a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h +++ b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h
@@ -10,7 +10,6 @@ #include "modules/ModulesExport.h" #include "modules/battery/BatteryManager.h" #include "modules/battery/battery_status.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp index d3a2fe6e..e717ea2d 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp
@@ -13,10 +13,11 @@ #include "modules/bluetooth/BluetoothRemoteGATTServer.h" #include "modules/bluetooth/BluetoothSupplement.h" #include "public/platform/modules/bluetooth/WebBluetooth.h" +#include <memory> namespace blink { -BluetoothDevice::BluetoothDevice(ExecutionContext* context, PassOwnPtr<WebBluetoothDeviceInit> webDevice) +BluetoothDevice::BluetoothDevice(ExecutionContext* context, std::unique_ptr<WebBluetoothDeviceInit> webDevice) : ActiveDOMObject(context) , m_webDevice(std::move(webDevice)) , m_gatt(BluetoothRemoteGATTServer::create(this)) @@ -25,7 +26,7 @@ ThreadState::current()->registerPreFinalizer(this); } -BluetoothDevice* BluetoothDevice::take(ScriptPromiseResolver* resolver, PassOwnPtr<WebBluetoothDeviceInit> webDevice) +BluetoothDevice* BluetoothDevice::take(ScriptPromiseResolver* resolver, std::unique_ptr<WebBluetoothDeviceInit> webDevice) { ASSERT(webDevice); BluetoothDevice* device = new BluetoothDevice(resolver->getExecutionContext(), std::move(webDevice));
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h index 6949310a..5b33bf21 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h
@@ -12,9 +12,8 @@ #include "platform/heap/Heap.h" #include "public/platform/modules/bluetooth/WebBluetoothDevice.h" #include "public/platform/modules/bluetooth/WebBluetoothDeviceInit.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -36,11 +35,11 @@ DEFINE_WRAPPERTYPEINFO(); USING_GARBAGE_COLLECTED_MIXIN(BluetoothDevice); public: - BluetoothDevice(ExecutionContext*, PassOwnPtr<WebBluetoothDeviceInit>); + BluetoothDevice(ExecutionContext*, std::unique_ptr<WebBluetoothDeviceInit>); // Interface required by CallbackPromiseAdapter: - using WebType = OwnPtr<WebBluetoothDeviceInit>; - static BluetoothDevice* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetoothDeviceInit>); + using WebType = std::unique_ptr<WebBluetoothDeviceInit>; + static BluetoothDevice* take(ScriptPromiseResolver*, std::unique_ptr<WebBluetoothDeviceInit>); // We should disconnect from the device in all of the following cases: // 1. When the object gets GarbageCollected e.g. it went out of scope. @@ -81,7 +80,7 @@ DEFINE_ATTRIBUTE_EVENT_LISTENER(gattserverdisconnected); private: - OwnPtr<WebBluetoothDeviceInit> m_webDevice; + std::unique_ptr<WebBluetoothDeviceInit> m_webDevice; Member<BluetoothRemoteGATTServer> m_gatt; };
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp index 04b4311..91df251 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp
@@ -16,6 +16,7 @@ #include "modules/bluetooth/BluetoothError.h" #include "modules/bluetooth/BluetoothSupplement.h" #include "public/platform/modules/bluetooth/WebBluetooth.h" +#include <memory> namespace blink { @@ -30,7 +31,7 @@ } // anonymous namespace -BluetoothRemoteGATTCharacteristic::BluetoothRemoteGATTCharacteristic(ExecutionContext* context, PassOwnPtr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic) +BluetoothRemoteGATTCharacteristic::BluetoothRemoteGATTCharacteristic(ExecutionContext* context, std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic) : ActiveDOMObject(context) , m_webCharacteristic(std::move(webCharacteristic)) , m_stopped(false) @@ -40,7 +41,7 @@ ThreadState::current()->registerPreFinalizer(this); } -BluetoothRemoteGATTCharacteristic* BluetoothRemoteGATTCharacteristic::take(ScriptPromiseResolver* resolver, PassOwnPtr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic) +BluetoothRemoteGATTCharacteristic* BluetoothRemoteGATTCharacteristic::take(ScriptPromiseResolver* resolver, std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic) { if (!webCharacteristic) { return nullptr;
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h index efcc800..3079ec2 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h
@@ -13,9 +13,8 @@ #include "platform/heap/Handle.h" #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic.h" #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristicInit.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -41,11 +40,11 @@ DEFINE_WRAPPERTYPEINFO(); USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic); public: - explicit BluetoothRemoteGATTCharacteristic(ExecutionContext*, PassOwnPtr<WebBluetoothRemoteGATTCharacteristicInit>); + explicit BluetoothRemoteGATTCharacteristic(ExecutionContext*, std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>); // Interface required by CallbackPromiseAdapter. - using WebType = OwnPtr<WebBluetoothRemoteGATTCharacteristicInit>; - static BluetoothRemoteGATTCharacteristic* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetoothRemoteGATTCharacteristicInit>); + using WebType = std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>; + static BluetoothRemoteGATTCharacteristic* take(ScriptPromiseResolver*, std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>); // Save value. void setValue(DOMDataView*); @@ -88,7 +87,7 @@ void addedEventListener(const AtomicString& eventType, RegisteredEventListener&) override; private: - OwnPtr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic; + std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic; bool m_stopped; Member<BluetoothCharacteristicProperties> m_properties; Member<DOMDataView> m_value;
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp index a57e6e1..8b134e79 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
@@ -15,7 +15,6 @@ #include "modules/bluetooth/BluetoothSupplement.h" #include "modules/bluetooth/BluetoothUUID.h" #include "public/platform/modules/bluetooth/WebBluetooth.h" -#include "wtf/OwnPtr.h" namespace blink { @@ -97,14 +96,14 @@ if (m_quantity == mojom::WebBluetoothGATTQueryQuantity::SINGLE) { DCHECK_EQ(1u, webServices.size()); - m_resolver->resolve(BluetoothRemoteGATTService::take(m_resolver, adoptPtr(webServices[0]))); + m_resolver->resolve(BluetoothRemoteGATTService::take(m_resolver, wrapUnique(webServices[0]))); return; } HeapVector<Member<BluetoothRemoteGATTService>> services; services.reserveInitialCapacity(webServices.size()); for (WebBluetoothRemoteGATTService* webService : webServices) { - services.append(BluetoothRemoteGATTService::take(m_resolver, adoptPtr(webService))); + services.append(BluetoothRemoteGATTService::take(m_resolver, wrapUnique(webService))); } m_resolver->resolve(services); }
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h index 657eadb..b29f68b 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h
@@ -10,8 +10,6 @@ #include "modules/bluetooth/BluetoothDevice.h" #include "platform/heap/Heap.h" #include "public/platform/modules/bluetooth/WebBluetoothError.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp index 250e55cf..ed200dd2 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
@@ -15,15 +15,17 @@ #include "modules/bluetooth/BluetoothSupplement.h" #include "modules/bluetooth/BluetoothUUID.h" #include "public/platform/modules/bluetooth/WebBluetooth.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -BluetoothRemoteGATTService::BluetoothRemoteGATTService(PassOwnPtr<WebBluetoothRemoteGATTService> webService) +BluetoothRemoteGATTService::BluetoothRemoteGATTService(std::unique_ptr<WebBluetoothRemoteGATTService> webService) : m_webService(std::move(webService)) { } -BluetoothRemoteGATTService* BluetoothRemoteGATTService::take(ScriptPromiseResolver*, PassOwnPtr<WebBluetoothRemoteGATTService> webService) +BluetoothRemoteGATTService* BluetoothRemoteGATTService::take(ScriptPromiseResolver*, std::unique_ptr<WebBluetoothRemoteGATTService> webService) { if (!webService) { return nullptr; @@ -46,14 +48,14 @@ if (m_quantity == mojom::WebBluetoothGATTQueryQuantity::SINGLE) { DCHECK_EQ(1u, webCharacteristics.size()); - m_resolver->resolve(BluetoothRemoteGATTCharacteristic::take(m_resolver, adoptPtr(webCharacteristics[0]))); + m_resolver->resolve(BluetoothRemoteGATTCharacteristic::take(m_resolver, wrapUnique(webCharacteristics[0]))); return; } HeapVector<Member<BluetoothRemoteGATTCharacteristic>> characteristics; characteristics.reserveInitialCapacity(webCharacteristics.size()); for (WebBluetoothRemoteGATTCharacteristicInit* webCharacteristic : webCharacteristics) { - characteristics.append(BluetoothRemoteGATTCharacteristic::take(m_resolver, adoptPtr(webCharacteristic))); + characteristics.append(BluetoothRemoteGATTCharacteristic::take(m_resolver, wrapUnique(webCharacteristic))); } m_resolver->resolve(characteristics); }
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.h index 107c2ec..1f647c1 100644 --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.h +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.h
@@ -10,9 +10,8 @@ #include "platform/heap/Handle.h" #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTService.h" #include "public/platform/modules/bluetooth/web_bluetooth.mojom.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -33,11 +32,11 @@ , public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); public: - explicit BluetoothRemoteGATTService(PassOwnPtr<WebBluetoothRemoteGATTService>); + explicit BluetoothRemoteGATTService(std::unique_ptr<WebBluetoothRemoteGATTService>); // Interface required by CallbackPromiseAdapter: - using WebType = OwnPtr<WebBluetoothRemoteGATTService>; - static BluetoothRemoteGATTService* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetoothRemoteGATTService>); + using WebType = std::unique_ptr<WebBluetoothRemoteGATTService>; + static BluetoothRemoteGATTService* take(ScriptPromiseResolver*, std::unique_ptr<WebBluetoothRemoteGATTService>); // Interface required by garbage collection. DEFINE_INLINE_TRACE() { } @@ -52,7 +51,7 @@ private: ScriptPromise getCharacteristicsImpl(ScriptState*, mojom::WebBluetoothGATTQueryQuantity, String characteristicUUID = String()); - OwnPtr<WebBluetoothRemoteGATTService> m_webService; + std::unique_ptr<WebBluetoothRemoteGATTService> m_webService; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/cachestorage/Cache.cpp b/third_party/WebKit/Source/modules/cachestorage/Cache.cpp index 29bd687..3a3787ef 100644 --- a/third_party/WebKit/Source/modules/cachestorage/Cache.cpp +++ b/third_party/WebKit/Source/modules/cachestorage/Cache.cpp
@@ -23,7 +23,6 @@ #include "platform/Histogram.h" #include "platform/RuntimeEnabledFeatures.h" #include "public/platform/modules/serviceworker/WebServiceWorkerCache.h" - #include <memory> namespace blink { @@ -360,7 +359,7 @@ WebServiceWorkerResponse m_webResponse; }; -Cache* Cache::create(GlobalFetch::ScopedFetcher* fetcher, PassOwnPtr<WebServiceWorkerCache> webCache) +Cache* Cache::create(GlobalFetch::ScopedFetcher* fetcher, std::unique_ptr<WebServiceWorkerCache> webCache) { return new Cache(fetcher, std::move(webCache)); } @@ -472,7 +471,7 @@ return webQueryParams; } -Cache::Cache(GlobalFetch::ScopedFetcher* fetcher, PassOwnPtr<WebServiceWorkerCache> webCache) +Cache::Cache(GlobalFetch::ScopedFetcher* fetcher, std::unique_ptr<WebServiceWorkerCache> webCache) : m_scopedFetcher(fetcher) , m_webCache(std::move(webCache)) {
diff --git a/third_party/WebKit/Source/modules/cachestorage/Cache.h b/third_party/WebKit/Source/modules/cachestorage/Cache.h index 3ae67a6..8357fe99 100644 --- a/third_party/WebKit/Source/modules/cachestorage/Cache.h +++ b/third_party/WebKit/Source/modules/cachestorage/Cache.h
@@ -14,9 +14,9 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -31,7 +31,7 @@ DEFINE_WRAPPERTYPEINFO(); WTF_MAKE_NONCOPYABLE(Cache); public: - static Cache* create(GlobalFetch::ScopedFetcher*, PassOwnPtr<WebServiceWorkerCache>); + static Cache* create(GlobalFetch::ScopedFetcher*, std::unique_ptr<WebServiceWorkerCache>); // From Cache.idl: ScriptPromise match(ScriptState*, const RequestInfo&, const CacheQueryOptions&, ExceptionState&); @@ -53,7 +53,7 @@ class BlobHandleCallbackForPut; class FetchResolvedForAdd; friend class FetchResolvedForAdd; - Cache(GlobalFetch::ScopedFetcher*, PassOwnPtr<WebServiceWorkerCache>); + Cache(GlobalFetch::ScopedFetcher*, std::unique_ptr<WebServiceWorkerCache>); ScriptPromise matchImpl(ScriptState*, const Request*, const CacheQueryOptions&); ScriptPromise matchAllImpl(ScriptState*); @@ -67,7 +67,7 @@ WebServiceWorkerCache* webCache() const; Member<GlobalFetch::ScopedFetcher> m_scopedFetcher; - OwnPtr<WebServiceWorkerCache> m_webCache; + std::unique_ptr<WebServiceWorkerCache> m_webCache; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/cachestorage/CacheStorage.cpp b/third_party/WebKit/Source/modules/cachestorage/CacheStorage.cpp index f6152032..057bd46cc 100644 --- a/third_party/WebKit/Source/modules/cachestorage/CacheStorage.cpp +++ b/third_party/WebKit/Source/modules/cachestorage/CacheStorage.cpp
@@ -15,6 +15,8 @@ #include "platform/RuntimeEnabledFeatures.h" #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" #include "public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -95,7 +97,7 @@ { if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; - Cache* cache = Cache::create(m_cacheStorage->m_scopedFetcher, adoptPtr(webCache.release())); + Cache* cache = Cache::create(m_cacheStorage->m_scopedFetcher, wrapUnique(webCache.release())); m_cacheStorage->m_nameToCacheMap.set(m_cacheName, cache); m_resolver->resolve(cache); m_resolver.clear(); @@ -216,7 +218,7 @@ CacheStorage* CacheStorage::create(GlobalFetch::ScopedFetcher* fetcher, WebServiceWorkerCacheStorage* webCacheStorage) { - return new CacheStorage(fetcher, adoptPtr(webCacheStorage)); + return new CacheStorage(fetcher, wrapUnique(webCacheStorage)); } ScriptPromise CacheStorage::open(ScriptState* scriptState, const String& cacheName, ExceptionState& exceptionState) @@ -325,7 +327,7 @@ return promise; } -CacheStorage::CacheStorage(GlobalFetch::ScopedFetcher* fetcher, PassOwnPtr<WebServiceWorkerCacheStorage> webCacheStorage) +CacheStorage::CacheStorage(GlobalFetch::ScopedFetcher* fetcher, std::unique_ptr<WebServiceWorkerCacheStorage> webCacheStorage) : m_scopedFetcher(fetcher) , m_webCacheStorage(std::move(webCacheStorage)) {
diff --git a/third_party/WebKit/Source/modules/cachestorage/CacheStorage.h b/third_party/WebKit/Source/modules/cachestorage/CacheStorage.h index 29a4721..9a0d149d 100644 --- a/third_party/WebKit/Source/modules/cachestorage/CacheStorage.h +++ b/third_party/WebKit/Source/modules/cachestorage/CacheStorage.h
@@ -15,6 +15,7 @@ #include "wtf/Forward.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -47,11 +48,11 @@ friend class WithCacheCallbacks; friend class DeleteCallbacks; - CacheStorage(GlobalFetch::ScopedFetcher*, PassOwnPtr<WebServiceWorkerCacheStorage>); + CacheStorage(GlobalFetch::ScopedFetcher*, std::unique_ptr<WebServiceWorkerCacheStorage>); ScriptPromise matchImpl(ScriptState*, const Request*, const CacheQueryOptions&); Member<GlobalFetch::ScopedFetcher> m_scopedFetcher; - OwnPtr<WebServiceWorkerCacheStorage> m_webCacheStorage; + std::unique_ptr<WebServiceWorkerCacheStorage> m_webCacheStorage; HeapHashMap<String, Member<Cache>> m_nameToCacheMap; };
diff --git a/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp b/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp index d2f723b2..0d39207 100644 --- a/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp +++ b/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp
@@ -24,9 +24,9 @@ #include "public/platform/WebURLResponse.h" #include "public/platform/modules/serviceworker/WebServiceWorkerCache.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" - +#include "wtf/PtrUtil.h" #include <algorithm> +#include <memory> #include <string> namespace blink { @@ -117,7 +117,7 @@ checkUrlIfProvided(webRequest.url()); checkQueryParamsIfProvided(queryParams); - OwnPtr<CacheMatchCallbacks> ownedCallbacks(adoptPtr(callbacks)); + std::unique_ptr<CacheMatchCallbacks> ownedCallbacks(wrapUnique(callbacks)); return callbacks->onError(m_error); } @@ -127,7 +127,7 @@ checkUrlIfProvided(webRequest.url()); checkQueryParamsIfProvided(queryParams); - OwnPtr<CacheWithResponsesCallbacks> ownedCallbacks(adoptPtr(callbacks)); + std::unique_ptr<CacheWithResponsesCallbacks> ownedCallbacks(wrapUnique(callbacks)); return callbacks->onError(m_error); } @@ -139,7 +139,7 @@ checkQueryParamsIfProvided(queryParams); } - OwnPtr<CacheWithRequestsCallbacks> ownedCallbacks(adoptPtr(callbacks)); + std::unique_ptr<CacheWithRequestsCallbacks> ownedCallbacks(wrapUnique(callbacks)); return callbacks->onError(m_error); } @@ -148,7 +148,7 @@ m_lastErrorWebCacheMethodCalled = "dispatchBatch"; checkBatchOperationsIfProvided(batchOperations); - OwnPtr<CacheBatchCallbacks> ownedCallbacks(adoptPtr(callbacks)); + std::unique_ptr<CacheBatchCallbacks> ownedCallbacks(wrapUnique(callbacks)); return callbacks->onError(m_error); } @@ -213,7 +213,7 @@ Cache* createCache(ScopedFetcherForTests* fetcher, WebServiceWorkerCache* webCache) { - return Cache::create(fetcher, adoptPtr(webCache)); + return Cache::create(fetcher, wrapUnique(webCache)); } ScriptState* getScriptState() { return ScriptState::forMainWorld(m_page->document().frame()); } @@ -306,7 +306,7 @@ }; // Lifetime is that of the text fixture. - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; NonThrowableExceptionState m_exceptionState; }; @@ -479,7 +479,7 @@ // From WebServiceWorkerCache: void dispatchMatch(CacheMatchCallbacks* callbacks, const WebServiceWorkerRequest& webRequest, const QueryParams& queryParams) override { - OwnPtr<CacheMatchCallbacks> ownedCallbacks(adoptPtr(callbacks)); + std::unique_ptr<CacheMatchCallbacks> ownedCallbacks(wrapUnique(callbacks)); return callbacks->onSuccess(m_response); } @@ -515,7 +515,7 @@ void dispatchKeys(CacheWithRequestsCallbacks* callbacks, const WebServiceWorkerRequest* webRequest, const QueryParams& queryParams) override { - OwnPtr<CacheWithRequestsCallbacks> ownedCallbacks(adoptPtr(callbacks)); + std::unique_ptr<CacheWithRequestsCallbacks> ownedCallbacks(wrapUnique(callbacks)); return callbacks->onSuccess(m_requests); } @@ -560,13 +560,13 @@ void dispatchMatchAll(CacheWithResponsesCallbacks* callbacks, const WebServiceWorkerRequest& webRequest, const QueryParams& queryParams) override { - OwnPtr<CacheWithResponsesCallbacks> ownedCallbacks(adoptPtr(callbacks)); + std::unique_ptr<CacheWithResponsesCallbacks> ownedCallbacks(wrapUnique(callbacks)); return callbacks->onSuccess(m_responses); } void dispatchBatch(CacheBatchCallbacks* callbacks, const WebVector<BatchOperation>& batchOperations) override { - OwnPtr<CacheBatchCallbacks> ownedCallbacks(adoptPtr(callbacks)); + std::unique_ptr<CacheBatchCallbacks> ownedCallbacks(wrapUnique(callbacks)); return callbacks->onSuccess(); }
diff --git a/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.cpp b/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.cpp index ab8ea03..a509375 100644 --- a/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.cpp +++ b/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.cpp
@@ -20,13 +20,12 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/StringBuilder.h" - #include <algorithm> #include <memory> @@ -64,7 +63,7 @@ return true; } -PassOwnPtr<WebServiceWorkerCacheStorage> assertCacheStorage(ErrorString* errorString, const String& securityOrigin) +std::unique_ptr<WebServiceWorkerCacheStorage> assertCacheStorage(ErrorString* errorString, const String& securityOrigin) { RefPtr<SecurityOrigin> secOrigin = SecurityOrigin::createFromString(securityOrigin); @@ -74,13 +73,13 @@ return nullptr; } - OwnPtr<WebServiceWorkerCacheStorage> cache = adoptPtr(Platform::current()->cacheStorage(WebSecurityOrigin(secOrigin))); + std::unique_ptr<WebServiceWorkerCacheStorage> cache = wrapUnique(Platform::current()->cacheStorage(WebSecurityOrigin(secOrigin))); if (!cache) *errorString = "Could not find cache storage."; return cache; } -PassOwnPtr<WebServiceWorkerCacheStorage> assertCacheStorageAndNameForId(ErrorString* errorString, const String& cacheId, String* cacheName) +std::unique_ptr<WebServiceWorkerCacheStorage> assertCacheStorageAndNameForId(ErrorString* errorString, const String& cacheId, String* cacheName) { String securityOrigin; if (!parseCacheId(errorString, cacheId, &securityOrigin, cacheName)) { @@ -249,7 +248,7 @@ WTF_MAKE_NONCOPYABLE(GetCacheKeysForRequestData); public: - GetCacheKeysForRequestData(const DataRequestParams& params, PassOwnPtr<WebServiceWorkerCache> cache, std::unique_ptr<RequestEntriesCallback> callback) + GetCacheKeysForRequestData(const DataRequestParams& params, std::unique_ptr<WebServiceWorkerCache> cache, std::unique_ptr<RequestEntriesCallback> callback) : m_params(params) , m_cache(std::move(cache)) , m_callback(std::move(callback)) @@ -281,7 +280,7 @@ private: DataRequestParams m_params; - OwnPtr<WebServiceWorkerCache> m_cache; + std::unique_ptr<WebServiceWorkerCache> m_cache; std::unique_ptr<RequestEntriesCallback> m_callback; }; @@ -299,7 +298,7 @@ void onSuccess(std::unique_ptr<WebServiceWorkerCache> cache) override { - auto* cacheRequest = new GetCacheKeysForRequestData(m_params, adoptPtr(cache.release()), std::move(m_callback)); + auto* cacheRequest = new GetCacheKeysForRequestData(m_params, wrapUnique(cache.release()), std::move(m_callback)); cacheRequest->cache()->dispatchKeys(cacheRequest, nullptr, WebServiceWorkerCache::QueryParams()); } @@ -418,7 +417,7 @@ return; } - OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString, securityOrigin); + std::unique_ptr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString, securityOrigin); if (!cache) { callback->sendFailure(*errorString); return; @@ -429,7 +428,7 @@ void InspectorCacheStorageAgent::requestEntries(ErrorString* errorString, const String& cacheId, int skipCount, int pageSize, std::unique_ptr<RequestEntriesCallback> callback) { String cacheName; - OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); + std::unique_ptr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); if (!cache) { callback->sendFailure(*errorString); return; @@ -444,7 +443,7 @@ void InspectorCacheStorageAgent::deleteCache(ErrorString* errorString, const String& cacheId, std::unique_ptr<DeleteCacheCallback> callback) { String cacheName; - OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); + std::unique_ptr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); if (!cache) { callback->sendFailure(*errorString); return; @@ -455,7 +454,7 @@ void InspectorCacheStorageAgent::deleteEntry(ErrorString* errorString, const String& cacheId, const String& request, std::unique_ptr<DeleteEntryCallback> callback) { String cacheName; - OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); + std::unique_ptr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId(errorString, cacheId, &cacheName); if (!cache) { callback->sendFailure(*errorString); return;
diff --git a/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.h b/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.h index 7b16352..868a0b0 100644 --- a/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.h +++ b/third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.h
@@ -8,7 +8,6 @@ #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/CacheStorage.h" #include "modules/ModulesExport.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp index 7ddd64cf..9ed184d 100644 --- a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp +++ b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModuleTest.cpp
@@ -12,6 +12,7 @@ #include "core/offscreencanvas/OffscreenCanvas.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -21,7 +22,7 @@ { Page::PageClients pageClients; fillWithEmptyClients(pageClients); - OwnPtr<DummyPageHolder> m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients); + std::unique_ptr<DummyPageHolder> m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients); Persistent<HTMLDocument> m_document = toHTMLDocument(&m_dummyPageHolder->document()); m_document->documentElement()->setInnerHTML("<body><canvas id='c'></canvas></body>", ASSERT_NO_EXCEPTION); m_document->view()->updateAllLifecyclePhases();
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp index cab800506..ba8009b 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -62,7 +62,6 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkImageFilter.h" #include "wtf/MathExtras.h" -#include "wtf/OwnPtr.h" #include "wtf/text/StringBuilder.h" #include "wtf/typed_arrays/ArrayBufferContents.h"
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp index a45f82dd6..81889c2ac 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp
@@ -20,6 +20,7 @@ #include "platform/graphics/UnacceleratedImageBufferSurface.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> using ::testing::Mock; @@ -38,7 +39,7 @@ void createContext(OpacityMode); private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; Persistent<HTMLCanvasElement> m_canvasElement;
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp index d0f57780..cff1f1b0 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp
@@ -22,6 +22,7 @@ #include "platform/graphics/skia/SkiaUtils.h" #include "third_party/skia/include/effects/SkDashPathEffect.h" #include "third_party/skia/include/effects/SkDropShadowImageFilter.h" +#include <memory> static const char defaultFont[] = "10px sans-serif"; static const char defaultFilter[] = "none"; @@ -351,7 +352,7 @@ SkDrawLooper* CanvasRenderingContext2DState::emptyDrawLooper() const { if (!m_emptyDrawLooper) { - OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); m_emptyDrawLooper = drawLooperBuilder->detachDrawLooper(); } return m_emptyDrawLooper.get(); @@ -360,7 +361,7 @@ SkDrawLooper* CanvasRenderingContext2DState::shadowOnlyDrawLooper() const { if (!m_shadowOnlyDrawLooper) { - OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); drawLooperBuilder->addShadow(m_shadowOffset, m_shadowBlur, m_shadowColor, DrawLooperBuilder::ShadowIgnoresTransforms, DrawLooperBuilder::ShadowRespectsAlpha); m_shadowOnlyDrawLooper = drawLooperBuilder->detachDrawLooper(); } @@ -370,7 +371,7 @@ SkDrawLooper* CanvasRenderingContext2DState::shadowAndForegroundDrawLooper() const { if (!m_shadowAndForegroundDrawLooper) { - OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); drawLooperBuilder->addShadow(m_shadowOffset, m_shadowBlur, m_shadowColor, DrawLooperBuilder::ShadowIgnoresTransforms, DrawLooperBuilder::ShadowRespectsAlpha); drawLooperBuilder->addUnmodifiedContent(); m_shadowAndForegroundDrawLooper = drawLooperBuilder->detachDrawLooper();
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp index dd38e5a4..a33dbaf 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp
@@ -23,6 +23,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkSurface.h" +#include "wtf/PtrUtil.h" +#include <memory> using ::testing::Mock; @@ -88,7 +90,7 @@ void unrefCanvas(); private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; Persistent<HTMLCanvasElement> m_canvasElement; Persistent<MemoryCache> m_globalMemoryCache; @@ -209,7 +211,7 @@ //============================================================================ #define TEST_OVERDRAW_SETUP(EXPECTED_OVERDRAWS) \ - OwnPtr<MockImageBufferSurfaceForOverwriteTesting> mockSurface = adoptPtr(new MockImageBufferSurfaceForOverwriteTesting(IntSize(10, 10), NonOpaque)); \ + std::unique_ptr<MockImageBufferSurfaceForOverwriteTesting> mockSurface = wrapUnique(new MockImageBufferSurfaceForOverwriteTesting(IntSize(10, 10), NonOpaque)); \ MockImageBufferSurfaceForOverwriteTesting* surfacePtr = mockSurface.get(); \ canvasElement().createImageBufferUsingSurfaceForTesting(std::move(mockSurface)); \ EXPECT_CALL(*surfacePtr, willOverwriteCanvas()).Times(EXPECTED_OVERDRAWS); \ @@ -261,13 +263,13 @@ ExpectFallback, ExpectNoFallback }; - static PassOwnPtr<MockSurfaceFactory> create(FallbackExpectation expectation) { return adoptPtr(new MockSurfaceFactory(expectation)); } + static std::unique_ptr<MockSurfaceFactory> create(FallbackExpectation expectation) { return wrapUnique(new MockSurfaceFactory(expectation)); } - PassOwnPtr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode mode) override + std::unique_ptr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode mode) override { EXPECT_EQ(ExpectFallback, m_expectation); m_didFallback = true; - return adoptPtr(new UnacceleratedImageBufferSurface(size, mode)); + return wrapUnique(new UnacceleratedImageBufferSurface(size, mode)); } ~MockSurfaceFactory() override @@ -407,7 +409,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionByDefault) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); EXPECT_FALSE(canvasElement().shouldBeDirectComposited()); @@ -416,7 +418,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionUnderOverdrawLimit) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->setGlobalAlpha(0.5f); // To prevent overdraw optimization @@ -430,7 +432,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionOverOverdrawLimit) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->setGlobalAlpha(0.5f); // To prevent overdraw optimization @@ -444,7 +446,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionUnderImageSizeRatioLimit) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); NonThrowableExceptionState exceptionState; @@ -452,7 +454,7 @@ EXPECT_FALSE(exceptionState.hadException()); HTMLCanvasElement* sourceCanvas = static_cast<HTMLCanvasElement*>(sourceCanvasElement); IntSize sourceSize(10, 10 * ExpensiveCanvasHeuristicParameters::ExpensiveImageSizeRatio); - OwnPtr<UnacceleratedImageBufferSurface> sourceSurface = adoptPtr(new UnacceleratedImageBufferSurface(sourceSize, NonOpaque)); + std::unique_ptr<UnacceleratedImageBufferSurface> sourceSurface = wrapUnique(new UnacceleratedImageBufferSurface(sourceSize, NonOpaque)); sourceCanvas->createImageBufferUsingSurfaceForTesting(std::move(sourceSurface)); const ImageBitmapOptions defaultOptions; @@ -468,7 +470,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionOverImageSizeRatioLimit) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); NonThrowableExceptionState exceptionState; @@ -476,7 +478,7 @@ EXPECT_FALSE(exceptionState.hadException()); HTMLCanvasElement* sourceCanvas = static_cast<HTMLCanvasElement*>(sourceCanvasElement); IntSize sourceSize(10, 10 * ExpensiveCanvasHeuristicParameters::ExpensiveImageSizeRatio + 1); - OwnPtr<UnacceleratedImageBufferSurface> sourceSurface = adoptPtr(new UnacceleratedImageBufferSurface(sourceSize, NonOpaque)); + std::unique_ptr<UnacceleratedImageBufferSurface> sourceSurface = wrapUnique(new UnacceleratedImageBufferSurface(sourceSize, NonOpaque)); sourceCanvas->createImageBufferUsingSurfaceForTesting(std::move(sourceSurface)); const ImageBitmapOptions defaultOptions; @@ -492,7 +494,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionUnderExpensivePathPointCount) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->beginPath(); @@ -509,7 +511,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionOverExpensivePathPointCount) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->beginPath(); @@ -526,7 +528,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionWhenPathIsConcave) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->beginPath(); @@ -546,7 +548,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionWithRectangleClip) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->beginPath(); @@ -560,7 +562,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionWithComplexClip) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->beginPath(); @@ -581,7 +583,7 @@ TEST_F(CanvasRenderingContext2DTest, LayerPromotionWithBlurredShadow) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->setShadowColor(String("red")); @@ -598,7 +600,7 @@ TEST_F(CanvasRenderingContext2DTest, NoLayerPromotionWithSharpShadow) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->setShadowColor(String("red")); @@ -611,7 +613,7 @@ TEST_F(CanvasRenderingContext2DTest, NoFallbackWithSmallState) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->fillRect(0, 0, 1, 1); // To have a non-empty dirty rect @@ -625,7 +627,7 @@ TEST_F(CanvasRenderingContext2DTest, FallbackWithLargeState) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->fillRect(0, 0, 1, 1); // To have a non-empty dirty rect @@ -644,7 +646,7 @@ // does not support pixel geometry settings. // See: crbug.com/583809 createContext(Opaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectFallback), Opaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectFallback), Opaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->fillText("Text", 0, 5); @@ -653,7 +655,7 @@ TEST_F(CanvasRenderingContext2DTest, NonOpaqueDisplayListDoesNotFallBackForText) { createContext(NonOpaque); - OwnPtr<RecordingImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); + std::unique_ptr<RecordingImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), MockSurfaceFactory::create(MockSurfaceFactory::ExpectNoFallback), NonOpaque)); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(surface)); context2d()->fillText("Text", 0, 5); @@ -685,7 +687,7 @@ { createContext(NonOpaque); - OwnPtr<FakeAcceleratedImageBufferSurfaceForTesting> fakeAccelerateSurface = adoptPtr(new FakeAcceleratedImageBufferSurfaceForTesting(IntSize(10, 10), NonOpaque)); + std::unique_ptr<FakeAcceleratedImageBufferSurfaceForTesting> fakeAccelerateSurface = wrapUnique(new FakeAcceleratedImageBufferSurfaceForTesting(IntSize(10, 10), NonOpaque)); FakeAcceleratedImageBufferSurfaceForTesting* fakeAccelerateSurfacePtr = fakeAccelerateSurface.get(); canvasElement().createImageBufferUsingSurfaceForTesting(std::move(fakeAccelerateSurface)); // 800 = 10 * 10 * 4 * 2 where 10*10 is canvas size, 4 is num of bytes per pixel per buffer, @@ -709,8 +711,8 @@ EXPECT_EQ(1u, getGlobalAcceleratedImageBufferCount()); // Creating a different accelerated image buffer - OwnPtr<FakeAcceleratedImageBufferSurfaceForTesting> fakeAccelerateSurface2 = adoptPtr(new FakeAcceleratedImageBufferSurfaceForTesting(IntSize(10, 5), NonOpaque)); - OwnPtr<ImageBuffer> imageBuffer2 = ImageBuffer::create(std::move(fakeAccelerateSurface2)); + std::unique_ptr<FakeAcceleratedImageBufferSurfaceForTesting> fakeAccelerateSurface2 = wrapUnique(new FakeAcceleratedImageBufferSurfaceForTesting(IntSize(10, 5), NonOpaque)); + std::unique_ptr<ImageBuffer> imageBuffer2 = ImageBuffer::create(std::move(fakeAccelerateSurface2)); EXPECT_EQ(800, getCurrentGPUMemoryUsage()); EXPECT_EQ(1200, getGlobalGPUMemoryUsage()); EXPECT_EQ(2u, getGlobalAcceleratedImageBufferCount());
diff --git a/third_party/WebKit/Source/modules/canvas2d/HitRegion.h b/third_party/WebKit/Source/modules/canvas2d/HitRegion.h index 6d3b11e..799dd103 100644 --- a/third_party/WebKit/Source/modules/canvas2d/HitRegion.h +++ b/third_party/WebKit/Source/modules/canvas2d/HitRegion.h
@@ -10,8 +10,6 @@ #include "platform/graphics/Path.h" #include "platform/heap/Handle.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp index 4e04afc..2bf0b6a 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp
@@ -9,10 +9,11 @@ #include "core/workers/WorkerThreadStartupData.h" #include "modules/EventTargetModules.h" #include "modules/compositorworker/CompositorWorkerThread.h" +#include <memory> namespace blink { -CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::create(CompositorWorkerThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData, double timeOrigin) +CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::create(CompositorWorkerThread* thread, std::unique_ptr<WorkerThreadStartupData> startupData, double timeOrigin) { // Note: startupData is finalized on return. After the relevant parts has been // passed along to the created 'context'. @@ -22,7 +23,7 @@ return context; } -CompositorWorkerGlobalScope::CompositorWorkerGlobalScope(const KURL& url, const String& userAgent, CompositorWorkerThread* thread, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) +CompositorWorkerGlobalScope::CompositorWorkerGlobalScope(const KURL& url, const String& userAgent, CompositorWorkerThread* thread, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) : WorkerGlobalScope(url, userAgent, thread, timeOrigin, std::move(starterOriginPrivilegeData), workerClients) , m_executingAnimationFrameCallbacks(false) , m_callbackCollection(this) @@ -48,7 +49,7 @@ void CompositorWorkerGlobalScope::postMessage(ExecutionContext* executionContext, PassRefPtr<SerializedScriptValue> message, const MessagePortArray& ports, ExceptionState& exceptionState) { // Disentangle the port in preparation for sending it to the remote context. - OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(executionContext, ports, exceptionState); + std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(executionContext, ports, exceptionState); if (exceptionState.hadException()) return; thread()->workerObjectProxy().postMessageToWorkerObject(message, std::move(channels));
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.h b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.h index 726131c..c1e619f 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.h +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.h
@@ -10,6 +10,7 @@ #include "core/dom/MessagePort.h" #include "core/workers/WorkerGlobalScope.h" #include "modules/ModulesExport.h" +#include <memory> namespace blink { @@ -19,7 +20,7 @@ class MODULES_EXPORT CompositorWorkerGlobalScope final : public WorkerGlobalScope { DEFINE_WRAPPERTYPEINFO(); public: - static CompositorWorkerGlobalScope* create(CompositorWorkerThread*, PassOwnPtr<WorkerThreadStartupData>, double timeOrigin); + static CompositorWorkerGlobalScope* create(CompositorWorkerThread*, std::unique_ptr<WorkerThreadStartupData>, double timeOrigin); ~CompositorWorkerGlobalScope() override; // EventTarget @@ -38,7 +39,7 @@ DECLARE_VIRTUAL_TRACE(); private: - CompositorWorkerGlobalScope(const KURL&, const String& userAgent, CompositorWorkerThread*, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData>, WorkerClients*); + CompositorWorkerGlobalScope(const KURL&, const String& userAgent, CompositorWorkerThread*, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); CompositorWorkerThread* thread() const; bool m_executingAnimationFrameCallbacks;
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.cpp index 6ad530b..c6c7e911 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.cpp
@@ -6,6 +6,7 @@ #include "core/workers/WorkerThreadStartupData.h" #include "modules/compositorworker/CompositorWorkerThread.h" +#include <memory> namespace blink { @@ -18,7 +19,7 @@ { } -PassOwnPtr<WorkerThread> CompositorWorkerMessagingProxy::createWorkerThread(double originTime) +std::unique_ptr<WorkerThread> CompositorWorkerMessagingProxy::createWorkerThread(double originTime) { return CompositorWorkerThread::create(loaderProxy(), workerObjectProxy(), originTime); }
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.h b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.h index 07d2aeff..8f0752d 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.h +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.h
@@ -7,6 +7,7 @@ #include "core/workers/InProcessWorkerMessagingProxy.h" #include "wtf/Allocator.h" +#include <memory> namespace blink { @@ -18,7 +19,7 @@ protected: ~CompositorWorkerMessagingProxy() override; - PassOwnPtr<WorkerThread> createWorkerThread(double originTime) override; + std::unique_ptr<WorkerThread> createWorkerThread(double originTime) override; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp index de797ad..4573680 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp
@@ -16,6 +16,8 @@ #include "platform/WebThreadSupportingGC.h" #include "public/platform/Platform.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -60,7 +62,7 @@ WorkerBackingThread* thread() { return m_thread.get(); } private: - BackingThreadHolder(PassOwnPtr<WorkerBackingThread> useBackingThread = nullptr) + BackingThreadHolder(std::unique_ptr<WorkerBackingThread> useBackingThread = nullptr) : m_thread(useBackingThread ? std::move(useBackingThread) : WorkerBackingThread::create(Platform::current()->compositorThread())) { DCHECK(isMainThread()); @@ -95,7 +97,7 @@ doneEvent->signal(); } - OwnPtr<WorkerBackingThread> m_thread; + std::unique_ptr<WorkerBackingThread> m_thread; bool m_initialized = false; static BackingThreadHolder* s_instance; @@ -105,11 +107,11 @@ } // namespace -PassOwnPtr<CompositorWorkerThread> CompositorWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) +std::unique_ptr<CompositorWorkerThread> CompositorWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositorWorkerThread::create"); ASSERT(isMainThread()); - return adoptPtr(new CompositorWorkerThread(workerLoaderProxy, workerObjectProxy, timeOrigin)); + return wrapUnique(new CompositorWorkerThread(workerLoaderProxy, workerObjectProxy, timeOrigin)); } CompositorWorkerThread::CompositorWorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin) @@ -128,7 +130,7 @@ return *BackingThreadHolder::instance().thread(); } -WorkerGlobalScope*CompositorWorkerThread::createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData> startupData) +WorkerGlobalScope*CompositorWorkerThread::createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData> startupData) { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositorWorkerThread::createWorkerGlobalScope"); return CompositorWorkerGlobalScope::create(this, std::move(startupData), m_timeOrigin);
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.h b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.h index b72fe9c..1ca5db2 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.h +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.h
@@ -7,6 +7,7 @@ #include "core/workers/WorkerThread.h" #include "modules/ModulesExport.h" +#include <memory> namespace blink { @@ -14,7 +15,7 @@ class MODULES_EXPORT CompositorWorkerThread final : public WorkerThread { public: - static PassOwnPtr<CompositorWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); + static std::unique_ptr<CompositorWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); ~CompositorWorkerThread() override; InProcessWorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; } @@ -29,7 +30,7 @@ protected: CompositorWorkerThread(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin); - WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override; + WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) override; bool isOwningBackingThread() const override { return false; } private:
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp index 1b3c0d83..adb2ac49 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
@@ -23,6 +23,8 @@ #include "public/platform/Platform.h" #include "public/platform/WebAddressSpace.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { namespace { @@ -30,13 +32,13 @@ // A null InProcessWorkerObjectProxy, supplied when creating CompositorWorkerThreads. class TestCompositorWorkerObjectProxy : public InProcessWorkerObjectProxy { public: - static PassOwnPtr<TestCompositorWorkerObjectProxy> create(ExecutionContext* context) + static std::unique_ptr<TestCompositorWorkerObjectProxy> create(ExecutionContext* context) { - return adoptPtr(new TestCompositorWorkerObjectProxy(context)); + return wrapUnique(new TestCompositorWorkerObjectProxy(context)); } // (Empty) WorkerReportingProxy implementation: - virtual void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) {} + virtual void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) {} void reportConsoleMessage(ConsoleMessage*) override {} void postMessageToPageInspector(const String&) override {} void postWorkerConsoleAgentEnabled() override {} @@ -75,7 +77,7 @@ class CompositorWorkerTestPlatform : public TestingPlatformSupport { public: CompositorWorkerTestPlatform() - : m_thread(adoptPtr(m_oldPlatform->createThread("Compositor"))) + : m_thread(wrapUnique(m_oldPlatform->createThread("Compositor"))) { } @@ -87,7 +89,7 @@ WebCompositorSupport* compositorSupport() override { return &m_compositorSupport; } private: - OwnPtr<WebThread> m_thread; + std::unique_ptr<WebThread> m_thread; TestingCompositorSupport m_compositorSupport; }; @@ -109,9 +111,9 @@ CompositorWorkerThread::clearSharedBackingThread(); } - PassOwnPtr<CompositorWorkerThread> createCompositorWorker() + std::unique_ptr<CompositorWorkerThread> createCompositorWorker() { - OwnPtr<CompositorWorkerThread> workerThread = CompositorWorkerThread::create(nullptr, *m_objectProxy, 0); + std::unique_ptr<CompositorWorkerThread> workerThread = CompositorWorkerThread::create(nullptr, *m_objectProxy, 0); WorkerClients* clients = WorkerClients::create(); provideCompositorProxyClientTo(clients, new TestCompositorProxyClient); workerThread->start(WorkerThreadStartupData::create( @@ -132,7 +134,7 @@ // Attempts to run some simple script for |worker|. void checkWorkerCanExecuteScript(WorkerThread* worker) { - OwnPtr<WaitableEvent> waitEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> waitEvent = wrapUnique(new WaitableEvent()); worker->workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&CompositorWorkerThreadTest::executeScriptInWorker, AllowCrossThreadAccess(this), AllowCrossThreadAccess(worker), AllowCrossThreadAccess(waitEvent.get()))); waitEvent->wait(); @@ -147,15 +149,15 @@ waitEvent->signal(); } - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; RefPtr<SecurityOrigin> m_securityOrigin; - OwnPtr<InProcessWorkerObjectProxy> m_objectProxy; + std::unique_ptr<InProcessWorkerObjectProxy> m_objectProxy; CompositorWorkerTestPlatform m_testPlatform; }; TEST_F(CompositorWorkerThreadTest, Basic) { - OwnPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker(); + std::unique_ptr<CompositorWorkerThread> compositorWorker = createCompositorWorker(); checkWorkerCanExecuteScript(compositorWorker.get()); compositorWorker->terminateAndWait(); } @@ -164,14 +166,14 @@ TEST_F(CompositorWorkerThreadTest, CreateSecondAndTerminateFirst) { // Create the first worker and wait until it is initialized. - OwnPtr<CompositorWorkerThread> firstWorker = createCompositorWorker(); + std::unique_ptr<CompositorWorkerThread> firstWorker = createCompositorWorker(); WebThreadSupportingGC* firstThread = &firstWorker->workerBackingThread().backingThread(); checkWorkerCanExecuteScript(firstWorker.get()); v8::Isolate* firstIsolate = firstWorker->isolate(); ASSERT_TRUE(firstIsolate); // Create the second worker and immediately destroy the first worker. - OwnPtr<CompositorWorkerThread> secondWorker = createCompositorWorker(); + std::unique_ptr<CompositorWorkerThread> secondWorker = createCompositorWorker(); // We don't use terminateAndWait here to avoid forcible termination. firstWorker->terminate(); firstWorker->waitForShutdownForTesting(); @@ -195,7 +197,7 @@ TEST_F(CompositorWorkerThreadTest, TerminateFirstAndCreateSecond) { // Create the first worker, wait until it is initialized, and terminate it. - OwnPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker(); + std::unique_ptr<CompositorWorkerThread> compositorWorker = createCompositorWorker(); WebThreadSupportingGC* firstThread = &compositorWorker->workerBackingThread().backingThread(); checkWorkerCanExecuteScript(compositorWorker.get()); @@ -215,7 +217,7 @@ // Tests that v8::Isolate and WebThread are correctly set-up if a worker is created while another is terminating. TEST_F(CompositorWorkerThreadTest, CreatingSecondDuringTerminationOfFirst) { - OwnPtr<CompositorWorkerThread> firstWorker = createCompositorWorker(); + std::unique_ptr<CompositorWorkerThread> firstWorker = createCompositorWorker(); checkWorkerCanExecuteScript(firstWorker.get()); v8::Isolate* firstIsolate = firstWorker->isolate(); ASSERT_TRUE(firstIsolate); @@ -227,7 +229,7 @@ // Note: We rely on the assumption that the termination steps don't run // on the worker thread so quickly. This could be a source of flakiness. - OwnPtr<CompositorWorkerThread> secondWorker = createCompositorWorker(); + std::unique_ptr<CompositorWorkerThread> secondWorker = createCompositorWorker(); v8::Isolate* secondIsolate = secondWorker->isolate(); ASSERT_TRUE(secondIsolate);
diff --git a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp index b671c5c..9f93a00 100644 --- a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp +++ b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp
@@ -27,6 +27,8 @@ #include "public/platform/WebCredentialManagerError.h" #include "public/platform/WebFederatedCredential.h" #include "public/platform/WebPasswordCredential.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -80,7 +82,7 @@ Frame* frame = toDocument(m_resolver->getScriptState()->getExecutionContext())->frame(); SECURITY_CHECK(!frame || frame == frame->tree().top()); - OwnPtr<WebCredential> credential = adoptPtr(webCredential.release()); + std::unique_ptr<WebCredential> credential = wrapUnique(webCredential.release()); if (!credential || !frame) { m_resolver->resolve(); return;
diff --git a/third_party/WebKit/Source/modules/credentialmanager/PasswordCredentialTest.cpp b/third_party/WebKit/Source/modules/credentialmanager/PasswordCredentialTest.cpp index bffa584c..f2d8fbe 100644 --- a/third_party/WebKit/Source/modules/credentialmanager/PasswordCredentialTest.cpp +++ b/third_party/WebKit/Source/modules/credentialmanager/PasswordCredentialTest.cpp
@@ -16,6 +16,7 @@ #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -45,7 +46,7 @@ } private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLDocument> m_document; };
diff --git a/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp b/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp index caf0638..d09a7b0 100644 --- a/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp +++ b/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp
@@ -40,9 +40,11 @@ #include "public/platform/WebCryptoAlgorithmParams.h" #include "public/platform/WebString.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/StringBuilder.h" #include <algorithm> +#include <memory> namespace blink { @@ -447,7 +449,7 @@ // dictionary AesCbcParams : Algorithm { // required BufferSource iv; // }; -bool parseAesCbcParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseAesCbcParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { BufferSource ivBufferSource; if (!getBufferSource(raw, "iv", ivBufferSource, context, error)) @@ -455,7 +457,7 @@ DOMArrayPiece iv(ivBufferSource); - params = adoptPtr(new WebCryptoAesCbcParams(iv.bytes(), iv.byteLength())); + params = wrapUnique(new WebCryptoAesCbcParams(iv.bytes(), iv.byteLength())); return true; } @@ -464,13 +466,13 @@ // dictionary AesKeyGenParams : Algorithm { // [EnforceRange] required unsigned short length; // }; -bool parseAesKeyGenParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseAesKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { uint16_t length; if (!getUint16(raw, "length", length, context, error)) return false; - params = adoptPtr(new WebCryptoAesKeyGenParams(length)); + params = wrapUnique(new WebCryptoAesKeyGenParams(length)); return true; } @@ -496,7 +498,7 @@ // FIXME: http://crbug.com/438475: The current implementation differs from the // spec in that the "hash" parameter is required. This seems more sensible, and // is being proposed as a change to the spec. (https://www.w3.org/Bugs/Public/show_bug.cgi?id=27448). -bool parseHmacImportParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseHmacImportParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) @@ -507,7 +509,7 @@ if (!getOptionalUint32(raw, "length", hasLength, length, context, error)) return false; - params = adoptPtr(new WebCryptoHmacImportParams(hash, hasLength, length)); + params = wrapUnique(new WebCryptoHmacImportParams(hash, hasLength, length)); return true; } @@ -517,7 +519,7 @@ // required HashAlgorithmIdentifier hash; // [EnforceRange] unsigned long length; // }; -bool parseHmacKeyGenParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseHmacKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) @@ -528,7 +530,7 @@ if (!getOptionalUint32(raw, "length", hasLength, length, context, error)) return false; - params = adoptPtr(new WebCryptoHmacKeyGenParams(hash, hasLength, length)); + params = wrapUnique(new WebCryptoHmacKeyGenParams(hash, hasLength, length)); return true; } @@ -537,13 +539,13 @@ // dictionary RsaHashedImportParams : Algorithm { // required HashAlgorithmIdentifier hash; // }; -bool parseRsaHashedImportParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseRsaHashedImportParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) return false; - params = adoptPtr(new WebCryptoRsaHashedImportParams(hash)); + params = wrapUnique(new WebCryptoRsaHashedImportParams(hash)); return true; } @@ -557,7 +559,7 @@ // dictionary RsaHashedKeyGenParams : RsaKeyGenParams { // required HashAlgorithmIdentifier hash; // }; -bool parseRsaHashedKeyGenParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseRsaHashedKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { uint32_t modulusLength; if (!getUint32(raw, "modulusLength", modulusLength, context, error)) @@ -571,7 +573,7 @@ if (!parseHash(raw, hash, context, error)) return false; - params = adoptPtr(new WebCryptoRsaHashedKeyGenParams(hash, modulusLength, static_cast<const unsigned char*>(publicExponent->baseAddress()), publicExponent->byteLength())); + params = wrapUnique(new WebCryptoRsaHashedKeyGenParams(hash, modulusLength, static_cast<const unsigned char*>(publicExponent->baseAddress()), publicExponent->byteLength())); return true; } @@ -581,7 +583,7 @@ // required BufferSource counter; // [EnforceRange] required octet length; // }; -bool parseAesCtrParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseAesCtrParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { BufferSource counterBufferSource; if (!getBufferSource(raw, "counter", counterBufferSource, context, error)) @@ -592,7 +594,7 @@ if (!getUint8(raw, "length", length, context, error)) return false; - params = adoptPtr(new WebCryptoAesCtrParams(length, counter.bytes(), counter.byteLength())); + params = wrapUnique(new WebCryptoAesCtrParams(length, counter.bytes(), counter.byteLength())); return true; } @@ -603,7 +605,7 @@ // BufferSource additionalData; // [EnforceRange] octet tagLength; // } -bool parseAesGcmParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseAesGcmParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { BufferSource ivBufferSource; if (!getBufferSource(raw, "iv", ivBufferSource, context, error)) @@ -622,7 +624,7 @@ DOMArrayPiece iv(ivBufferSource); DOMArrayPiece additionalData(additionalDataBufferSource, DOMArrayPiece::AllowNullPointToNullWithZeroSize); - params = adoptPtr(new WebCryptoAesGcmParams(iv.bytes(), iv.byteLength(), hasAdditionalData, additionalData.bytes(), additionalData.byteLength(), hasTagLength, tagLength)); + params = wrapUnique(new WebCryptoAesGcmParams(iv.bytes(), iv.byteLength(), hasAdditionalData, additionalData.bytes(), additionalData.byteLength(), hasTagLength, tagLength)); return true; } @@ -631,7 +633,7 @@ // dictionary RsaOaepParams : Algorithm { // BufferSource label; // }; -bool parseRsaOaepParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseRsaOaepParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { bool hasLabel; BufferSource labelBufferSource; @@ -639,7 +641,7 @@ return false; DOMArrayPiece label(labelBufferSource, DOMArrayPiece::AllowNullPointToNullWithZeroSize); - params = adoptPtr(new WebCryptoRsaOaepParams(hasLabel, label.bytes(), label.byteLength())); + params = wrapUnique(new WebCryptoRsaOaepParams(hasLabel, label.bytes(), label.byteLength())); return true; } @@ -648,13 +650,13 @@ // dictionary RsaPssParams : Algorithm { // [EnforceRange] required unsigned long saltLength; // }; -bool parseRsaPssParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseRsaPssParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { uint32_t saltLengthBytes; if (!getUint32(raw, "saltLength", saltLengthBytes, context, error)) return false; - params = adoptPtr(new WebCryptoRsaPssParams(saltLengthBytes)); + params = wrapUnique(new WebCryptoRsaPssParams(saltLengthBytes)); return true; } @@ -663,13 +665,13 @@ // dictionary EcdsaParams : Algorithm { // required HashAlgorithmIdentifier hash; // }; -bool parseEcdsaParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseEcdsaParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) return false; - params = adoptPtr(new WebCryptoEcdsaParams(hash)); + params = wrapUnique(new WebCryptoEcdsaParams(hash)); return true; } @@ -711,13 +713,13 @@ // dictionary EcKeyGenParams : Algorithm { // required NamedCurve namedCurve; // }; -bool parseEcKeyGenParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseEcKeyGenParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoNamedCurve namedCurve; if (!parseNamedCurve(raw, namedCurve, context, error)) return false; - params = adoptPtr(new WebCryptoEcKeyGenParams(namedCurve)); + params = wrapUnique(new WebCryptoEcKeyGenParams(namedCurve)); return true; } @@ -726,13 +728,13 @@ // dictionary EcKeyImportParams : Algorithm { // required NamedCurve namedCurve; // }; -bool parseEcKeyImportParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseEcKeyImportParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoNamedCurve namedCurve; if (!parseNamedCurve(raw, namedCurve, context, error)) return false; - params = adoptPtr(new WebCryptoEcKeyImportParams(namedCurve)); + params = wrapUnique(new WebCryptoEcKeyImportParams(namedCurve)); return true; } @@ -741,7 +743,7 @@ // dictionary EcdhKeyDeriveParams : Algorithm { // required CryptoKey public; // }; -bool parseEcdhKeyDeriveParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseEcdhKeyDeriveParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { v8::Local<v8::Value> v8Value; if (!raw.get("public", v8Value)) { @@ -755,7 +757,7 @@ return false; } - params = adoptPtr(new WebCryptoEcdhKeyDeriveParams(cryptoKey->key())); + params = wrapUnique(new WebCryptoEcdhKeyDeriveParams(cryptoKey->key())); return true; } @@ -766,7 +768,7 @@ // [EnforceRange] required unsigned long iterations; // required HashAlgorithmIdentifier hash; // }; -bool parsePbkdf2Params(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parsePbkdf2Params(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { BufferSource saltBufferSource; if (!getBufferSource(raw, "salt", saltBufferSource, context, error)) @@ -781,7 +783,7 @@ WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) return false; - params = adoptPtr(new WebCryptoPbkdf2Params(hash, salt.bytes(), salt.byteLength(), iterations)); + params = wrapUnique(new WebCryptoPbkdf2Params(hash, salt.bytes(), salt.byteLength(), iterations)); return true; } @@ -790,13 +792,13 @@ // dictionary AesDerivedKeyParams : Algorithm { // [EnforceRange] required unsigned short length; // }; -bool parseAesDerivedKeyParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseAesDerivedKeyParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { uint16_t length; if (!getUint16(raw, "length", length, context, error)) return false; - params = adoptPtr(new WebCryptoAesDerivedKeyParams(length)); + params = wrapUnique(new WebCryptoAesDerivedKeyParams(length)); return true; } @@ -812,7 +814,7 @@ // required BufferSource salt; // required BufferSource info; // }; -bool parseHkdfParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) +bool parseHkdfParams(const Dictionary& raw, std::unique_ptr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { WebCryptoAlgorithm hash; if (!parseHash(raw, hash, context, error)) @@ -827,11 +829,11 @@ DOMArrayPiece salt(saltBufferSource); DOMArrayPiece info(infoBufferSource); - params = adoptPtr(new WebCryptoHkdfParams(hash, salt.bytes(), salt.byteLength(), info.bytes(), info.byteLength())); + params = wrapUnique(new WebCryptoHkdfParams(hash, salt.bytes(), salt.byteLength(), info.bytes(), info.byteLength())); return true; } -bool parseAlgorithmParams(const Dictionary& raw, WebCryptoAlgorithmParamsType type, OwnPtr<WebCryptoAlgorithmParams>& params, ErrorContext& context, AlgorithmError* error) +bool parseAlgorithmParams(const Dictionary& raw, WebCryptoAlgorithmParamsType type, std::unique_ptr<WebCryptoAlgorithmParams>& params, ErrorContext& context, AlgorithmError* error) { switch (type) { case WebCryptoAlgorithmParamsTypeNone: @@ -942,7 +944,7 @@ WebCryptoAlgorithmParamsType paramsType = static_cast<WebCryptoAlgorithmParamsType>(algorithmInfo->operationToParamsType[op]); - OwnPtr<WebCryptoAlgorithmParams> params; + std::unique_ptr<WebCryptoAlgorithmParams> params; if (!parseAlgorithmParams(raw, paramsType, params, context, error)) return false;
diff --git a/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp b/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp index 41059bb..c957321 100644 --- a/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp +++ b/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp
@@ -17,6 +17,7 @@ #include "platform/graphics/ImageBuffer.h" #include "platform/graphics/PaintGeneratedImage.h" #include "platform/graphics/RecordingImageBufferSurface.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -55,7 +56,7 @@ DCHECK(layoutObject.node()); PaintRenderingContext2D* renderingContext = PaintRenderingContext2D::create( - ImageBuffer::create(adoptPtr(new RecordingImageBufferSurface(size)))); + ImageBuffer::create(wrapUnique(new RecordingImageBufferSurface(size)))); Geometry* geometry = Geometry::create(size); StylePropertyMap* styleMap = FilteredComputedStylePropertyMap::create( CSSComputedStyleDeclaration::create(layoutObject.node()),
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp index 3d887ec..2d975bb 100644 --- a/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp
@@ -5,10 +5,11 @@ #include "modules/csspaint/PaintRenderingContext2D.h" #include "platform/graphics/ImageBuffer.h" +#include <memory> namespace blink { -PaintRenderingContext2D::PaintRenderingContext2D(PassOwnPtr<ImageBuffer> imageBuffer) +PaintRenderingContext2D::PaintRenderingContext2D(std::unique_ptr<ImageBuffer> imageBuffer) : m_imageBuffer(std::move(imageBuffer)) { m_clipAntialiasing = AntiAliased;
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h index 55ab09b..03b3fa6 100644 --- a/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h +++ b/third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.h
@@ -9,6 +9,7 @@ #include "modules/ModulesExport.h" #include "modules/canvas2d/BaseRenderingContext2D.h" #include "platform/graphics/ImageBuffer.h" +#include <memory> class SkCanvas; @@ -22,7 +23,7 @@ USING_GARBAGE_COLLECTED_MIXIN(PaintRenderingContext2D); WTF_MAKE_NONCOPYABLE(PaintRenderingContext2D); public: - static PaintRenderingContext2D* create(PassOwnPtr<ImageBuffer> imageBuffer) + static PaintRenderingContext2D* create(std::unique_ptr<ImageBuffer> imageBuffer) { return new PaintRenderingContext2D(std::move(imageBuffer)); } @@ -67,9 +68,9 @@ bool isContextLost() const final { return false; } private: - explicit PaintRenderingContext2D(PassOwnPtr<ImageBuffer>); + explicit PaintRenderingContext2D(std::unique_ptr<ImageBuffer>); - OwnPtr<ImageBuffer> m_imageBuffer; + std::unique_ptr<ImageBuffer> m_imageBuffer; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp index eb7740a..05f4c79 100644 --- a/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp
@@ -13,7 +13,7 @@ #include "modules/csspaint/PaintWorkletGlobalScope.h" #include "modules/csspaint/WindowPaintWorklet.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -39,7 +39,7 @@ } protected: - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; }; TEST_F(PaintWorkletTest, GarbageCollectionOfCSSPaintDefinition)
diff --git a/third_party/WebKit/Source/modules/encoding/TextDecoder.h b/third_party/WebKit/Source/modules/encoding/TextDecoder.h index ccbab4d..5118a26b 100644 --- a/third_party/WebKit/Source/modules/encoding/TextDecoder.h +++ b/third_party/WebKit/Source/modules/encoding/TextDecoder.h
@@ -39,6 +39,7 @@ #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -67,7 +68,7 @@ String decode(const char* start, size_t length, const TextDecodeOptions&, ExceptionState&); WTF::TextEncoding m_encoding; - OwnPtr<WTF::TextCodec> m_codec; + std::unique_ptr<WTF::TextCodec> m_codec; bool m_fatal; bool m_ignoreBOM; bool m_bomSeen;
diff --git a/third_party/WebKit/Source/modules/encoding/TextEncoder.h b/third_party/WebKit/Source/modules/encoding/TextEncoder.h index d8cd446..02dc49b 100644 --- a/third_party/WebKit/Source/modules/encoding/TextEncoder.h +++ b/third_party/WebKit/Source/modules/encoding/TextEncoder.h
@@ -37,6 +37,7 @@ #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -59,7 +60,7 @@ TextEncoder(const WTF::TextEncoding&); WTF::TextEncoding m_encoding; - OwnPtr<WTF::TextCodec> m_codec; + std::unique_ptr<WTF::TextCodec> m_codec; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp index a8c49763..60426813 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp
@@ -50,6 +50,7 @@ #include "public/platform/WebString.h" #include "public/platform/WebURL.h" #include "wtf/ASCIICType.h" +#include "wtf/PtrUtil.h" #include <cmath> #include <limits> @@ -331,7 +332,7 @@ // initializeNewSession() is called in response to the user calling // generateRequest(). WebContentDecryptionModule* cdm = mediaKeys->contentDecryptionModule(); - m_session = adoptPtr(cdm->createSession()); + m_session = wrapUnique(cdm->createSession()); m_session->setClientInterface(this); // From https://w3c.github.io/encrypted-media/#createSession:
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h index 8fcfaf9..018d75d 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h
@@ -36,6 +36,7 @@ #include "platform/heap/Handle.h" #include "public/platform/WebContentDecryptionModuleSession.h" #include "public/platform/WebEncryptedMediaTypes.h" +#include <memory> namespace blink { @@ -118,7 +119,7 @@ void finishLoad(); Member<GenericEventQueue> m_asyncEventQueue; - OwnPtr<WebContentDecryptionModuleSession> m_session; + std::unique_ptr<WebContentDecryptionModuleSession> m_session; // Used to determine if MediaKeys is still active. WeakMember<MediaKeys> m_mediaKeys;
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.cpp index 9485c91..3c9dd43 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.cpp
@@ -18,6 +18,8 @@ #include "public/platform/WebContentDecryptionModule.h" #include "public/platform/WebEncryptedMediaTypes.h" #include "public/platform/WebMediaKeySystemConfiguration.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -48,7 +50,7 @@ { // NOTE: Continued from step 2.8 of createMediaKeys(). // 2.9. Let media keys be a new MediaKeys object. - MediaKeys* mediaKeys = MediaKeys::create(getExecutionContext(), m_supportedSessionTypes, adoptPtr(cdm)); + MediaKeys* mediaKeys = MediaKeys::create(getExecutionContext(), m_supportedSessionTypes, wrapUnique(cdm)); // 2.10. Resolve promise with media keys. resolve(mediaKeys); @@ -105,7 +107,7 @@ } // namespace -MediaKeySystemAccess::MediaKeySystemAccess(const String& keySystem, PassOwnPtr<WebContentDecryptionModuleAccess> access) +MediaKeySystemAccess::MediaKeySystemAccess(const String& keySystem, std::unique_ptr<WebContentDecryptionModuleAccess> access) : m_keySystem(keySystem) , m_access(std::move(access)) {
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.h b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.h index c1c4e13c..e5c4f411 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySystemAccess.h
@@ -10,6 +10,7 @@ #include "modules/encryptedmedia/MediaKeySystemConfiguration.h" #include "public/platform/WebContentDecryptionModuleAccess.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -17,7 +18,7 @@ DEFINE_WRAPPERTYPEINFO(); public: - MediaKeySystemAccess(const String& keySystem, PassOwnPtr<WebContentDecryptionModuleAccess>); + MediaKeySystemAccess(const String& keySystem, std::unique_ptr<WebContentDecryptionModuleAccess>); virtual ~MediaKeySystemAccess(); const String& keySystem() const { return m_keySystem; } @@ -28,7 +29,7 @@ private: const String m_keySystem; - OwnPtr<WebContentDecryptionModuleAccess> m_access; + std::unique_ptr<WebContentDecryptionModuleAccess> m_access; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp index 1668a823..cb4bded 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp
@@ -38,6 +38,7 @@ #include "platform/Timer.h" #include "public/platform/WebContentDecryptionModule.h" #include "wtf/RefPtr.h" +#include <memory> #define MEDIA_KEYS_LOG_LEVEL 3 @@ -116,14 +117,14 @@ } }; -MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule> cdm) +MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule> cdm) { MediaKeys* mediaKeys = new MediaKeys(context, supportedSessionTypes, std::move(cdm)); mediaKeys->suspendIfNeeded(); return mediaKeys; } -MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule> cdm) +MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule> cdm) : ActiveScriptWrappable(this) , ActiveDOMObject(context) , m_supportedSessionTypes(supportedSessionTypes)
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h index 8541355..05f7972 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h
@@ -38,6 +38,7 @@ #include "public/platform/WebVector.h" #include "wtf/Forward.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -54,7 +55,7 @@ USING_GARBAGE_COLLECTED_MIXIN(MediaKeys); DEFINE_WRAPPERTYPEINFO(); public: - static MediaKeys* create(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule>); + static MediaKeys* create(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule>); ~MediaKeys() override; MediaKeySession* createSession(ScriptState*, const String& sessionTypeString, ExceptionState&); @@ -91,14 +92,14 @@ bool hasPendingActivity() const final; private: - MediaKeys(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule>); + MediaKeys(ExecutionContext*, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule>); class PendingAction; bool sessionTypeSupported(WebEncryptedMediaSessionType); void timerFired(Timer<MediaKeys>*); const WebVector<WebEncryptedMediaSessionType> m_supportedSessionTypes; - OwnPtr<WebContentDecryptionModule> m_cdm; + std::unique_ptr<WebContentDecryptionModule> m_cdm; // Keep track of the HTMLMediaElement that references this object. Keeping // a WeakMember so that HTMLMediaElement's lifetime isn't dependent on
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp index dd0af18..6977f4cc 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp
@@ -24,6 +24,7 @@ #include "public/platform/WebMediaKeySystemConfiguration.h" #include "public/platform/WebMediaKeySystemMediaCapability.h" #include "public/platform/WebVector.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" #include <algorithm> @@ -167,7 +168,7 @@ { checkEmptyCodecs(access->getConfiguration()); - m_resolver->resolve(new MediaKeySystemAccess(m_keySystem, adoptPtr(access))); + m_resolver->resolve(new MediaKeySystemAccess(m_keySystem, wrapUnique(access))); m_resolver.clear(); }
diff --git a/third_party/WebKit/Source/modules/fetch/Body.cpp b/third_party/WebKit/Source/modules/fetch/Body.cpp index 239d6e6..d7d78ec 100644 --- a/third_party/WebKit/Source/modules/fetch/Body.cpp +++ b/third_party/WebKit/Source/modules/fetch/Body.cpp
@@ -15,9 +15,9 @@ #include "modules/fetch/BodyStreamBuffer.h" #include "modules/fetch/FetchDataLoader.h" #include "public/platform/WebDataConsumerHandle.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -141,7 +141,7 @@ if (bodyBuffer()) { bodyBuffer()->startLoading(FetchDataLoader::createLoaderAsBlobHandle(mimeType()), new BodyBlobConsumer(resolver)); } else { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->setContentType(mimeType()); resolver->resolve(Blob::create(BlobDataHandle::create(std::move(blobData), 0))); }
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp index 0ddba08..a339b1e 100644 --- a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp +++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp
@@ -20,6 +20,7 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/blob/BlobData.h" #include "platform/network/EncodedFormData.h" +#include <memory> namespace blink { @@ -97,7 +98,7 @@ Member<FetchDataLoader::Client> m_client; }; -BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, PassOwnPtr<FetchDataConsumerHandle> handle) +BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, std::unique_ptr<FetchDataConsumerHandle> handle) : UnderlyingSourceBase(scriptState) , m_scriptState(scriptState) , m_handle(std::move(handle)) @@ -214,7 +215,7 @@ { ASSERT(!m_loader); ASSERT(m_scriptState->contextIsValid()); - OwnPtr<FetchDataConsumerHandle> handle = releaseHandle(); + std::unique_ptr<FetchDataConsumerHandle> handle = releaseHandle(); m_loader = loader; loader->start(handle.get(), new LoaderClient(m_scriptState->getExecutionContext(), this, client)); } @@ -234,8 +235,8 @@ *branch2 = new BodyStreamBuffer(m_scriptState.get(), stream2); return; } - OwnPtr<FetchDataConsumerHandle> handle = releaseHandle(); - OwnPtr<FetchDataConsumerHandle> handle1, handle2; + std::unique_ptr<FetchDataConsumerHandle> handle = releaseHandle(); + std::unique_ptr<FetchDataConsumerHandle> handle1, handle2; DataConsumerTee::create(m_scriptState->getExecutionContext(), std::move(handle), &handle1, &handle2); *branch1 = new BodyStreamBuffer(m_scriptState.get(), std::move(handle1)); *branch2 = new BodyStreamBuffer(m_scriptState.get(), std::move(handle2)); @@ -449,7 +450,7 @@ m_loader = nullptr; } -PassOwnPtr<FetchDataConsumerHandle> BodyStreamBuffer::releaseHandle() +std::unique_ptr<FetchDataConsumerHandle> BodyStreamBuffer::releaseHandle() { DCHECK(!isStreamLocked()); DCHECK(!isStreamDisturbed()); @@ -469,7 +470,7 @@ // We need to call these before calling closeAndLockAndDisturb. const bool isClosed = isStreamClosed(); const bool isErrored = isStreamErrored(); - OwnPtr<FetchDataConsumerHandle> handle = std::move(m_handle); + std::unique_ptr<FetchDataConsumerHandle> handle = std::move(m_handle); closeAndLockAndDisturb();
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h index 2ef8bc9..ba0226b 100644 --- a/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h +++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h
@@ -17,8 +17,7 @@ #include "modules/fetch/FetchDataLoader.h" #include "platform/heap/Handle.h" #include "public/platform/WebDataConsumerHandle.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -32,7 +31,7 @@ // Needed because we have to release |m_reader| promptly. EAGERLY_FINALIZE(); // |handle| cannot be null and cannot be locked. - BodyStreamBuffer(ScriptState*, PassOwnPtr<FetchDataConsumerHandle> /* handle */); + BodyStreamBuffer(ScriptState*, std::unique_ptr<FetchDataConsumerHandle> /* handle */); // |ReadableStreamOperations::isReadableStream(stream)| must hold. BodyStreamBuffer(ScriptState*, ScriptValue stream); @@ -81,11 +80,11 @@ void processData(); void endLoading(); void stopLoading(); - PassOwnPtr<FetchDataConsumerHandle> releaseHandle(); + std::unique_ptr<FetchDataConsumerHandle> releaseHandle(); RefPtr<ScriptState> m_scriptState; - OwnPtr<FetchDataConsumerHandle> m_handle; - OwnPtr<FetchDataConsumerHandle::Reader> m_reader; + std::unique_ptr<FetchDataConsumerHandle> m_handle; + std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; Member<ReadableByteStream> m_stream; // We need this member to keep it alive while loading. Member<FetchDataLoader> m_loader;
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp index c7869ca2..defd829 100644 --- a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
@@ -15,7 +15,8 @@ #include "platform/testing/UnitTestHelpers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -31,7 +32,7 @@ class FakeLoaderFactory : public FetchBlobDataConsumerHandle::LoaderFactory { public: - PassOwnPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) override + std::unique_ptr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) override { ASSERT_NOT_REACHED(); return nullptr; @@ -50,7 +51,7 @@ ScriptState* getScriptState() { return ScriptState::forMainWorld(m_page->document().frame()); } ExecutionContext* getExecutionContext() { return &m_page->document(); } - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; ScriptValue eval(const char* s) { @@ -93,7 +94,7 @@ EXPECT_CALL(*client2, didFetchDataLoadedString(String("hello, world"))); EXPECT_CALL(checkpoint, Call(4)); - OwnPtr<DataConsumerHandleTestUtil::ReplayingHandle> handle = DataConsumerHandleTestUtil::ReplayingHandle::create(); + std::unique_ptr<DataConsumerHandleTestUtil::ReplayingHandle> handle = DataConsumerHandleTestUtil::ReplayingHandle::create(); handle->add(DataConsumerHandleTestUtil::Command(DataConsumerHandleTestUtil::Command::Data, "hello, ")); handle->add(DataConsumerHandleTestUtil::Command(DataConsumerHandleTestUtil::Command::Data, "world")); handle->add(DataConsumerHandleTestUtil::Command(DataConsumerHandleTestUtil::Command::Done)); @@ -173,7 +174,7 @@ TEST_F(BodyStreamBufferTest, DrainAsBlobDataHandle) { - OwnPtr<BlobData> data = BlobData::create(); + std::unique_ptr<BlobData> data = BlobData::create(); data->appendText("hello", false); auto size = data->length(); RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(std::move(data), size); @@ -193,7 +194,7 @@ TEST_F(BodyStreamBufferTest, DrainAsBlobDataHandleReturnsNull) { // This handle is not drainable. - OwnPtr<FetchDataConsumerHandle> handle = createFetchDataConsumerHandleFromWebHandle(createWaitingDataConsumerHandle()); + std::unique_ptr<FetchDataConsumerHandle> handle = createFetchDataConsumerHandleFromWebHandle(createWaitingDataConsumerHandle()); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), std::move(handle)); EXPECT_FALSE(buffer->isStreamLocked()); @@ -249,7 +250,7 @@ TEST_F(BodyStreamBufferTest, DrainAsFormDataReturnsNull) { // This handle is not drainable. - OwnPtr<FetchDataConsumerHandle> handle = createFetchDataConsumerHandleFromWebHandle(createWaitingDataConsumerHandle()); + std::unique_ptr<FetchDataConsumerHandle> handle = createFetchDataConsumerHandleFromWebHandle(createWaitingDataConsumerHandle()); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), std::move(handle)); EXPECT_FALSE(buffer->isStreamLocked()); @@ -293,7 +294,7 @@ EXPECT_CALL(*client, didFetchDataLoadedArrayBufferMock(_)).WillOnce(SaveArg<0>(&arrayBuffer)); EXPECT_CALL(checkpoint, Call(2)); - OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); handle->add(Command(Command::Data, "hello")); handle->add(Command(Command::Done)); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle))); @@ -325,7 +326,7 @@ EXPECT_CALL(*client, didFetchDataLoadedBlobHandleMock(_)).WillOnce(SaveArg<0>(&blobDataHandle)); EXPECT_CALL(checkpoint, Call(2)); - OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); handle->add(Command(Command::Data, "hello")); handle->add(Command(Command::Done)); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle))); @@ -355,7 +356,7 @@ EXPECT_CALL(*client, didFetchDataLoadedString(String("hello"))); EXPECT_CALL(checkpoint, Call(2)); - OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); handle->add(Command(Command::Data, "hello")); handle->add(Command(Command::Done)); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle))); @@ -451,7 +452,7 @@ EXPECT_CALL(*client, didFetchDataLoadedString(String("hello"))); EXPECT_CALL(checkpoint, Call(2)); - OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); handle->add(Command(Command::Data, "hello")); handle->add(Command(Command::Done)); Persistent<BodyStreamBuffer> buffer = new BodyStreamBuffer(getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle))); @@ -466,7 +467,7 @@ // TODO(hiroshige): Merge this class into MockFetchDataConsumerHandle. class MockFetchDataConsumerHandleWithMockDestructor : public DataConsumerHandleTestUtil::MockFetchDataConsumerHandle { public: - static PassOwnPtr<::testing::StrictMock<MockFetchDataConsumerHandleWithMockDestructor>> create() { return adoptPtr(new ::testing::StrictMock<MockFetchDataConsumerHandleWithMockDestructor>); } + static std::unique_ptr<::testing::StrictMock<MockFetchDataConsumerHandleWithMockDestructor>> create() { return wrapUnique(new ::testing::StrictMock<MockFetchDataConsumerHandleWithMockDestructor>); } ~MockFetchDataConsumerHandleWithMockDestructor() override { @@ -481,8 +482,8 @@ ScriptState::Scope scope(getScriptState()); using MockHandle = MockFetchDataConsumerHandleWithMockDestructor; using MockReader = DataConsumerHandleTestUtil::MockFetchDataConsumerReader; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); Checkpoint checkpoint; InSequence s; @@ -494,7 +495,7 @@ EXPECT_CALL(checkpoint, Call(2)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); BodyStreamBuffer* buffer = new BodyStreamBuffer(getScriptState(), std::move(handle)); checkpoint.Call(1);
diff --git a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp index 5679b7b..e1b9266 100644 --- a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp +++ b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp
@@ -10,8 +10,10 @@ #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Locker.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> namespace blink { @@ -32,14 +34,14 @@ class CompositeDataConsumerHandle::Context final : public ThreadSafeRefCounted<Context> { public: using Token = unsigned; - static PassRefPtr<Context> create(PassOwnPtr<WebDataConsumerHandle> handle) { return adoptRef(new Context(std::move(handle))); } + static PassRefPtr<Context> create(std::unique_ptr<WebDataConsumerHandle> handle) { return adoptRef(new Context(std::move(handle))); } ~Context() { ASSERT(!m_readerThread); ASSERT(!m_reader); ASSERT(!m_client); } - PassOwnPtr<ReaderImpl> obtainReader(Client* client) + std::unique_ptr<ReaderImpl> obtainReader(Client* client) { MutexLocker locker(m_mutex); ASSERT(!m_readerThread); @@ -49,7 +51,7 @@ m_client = client; m_readerThread = Platform::current()->currentThread(); m_reader = m_handle->obtainReader(m_client); - return adoptPtr(new ReaderImpl(this)); + return wrapUnique(new ReaderImpl(this)); } void detachReader() { @@ -64,7 +66,7 @@ m_readerThread = nullptr; m_client = nullptr; } - void update(PassOwnPtr<WebDataConsumerHandle> handle) + void update(std::unique_ptr<WebDataConsumerHandle> handle) { MutexLocker locker(m_mutex); m_handle = std::move(handle); @@ -106,7 +108,7 @@ } private: - explicit Context(PassOwnPtr<WebDataConsumerHandle> handle) + explicit Context(std::unique_ptr<WebDataConsumerHandle> handle) : m_handle(std::move(handle)) , m_readerThread(nullptr) , m_client(nullptr) @@ -143,8 +145,8 @@ m_readerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&Context::updateReader, this, m_token)); } - OwnPtr<Reader> m_reader; - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<Reader> m_reader; + std::unique_ptr<WebDataConsumerHandle> m_handle; // Note: Holding a WebThread raw pointer is not generally safe, but we can // do that in this case because: // 1. Destructing a ReaderImpl when the bound thread ends is a user's @@ -192,14 +194,14 @@ CompositeDataConsumerHandle::Updater::~Updater() {} -void CompositeDataConsumerHandle::Updater::update(PassOwnPtr<WebDataConsumerHandle> handle) +void CompositeDataConsumerHandle::Updater::update(std::unique_ptr<WebDataConsumerHandle> handle) { ASSERT(handle); ASSERT(m_thread->isCurrentThread()); m_context->update(std::move(handle)); } -CompositeDataConsumerHandle::CompositeDataConsumerHandle(PassOwnPtr<WebDataConsumerHandle> handle, Updater** updater) +CompositeDataConsumerHandle::CompositeDataConsumerHandle(std::unique_ptr<WebDataConsumerHandle> handle, Updater** updater) : m_context(Context::create(std::move(handle))) { *updater = new Updater(m_context); @@ -209,7 +211,7 @@ WebDataConsumerHandle::Reader* CompositeDataConsumerHandle::obtainReaderInternal(Client* client) { - return m_context->obtainReader(client).leakPtr(); + return m_context->obtainReader(client).release(); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.h index cc41704d..e2a95d2d 100644 --- a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.h +++ b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.h
@@ -9,9 +9,9 @@ #include "platform/heap/Handle.h" #include "public/platform/WebDataConsumerHandle.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -32,7 +32,7 @@ ~Updater(); // |handle| must not be null and must not be locked. - void update(PassOwnPtr<WebDataConsumerHandle> /* handle */); + void update(std::unique_ptr<WebDataConsumerHandle> /* handle */); DEFINE_INLINE_TRACE() { } private: @@ -46,11 +46,11 @@ // associated updater will be bound to the calling thread. // |handle| must not be null and must not be locked. template<typename T> - static PassOwnPtr<WebDataConsumerHandle> create(PassOwnPtr<WebDataConsumerHandle> handle, T* updater) + static std::unique_ptr<WebDataConsumerHandle> create(std::unique_ptr<WebDataConsumerHandle> handle, T* updater) { ASSERT(handle); Updater* u = nullptr; - OwnPtr<CompositeDataConsumerHandle> p = adoptPtr(new CompositeDataConsumerHandle(std::move(handle), &u)); + std::unique_ptr<CompositeDataConsumerHandle> p = wrapUnique(new CompositeDataConsumerHandle(std::move(handle), &u)); *updater = u; return std::move(p); } @@ -62,7 +62,7 @@ const char* debugName() const override { return "CompositeDataConsumerHandle"; } - CompositeDataConsumerHandle(PassOwnPtr<WebDataConsumerHandle>, Updater**); + CompositeDataConsumerHandle(std::unique_ptr<WebDataConsumerHandle>, Updater**); RefPtr<Context> m_context; };
diff --git a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp index 863dd6da..0ff02a9 100644 --- a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandleTest.cpp
@@ -14,6 +14,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/Locker.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -30,7 +32,7 @@ class MockReader : public WebDataConsumerHandle::Reader { public: - static PassOwnPtr<StrictMock<MockReader>> create() { return adoptPtr(new StrictMock<MockReader>); } + static std::unique_ptr<StrictMock<MockReader>> create() { return wrapUnique(new StrictMock<MockReader>); } using Result = WebDataConsumerHandle::Result; using Flags = WebDataConsumerHandle::Flags; @@ -41,7 +43,7 @@ class MockHandle : public WebDataConsumerHandle { public: - static PassOwnPtr<StrictMock<MockHandle>> create() { return adoptPtr(new StrictMock<MockHandle>); } + static std::unique_ptr<StrictMock<MockHandle>> create() { return wrapUnique(new StrictMock<MockHandle>); } MOCK_METHOD1(obtainReaderInternal, Reader*(Client*)); @@ -57,7 +59,7 @@ void run() { ThreadHolder holder(this); - m_waitableEvent = adoptPtr(new WaitableEvent()); + m_waitableEvent = wrapUnique(new WaitableEvent()); postTaskToUpdatingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::createHandle, this)); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -84,7 +86,7 @@ postTaskToReadingThread(BLINK_FROM_HERE, threadSafeBind(&Self::signalDone, this)); } - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<WebDataConsumerHandle> m_handle; CrossThreadPersistent<CompositeDataConsumerHandle::Updater> m_updater; }; @@ -96,7 +98,7 @@ void run() { ThreadHolder holder(this); - m_waitableEvent = adoptPtr(new WaitableEvent()); + m_waitableEvent = wrapUnique(new WaitableEvent()); postTaskToUpdatingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::createHandle, this)); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -125,7 +127,7 @@ postTaskToReadingThread(BLINK_FROM_HERE, threadSafeBind(&Self::signalDone, this)); } - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<WebDataConsumerHandle> m_handle; CrossThreadPersistent<CompositeDataConsumerHandle::Updater> m_updater; }; @@ -137,7 +139,7 @@ void run() { ThreadHolder holder(this); - m_waitableEvent = adoptPtr(new WaitableEvent()); + m_waitableEvent = wrapUnique(new WaitableEvent()); postTaskToUpdatingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::createHandle, this)); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -166,7 +168,7 @@ postTaskToReadingThread(BLINK_FROM_HERE, threadSafeBind(&Self::signalDone, this)); } - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<WebDataConsumerHandle> m_handle; CrossThreadPersistent<CompositeDataConsumerHandle::Updater> m_updater; }; @@ -178,8 +180,8 @@ void run() { ThreadHolder holder(this); - m_waitableEvent = adoptPtr(new WaitableEvent()); - m_updateEvent = adoptPtr(new WaitableEvent()); + m_waitableEvent = wrapUnique(new WaitableEvent()); + m_updateEvent = wrapUnique(new WaitableEvent()); postTaskToUpdatingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::createHandle, this)); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -217,9 +219,9 @@ m_reader = m_handle->obtainReader(&m_client); } - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<WebDataConsumerHandle> m_handle; CrossThreadPersistent<CompositeDataConsumerHandle::Updater> m_updater; - OwnPtr<WaitableEvent> m_updateEvent; + std::unique_ptr<WaitableEvent> m_updateEvent; }; class ThreadingRegistrationUpdateTwiceAtOneTimeTest : public DataConsumerHandleTestUtil::ThreadingTestBase { @@ -230,8 +232,8 @@ void run() { ThreadHolder holder(this); - m_waitableEvent = adoptPtr(new WaitableEvent()); - m_updateEvent = adoptPtr(new WaitableEvent()); + m_waitableEvent = wrapUnique(new WaitableEvent()); + m_updateEvent = wrapUnique(new WaitableEvent()); postTaskToUpdatingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::createHandle, this)); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -263,9 +265,9 @@ postTaskToReadingThread(BLINK_FROM_HERE, threadSafeBind(&Self::signalDone, this)); } - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<WebDataConsumerHandle> m_handle; CrossThreadPersistent<CompositeDataConsumerHandle::Updater> m_updater; - OwnPtr<WaitableEvent> m_updateEvent; + std::unique_ptr<WaitableEvent> m_updateEvent; }; TEST(CompositeDataConsumerHandleTest, Read) @@ -275,10 +277,10 @@ DataConsumerHandleTestUtil::NoopClient client; Checkpoint checkpoint; - OwnPtr<MockHandle> handle1 = MockHandle::create(); - OwnPtr<MockHandle> handle2 = MockHandle::create(); - OwnPtr<MockReader> reader1 = MockReader::create(); - OwnPtr<MockReader> reader2 = MockReader::create(); + std::unique_ptr<MockHandle> handle1 = MockHandle::create(); + std::unique_ptr<MockHandle> handle2 = MockHandle::create(); + std::unique_ptr<MockReader> reader1 = MockReader::create(); + std::unique_ptr<MockReader> reader2 = MockReader::create(); InSequence s; EXPECT_CALL(checkpoint, Call(0)); @@ -292,13 +294,13 @@ EXPECT_CALL(checkpoint, Call(4)); // They are adopted by |obtainReader|. - ASSERT_TRUE(reader1.leakPtr()); - ASSERT_TRUE(reader2.leakPtr()); + ASSERT_TRUE(reader1.release()); + ASSERT_TRUE(reader2.release()); CompositeDataConsumerHandle::Updater* updater = nullptr; - OwnPtr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); + std::unique_ptr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); checkpoint.Call(0); - OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(&client); + std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(&client); checkpoint.Call(1); EXPECT_EQ(kOk, reader->read(buffer, sizeof(buffer), kNone, &size)); checkpoint.Call(2); @@ -314,10 +316,10 @@ size_t size = 0; Checkpoint checkpoint; - OwnPtr<MockHandle> handle1 = MockHandle::create(); - OwnPtr<MockHandle> handle2 = MockHandle::create(); - OwnPtr<MockReader> reader1 = MockReader::create(); - OwnPtr<MockReader> reader2 = MockReader::create(); + std::unique_ptr<MockHandle> handle1 = MockHandle::create(); + std::unique_ptr<MockHandle> handle2 = MockHandle::create(); + std::unique_ptr<MockReader> reader1 = MockReader::create(); + std::unique_ptr<MockReader> reader2 = MockReader::create(); InSequence s; EXPECT_CALL(checkpoint, Call(0)); @@ -335,13 +337,13 @@ EXPECT_CALL(checkpoint, Call(6)); // They are adopted by |obtainReader|. - ASSERT_TRUE(reader1.leakPtr()); - ASSERT_TRUE(reader2.leakPtr()); + ASSERT_TRUE(reader1.release()); + ASSERT_TRUE(reader2.release()); CompositeDataConsumerHandle::Updater* updater = nullptr; - OwnPtr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); + std::unique_ptr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); checkpoint.Call(0); - OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); checkpoint.Call(1); EXPECT_EQ(kOk, reader->beginRead(&p, kNone, &size)); checkpoint.Call(2); @@ -361,12 +363,12 @@ size_t size = 0; Checkpoint checkpoint; - OwnPtr<MockHandle> handle1 = MockHandle::create(); - OwnPtr<MockHandle> handle2 = MockHandle::create(); - OwnPtr<MockHandle> handle3 = MockHandle::create(); - OwnPtr<MockReader> reader1 = MockReader::create(); - OwnPtr<MockReader> reader2 = MockReader::create(); - OwnPtr<MockReader> reader3 = MockReader::create(); + std::unique_ptr<MockHandle> handle1 = MockHandle::create(); + std::unique_ptr<MockHandle> handle2 = MockHandle::create(); + std::unique_ptr<MockHandle> handle3 = MockHandle::create(); + std::unique_ptr<MockReader> reader1 = MockReader::create(); + std::unique_ptr<MockReader> reader2 = MockReader::create(); + std::unique_ptr<MockReader> reader3 = MockReader::create(); InSequence s; EXPECT_CALL(checkpoint, Call(0)); @@ -388,14 +390,14 @@ EXPECT_CALL(checkpoint, Call(8)); // They are adopted by |obtainReader|. - ASSERT_TRUE(reader1.leakPtr()); - ASSERT_TRUE(reader2.leakPtr()); - ASSERT_TRUE(reader3.leakPtr()); + ASSERT_TRUE(reader1.release()); + ASSERT_TRUE(reader2.release()); + ASSERT_TRUE(reader3.release()); CompositeDataConsumerHandle::Updater* updater = nullptr; - OwnPtr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); + std::unique_ptr<WebDataConsumerHandle> handle = CompositeDataConsumerHandle::create(std::move(handle1), &updater); checkpoint.Call(0); - OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); checkpoint.Call(1); EXPECT_EQ(kOk, reader->beginRead(&p, kNone, &size)); checkpoint.Call(2);
diff --git a/third_party/WebKit/Source/modules/fetch/CrossThreadHolder.h b/third_party/WebKit/Source/modules/fetch/CrossThreadHolder.h index 9492ba1f..12da6c70 100644 --- a/third_party/WebKit/Source/modules/fetch/CrossThreadHolder.h +++ b/third_party/WebKit/Source/modules/fetch/CrossThreadHolder.h
@@ -10,11 +10,11 @@ #include "core/dom/ExecutionContext.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Locker.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> namespace blink { @@ -33,10 +33,10 @@ // Must be called on the thread where |obj| is created // (== the thread of |executionContext|). // The current thread must be attached to Oilpan. - static PassOwnPtr<CrossThreadHolder<T>> create(ExecutionContext* executionContext, PassOwnPtr<T> obj) + static std::unique_ptr<CrossThreadHolder<T>> create(ExecutionContext* executionContext, std::unique_ptr<T> obj) { ASSERT(executionContext->isContextThread()); - return adoptPtr(new CrossThreadHolder(executionContext, std::move(obj))); + return wrapUnique(new CrossThreadHolder(executionContext, std::move(obj))); } // Can be called from any thread. @@ -65,7 +65,7 @@ private: // Object graph: // +------+ +-----------------+ - // T <-OwnPtr- |Bridge| ---------*-------------> |CrossThreadHolder| + // T <-std::unique_ptr- |Bridge| ---------*-------------> |CrossThreadHolder| // | | <-CrossThreadPersistent- | | // +------+ +-----------------+ // | | @@ -93,7 +93,7 @@ , public ActiveDOMObject { USING_GARBAGE_COLLECTED_MIXIN(Bridge); public: - Bridge(ExecutionContext* executionContext, PassOwnPtr<T> obj, PassRefPtr<MutexWrapper> mutex, CrossThreadHolder* holder) + Bridge(ExecutionContext* executionContext, std::unique_ptr<T> obj, PassRefPtr<MutexWrapper> mutex, CrossThreadHolder* holder) : ActiveDOMObject(executionContext) , m_obj(std::move(obj)) , m_mutex(mutex) @@ -145,7 +145,7 @@ } - OwnPtr<T> m_obj; + std::unique_ptr<T> m_obj; // All accesses to |m_holder| must be protected by |m_mutex|. RefPtr<MutexWrapper> m_mutex; CrossThreadHolder* m_holder; @@ -159,7 +159,7 @@ m_bridge.clear(); } - CrossThreadHolder(ExecutionContext* executionContext, PassOwnPtr<T> obj) + CrossThreadHolder(ExecutionContext* executionContext, std::unique_ptr<T> obj) : m_mutex(MutexWrapper::create()) , m_bridge(new Bridge(executionContext, std::move(obj), m_mutex, this)) {
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp index efb5391..7b28ea9 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp
@@ -5,13 +5,15 @@ #include "modules/fetch/DataConsumerHandleTestUtil.h" #include "bindings/core/v8/DOMWrapperWorld.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { DataConsumerHandleTestUtil::Thread::Thread(const char* name, InitializationPolicy initializationPolicy) : m_thread(WebThreadSupportingGC::create(name)) , m_initializationPolicy(initializationPolicy) - , m_waitableEvent(adoptPtr(new WaitableEvent())) + , m_waitableEvent(wrapUnique(new WaitableEvent())) { m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&Thread::initialize, AllowCrossThreadAccess(this))); m_waitableEvent->wait(); @@ -26,7 +28,7 @@ void DataConsumerHandleTestUtil::Thread::initialize() { if (m_initializationPolicy >= ScriptExecution) { - m_isolateHolder = adoptPtr(new gin::IsolateHolder()); + m_isolateHolder = wrapUnique(new gin::IsolateHolder()); isolate()->Enter(); } m_thread->initialize(); @@ -165,7 +167,7 @@ , m_client(nullptr) , m_result(ShouldWait) , m_isHandleAttached(true) - , m_detached(adoptPtr(new WaitableEvent())) + , m_detached(wrapUnique(new WaitableEvent())) { } @@ -229,7 +231,7 @@ m_context->add(command); } -DataConsumerHandleTestUtil::HandleReader::HandleReader(PassOwnPtr<WebDataConsumerHandle> handle, std::unique_ptr<OnFinishedReading> onFinishedReading) +DataConsumerHandleTestUtil::HandleReader::HandleReader(std::unique_ptr<WebDataConsumerHandle> handle, std::unique_ptr<OnFinishedReading> onFinishedReading) : m_reader(handle->obtainReader(this)) , m_onFinishedReading(std::move(onFinishedReading)) { @@ -248,20 +250,20 @@ break; m_data.append(buffer, size); } - OwnPtr<HandleReadResult> result = adoptPtr(new HandleReadResult(r, m_data)); + std::unique_ptr<HandleReadResult> result = wrapUnique(new HandleReadResult(r, m_data)); m_data.clear(); - Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, bind(&HandleReader::runOnFinishedReading, this, passed(std::move(result)))); + Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, WTF::bind(&HandleReader::runOnFinishedReading, this, passed(std::move(result)))); m_reader = nullptr; } -void DataConsumerHandleTestUtil::HandleReader::runOnFinishedReading(PassOwnPtr<HandleReadResult> result) +void DataConsumerHandleTestUtil::HandleReader::runOnFinishedReading(std::unique_ptr<HandleReadResult> result) { ASSERT(m_onFinishedReading); std::unique_ptr<OnFinishedReading> onFinishedReading(std::move(m_onFinishedReading)); (*onFinishedReading)(std::move(result)); } -DataConsumerHandleTestUtil::HandleTwoPhaseReader::HandleTwoPhaseReader(PassOwnPtr<WebDataConsumerHandle> handle, std::unique_ptr<OnFinishedReading> onFinishedReading) +DataConsumerHandleTestUtil::HandleTwoPhaseReader::HandleTwoPhaseReader(std::unique_ptr<WebDataConsumerHandle> handle, std::unique_ptr<OnFinishedReading> onFinishedReading) : m_reader(handle->obtainReader(this)) , m_onFinishedReading(std::move(onFinishedReading)) { @@ -283,13 +285,13 @@ m_data.append(static_cast<const char*>(buffer), readSize); m_reader->endRead(readSize); } - OwnPtr<HandleReadResult> result = adoptPtr(new HandleReadResult(r, m_data)); + std::unique_ptr<HandleReadResult> result = wrapUnique(new HandleReadResult(r, m_data)); m_data.clear(); - Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, bind(&HandleTwoPhaseReader::runOnFinishedReading, this, passed(std::move(result)))); + Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, WTF::bind(&HandleTwoPhaseReader::runOnFinishedReading, this, passed(std::move(result)))); m_reader = nullptr; } -void DataConsumerHandleTestUtil::HandleTwoPhaseReader::runOnFinishedReading(PassOwnPtr<HandleReadResult> result) +void DataConsumerHandleTestUtil::HandleTwoPhaseReader::runOnFinishedReading(std::unique_ptr<HandleReadResult> result) { ASSERT(m_onFinishedReading); std::unique_ptr<OnFinishedReading> onFinishedReading(std::move(m_onFinishedReading));
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h index e629a03..47cb1c70 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h
@@ -20,14 +20,13 @@ #include "public/platform/WebTraceLocation.h" #include "wtf/Deque.h" #include "wtf/Locker.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" - #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <memory> #include <v8.h> namespace blink { @@ -69,11 +68,11 @@ void initialize(); void shutdown(); - OwnPtr<WebThreadSupportingGC> m_thread; + std::unique_ptr<WebThreadSupportingGC> m_thread; const InitializationPolicy m_initializationPolicy; - OwnPtr<WaitableEvent> m_waitableEvent; + std::unique_ptr<WaitableEvent> m_waitableEvent; Persistent<NullExecutionContext> m_executionContext; - OwnPtr<gin::IsolateHolder> m_isolateHolder; + std::unique_ptr<gin::IsolateHolder> m_isolateHolder; RefPtr<ScriptState> m_scriptState; }; @@ -160,8 +159,8 @@ public: ThreadHolder(ThreadingTestBase* test) : m_context(test->m_context) - , m_readingThread(adoptPtr(new Thread("reading thread"))) - , m_updatingThread(adoptPtr(new Thread("updating thread"))) + , m_readingThread(wrapUnique(new Thread("reading thread"))) + , m_updatingThread(wrapUnique(new Thread("updating thread"))) { m_context->registerThreadHolder(this); } @@ -175,8 +174,8 @@ private: RefPtr<Context> m_context; - OwnPtr<Thread> m_readingThread; - OwnPtr<Thread> m_updatingThread; + std::unique_ptr<Thread> m_readingThread; + std::unique_ptr<Thread> m_updatingThread; }; class ReaderImpl final : public WebDataConsumerHandle::Reader { @@ -200,9 +199,9 @@ class DataConsumerHandle final : public WebDataConsumerHandle { USING_FAST_MALLOC(DataConsumerHandle); public: - static PassOwnPtr<WebDataConsumerHandle> create(const String& name, PassRefPtr<Context> context) + static std::unique_ptr<WebDataConsumerHandle> create(const String& name, PassRefPtr<Context> context) { - return adoptPtr(new DataConsumerHandle(name, context)); + return wrapUnique(new DataConsumerHandle(name, context)); } private: @@ -241,8 +240,8 @@ : m_context(Context::create()) { } RefPtr<Context> m_context; - OwnPtr<WebDataConsumerHandle::Reader> m_reader; - OwnPtr<WaitableEvent> m_waitableEvent; + std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; + std::unique_ptr<WaitableEvent> m_waitableEvent; NoopClient m_client; }; @@ -251,10 +250,10 @@ using Self = ThreadingHandleNotificationTest; static PassRefPtr<Self> create() { return adoptRef(new Self); } - void run(PassOwnPtr<WebDataConsumerHandle> handle) + void run(std::unique_ptr<WebDataConsumerHandle> handle) { ThreadHolder holder(this); - m_waitableEvent = adoptPtr(new WaitableEvent()); + m_waitableEvent = wrapUnique(new WaitableEvent()); m_handle = std::move(handle); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -272,7 +271,7 @@ postTaskToReadingThread(BLINK_FROM_HERE, threadSafeBind(&Self::signalDone, this)); } - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<WebDataConsumerHandle> m_handle; }; class ThreadingHandleNoNotificationTest : public ThreadingTestBase, public WebDataConsumerHandle::Client { @@ -280,10 +279,10 @@ using Self = ThreadingHandleNoNotificationTest; static PassRefPtr<Self> create() { return adoptRef(new Self); } - void run(PassOwnPtr<WebDataConsumerHandle> handle) + void run(std::unique_ptr<WebDataConsumerHandle> handle) { ThreadHolder holder(this); - m_waitableEvent = adoptPtr(new WaitableEvent()); + m_waitableEvent = wrapUnique(new WaitableEvent()); m_handle = std::move(handle); postTaskToReadingThreadAndWait(BLINK_FROM_HERE, threadSafeBind(&Self::obtainReader, this)); @@ -302,12 +301,12 @@ ASSERT_NOT_REACHED(); } - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<WebDataConsumerHandle> m_handle; }; class MockFetchDataConsumerHandle : public FetchDataConsumerHandle { public: - static PassOwnPtr<::testing::StrictMock<MockFetchDataConsumerHandle>> create() { return adoptPtr(new ::testing::StrictMock<MockFetchDataConsumerHandle>); } + static std::unique_ptr<::testing::StrictMock<MockFetchDataConsumerHandle>> create() { return wrapUnique(new ::testing::StrictMock<MockFetchDataConsumerHandle>); } MOCK_METHOD1(obtainReaderInternal, Reader*(Client*)); private: @@ -316,7 +315,7 @@ class MockFetchDataConsumerReader : public FetchDataConsumerHandle::Reader { public: - static PassOwnPtr<::testing::StrictMock<MockFetchDataConsumerReader>> create() { return adoptPtr(new ::testing::StrictMock<MockFetchDataConsumerReader>); } + static std::unique_ptr<::testing::StrictMock<MockFetchDataConsumerReader>> create() { return wrapUnique(new ::testing::StrictMock<MockFetchDataConsumerReader>); } using Result = WebDataConsumerHandle::Result; using Flags = WebDataConsumerHandle::Flags; @@ -388,7 +387,7 @@ class ReplayingHandle final : public WebDataConsumerHandle { USING_FAST_MALLOC(ReplayingHandle); public: - static PassOwnPtr<ReplayingHandle> create() { return adoptPtr(new ReplayingHandle()); } + static std::unique_ptr<ReplayingHandle> create() { return wrapUnique(new ReplayingHandle()); } ~ReplayingHandle(); // Add a command to this handle. This function must be called on the @@ -425,7 +424,7 @@ Result m_result; bool m_isHandleAttached; Mutex m_mutex; - OwnPtr<WaitableEvent> m_detached; + std::unique_ptr<WaitableEvent> m_detached; }; Context* getContext() { return m_context.get(); } @@ -458,15 +457,15 @@ class HandleReader final : public WebDataConsumerHandle::Client { USING_FAST_MALLOC(HandleReader); public: - using OnFinishedReading = WTF::Function<void(PassOwnPtr<HandleReadResult>)>; + using OnFinishedReading = WTF::Function<void(std::unique_ptr<HandleReadResult>)>; - HandleReader(PassOwnPtr<WebDataConsumerHandle>, std::unique_ptr<OnFinishedReading>); + HandleReader(std::unique_ptr<WebDataConsumerHandle>, std::unique_ptr<OnFinishedReading>); void didGetReadable() override; private: - void runOnFinishedReading(PassOwnPtr<HandleReadResult>); + void runOnFinishedReading(std::unique_ptr<HandleReadResult>); - OwnPtr<WebDataConsumerHandle::Reader> m_reader; + std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; std::unique_ptr<OnFinishedReading> m_onFinishedReading; Vector<char> m_data; }; @@ -476,15 +475,15 @@ class HandleTwoPhaseReader final : public WebDataConsumerHandle::Client { USING_FAST_MALLOC(HandleTwoPhaseReader); public: - using OnFinishedReading = WTF::Function<void(PassOwnPtr<HandleReadResult>)>; + using OnFinishedReading = WTF::Function<void(std::unique_ptr<HandleReadResult>)>; - HandleTwoPhaseReader(PassOwnPtr<WebDataConsumerHandle>, std::unique_ptr<OnFinishedReading>); + HandleTwoPhaseReader(std::unique_ptr<WebDataConsumerHandle>, std::unique_ptr<OnFinishedReading>); void didGetReadable() override; private: - void runOnFinishedReading(PassOwnPtr<HandleReadResult>); + void runOnFinishedReading(std::unique_ptr<HandleReadResult>); - OwnPtr<WebDataConsumerHandle::Reader> m_reader; + std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; std::unique_ptr<OnFinishedReading> m_onFinishedReading; Vector<char> m_data; }; @@ -495,9 +494,9 @@ class HandleReaderRunner final { STACK_ALLOCATED(); public: - explicit HandleReaderRunner(PassOwnPtr<WebDataConsumerHandle> handle) - : m_thread(adoptPtr(new Thread("reading thread"))) - , m_event(adoptPtr(new WaitableEvent())) + explicit HandleReaderRunner(std::unique_ptr<WebDataConsumerHandle> handle) + : m_thread(wrapUnique(new Thread("reading thread"))) + , m_event(wrapUnique(new WaitableEvent())) , m_isDone(false) { m_thread->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(&HandleReaderRunner::start, AllowCrossThreadAccess(this), passed(std::move(handle)))); @@ -507,7 +506,7 @@ wait(); } - PassOwnPtr<HandleReadResult> wait() + std::unique_ptr<HandleReadResult> wait() { if (m_isDone) return nullptr; @@ -517,24 +516,24 @@ } private: - void start(PassOwnPtr<WebDataConsumerHandle> handle) + void start(std::unique_ptr<WebDataConsumerHandle> handle) { - m_handleReader = adoptPtr(new T(std::move(handle), bind<PassOwnPtr<HandleReadResult>>(&HandleReaderRunner::onFinished, this))); + m_handleReader = wrapUnique(new T(std::move(handle), WTF::bind<std::unique_ptr<HandleReadResult>>(&HandleReaderRunner::onFinished, this))); } - void onFinished(PassOwnPtr<HandleReadResult> result) + void onFinished(std::unique_ptr<HandleReadResult> result) { m_handleReader = nullptr; m_result = std::move(result); m_event->signal(); } - OwnPtr<Thread> m_thread; - OwnPtr<WaitableEvent> m_event; - OwnPtr<HandleReadResult> m_result; + std::unique_ptr<Thread> m_thread; + std::unique_ptr<WaitableEvent> m_event; + std::unique_ptr<HandleReadResult> m_result; bool m_isDone; - OwnPtr<T> m_handleReader; + std::unique_ptr<T> m_handleReader; }; };
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.cpp index 34326a17..f53b200 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.cpp
@@ -10,6 +10,8 @@ #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -71,11 +73,11 @@ class WebToFetchDataConsumerHandleAdapter : public FetchDataConsumerHandle { public: - WebToFetchDataConsumerHandleAdapter(PassOwnPtr<WebDataConsumerHandle> handle) : m_handle(std::move(handle)) { } + WebToFetchDataConsumerHandleAdapter(std::unique_ptr<WebDataConsumerHandle> handle) : m_handle(std::move(handle)) { } private: class ReaderImpl final : public FetchDataConsumerHandle::Reader { public: - ReaderImpl(PassOwnPtr<WebDataConsumerHandle::Reader> reader) : m_reader(std::move(reader)) { } + ReaderImpl(std::unique_ptr<WebDataConsumerHandle::Reader> reader) : m_reader(std::move(reader)) { } Result read(void* data, size_t size, Flags flags, size_t* readSize) override { return m_reader->read(data, size, flags, readSize); @@ -90,36 +92,36 @@ return m_reader->endRead(readSize); } private: - OwnPtr<WebDataConsumerHandle::Reader> m_reader; + std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; }; Reader* obtainReaderInternal(Client* client) override { return new ReaderImpl(m_handle->obtainReader(client)); } const char* debugName() const override { return m_handle->debugName(); } - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<WebDataConsumerHandle> m_handle; }; } // namespace -PassOwnPtr<WebDataConsumerHandle> createWaitingDataConsumerHandle() +std::unique_ptr<WebDataConsumerHandle> createWaitingDataConsumerHandle() { - return adoptPtr(new WaitingHandle); + return wrapUnique(new WaitingHandle); } -PassOwnPtr<WebDataConsumerHandle> createDoneDataConsumerHandle() +std::unique_ptr<WebDataConsumerHandle> createDoneDataConsumerHandle() { - return adoptPtr(new DoneHandle); + return wrapUnique(new DoneHandle); } -PassOwnPtr<WebDataConsumerHandle> createUnexpectedErrorDataConsumerHandle() +std::unique_ptr<WebDataConsumerHandle> createUnexpectedErrorDataConsumerHandle() { - return adoptPtr(new UnexpectedErrorHandle); + return wrapUnique(new UnexpectedErrorHandle); } -PassOwnPtr<FetchDataConsumerHandle> createFetchDataConsumerHandleFromWebHandle(PassOwnPtr<WebDataConsumerHandle> handle) +std::unique_ptr<FetchDataConsumerHandle> createFetchDataConsumerHandleFromWebHandle(std::unique_ptr<WebDataConsumerHandle> handle) { - return adoptPtr(new WebToFetchDataConsumerHandleAdapter(std::move(handle))); + return wrapUnique(new WebToFetchDataConsumerHandleAdapter(std::move(handle))); } NotifyOnReaderCreationHelper::NotifyOnReaderCreationHelper(WebDataConsumerHandle::Client* client)
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.h b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.h index bbd5585..51602cb 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.h +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtil.h
@@ -9,25 +9,25 @@ #include "modules/fetch/FetchDataConsumerHandle.h" #include "public/platform/WebDataConsumerHandle.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" #include "wtf/WeakPtr.h" +#include <memory> namespace blink { // Returns a handle that returns ShouldWait for read / beginRead and // UnexpectedError for endRead. -MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createWaitingDataConsumerHandle(); +MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createWaitingDataConsumerHandle(); // Returns a handle that returns Done for read / beginRead and // UnexpectedError for endRead. -MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createDoneDataConsumerHandle(); +MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createDoneDataConsumerHandle(); // Returns a handle that returns UnexpectedError for read / beginRead / // endRead. -MODULES_EXPORT PassOwnPtr<WebDataConsumerHandle> createUnexpectedErrorDataConsumerHandle(); +MODULES_EXPORT std::unique_ptr<WebDataConsumerHandle> createUnexpectedErrorDataConsumerHandle(); // Returns a FetchDataConsumerHandle that wraps WebDataConsumerHandle. -MODULES_EXPORT PassOwnPtr<FetchDataConsumerHandle> createFetchDataConsumerHandleFromWebHandle(PassOwnPtr<WebDataConsumerHandle>); +MODULES_EXPORT std::unique_ptr<FetchDataConsumerHandle> createFetchDataConsumerHandleFromWebHandle(std::unique_ptr<WebDataConsumerHandle>); // A helper class to call Client::didGetReadable() asynchronously after // Reader creation.
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtilTest.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtilTest.cpp index 760cf0e..13115fe8 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtilTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleUtilTest.cpp
@@ -5,6 +5,7 @@ #include "modules/fetch/DataConsumerHandleUtil.h" #include "modules/fetch/DataConsumerHandleTestUtil.h" +#include <memory> namespace blink { @@ -20,8 +21,8 @@ char buffer[20]; const void* p = nullptr; size_t size = 0; - OwnPtr<WebDataConsumerHandle> handle = createWaitingDataConsumerHandle(); - OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<WebDataConsumerHandle> handle = createWaitingDataConsumerHandle(); + std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); EXPECT_EQ(kShouldWait, reader->read(buffer, sizeof(buffer), kNone, &size)); EXPECT_EQ(kShouldWait, reader->beginRead(&p, kNone, &size)); @@ -40,8 +41,8 @@ char buffer[20]; const void* p = nullptr; size_t size = 0; - OwnPtr<WebDataConsumerHandle> handle = createDoneDataConsumerHandle(); - OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<WebDataConsumerHandle> handle = createDoneDataConsumerHandle(); + std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); EXPECT_EQ(kDone, reader->read(buffer, sizeof(buffer), kNone, &size)); EXPECT_EQ(kDone, reader->beginRead(&p, kNone, &size)); @@ -67,8 +68,8 @@ char buffer[20]; const void* p = nullptr; size_t size = 0; - OwnPtr<WebDataConsumerHandle> handle = createUnexpectedErrorDataConsumerHandle(); - OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<WebDataConsumerHandle> handle = createUnexpectedErrorDataConsumerHandle(); + std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); EXPECT_EQ(kUnexpectedError, reader->read(buffer, sizeof(buffer), kNone, &size)); EXPECT_EQ(kUnexpectedError, reader->beginRead(&p, kNone, &size));
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp index 71f3deb..a646561 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp
@@ -16,9 +16,11 @@ #include "public/platform/WebTraceLocation.h" #include "wtf/Deque.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -148,7 +150,7 @@ { MutexLocker locker(m_mutex); needsNotification = m_queue.isEmpty(); - OwnPtr<Vector<char>> data = adoptPtr(new Vector<char>); + std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>); data->append(buffer, size); m_queue.append(std::move(data)); } @@ -209,7 +211,7 @@ m_readerThread = nullptr; m_client = nullptr; } - const OwnPtr<Vector<char>>& top() const { return m_queue.first(); } + const std::unique_ptr<Vector<char>>& top() const { return m_queue.first(); } bool isEmpty() const { return m_queue.isEmpty(); } size_t offset() const { return m_offset; } void consume(size_t size) @@ -245,7 +247,7 @@ } Result m_result; - Deque<OwnPtr<Vector<char>>> m_queue; + Deque<std::unique_ptr<Vector<char>>> m_queue; // Note: Holding a WebThread raw pointer is not generally safe, but we can // do that in this case because: // 1. Destructing a ReaderImpl when the bound thread ends is a user's @@ -287,7 +289,7 @@ if (context()->isEmpty()) return context()->getResult(); - const OwnPtr<Vector<char>>& chunk = context()->top(); + const std::unique_ptr<Vector<char>>& chunk = context()->top(); *available = chunk->size() - context()->offset(); *buffer = chunk->data() + context()->offset(); return WebDataConsumerHandle::Ok; @@ -310,9 +312,9 @@ class DestinationHandle final : public WebDataConsumerHandle { public: - static PassOwnPtr<WebDataConsumerHandle> create(PassRefPtr<DestinationContext::Proxy> contextProxy) + static std::unique_ptr<WebDataConsumerHandle> create(PassRefPtr<DestinationContext::Proxy> contextProxy) { - return adoptPtr(new DestinationHandle(contextProxy)); + return wrapUnique(new DestinationHandle(contextProxy)); } private: @@ -329,7 +331,7 @@ public: SourceContext( PassRefPtr<TeeRootObject> root, - PassOwnPtr<WebDataConsumerHandle> src, + std::unique_ptr<WebDataConsumerHandle> src, PassRefPtr<DestinationContext> dest1, PassRefPtr<DestinationContext> dest2, ExecutionContext* executionContext) @@ -394,14 +396,14 @@ } RefPtr<TeeRootObject> m_root; - OwnPtr<WebDataConsumerHandle::Reader> m_reader; + std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; RefPtr<DestinationContext> m_dest1; RefPtr<DestinationContext> m_dest2; }; } // namespace -void DataConsumerTee::create(ExecutionContext* executionContext, PassOwnPtr<WebDataConsumerHandle> src, OwnPtr<WebDataConsumerHandle>* dest1, OwnPtr<WebDataConsumerHandle>* dest2) +void DataConsumerTee::create(ExecutionContext* executionContext, std::unique_ptr<WebDataConsumerHandle> src, std::unique_ptr<WebDataConsumerHandle>* dest1, std::unique_ptr<WebDataConsumerHandle>* dest2) { RefPtr<TeeRootObject> root = TeeRootObject::create(); RefPtr<DestinationTracker> tracker = DestinationTracker::create(root); @@ -414,7 +416,7 @@ *dest2 = DestinationHandle::create(DestinationContext::Proxy::create(context2, tracker)); } -void DataConsumerTee::create(ExecutionContext* executionContext, PassOwnPtr<FetchDataConsumerHandle> src, OwnPtr<FetchDataConsumerHandle>* dest1, OwnPtr<FetchDataConsumerHandle>* dest2) +void DataConsumerTee::create(ExecutionContext* executionContext, std::unique_ptr<FetchDataConsumerHandle> src, std::unique_ptr<FetchDataConsumerHandle>* dest1, std::unique_ptr<FetchDataConsumerHandle>* dest2) { RefPtr<BlobDataHandle> blobDataHandle = src->obtainReader(nullptr)->drainAsBlobDataHandle(FetchDataConsumerHandle::Reader::AllowBlobWithInvalidSize); if (blobDataHandle) { @@ -423,8 +425,8 @@ return; } - OwnPtr<WebDataConsumerHandle> webDest1, webDest2; - DataConsumerTee::create(executionContext, static_cast<PassOwnPtr<WebDataConsumerHandle>>(std::move(src)), &webDest1, &webDest2); + std::unique_ptr<WebDataConsumerHandle> webDest1, webDest2; + DataConsumerTee::create(executionContext, static_cast<std::unique_ptr<WebDataConsumerHandle>>(std::move(src)), &webDest1, &webDest2); *dest1 = createFetchDataConsumerHandleFromWebHandle(std::move(webDest1)); *dest2 = createFetchDataConsumerHandleFromWebHandle(std::move(webDest2)); return;
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerTee.h b/third_party/WebKit/Source/modules/fetch/DataConsumerTee.h index 30a5782..b0e283d2 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerTee.h +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerTee.h
@@ -9,8 +9,7 @@ #include "modules/fetch/FetchDataConsumerHandle.h" #include "public/platform/WebDataConsumerHandle.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -20,8 +19,8 @@ STATIC_ONLY(DataConsumerTee); public: // Create two handles from one. |src| must be a valid unlocked handle. - static void create(ExecutionContext*, PassOwnPtr<WebDataConsumerHandle> src, OwnPtr<WebDataConsumerHandle>* dest1, OwnPtr<WebDataConsumerHandle>* dest2); - static void create(ExecutionContext*, PassOwnPtr<FetchDataConsumerHandle> src, OwnPtr<FetchDataConsumerHandle>* dest1, OwnPtr<FetchDataConsumerHandle>* dest2); + static void create(ExecutionContext*, std::unique_ptr<WebDataConsumerHandle> src, std::unique_ptr<WebDataConsumerHandle>* dest1, std::unique_ptr<WebDataConsumerHandle>* dest2); + static void create(ExecutionContext*, std::unique_ptr<FetchDataConsumerHandle> src, std::unique_ptr<FetchDataConsumerHandle>* dest1, std::unique_ptr<FetchDataConsumerHandle>* dest2); }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp index d467143..dfa3d1c 100644 --- a/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerTeeTest.cpp
@@ -15,7 +15,9 @@ #include "public/platform/WebTraceLocation.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> #include <string.h> #include <v8.h> @@ -53,10 +55,10 @@ template<typename Handle> class TeeCreationThread { public: - void run(PassOwnPtr<Handle> src, OwnPtr<Handle>* dest1, OwnPtr<Handle>* dest2) + void run(std::unique_ptr<Handle> src, std::unique_ptr<Handle>* dest1, std::unique_ptr<Handle>* dest2) { - m_thread = adoptPtr(new Thread("src thread", Thread::WithExecutionContext)); - m_waitableEvent = adoptPtr(new WaitableEvent()); + m_thread = wrapUnique(new Thread("src thread", Thread::WithExecutionContext)); + m_waitableEvent = wrapUnique(new WaitableEvent()); m_thread->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(&TeeCreationThread<Handle>::runInternal, AllowCrossThreadAccess(this), passed(std::move(src)), AllowCrossThreadAccess(dest1), AllowCrossThreadAccess(dest2))); m_waitableEvent->wait(); } @@ -64,24 +66,24 @@ Thread* getThread() { return m_thread.get(); } private: - void runInternal(PassOwnPtr<Handle> src, OwnPtr<Handle>* dest1, OwnPtr<Handle>* dest2) + void runInternal(std::unique_ptr<Handle> src, std::unique_ptr<Handle>* dest1, std::unique_ptr<Handle>* dest2) { DataConsumerTee::create(m_thread->getExecutionContext(), std::move(src), dest1, dest2); m_waitableEvent->signal(); } - OwnPtr<Thread> m_thread; - OwnPtr<WaitableEvent> m_waitableEvent; + std::unique_ptr<Thread> m_thread; + std::unique_ptr<WaitableEvent> m_waitableEvent; }; TEST(DataConsumerTeeTest, CreateDone) { - OwnPtr<Handle> src(Handle::create()); - OwnPtr<WebDataConsumerHandle> dest1, dest2; + std::unique_ptr<Handle> src(Handle::create()); + std::unique_ptr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Done)); - OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); + std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -89,8 +91,8 @@ HandleReaderRunner<HandleReader> r1(std::move(dest1)), r2(std::move(dest2)); - OwnPtr<HandleReadResult> res1 = r1.wait(); - OwnPtr<HandleReadResult> res2 = r2.wait(); + std::unique_ptr<HandleReadResult> res1 = r1.wait(); + std::unique_ptr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res1->result()); EXPECT_EQ(0u, res1->data().size()); @@ -100,8 +102,8 @@ TEST(DataConsumerTeeTest, Read) { - OwnPtr<Handle> src(Handle::create()); - OwnPtr<WebDataConsumerHandle> dest1, dest2; + std::unique_ptr<Handle> src(Handle::create()); + std::unique_ptr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Wait)); src->add(Command(Command::Data, "hello, ")); @@ -111,7 +113,7 @@ src->add(Command(Command::Wait)); src->add(Command(Command::Done)); - OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); + std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -120,8 +122,8 @@ HandleReaderRunner<HandleReader> r1(std::move(dest1)); HandleReaderRunner<HandleReader> r2(std::move(dest2)); - OwnPtr<HandleReadResult> res1 = r1.wait(); - OwnPtr<HandleReadResult> res2 = r2.wait(); + std::unique_ptr<HandleReadResult> res1 = r1.wait(); + std::unique_ptr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res1->result()); EXPECT_EQ("hello, world", toString(res1->data())); @@ -132,8 +134,8 @@ TEST(DataConsumerTeeTest, TwoPhaseRead) { - OwnPtr<Handle> src(Handle::create()); - OwnPtr<WebDataConsumerHandle> dest1, dest2; + std::unique_ptr<Handle> src(Handle::create()); + std::unique_ptr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Wait)); src->add(Command(Command::Data, "hello, ")); @@ -144,7 +146,7 @@ src->add(Command(Command::Wait)); src->add(Command(Command::Done)); - OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); + std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -153,8 +155,8 @@ HandleReaderRunner<HandleTwoPhaseReader> r1(std::move(dest1)); HandleReaderRunner<HandleTwoPhaseReader> r2(std::move(dest2)); - OwnPtr<HandleReadResult> res1 = r1.wait(); - OwnPtr<HandleReadResult> res2 = r2.wait(); + std::unique_ptr<HandleReadResult> res1 = r1.wait(); + std::unique_ptr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res1->result()); EXPECT_EQ("hello, world", toString(res1->data())); @@ -165,14 +167,14 @@ TEST(DataConsumerTeeTest, Error) { - OwnPtr<Handle> src(Handle::create()); - OwnPtr<WebDataConsumerHandle> dest1, dest2; + std::unique_ptr<Handle> src(Handle::create()); + std::unique_ptr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); src->add(Command(Command::Error)); - OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); + std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -181,8 +183,8 @@ HandleReaderRunner<HandleReader> r1(std::move(dest1)); HandleReaderRunner<HandleReader> r2(std::move(dest2)); - OwnPtr<HandleReadResult> res1 = r1.wait(); - OwnPtr<HandleReadResult> res2 = r2.wait(); + std::unique_ptr<HandleReadResult> res1 = r1.wait(); + std::unique_ptr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kUnexpectedError, res1->result()); EXPECT_EQ(kUnexpectedError, res2->result()); @@ -195,13 +197,13 @@ TEST(DataConsumerTeeTest, StopSource) { - OwnPtr<Handle> src(Handle::create()); - OwnPtr<WebDataConsumerHandle> dest1, dest2; + std::unique_ptr<Handle> src(Handle::create()); + std::unique_ptr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); - OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); + std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -214,8 +216,8 @@ // t->thread() is alive. t->getThread()->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(postStop, AllowCrossThreadAccess(t->getThread()))); - OwnPtr<HandleReadResult> res1 = r1.wait(); - OwnPtr<HandleReadResult> res2 = r2.wait(); + std::unique_ptr<HandleReadResult> res1 = r1.wait(); + std::unique_ptr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kUnexpectedError, res1->result()); EXPECT_EQ(kUnexpectedError, res2->result()); @@ -223,13 +225,13 @@ TEST(DataConsumerTeeTest, DetachSource) { - OwnPtr<Handle> src(Handle::create()); - OwnPtr<WebDataConsumerHandle> dest1, dest2; + std::unique_ptr<Handle> src(Handle::create()); + std::unique_ptr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); - OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); + std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -240,8 +242,8 @@ t = nullptr; - OwnPtr<HandleReadResult> res1 = r1.wait(); - OwnPtr<HandleReadResult> res2 = r2.wait(); + std::unique_ptr<HandleReadResult> res1 = r1.wait(); + std::unique_ptr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kUnexpectedError, res1->result()); EXPECT_EQ(kUnexpectedError, res2->result()); @@ -249,21 +251,21 @@ TEST(DataConsumerTeeTest, DetachSourceAfterReadingDone) { - OwnPtr<Handle> src(Handle::create()); - OwnPtr<WebDataConsumerHandle> dest1, dest2; + std::unique_ptr<Handle> src(Handle::create()); + std::unique_ptr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); src->add(Command(Command::Done)); - OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); + std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); ASSERT_TRUE(dest2); HandleReaderRunner<HandleReader> r1(std::move(dest1)); - OwnPtr<HandleReadResult> res1 = r1.wait(); + std::unique_ptr<HandleReadResult> res1 = r1.wait(); EXPECT_EQ(kDone, res1->result()); EXPECT_EQ("hello, world", toString(res1->data())); @@ -271,7 +273,7 @@ t = nullptr; HandleReaderRunner<HandleReader> r2(std::move(dest2)); - OwnPtr<HandleReadResult> res2 = r2.wait(); + std::unique_ptr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res2->result()); EXPECT_EQ("hello, world", toString(res2->data())); @@ -279,14 +281,14 @@ TEST(DataConsumerTeeTest, DetachOneDestination) { - OwnPtr<Handle> src(Handle::create()); - OwnPtr<WebDataConsumerHandle> dest1, dest2; + std::unique_ptr<Handle> src(Handle::create()); + std::unique_ptr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); src->add(Command(Command::Done)); - OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); + std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -295,7 +297,7 @@ dest1 = nullptr; HandleReaderRunner<HandleReader> r2(std::move(dest2)); - OwnPtr<HandleReadResult> res2 = r2.wait(); + std::unique_ptr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res2->result()); EXPECT_EQ("hello, world", toString(res2->data())); @@ -303,14 +305,14 @@ TEST(DataConsumerTeeTest, DetachBothDestinationsShouldStopSourceReader) { - OwnPtr<Handle> src(Handle::create()); + std::unique_ptr<Handle> src(Handle::create()); RefPtr<Handle::Context> context(src->getContext()); - OwnPtr<WebDataConsumerHandle> dest1, dest2; + std::unique_ptr<WebDataConsumerHandle> dest1, dest2; src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); - OwnPtr<TeeCreationThread<WebDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<WebDataConsumerHandle>()); + std::unique_ptr<TeeCreationThread<WebDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<WebDataConsumerHandle>()); t->run(std::move(src), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -327,8 +329,8 @@ TEST(FetchDataConsumerTeeTest, Create) { RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(); - OwnPtr<MockFetchDataConsumerHandle> src(MockFetchDataConsumerHandle::create()); - OwnPtr<MockFetchDataConsumerReader> reader(MockFetchDataConsumerReader::create()); + std::unique_ptr<MockFetchDataConsumerHandle> src(MockFetchDataConsumerHandle::create()); + std::unique_ptr<MockFetchDataConsumerReader> reader(MockFetchDataConsumerReader::create()); Checkpoint checkpoint; InSequence s; @@ -339,10 +341,10 @@ EXPECT_CALL(checkpoint, Call(2)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); - OwnPtr<FetchDataConsumerHandle> dest1, dest2; - OwnPtr<TeeCreationThread<FetchDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<FetchDataConsumerHandle>()); + std::unique_ptr<FetchDataConsumerHandle> dest1, dest2; + std::unique_ptr<TeeCreationThread<FetchDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<FetchDataConsumerHandle>()); checkpoint.Call(1); t->run(std::move(src), &dest1, &dest2); @@ -357,8 +359,8 @@ TEST(FetchDataConsumerTeeTest, CreateFromBlobWithInvalidSize) { RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(BlobData::create(), -1); - OwnPtr<MockFetchDataConsumerHandle> src(MockFetchDataConsumerHandle::create()); - OwnPtr<MockFetchDataConsumerReader> reader(MockFetchDataConsumerReader::create()); + std::unique_ptr<MockFetchDataConsumerHandle> src(MockFetchDataConsumerHandle::create()); + std::unique_ptr<MockFetchDataConsumerReader> reader(MockFetchDataConsumerReader::create()); Checkpoint checkpoint; InSequence s; @@ -369,10 +371,10 @@ EXPECT_CALL(checkpoint, Call(2)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); - OwnPtr<FetchDataConsumerHandle> dest1, dest2; - OwnPtr<TeeCreationThread<FetchDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<FetchDataConsumerHandle>()); + std::unique_ptr<FetchDataConsumerHandle> dest1, dest2; + std::unique_ptr<TeeCreationThread<FetchDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<FetchDataConsumerHandle>()); checkpoint.Call(1); t->run(std::move(src), &dest1, &dest2); @@ -388,12 +390,12 @@ TEST(FetchDataConsumerTeeTest, CreateDone) { - OwnPtr<Handle> src(Handle::create()); - OwnPtr<FetchDataConsumerHandle> dest1, dest2; + std::unique_ptr<Handle> src(Handle::create()); + std::unique_ptr<FetchDataConsumerHandle> dest1, dest2; src->add(Command(Command::Done)); - OwnPtr<TeeCreationThread<FetchDataConsumerHandle>> t = adoptPtr(new TeeCreationThread<FetchDataConsumerHandle>()); + std::unique_ptr<TeeCreationThread<FetchDataConsumerHandle>> t = wrapUnique(new TeeCreationThread<FetchDataConsumerHandle>()); t->run(createFetchDataConsumerHandleFromWebHandle(std::move(src)), &dest1, &dest2); ASSERT_TRUE(dest1); @@ -404,8 +406,8 @@ HandleReaderRunner<HandleReader> r1(std::move(dest1)), r2(std::move(dest2)); - OwnPtr<HandleReadResult> res1 = r1.wait(); - OwnPtr<HandleReadResult> res2 = r2.wait(); + std::unique_ptr<HandleReadResult> res1 = r1.wait(); + std::unique_ptr<HandleReadResult> res2 = r2.wait(); EXPECT_EQ(kDone, res1->result()); EXPECT_EQ(0u, res1->data().size());
diff --git a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.cpp b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.cpp index 9a86008..d7a0254 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.cpp
@@ -13,7 +13,8 @@ #include "platform/blob/BlobRegistry.h" #include "platform/blob/BlobURL.h" #include "platform/network/ResourceRequest.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -102,7 +103,7 @@ } private: - PassOwnPtr<ThreadableLoader> createLoader(ExecutionContext* executionContext, ThreadableLoaderClient* client) const + std::unique_ptr<ThreadableLoader> createLoader(ExecutionContext* executionContext, ThreadableLoaderClient* client) const { ThreadableLoaderOptions options; options.preflightPolicy = ConsiderPreflight; @@ -117,7 +118,7 @@ } // ThreadableLoaderClient - void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle> handle) override + void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle> handle) override { ASSERT(!m_receivedResponse); m_receivedResponse = true; @@ -153,14 +154,14 @@ RefPtr<BlobDataHandle> m_blobDataHandle; Persistent<FetchBlobDataConsumerHandle::LoaderFactory> m_loaderFactory; - OwnPtr<ThreadableLoader> m_loader; + std::unique_ptr<ThreadableLoader> m_loader; bool m_receivedResponse; }; class DefaultLoaderFactory final : public FetchBlobDataConsumerHandle::LoaderFactory { public: - PassOwnPtr<ThreadableLoader> create( + std::unique_ptr<ThreadableLoader> create( ExecutionContext& executionContext, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, @@ -180,7 +181,7 @@ public: class ReaderImpl : public FetchDataConsumerHandle::Reader { public: - ReaderImpl(Client* client, PassRefPtr<ReaderContext> readerContext, PassOwnPtr<WebDataConsumerHandle::Reader> reader) + ReaderImpl(Client* client, PassRefPtr<ReaderContext> readerContext, std::unique_ptr<WebDataConsumerHandle::Reader> reader) : m_readerContext(readerContext) , m_reader(std::move(reader)) , m_notifier(client) { } @@ -238,7 +239,7 @@ private: RefPtr<ReaderContext> m_readerContext; - OwnPtr<WebDataConsumerHandle::Reader> m_reader; + std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; NotifyOnReaderCreationHelper m_notifier; }; @@ -249,12 +250,12 @@ { CompositeDataConsumerHandle::Updater* updater = nullptr; m_handle = CompositeDataConsumerHandle::create(createWaitingDataConsumerHandle(), &updater); - m_loaderContextHolder = CrossThreadHolder<LoaderContext>::create(executionContext, adoptPtr(new BlobLoaderContext(updater, m_blobDataHandleForDrain, loaderFactory))); + m_loaderContextHolder = CrossThreadHolder<LoaderContext>::create(executionContext, wrapUnique(new BlobLoaderContext(updater, m_blobDataHandleForDrain, loaderFactory))); } - PassOwnPtr<FetchDataConsumerHandle::Reader> obtainReader(WebDataConsumerHandle::Client* client) + std::unique_ptr<FetchDataConsumerHandle::Reader> obtainReader(WebDataConsumerHandle::Client* client) { - return adoptPtr(new ReaderImpl(client, this, m_handle->obtainReader(client))); + return wrapUnique(new ReaderImpl(client, this, m_handle->obtainReader(client))); } private: @@ -274,9 +275,9 @@ bool drained() const { return m_drained; } void setDrained() { m_drained = true; } - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<WebDataConsumerHandle> m_handle; RefPtr<BlobDataHandle> m_blobDataHandleForDrain; - OwnPtr<CrossThreadHolder<LoaderContext>> m_loaderContextHolder; + std::unique_ptr<CrossThreadHolder<LoaderContext>> m_loaderContextHolder; bool m_loaderStarted; bool m_drained; @@ -291,25 +292,25 @@ { } -PassOwnPtr<FetchDataConsumerHandle> FetchBlobDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<BlobDataHandle> blobDataHandle, LoaderFactory* loaderFactory) +std::unique_ptr<FetchDataConsumerHandle> FetchBlobDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<BlobDataHandle> blobDataHandle, LoaderFactory* loaderFactory) { if (!blobDataHandle) return createFetchDataConsumerHandleFromWebHandle(createDoneDataConsumerHandle()); - return adoptPtr(new FetchBlobDataConsumerHandle(executionContext, blobDataHandle, loaderFactory)); + return wrapUnique(new FetchBlobDataConsumerHandle(executionContext, blobDataHandle, loaderFactory)); } -PassOwnPtr<FetchDataConsumerHandle> FetchBlobDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<BlobDataHandle> blobDataHandle) +std::unique_ptr<FetchDataConsumerHandle> FetchBlobDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<BlobDataHandle> blobDataHandle) { if (!blobDataHandle) return createFetchDataConsumerHandleFromWebHandle(createDoneDataConsumerHandle()); - return adoptPtr(new FetchBlobDataConsumerHandle(executionContext, blobDataHandle, new DefaultLoaderFactory)); + return wrapUnique(new FetchBlobDataConsumerHandle(executionContext, blobDataHandle, new DefaultLoaderFactory)); } FetchDataConsumerHandle::Reader* FetchBlobDataConsumerHandle::obtainReaderInternal(Client* client) { - return m_readerContext->obtainReader(client).leakPtr(); + return m_readerContext->obtainReader(client).release(); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.h index 2167b4b7..658c468 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.h +++ b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandle.h
@@ -10,9 +10,9 @@ #include "modules/ModulesExport.h" #include "modules/fetch/FetchDataConsumerHandle.h" #include "platform/blob/BlobData.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -24,15 +24,15 @@ public: class MODULES_EXPORT LoaderFactory : public GarbageCollectedFinalized<LoaderFactory> { public: - virtual PassOwnPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) = 0; + virtual std::unique_ptr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) = 0; virtual ~LoaderFactory() { } DEFINE_INLINE_VIRTUAL_TRACE() { } }; - static PassOwnPtr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<BlobDataHandle>); + static std::unique_ptr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<BlobDataHandle>); // For testing. - static PassOwnPtr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<BlobDataHandle>, LoaderFactory*); + static std::unique_ptr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<BlobDataHandle>, LoaderFactory*); ~FetchBlobDataConsumerHandle();
diff --git a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp index 869a7273..aa597e4 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp
@@ -18,9 +18,10 @@ #include "platform/testing/UnitTestHelpers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> #include <string.h> namespace blink { @@ -52,9 +53,9 @@ class MockLoaderFactory : public FetchBlobDataConsumerHandle::LoaderFactory { public: - PassOwnPtr<ThreadableLoader> create(ExecutionContext& executionContext, ThreadableLoaderClient* client, const ThreadableLoaderOptions& threadableLoaderOptions, const ResourceLoaderOptions& resourceLoaderOptions) override + std::unique_ptr<ThreadableLoader> create(ExecutionContext& executionContext, ThreadableLoaderClient* client, const ThreadableLoaderOptions& threadableLoaderOptions, const ResourceLoaderOptions& resourceLoaderOptions) override { - return adoptPtr(createInternal(executionContext, client, threadableLoaderOptions, resourceLoaderOptions)); + return wrapUnique(createInternal(executionContext, client, threadableLoaderOptions, resourceLoaderOptions)); } MOCK_METHOD4(createInternal, ThreadableLoader*(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&)); @@ -62,7 +63,7 @@ PassRefPtr<BlobDataHandle> createBlobDataHandle(const char* s) { - OwnPtr<BlobData> data = BlobData::create(); + std::unique_ptr<BlobData> data = BlobData::create(); data->appendText(s, false); auto size = data->length(); return BlobDataHandle::create(std::move(data), size); @@ -87,7 +88,7 @@ Document& document() { return m_dummyPageHolder->document(); } private: - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; }; TEST_F(FetchBlobDataConsumerHandleTest, CreateLoader) @@ -99,7 +100,7 @@ ThreadableLoaderOptions options; ResourceLoaderOptions resourceLoaderOptions; - OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); + std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); InSequence s; @@ -107,13 +108,13 @@ EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll( SaveArg<2>(&options), SaveArg<3>(&resourceLoaderOptions), - Return(loader.leakPtr()))); + Return(loader.release()))); EXPECT_CALL(*loaderPtr, start(_)).WillOnce(SaveArg<0>(&request)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(*loaderPtr, cancel()); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<WebDataConsumerHandle> handle + std::unique_ptr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); testing::runPendingTasks(); @@ -144,19 +145,19 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); + std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(Return(loader.leakPtr())); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(Return(loader.release())); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(*loaderPtr, cancel()); EXPECT_CALL(checkpoint, Call(3)); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<WebDataConsumerHandle> handle + std::unique_ptr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); testing::runPendingTasks(); @@ -174,12 +175,12 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); + std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(Return(loader.leakPtr())); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(Return(loader.release())); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(checkpoint, Call(3)); @@ -187,9 +188,9 @@ EXPECT_CALL(checkpoint, Call(4)); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<WebDataConsumerHandle> handle + std::unique_ptr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - OwnPtr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); testing::runPendingTasks(); size_t size = 0; @@ -209,22 +210,22 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); + std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); ThreadableLoaderClient* client = nullptr; InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.leakPtr()))); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.release()))); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(*loaderPtr, cancel()); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<WebDataConsumerHandle> handle + std::unique_ptr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Wait)); src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); @@ -238,7 +239,7 @@ checkpoint.Call(2); client->didReceiveResponse(0, ResourceResponse(), std::move(src)); HandleReaderRunner<HandleReader> runner(std::move(handle)); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("hello, world", toString(r->data())); } @@ -248,22 +249,22 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); + std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); ThreadableLoaderClient* client = nullptr; InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.leakPtr()))); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.release()))); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(*loaderPtr, cancel()); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<WebDataConsumerHandle> handle + std::unique_ptr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Wait)); src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Data, "world")); @@ -277,7 +278,7 @@ checkpoint.Call(2); client->didReceiveResponse(0, ResourceResponse(), std::move(src)); HandleReaderRunner<HandleTwoPhaseReader> runner(std::move(handle)); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("hello, world", toString(r->data())); } @@ -287,18 +288,18 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); + std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); ThreadableLoaderClient* client = nullptr; InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.leakPtr()))); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.release()))); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<WebDataConsumerHandle> handle + std::unique_ptr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); size_t size = 0; @@ -308,7 +309,7 @@ checkpoint.Call(2); client->didFail(ResourceError()); HandleReaderRunner<HandleReader> runner(std::move(handle)); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kUnexpectedError, r->result()); } @@ -317,22 +318,22 @@ auto factory = new StrictMock<MockLoaderFactory>; Checkpoint checkpoint; - OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); + std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); MockThreadableLoader* loaderPtr = loader.get(); ThreadableLoaderClient* client = nullptr; InSequence s; EXPECT_CALL(checkpoint, Call(1)); - EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.leakPtr()))); + EXPECT_CALL(*factory, createInternal(Ref(document()), _, _, _)).WillOnce(DoAll(SaveArg<1>(&client), Return(loader.release()))); EXPECT_CALL(*loaderPtr, start(_)); EXPECT_CALL(checkpoint, Call(2)); EXPECT_CALL(*loaderPtr, cancel()); RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<WebDataConsumerHandle> handle + std::unique_ptr<WebDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Wait)); src->add(Command(Command::Data, "hello, ")); src->add(Command(Command::Error)); @@ -344,7 +345,7 @@ checkpoint.Call(2); client->didReceiveResponse(0, ResourceResponse(), std::move(src)); HandleReaderRunner<HandleReader> runner(std::move(handle)); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kUnexpectedError, r->result()); } @@ -353,7 +354,7 @@ auto factory = new StrictMock<MockLoaderFactory>; RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<FetchDataConsumerHandle> handle + std::unique_ptr<FetchDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); size_t size = 0; @@ -368,7 +369,7 @@ auto factory = new StrictMock<MockLoaderFactory>; RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<FetchDataConsumerHandle> handle + std::unique_ptr<FetchDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); RefPtr<EncodedFormData> formData = handle->obtainReader(nullptr)->drainAsFormData(); @@ -389,9 +390,9 @@ auto factory = new StrictMock<MockLoaderFactory>; RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<FetchDataConsumerHandle> handle + std::unique_ptr<FetchDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t readSize; EXPECT_EQ(kShouldWait, reader->read(nullptr, 0, kNone, &readSize)); @@ -403,9 +404,9 @@ auto factory = new StrictMock<MockLoaderFactory>; RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<FetchDataConsumerHandle> handle + std::unique_ptr<FetchDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t readSize; char c; @@ -418,9 +419,9 @@ auto factory = new StrictMock<MockLoaderFactory>; RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time"); - OwnPtr<FetchDataConsumerHandle> handle + std::unique_ptr<FetchDataConsumerHandle> handle = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); const void* buffer; size_t available;
diff --git a/third_party/WebKit/Source/modules/fetch/FetchDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/FetchDataConsumerHandle.h index 1179835..608ec91 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchDataConsumerHandle.h +++ b/third_party/WebKit/Source/modules/fetch/FetchDataConsumerHandle.h
@@ -11,6 +11,8 @@ #include "public/platform/WebDataConsumerHandle.h" #include "wtf/Forward.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -64,7 +66,7 @@ // TODO(yhirano): obtainReader() is currently non-virtual override, and // will be changed into virtual override when we can use unique_ptr in // Blink. - PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainReaderInternal(client)); } + std::unique_ptr<Reader> obtainReader(Client* client) { return wrapUnique(obtainReaderInternal(client)); } private: Reader* obtainReaderInternal(Client*) override = 0;
diff --git a/third_party/WebKit/Source/modules/fetch/FetchDataLoader.cpp b/third_party/WebKit/Source/modules/fetch/FetchDataLoader.cpp index ea21ae5..abf3900 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchDataLoader.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchDataLoader.cpp
@@ -5,9 +5,11 @@ #include "modules/fetch/FetchDataLoader.h" #include "core/html/parser/TextResourceDecoder.h" +#include "wtf/PtrUtil.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" #include "wtf/typed_arrays/ArrayBufferBuilder.h" +#include <memory> namespace blink { @@ -101,11 +103,11 @@ m_client.clear(); } - OwnPtr<FetchDataConsumerHandle::Reader> m_reader; + std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; Member<FetchDataLoader::Client> m_client; String m_mimeType; - OwnPtr<BlobData> m_blobData; + std::unique_ptr<BlobData> m_blobData; }; class FetchDataLoaderAsArrayBuffer @@ -128,7 +130,7 @@ ASSERT(!m_rawData); ASSERT(!m_reader); m_client = client; - m_rawData = adoptPtr(new ArrayBufferBuilder()); + m_rawData = wrapUnique(new ArrayBufferBuilder()); m_reader = handle->obtainReader(this); } @@ -191,10 +193,10 @@ m_client.clear(); } - OwnPtr<FetchDataConsumerHandle::Reader> m_reader; + std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; Member<FetchDataLoader::Client> m_client; - OwnPtr<ArrayBufferBuilder> m_rawData; + std::unique_ptr<ArrayBufferBuilder> m_rawData; }; class FetchDataLoaderAsString @@ -277,10 +279,10 @@ m_client.clear(); } - OwnPtr<FetchDataConsumerHandle::Reader> m_reader; + std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; Member<FetchDataLoader::Client> m_client; - OwnPtr<TextResourceDecoder> m_decoder; + std::unique_ptr<TextResourceDecoder> m_decoder; StringBuilder m_builder; }; @@ -369,7 +371,7 @@ m_outStream.clear(); } - OwnPtr<FetchDataConsumerHandle::Reader> m_reader; + std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; Member<FetchDataLoader::Client> m_client; Member<Stream> m_outStream;
diff --git a/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp index 9c031fa..666ac44 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchDataLoaderTest.cpp
@@ -7,6 +7,7 @@ #include "modules/fetch/DataConsumerHandleTestUtil.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -39,8 +40,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle("text/test"); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); RefPtr<BlobDataHandle> blobDataHandle; @@ -59,7 +60,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -80,8 +81,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle("text/test"); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -99,7 +100,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -115,8 +116,8 @@ { Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle("text/test"); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -129,7 +130,7 @@ EXPECT_CALL(checkpoint, Call(3)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -140,15 +141,15 @@ TEST(FetchDataLoaderTest, LoadAsBlobViaDrainAsBlobDataHandleWithSameContentType) { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->appendBytes(kQuickBrownFox, kQuickBrownFoxLengthWithTerminatingNull); blobData->setContentType("text/test"); RefPtr<BlobDataHandle> inputBlobDataHandle = BlobDataHandle::create(std::move(blobData), kQuickBrownFoxLengthWithTerminatingNull); Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle("text/test"); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); RefPtr<BlobDataHandle> blobDataHandle; @@ -163,7 +164,7 @@ EXPECT_CALL(checkpoint, Call(3)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -179,15 +180,15 @@ TEST(FetchDataLoaderTest, LoadAsBlobViaDrainAsBlobDataHandleWithDifferentContentType) { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->appendBytes(kQuickBrownFox, kQuickBrownFoxLengthWithTerminatingNull); blobData->setContentType("text/different"); RefPtr<BlobDataHandle> inputBlobDataHandle = BlobDataHandle::create(std::move(blobData), kQuickBrownFoxLengthWithTerminatingNull); Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsBlobHandle("text/test"); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); RefPtr<BlobDataHandle> blobDataHandle; @@ -202,7 +203,7 @@ EXPECT_CALL(checkpoint, Call(3)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -221,8 +222,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsArrayBuffer(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); DOMArrayBuffer* arrayBuffer = nullptr; @@ -240,7 +241,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -261,8 +262,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsArrayBuffer(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -279,7 +280,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -295,8 +296,8 @@ { Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsArrayBuffer(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -308,7 +309,7 @@ EXPECT_CALL(checkpoint, Call(3)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -322,8 +323,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsString(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -340,7 +341,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -357,8 +358,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsString(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -375,7 +376,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -392,8 +393,8 @@ WebDataConsumerHandle::Client *client = nullptr; Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsString(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -410,7 +411,7 @@ EXPECT_CALL(checkpoint, Call(4)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient); @@ -426,8 +427,8 @@ { Checkpoint checkpoint; - OwnPtr<MockHandle> handle = MockHandle::create(); - OwnPtr<MockReader> reader = MockReader::create(); + std::unique_ptr<MockHandle> handle = MockHandle::create(); + std::unique_ptr<MockReader> reader = MockReader::create(); FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsString(); MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient::create(); @@ -439,7 +440,7 @@ EXPECT_CALL(checkpoint, Call(3)); // |reader| is adopted by |obtainReader|. - ASSERT_TRUE(reader.leakPtr()); + ASSERT_TRUE(reader.release()); checkpoint.Call(1); fetchDataLoader->start(handle.get(), fetchDataLoaderClient);
diff --git a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.cpp b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.cpp index 36bc1754..b20f742 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.cpp
@@ -6,12 +6,13 @@ #include "modules/fetch/DataConsumerHandleUtil.h" #include "modules/fetch/FetchBlobDataConsumerHandle.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" - +#include <memory> #include <utility> namespace blink { @@ -35,7 +36,7 @@ WTF_MAKE_NONCOPYABLE(Context); public: virtual ~Context() {} - virtual PassOwnPtr<FetchDataConsumerHandle::Reader> obtainReader(Client*) = 0; + virtual std::unique_ptr<FetchDataConsumerHandle::Reader> obtainReader(Client*) = 0; protected: explicit Context() {} @@ -48,7 +49,7 @@ static PassRefPtr<SimpleContext> create(const void* data, size_t size) { return adoptRef(new SimpleContext(data, size)); } static PassRefPtr<SimpleContext> create(PassRefPtr<EncodedFormData> body) { return adoptRef(new SimpleContext(body)); } - PassOwnPtr<Reader> obtainReader(Client* client) override + std::unique_ptr<Reader> obtainReader(Client* client) override { // For memory barrier. Mutex m; @@ -61,7 +62,7 @@ if (!m_formData) return nullptr; flatten(); - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->appendBytes(m_flattenFormData.data(), m_flattenFormData.size()); m_flattenFormData.clear(); auto length = blobData->length(); @@ -121,7 +122,7 @@ class ReaderImpl final : public FetchDataConsumerHandle::Reader { WTF_MAKE_NONCOPYABLE(ReaderImpl); public: - static PassOwnPtr<ReaderImpl> create(PassRefPtr<SimpleContext> context, Client* client) { return adoptPtr(new ReaderImpl(context, client)); } + static std::unique_ptr<ReaderImpl> create(PassRefPtr<SimpleContext> context, Client* client) { return wrapUnique(new ReaderImpl(context, client)); } Result read(void* data, size_t size, Flags flags, size_t* readSize) override { return m_context->read(data, size, flags, readSize); @@ -184,7 +185,7 @@ return adoptRef(new ComplexContext(executionContext, formData, factory)); } - PassOwnPtr<FetchFormDataConsumerHandle::Reader> obtainReader(Client* client) override + std::unique_ptr<FetchFormDataConsumerHandle::Reader> obtainReader(Client* client) override { // For memory barrier. Mutex m; @@ -196,7 +197,7 @@ class ReaderImpl final : public FetchDataConsumerHandle::Reader { WTF_MAKE_NONCOPYABLE(ReaderImpl); public: - static PassOwnPtr<ReaderImpl> create(PassRefPtr<ComplexContext> context, Client* client) { return adoptPtr(new ReaderImpl(context, client)); } + static std::unique_ptr<ReaderImpl> create(PassRefPtr<ComplexContext> context, Client* client) { return wrapUnique(new ReaderImpl(context, client)); } Result read(void* data, size_t size, Flags flags, size_t* readSize) override { Result r = m_reader->read(data, size, flags, readSize); @@ -239,12 +240,12 @@ ReaderImpl(PassRefPtr<ComplexContext> context, Client* client) : m_context(context), m_reader(m_context->m_handle->obtainReader(client)) {} RefPtr<ComplexContext> m_context; - OwnPtr<FetchDataConsumerHandle::Reader> m_reader; + std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader; }; ComplexContext(ExecutionContext* executionContext, PassRefPtr<EncodedFormData> body, FetchBlobDataConsumerHandle::LoaderFactory* factory) { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); for (const auto& element : body->elements()) { switch (element.m_type) { case FormDataElement::data: @@ -284,35 +285,35 @@ } RefPtr<EncodedFormData> m_formData; - OwnPtr<FetchDataConsumerHandle> m_handle; + std::unique_ptr<FetchDataConsumerHandle> m_handle; }; -PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(const String& body) +std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(const String& body) { - return adoptPtr(new FetchFormDataConsumerHandle(body)); + return wrapUnique(new FetchFormDataConsumerHandle(body)); } -PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(DOMArrayBuffer* body) +std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(DOMArrayBuffer* body) { - return adoptPtr(new FetchFormDataConsumerHandle(body->data(), body->byteLength())); + return wrapUnique(new FetchFormDataConsumerHandle(body->data(), body->byteLength())); } -PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(DOMArrayBufferView* body) +std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(DOMArrayBufferView* body) { - return adoptPtr(new FetchFormDataConsumerHandle(body->baseAddress(), body->byteLength())); + return wrapUnique(new FetchFormDataConsumerHandle(body->baseAddress(), body->byteLength())); } -PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(const void* data, size_t size) +std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(const void* data, size_t size) { - return adoptPtr(new FetchFormDataConsumerHandle(data, size)); + return wrapUnique(new FetchFormDataConsumerHandle(data, size)); } -PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<EncodedFormData> body) +std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::create(ExecutionContext* executionContext, PassRefPtr<EncodedFormData> body) { - return adoptPtr(new FetchFormDataConsumerHandle(executionContext, body)); + return wrapUnique(new FetchFormDataConsumerHandle(executionContext, body)); } -PassOwnPtr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::createForTest( +std::unique_ptr<FetchDataConsumerHandle> FetchFormDataConsumerHandle::createForTest( ExecutionContext* executionContext, PassRefPtr<EncodedFormData> body, FetchBlobDataConsumerHandle::LoaderFactory* loaderFactory) { - return adoptPtr(new FetchFormDataConsumerHandle(executionContext, body, loaderFactory)); + return wrapUnique(new FetchFormDataConsumerHandle(executionContext, body, loaderFactory)); } FetchFormDataConsumerHandle::FetchFormDataConsumerHandle(const String& body) : m_context(SimpleContext::create(body)) {} @@ -331,7 +332,7 @@ FetchDataConsumerHandle::Reader* FetchFormDataConsumerHandle::obtainReaderInternal(Client* client) { - return m_context->obtainReader(client).leakPtr(); + return m_context->obtainReader(client).release(); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.h index ab25ff88..2abe693d 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.h +++ b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandle.h
@@ -13,10 +13,10 @@ #include "platform/blob/BlobData.h" #include "platform/network/EncodedFormData.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/ThreadSafeRefCounted.h" +#include <memory> namespace blink { @@ -27,16 +27,16 @@ class MODULES_EXPORT FetchFormDataConsumerHandle final : public FetchDataConsumerHandle { WTF_MAKE_NONCOPYABLE(FetchFormDataConsumerHandle); public: - static PassOwnPtr<FetchDataConsumerHandle> create(const String& body); - static PassOwnPtr<FetchDataConsumerHandle> create(DOMArrayBuffer* body); - static PassOwnPtr<FetchDataConsumerHandle> create(DOMArrayBufferView* body); - static PassOwnPtr<FetchDataConsumerHandle> create(const void* data, size_t); - static PassOwnPtr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<EncodedFormData> body); + static std::unique_ptr<FetchDataConsumerHandle> create(const String& body); + static std::unique_ptr<FetchDataConsumerHandle> create(DOMArrayBuffer* body); + static std::unique_ptr<FetchDataConsumerHandle> create(DOMArrayBufferView* body); + static std::unique_ptr<FetchDataConsumerHandle> create(const void* data, size_t); + static std::unique_ptr<FetchDataConsumerHandle> create(ExecutionContext*, PassRefPtr<EncodedFormData> body); // Use FetchBlobDataConsumerHandle for blobs. ~FetchFormDataConsumerHandle() override; - static PassOwnPtr<FetchDataConsumerHandle> createForTest( + static std::unique_ptr<FetchDataConsumerHandle> createForTest( ExecutionContext*, PassRefPtr<EncodedFormData> body, FetchBlobDataConsumerHandle::LoaderFactory*);
diff --git a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp index f4432a6..43262d0 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchFormDataConsumerHandleTest.cpp
@@ -15,13 +15,12 @@ #include "platform/weborigin/KURL.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" +#include <memory> #include <string.h> namespace blink { @@ -50,14 +49,14 @@ class LoaderFactory : public FetchBlobDataConsumerHandle::LoaderFactory { public: - explicit LoaderFactory(PassOwnPtr<WebDataConsumerHandle> handle) + explicit LoaderFactory(std::unique_ptr<WebDataConsumerHandle> handle) : m_client(nullptr) , m_handle(std::move(handle)) {} - PassOwnPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient* client, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) override + std::unique_ptr<ThreadableLoader> create(ExecutionContext&, ThreadableLoaderClient* client, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) override { m_client = client; - OwnPtr<MockThreadableLoader> loader = MockThreadableLoader::create(); + std::unique_ptr<MockThreadableLoader> loader = MockThreadableLoader::create(); EXPECT_CALL(*loader, start(_)).WillOnce(InvokeWithoutArgs(this, &LoaderFactory::handleDidReceiveResponse)); EXPECT_CALL(*loader, cancel()).Times(1); return std::move(loader); @@ -70,7 +69,7 @@ } ThreadableLoaderClient* m_client; - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<WebDataConsumerHandle> m_handle; }; class FetchFormDataConsumerHandleTest : public ::testing::Test { @@ -80,7 +79,7 @@ protected: Document* getDocument() { return &m_page->document(); } - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; }; PassRefPtr<EncodedFormData> complexFormData() @@ -90,7 +89,7 @@ data->appendData("foo", 3); data->appendFileRange("/foo/bar/baz", 3, 4, 5); data->appendFileSystemURLRange(KURL(KURL(), "file:///foo/bar/baz"), 6, 7, 8); - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->appendText("hello", false); auto size = blobData->length(); RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(std::move(blobData), size); @@ -132,18 +131,18 @@ TEST_F(FetchFormDataConsumerHandleTest, ReadFromString) { - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); HandleReaderRunner<HandleReader> runner(std::move(handle)); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("hello, world", toString(r->data())); } TEST_F(FetchFormDataConsumerHandleTest, TwoPhaseReadFromString) { - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); HandleReaderRunner<HandleTwoPhaseReader> runner(std::move(handle)); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("hello, world", toString(r->data())); } @@ -151,9 +150,9 @@ TEST_F(FetchFormDataConsumerHandleTest, ReadFromStringNonLatin) { UChar cs[] = {0x3042, 0}; - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String(cs)); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String(cs)); HandleReaderRunner<HandleReader> runner(std::move(handle)); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("\xe3\x81\x82", toString(r->data())); } @@ -162,9 +161,9 @@ { const unsigned char data[] = { 0x21, 0xfe, 0x00, 0x00, 0xff, 0xa3, 0x42, 0x30, 0x42, 0x99, 0x88 }; DOMArrayBuffer* buffer = DOMArrayBuffer::create(data, WTF_ARRAY_LENGTH(data)); - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(buffer); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(buffer); HandleReaderRunner<HandleReader> runner(std::move(handle)); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); Vector<char> expected; expected.append(data, WTF_ARRAY_LENGTH(data)); @@ -176,9 +175,9 @@ const unsigned char data[] = { 0x21, 0xfe, 0x00, 0x00, 0xff, 0xa3, 0x42, 0x30, 0x42, 0x99, 0x88 }; const size_t offset = 1, size = 4; DOMArrayBuffer* buffer = DOMArrayBuffer::create(data, WTF_ARRAY_LENGTH(data)); - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMUint8Array::create(buffer, offset, size)); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMUint8Array::create(buffer, offset, size)); HandleReaderRunner<HandleReader> runner(std::move(handle)); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); Vector<char> expected; expected.append(data + offset, size); @@ -191,10 +190,10 @@ data->appendData("foo", 3); data->appendData("hoge", 4); - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), data); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), data); HandleReaderRunner<HandleReader> runner(std::move(handle)); testing::runPendingTasks(); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("foohoge", toString(r->data())); } @@ -202,17 +201,17 @@ TEST_F(FetchFormDataConsumerHandleTest, ReadFromComplexFormData) { RefPtr<EncodedFormData> data = complexFormData(); - OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Data, "bar")); src->add(Command(Command::Done)); - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), data, new LoaderFactory(std::move(src))); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), data, new LoaderFactory(std::move(src))); char c; size_t readSize; EXPECT_EQ(kShouldWait, handle->obtainReader(nullptr)->read(&c, 1, kNone, &readSize)); HandleReaderRunner<HandleReader> runner(std::move(handle)); testing::runPendingTasks(); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("bar", toString(r->data())); } @@ -220,25 +219,25 @@ TEST_F(FetchFormDataConsumerHandleTest, TwoPhaseReadFromComplexFormData) { RefPtr<EncodedFormData> data = complexFormData(); - OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Data, "bar")); src->add(Command(Command::Done)); - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), data, new LoaderFactory(std::move(src))); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), data, new LoaderFactory(std::move(src))); char c; size_t readSize; EXPECT_EQ(kShouldWait, handle->obtainReader(nullptr)->read(&c, 1, kNone, &readSize)); HandleReaderRunner<HandleTwoPhaseReader> runner(std::move(handle)); testing::runPendingTasks(); - OwnPtr<HandleReadResult> r = runner.wait(); + std::unique_ptr<HandleReadResult> r = runner.wait(); EXPECT_EQ(kDone, r->result()); EXPECT_EQ("bar", toString(r->data())); } TEST_F(FetchFormDataConsumerHandleTest, DrainAsBlobDataHandleFromString) { - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<BlobDataHandle> blobDataHandle = reader->drainAsBlobDataHandle(); ASSERT_TRUE(blobDataHandle); @@ -252,8 +251,8 @@ TEST_F(FetchFormDataConsumerHandleTest, DrainAsBlobDataHandleFromArrayBuffer) { - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMArrayBuffer::create("foo", 3)); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMArrayBuffer::create("foo", 3)); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<BlobDataHandle> blobDataHandle = reader->drainAsBlobDataHandle(); ASSERT_TRUE(blobDataHandle); @@ -272,8 +271,8 @@ data->append("name2", "value2"); RefPtr<EncodedFormData> inputFormData = data->encodeMultiPartFormData(); - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<BlobDataHandle> blobDataHandle = reader->drainAsBlobDataHandle(); ASSERT_TRUE(blobDataHandle); @@ -289,8 +288,8 @@ { RefPtr<EncodedFormData> inputFormData = complexFormData(); - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<BlobDataHandle> blobDataHandle = reader->drainAsBlobDataHandle(); ASSERT_TRUE(blobDataHandle); @@ -302,8 +301,8 @@ TEST_F(FetchFormDataConsumerHandleTest, DrainAsFormDataFromString) { - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<EncodedFormData> formData = reader->drainAsFormData(); ASSERT_TRUE(formData); EXPECT_TRUE(formData->isSafeToSendToAnotherThread()); @@ -317,8 +316,8 @@ TEST_F(FetchFormDataConsumerHandleTest, DrainAsFormDataFromArrayBuffer) { - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMArrayBuffer::create("foo", 3)); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(DOMArrayBuffer::create("foo", 3)); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<EncodedFormData> formData = reader->drainAsFormData(); ASSERT_TRUE(formData); EXPECT_TRUE(formData->isSafeToSendToAnotherThread()); @@ -332,8 +331,8 @@ data->append("name2", "value2"); RefPtr<EncodedFormData> inputFormData = data->encodeMultiPartFormData(); - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<EncodedFormData> outputFormData = reader->drainAsFormData(); ASSERT_TRUE(outputFormData); EXPECT_TRUE(outputFormData->isSafeToSendToAnotherThread()); @@ -345,8 +344,8 @@ { RefPtr<EncodedFormData> inputFormData = complexFormData(); - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(getDocument(), inputFormData); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); RefPtr<EncodedFormData> outputFormData = reader->drainAsFormData(); ASSERT_TRUE(outputFormData); EXPECT_TRUE(outputFormData->isSafeToSendToAnotherThread()); @@ -356,8 +355,8 @@ TEST_F(FetchFormDataConsumerHandleTest, ZeroByteReadDoesNotAffectDraining) { - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t readSize; EXPECT_EQ(kOk, reader->read(nullptr, 0, kNone, &readSize)); RefPtr<EncodedFormData> formData = reader->drainAsFormData(); @@ -369,8 +368,8 @@ TEST_F(FetchFormDataConsumerHandleTest, OneByteReadAffectsDraining) { char c; - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t readSize; EXPECT_EQ(kOk, reader->read(&c, 1, kNone, &readSize)); EXPECT_EQ(1u, readSize); @@ -381,8 +380,8 @@ TEST_F(FetchFormDataConsumerHandleTest, BeginReadAffectsDraining) { const void* buffer = nullptr; - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::create(String("hello, world")); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t available; EXPECT_EQ(kOk, reader->beginRead(&buffer, kNone, &available)); ASSERT_TRUE(buffer); @@ -394,11 +393,11 @@ TEST_F(FetchFormDataConsumerHandleTest, ZeroByteReadDoesNotAffectDrainingForComplexFormData) { - OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Data, "bar")); src->add(Command(Command::Done)); - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t readSize; EXPECT_EQ(kShouldWait, reader->read(nullptr, 0, kNone, &readSize)); testing::runPendingTasks(); @@ -411,11 +410,11 @@ TEST_F(FetchFormDataConsumerHandleTest, OneByteReadAffectsDrainingForComplexFormData) { - OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Data, "bar")); src->add(Command(Command::Done)); - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); char c; size_t readSize; EXPECT_EQ(kShouldWait, reader->read(&c, 1, kNone, &readSize)); @@ -428,12 +427,12 @@ TEST_F(FetchFormDataConsumerHandleTest, BeginReadAffectsDrainingForComplexFormData) { - OwnPtr<ReplayingHandle> src = ReplayingHandle::create(); + std::unique_ptr<ReplayingHandle> src = ReplayingHandle::create(); src->add(Command(Command::Data, "bar")); src->add(Command(Command::Done)); const void* buffer = nullptr; - OwnPtr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); + std::unique_ptr<FetchDataConsumerHandle> handle = FetchFormDataConsumerHandle::createForTest(getDocument(), complexFormData(), new LoaderFactory(std::move(src))); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr); size_t available; EXPECT_EQ(kShouldWait, reader->beginRead(&buffer, kNone, &available)); testing::runPendingTasks();
diff --git a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp index cb329ed..aa54baf1 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp
@@ -6,7 +6,7 @@ #include "core/fetch/FetchUtils.h" #include "platform/network/HTTPParsers.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -36,7 +36,7 @@ // "To append a name/value (|name|/|value|) pair to a header list (|list|), // append a new header whose name is |name|, byte lowercased, and value is // |value|, to |list|." - m_headerList.append(adoptPtr(new Header(name.lower(), value))); + m_headerList.append(wrapUnique(new Header(name.lower(), value))); } void FetchHeaderList::set(const String& name, const String& value) @@ -61,7 +61,7 @@ return; } } - m_headerList.append(adoptPtr(new Header(lowercasedName, value))); + m_headerList.append(wrapUnique(new Header(lowercasedName, value))); } String FetchHeaderList::extractMIMEType() const
diff --git a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h index 2aa9d0f..e22abab 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h +++ b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h
@@ -7,10 +7,10 @@ #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> #include <utility> namespace blink { @@ -39,7 +39,7 @@ bool containsNonSimpleHeader() const; - const Vector<OwnPtr<Header>>& list() const { return m_headerList; } + const Vector<std::unique_ptr<Header>>& list() const { return m_headerList; } const Header& entry(size_t index) const { return *(m_headerList[index].get()); } static bool isValidHeaderName(const String&); @@ -49,7 +49,7 @@ private: FetchHeaderList(); - Vector<OwnPtr<Header>> m_headerList; + Vector<std::unique_ptr<Header>> m_headerList; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/fetch/FetchManager.cpp b/third_party/WebKit/Source/modules/fetch/FetchManager.cpp index 482e116..742c0f6 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchManager.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
@@ -38,9 +38,9 @@ #include "platform/weborigin/SecurityPolicy.h" #include "public/platform/WebURLRequest.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -64,7 +64,7 @@ ~Loader() override; DECLARE_VIRTUAL_TRACE(); - void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; void didFinishLoading(unsigned long, double) override; void didFail(const ResourceError&) override; void didFailAccessControlCheck(const ResourceError&) override; @@ -80,7 +80,7 @@ // SRIVerifier takes ownership of |handle| and |response|. // |updater| must be garbage collected. The other arguments // all must have the lifetime of the give loader. - SRIVerifier(PassOwnPtr<WebDataConsumerHandle> handle, CompositeDataConsumerHandle::Updater* updater, Response* response, FetchManager::Loader* loader, String integrityMetadata, const KURL& url) + SRIVerifier(std::unique_ptr<WebDataConsumerHandle> handle, CompositeDataConsumerHandle::Updater* updater, Response* response, FetchManager::Loader* loader, String integrityMetadata, const KURL& url) : m_handle(std::move(handle)) , m_updater(updater) , m_response(response) @@ -141,13 +141,13 @@ visitor->trace(m_loader); } private: - OwnPtr<WebDataConsumerHandle> m_handle; + std::unique_ptr<WebDataConsumerHandle> m_handle; Member<CompositeDataConsumerHandle::Updater> m_updater; Member<Response> m_response; Member<FetchManager::Loader> m_loader; String m_integrityMetadata; KURL m_url; - OwnPtr<WebDataConsumerHandle::Reader> m_reader; + std::unique_ptr<WebDataConsumerHandle::Reader> m_reader; Vector<char> m_buffer; bool m_finished; }; @@ -167,7 +167,7 @@ Member<FetchManager> m_fetchManager; Member<ScriptPromiseResolver> m_resolver; Member<FetchRequestData> m_request; - OwnPtr<ThreadableLoader> m_loader; + std::unique_ptr<ThreadableLoader> m_loader; bool m_failed; bool m_finished; int m_responseHttpStatusCode; @@ -206,7 +206,7 @@ visitor->trace(m_executionContext); } -void FetchManager::Loader::didReceiveResponse(unsigned long, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void FetchManager::Loader::didReceiveResponse(unsigned long, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { ASSERT(handle); @@ -562,7 +562,7 @@ request.setHTTPMethod(m_request->method()); request.setFetchRequestMode(m_request->mode()); request.setFetchCredentialsMode(m_request->credentials()); - const Vector<OwnPtr<FetchHeaderList::Header>>& list = m_request->headerList()->list(); + const Vector<std::unique_ptr<FetchHeaderList::Header>>& list = m_request->headerList()->list(); for (size_t i = 0; i < list.size(); ++i) { request.addHTTPHeaderField(AtomicString(list[i]->first), AtomicString(list[i]->second)); }
diff --git a/third_party/WebKit/Source/modules/fetch/FetchRequestData.h b/third_party/WebKit/Source/modules/fetch/FetchRequestData.h index 3935f79..2ba45e8 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchRequestData.h +++ b/third_party/WebKit/Source/modules/fetch/FetchRequestData.h
@@ -12,7 +12,6 @@ #include "platform/weborigin/ReferrerPolicy.h" #include "public/platform/WebURLRequest.h" #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/AtomicString.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp b/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp index 9e10c5a8..17bfc8c5 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp +++ b/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp
@@ -11,6 +11,7 @@ #include "modules/fetch/DataConsumerHandleUtil.h" #include "modules/fetch/FetchHeaderList.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -189,7 +190,7 @@ FetchResponseData* newResponse = create(); newResponse->m_type = m_type; if (m_terminationReason) { - newResponse->m_terminationReason = adoptPtr(new TerminationReason); + newResponse->m_terminationReason = wrapUnique(new TerminationReason); *newResponse->m_terminationReason = *m_terminationReason; } newResponse->m_url = m_url;
diff --git a/third_party/WebKit/Source/modules/fetch/FetchResponseData.h b/third_party/WebKit/Source/modules/fetch/FetchResponseData.h index 5f066dec..b4aab02 100644 --- a/third_party/WebKit/Source/modules/fetch/FetchResponseData.h +++ b/third_party/WebKit/Source/modules/fetch/FetchResponseData.h
@@ -12,6 +12,7 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" #include "wtf/PassRefPtr.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -88,7 +89,7 @@ FetchResponseData(Type, unsigned short, AtomicString); Type m_type; - OwnPtr<TerminationReason> m_terminationReason; + std::unique_ptr<TerminationReason> m_terminationReason; KURL m_url; unsigned short m_status; AtomicString m_statusMessage;
diff --git a/third_party/WebKit/Source/modules/fetch/GlobalFetch.cpp b/third_party/WebKit/Source/modules/fetch/GlobalFetch.cpp index 872a327..12bbb679 100644 --- a/third_party/WebKit/Source/modules/fetch/GlobalFetch.cpp +++ b/third_party/WebKit/Source/modules/fetch/GlobalFetch.cpp
@@ -12,7 +12,6 @@ #include "modules/fetch/Request.h" #include "platform/Supplementable.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/fetch/Headers.h b/third_party/WebKit/Source/modules/fetch/Headers.h index e1c6c4e7..ab97171 100644 --- a/third_party/WebKit/Source/modules/fetch/Headers.h +++ b/third_party/WebKit/Source/modules/fetch/Headers.h
@@ -11,7 +11,6 @@ #include "modules/ModulesExport.h" #include "modules/fetch/FetchHeaderList.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h index cb14457..905f0b7 100644 --- a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h +++ b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h
@@ -9,8 +9,9 @@ #include "modules/ModulesExport.h" #include "modules/fetch/FetchDataConsumerHandle.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -29,9 +30,9 @@ class MODULES_EXPORT ReadableStreamDataConsumerHandle final : public FetchDataConsumerHandle { WTF_MAKE_NONCOPYABLE(ReadableStreamDataConsumerHandle); public: - static PassOwnPtr<ReadableStreamDataConsumerHandle> create(ScriptState* scriptState, ScriptValue streamReader) + static std::unique_ptr<ReadableStreamDataConsumerHandle> create(ScriptState* scriptState, ScriptValue streamReader) { - return adoptPtr(new ReadableStreamDataConsumerHandle(scriptState, streamReader)); + return wrapUnique(new ReadableStreamDataConsumerHandle(scriptState, streamReader)); } ~ReadableStreamDataConsumerHandle() override;
diff --git a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp index fd89148..3cfcf1a8 100644 --- a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp
@@ -16,6 +16,7 @@ #include "public/platform/WebDataConsumerHandle.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> #include <v8.h> // TODO(yhirano): Add cross-thread tests once the handle gets thread-safe. @@ -81,7 +82,7 @@ return r; } - PassOwnPtr<ReadableStreamDataConsumerHandle> createHandle(ScriptValue stream) + std::unique_ptr<ReadableStreamDataConsumerHandle> createHandle(ScriptValue stream) { NonThrowableExceptionState es; ScriptValue reader = ReadableStreamOperations::getReader(getScriptState(), stream, es); @@ -93,7 +94,7 @@ void gc() { V8GCController::collectAllGarbageForTesting(isolate()); } private: - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; }; TEST_F(ReadableStreamDataConsumerHandleTest, Create) @@ -101,7 +102,7 @@ ScriptState::Scope scope(getScriptState()); ScriptValue stream(getScriptState(), evalWithPrintingError("new ReadableStream")); ASSERT_FALSE(stream.isEmpty()); - OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -111,7 +112,7 @@ EXPECT_CALL(*client, didGetReadable()); EXPECT_CALL(checkpoint, Call(2)); - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -124,7 +125,7 @@ ScriptValue stream(getScriptState(), evalWithPrintingError( "new ReadableStream({start: c => c.close()})")); ASSERT_FALSE(stream.isEmpty()); - OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -138,7 +139,7 @@ char c; size_t readBytes; - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -155,7 +156,7 @@ ScriptValue stream(getScriptState(), evalWithPrintingError( "new ReadableStream({start: c => c.error()})")); ASSERT_FALSE(stream.isEmpty()); - OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -169,7 +170,7 @@ char c; size_t readBytes; - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -192,7 +193,7 @@ "controller.close();" "stream")); ASSERT_FALSE(stream.isEmpty()); - OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -212,7 +213,7 @@ char buffer[3]; size_t readBytes; - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -260,7 +261,7 @@ "controller.close();" "stream")); ASSERT_FALSE(stream.isEmpty()); - OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -280,7 +281,7 @@ const void* buffer; size_t available; - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -337,7 +338,7 @@ "controller.close();" "stream")); ASSERT_FALSE(stream.isEmpty()); - OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -351,7 +352,7 @@ const void* buffer; size_t available; - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -372,7 +373,7 @@ "controller.close();" "stream")); ASSERT_FALSE(stream.isEmpty()); - OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -386,7 +387,7 @@ const void* buffer; size_t available; - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -407,7 +408,7 @@ "controller.close();" "stream")); ASSERT_FALSE(stream.isEmpty()); - OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); Persistent<MockClient> client = MockClient::create(); Checkpoint checkpoint; @@ -421,7 +422,7 @@ const void* buffer; size_t available; - OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); + std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(client); ASSERT_TRUE(reader); checkpoint.Call(1); testing::runPendingTasks(); @@ -434,7 +435,7 @@ TEST_F(ReadableStreamDataConsumerHandleTest, StreamReaderShouldBeWeak) { - OwnPtr<FetchDataConsumerHandle::Reader> reader; + std::unique_ptr<FetchDataConsumerHandle::Reader> reader; Checkpoint checkpoint; Persistent<MockClient> client = MockClient::create(); ScriptValue stream; @@ -452,7 +453,7 @@ ScriptState::Scope scope(getScriptState()); stream = ScriptValue(getScriptState(), evalWithPrintingError("new ReadableStream()")); ASSERT_FALSE(stream.isEmpty()); - OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); reader = handle->obtainReader(client); @@ -475,7 +476,7 @@ TEST_F(ReadableStreamDataConsumerHandleTest, StreamReaderShouldBeWeakWhenReading) { - OwnPtr<FetchDataConsumerHandle::Reader> reader; + std::unique_ptr<FetchDataConsumerHandle::Reader> reader; Checkpoint checkpoint; Persistent<MockClient> client = MockClient::create(); ScriptValue stream; @@ -494,7 +495,7 @@ ScriptState::Scope scope(getScriptState()); stream = ScriptValue(getScriptState(), evalWithPrintingError("new ReadableStream()")); ASSERT_FALSE(stream.isEmpty()); - OwnPtr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); + std::unique_ptr<ReadableStreamDataConsumerHandle> handle = createHandle(stream); ASSERT_TRUE(handle); reader = handle->obtainReader(client);
diff --git a/third_party/WebKit/Source/modules/fetch/RequestInit.h b/third_party/WebKit/Source/modules/fetch/RequestInit.h index 7fbf8e2..593f713 100644 --- a/third_party/WebKit/Source/modules/fetch/RequestInit.h +++ b/third_party/WebKit/Source/modules/fetch/RequestInit.h
@@ -9,9 +9,9 @@ #include "platform/heap/Handle.h" #include "platform/network/EncodedFormData.h" #include "platform/weborigin/Referrer.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -29,7 +29,7 @@ Member<Headers> headers; Dictionary headersDictionary; String contentType; - OwnPtr<FetchDataConsumerHandle> body; + std::unique_ptr<FetchDataConsumerHandle> body; Referrer referrer; String mode; String credentials;
diff --git a/third_party/WebKit/Source/modules/fetch/RequestTest.cpp b/third_party/WebKit/Source/modules/fetch/RequestTest.cpp index cb56d27..a264e1e 100644 --- a/third_party/WebKit/Source/modules/fetch/RequestTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/RequestTest.cpp
@@ -14,6 +14,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/HashMap.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { namespace { @@ -27,7 +28,7 @@ ExecutionContext* getExecutionContext() { return getScriptState()->getExecutionContext(); } private: - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; }; TEST_F(ServiceWorkerRequestTest, FromString)
diff --git a/third_party/WebKit/Source/modules/fetch/Response.cpp b/third_party/WebKit/Source/modules/fetch/Response.cpp index 6d74e14..d801f76 100644 --- a/third_party/WebKit/Source/modules/fetch/Response.cpp +++ b/third_party/WebKit/Source/modules/fetch/Response.cpp
@@ -29,6 +29,7 @@ #include "platform/network/HTTPHeaderMap.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -146,7 +147,7 @@ if (RuntimeEnabledFeatures::responseBodyWithV8ExtraStreamEnabled()) { bodyBuffer = new BodyStreamBuffer(scriptState, bodyValue); } else { - OwnPtr<FetchDataConsumerHandle> bodyHandle; + std::unique_ptr<FetchDataConsumerHandle> bodyHandle; reader = ReadableStreamOperations::getReader(scriptState, bodyValue, exceptionState); if (exceptionState.hadException()) { reader = ScriptValue();
diff --git a/third_party/WebKit/Source/modules/fetch/Response.h b/third_party/WebKit/Source/modules/fetch/Response.h index 01c16c42..4f91a0d 100644 --- a/third_party/WebKit/Source/modules/fetch/Response.h +++ b/third_party/WebKit/Source/modules/fetch/Response.h
@@ -15,7 +15,6 @@ #include "modules/fetch/Headers.h" #include "platform/blob/BlobData.h" #include "platform/heap/Handle.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp b/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp index a1fad617..0fee482 100644 --- a/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/ResponseTest.cpp
@@ -17,11 +17,13 @@ #include "platform/testing/UnitTestHelpers.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { namespace { -PassOwnPtr<WebServiceWorkerResponse> createTestWebServiceWorkerResponse() +std::unique_ptr<WebServiceWorkerResponse> createTestWebServiceWorkerResponse() { const KURL url(ParsedURLString, "http://www.webresponse.com/"); const unsigned short status = 200; @@ -31,7 +33,7 @@ const char* value; } headers[] = { { "cache-control", "no-cache" }, { "set-cookie", "foop" }, { "foo", "bar" }, { 0, 0 } }; - OwnPtr<WebServiceWorkerResponse> webResponse = adoptPtr(new WebServiceWorkerResponse()); + std::unique_ptr<WebServiceWorkerResponse> webResponse = wrapUnique(new WebServiceWorkerResponse()); webResponse->setURL(url); webResponse->setStatus(status); webResponse->setStatusText(statusText); @@ -50,7 +52,7 @@ ExecutionContext* getExecutionContext() { return getScriptState()->getExecutionContext(); } private: - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; }; @@ -68,7 +70,7 @@ TEST_F(ServiceWorkerResponseTest, FromWebServiceWorkerResponse) { - OwnPtr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); + std::unique_ptr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); Response* response = Response::create(getScriptState(), *webResponse); ASSERT(response); EXPECT_EQ(webResponse->url(), response->url()); @@ -89,7 +91,7 @@ TEST_F(ServiceWorkerResponseTest, FromWebServiceWorkerResponseDefault) { - OwnPtr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); + std::unique_ptr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); webResponse->setResponseType(WebServiceWorkerResponseTypeDefault); Response* response = Response::create(getScriptState(), *webResponse); @@ -103,7 +105,7 @@ TEST_F(ServiceWorkerResponseTest, FromWebServiceWorkerResponseBasic) { - OwnPtr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); + std::unique_ptr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); webResponse->setResponseType(WebServiceWorkerResponseTypeBasic); Response* response = Response::create(getScriptState(), *webResponse); @@ -117,7 +119,7 @@ TEST_F(ServiceWorkerResponseTest, FromWebServiceWorkerResponseCORS) { - OwnPtr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); + std::unique_ptr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); webResponse->setResponseType(WebServiceWorkerResponseTypeCORS); Response* response = Response::create(getScriptState(), *webResponse); @@ -131,7 +133,7 @@ TEST_F(ServiceWorkerResponseTest, FromWebServiceWorkerResponseOpaque) { - OwnPtr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); + std::unique_ptr<WebServiceWorkerResponse> webResponse = createTestWebServiceWorkerResponse(); webResponse->setResponseType(WebServiceWorkerResponseTypeOpaque); Response* response = Response::create(getScriptState(), *webResponse); @@ -187,7 +189,7 @@ BodyStreamBuffer* createHelloWorldBuffer(ScriptState* scriptState) { using Command = DataConsumerHandleTestUtil::Command; - OwnPtr<DataConsumerHandleTestUtil::ReplayingHandle> src(DataConsumerHandleTestUtil::ReplayingHandle::create()); + std::unique_ptr<DataConsumerHandleTestUtil::ReplayingHandle> src(DataConsumerHandleTestUtil::ReplayingHandle::create()); src->add(Command(Command::Data, "Hello, ")); src->add(Command(Command::Data, "world")); src->add(Command(Command::Done));
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp index 980c34d..4f66b32 100644 --- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp +++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
@@ -46,9 +46,9 @@ #include "public/platform/WebFileSystem.h" #include "public/platform/WebFileSystemCallbacks.h" #include "public/platform/WebSecurityOrigin.h" -#include "wtf/OwnPtr.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -160,7 +160,7 @@ FileWriter* fileWriter = FileWriter::create(getExecutionContext()); FileWriterBaseCallback* conversionCallback = ConvertToFileWriterCallback::create(successCallback); - OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create(fileWriter, conversionCallback, errorCallback, m_context); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create(fileWriter, conversionCallback, errorCallback, m_context); fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, std::move(callbacks)); }
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBase.cpp b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBase.cpp index 07fb06f4..02cf027 100644 --- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBase.cpp +++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemBase.cpp
@@ -48,9 +48,9 @@ #include "public/platform/Platform.h" #include "public/platform/WebFileSystem.h" #include "public/platform/WebFileSystemCallbacks.h" -#include "wtf/OwnPtr.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/TextEncoding.h" +#include <memory> namespace blink { @@ -222,7 +222,7 @@ return; } - OwnPtr<AsyncFileSystemCallbacks> callbacks(MetadataCallbacks::create(successCallback, errorCallback, m_context, this)); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks(MetadataCallbacks::create(successCallback, errorCallback, m_context, this)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); fileSystem()->readMetadata(createFileSystemURL(entry), std::move(callbacks)); } @@ -269,7 +269,7 @@ return; } - OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); fileSystem()->move(createFileSystemURL(source), parent->filesystem()->createFileSystemURL(destinationPath), std::move(callbacks)); @@ -288,7 +288,7 @@ return; } - OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); fileSystem()->copy(createFileSystemURL(source), parent->filesystem()->createFileSystemURL(destinationPath), std::move(callbacks)); @@ -308,7 +308,7 @@ return; } - OwnPtr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCallback, errorCallback, m_context, this)); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCallback, errorCallback, m_context, this)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); fileSystem()->remove(createFileSystemURL(entry), std::move(callbacks)); @@ -328,7 +328,7 @@ return; } - OwnPtr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCallback, errorCallback, m_context, this)); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCallback, errorCallback, m_context, this)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); fileSystem()->removeRecursively(createFileSystemURL(entry), std::move(callbacks)); @@ -360,7 +360,7 @@ return; } - OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, this, absolutePath, false)); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, this, absolutePath, false)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); if (flags.createFlag()) @@ -382,7 +382,7 @@ return; } - OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, this, absolutePath, true)); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, this, absolutePath, true)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); if (flags.createFlag()) @@ -400,7 +400,7 @@ ASSERT(DOMFilePath::isAbsolute(path)); - OwnPtr<AsyncFileSystemCallbacks> callbacks(EntriesCallbacks::create(successCallback, errorCallback, m_context, reader, path)); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks(EntriesCallbacks::create(successCallback, errorCallback, m_context, reader, path)); callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); return fileSystem()->readDirectory(createFileSystemURL(path), std::move(callbacks));
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp index c5f2012..e57da4d 100644 --- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp +++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp
@@ -43,6 +43,8 @@ #include "platform/FileMetadata.h" #include "public/platform/WebFileSystem.h" #include "public/platform/WebFileSystemCallbacks.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -101,9 +103,9 @@ } }; - static PassOwnPtr<AsyncFileSystemCallbacks> create(CreateFileResult* result, const String& name, const KURL& url, FileSystemType type) + static std::unique_ptr<AsyncFileSystemCallbacks> create(CreateFileResult* result, const String& name, const KURL& url, FileSystemType type) { - return adoptPtr(static_cast<AsyncFileSystemCallbacks*>(new CreateFileHelper(result, name, url, type))); + return wrapUnique(static_cast<AsyncFileSystemCallbacks*>(new CreateFileHelper(result, name, url, type))); } void didFail(int code) override @@ -212,7 +214,7 @@ FileError::ErrorCode errorCode = FileError::OK; LocalErrorCallback* errorCallback = LocalErrorCallback::create(errorCode); - OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create(fileWriter, successCallback, errorCallback, m_context); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create(fileWriter, successCallback, errorCallback, m_context); callbacks->setShouldBlockUntilCompletion(true); fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, std::move(callbacks));
diff --git a/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp b/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp index b88517d..34c58f2 100644 --- a/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp +++ b/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp
@@ -51,6 +51,8 @@ #include "modules/filesystem/MetadataCallback.h" #include "platform/FileMetadata.h" #include "public/platform/WebFileWriter.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -104,9 +106,9 @@ // EntryCallbacks ------------------------------------------------------------- -PassOwnPtr<AsyncFileSystemCallbacks> EntryCallbacks::create(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem, const String& expectedPath, bool isDirectory) +std::unique_ptr<AsyncFileSystemCallbacks> EntryCallbacks::create(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem, const String& expectedPath, bool isDirectory) { - return adoptPtr(new EntryCallbacks(successCallback, errorCallback, context, fileSystem, expectedPath, isDirectory)); + return wrapUnique(new EntryCallbacks(successCallback, errorCallback, context, fileSystem, expectedPath, isDirectory)); } EntryCallbacks::EntryCallbacks(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem, const String& expectedPath, bool isDirectory) @@ -129,9 +131,9 @@ // EntriesCallbacks ----------------------------------------------------------- -PassOwnPtr<AsyncFileSystemCallbacks> EntriesCallbacks::create(EntriesCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DirectoryReaderBase* directoryReader, const String& basePath) +std::unique_ptr<AsyncFileSystemCallbacks> EntriesCallbacks::create(EntriesCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DirectoryReaderBase* directoryReader, const String& basePath) { - return adoptPtr(new EntriesCallbacks(successCallback, errorCallback, context, directoryReader, basePath)); + return wrapUnique(new EntriesCallbacks(successCallback, errorCallback, context, directoryReader, basePath)); } EntriesCallbacks::EntriesCallbacks(EntriesCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DirectoryReaderBase* directoryReader, const String& basePath) @@ -163,9 +165,9 @@ // FileSystemCallbacks -------------------------------------------------------- -PassOwnPtr<AsyncFileSystemCallbacks> FileSystemCallbacks::create(FileSystemCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, FileSystemType type) +std::unique_ptr<AsyncFileSystemCallbacks> FileSystemCallbacks::create(FileSystemCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, FileSystemType type) { - return adoptPtr(new FileSystemCallbacks(successCallback, errorCallback, context, type)); + return wrapUnique(new FileSystemCallbacks(successCallback, errorCallback, context, type)); } FileSystemCallbacks::FileSystemCallbacks(FileSystemCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, FileSystemType type) @@ -183,9 +185,9 @@ // ResolveURICallbacks -------------------------------------------------------- -PassOwnPtr<AsyncFileSystemCallbacks> ResolveURICallbacks::create(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) +std::unique_ptr<AsyncFileSystemCallbacks> ResolveURICallbacks::create(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) { - return adoptPtr(new ResolveURICallbacks(successCallback, errorCallback, context)); + return wrapUnique(new ResolveURICallbacks(successCallback, errorCallback, context)); } ResolveURICallbacks::ResolveURICallbacks(EntryCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) @@ -213,9 +215,9 @@ // MetadataCallbacks ---------------------------------------------------------- -PassOwnPtr<AsyncFileSystemCallbacks> MetadataCallbacks::create(MetadataCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem) +std::unique_ptr<AsyncFileSystemCallbacks> MetadataCallbacks::create(MetadataCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem) { - return adoptPtr(new MetadataCallbacks(successCallback, errorCallback, context, fileSystem)); + return wrapUnique(new MetadataCallbacks(successCallback, errorCallback, context, fileSystem)); } MetadataCallbacks::MetadataCallbacks(MetadataCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem) @@ -232,9 +234,9 @@ // FileWriterBaseCallbacks ---------------------------------------------------- -PassOwnPtr<AsyncFileSystemCallbacks> FileWriterBaseCallbacks::create(FileWriterBase* fileWriter, FileWriterBaseCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) +std::unique_ptr<AsyncFileSystemCallbacks> FileWriterBaseCallbacks::create(FileWriterBase* fileWriter, FileWriterBaseCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) { - return adoptPtr(new FileWriterBaseCallbacks(fileWriter, successCallback, errorCallback, context)); + return wrapUnique(new FileWriterBaseCallbacks(fileWriter, successCallback, errorCallback, context)); } FileWriterBaseCallbacks::FileWriterBaseCallbacks(FileWriterBase* fileWriter, FileWriterBaseCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) @@ -244,7 +246,7 @@ { } -void FileWriterBaseCallbacks::didCreateFileWriter(PassOwnPtr<WebFileWriter> fileWriter, long long length) +void FileWriterBaseCallbacks::didCreateFileWriter(std::unique_ptr<WebFileWriter> fileWriter, long long length) { m_fileWriter->initialize(std::move(fileWriter), length); if (m_successCallback) @@ -253,9 +255,9 @@ // SnapshotFileCallback ------------------------------------------------------- -PassOwnPtr<AsyncFileSystemCallbacks> SnapshotFileCallback::create(DOMFileSystemBase* filesystem, const String& name, const KURL& url, BlobCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) +std::unique_ptr<AsyncFileSystemCallbacks> SnapshotFileCallback::create(DOMFileSystemBase* filesystem, const String& name, const KURL& url, BlobCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) { - return adoptPtr(new SnapshotFileCallback(filesystem, name, url, successCallback, errorCallback, context)); + return wrapUnique(new SnapshotFileCallback(filesystem, name, url, successCallback, errorCallback, context)); } SnapshotFileCallback::SnapshotFileCallback(DOMFileSystemBase* filesystem, const String& name, const KURL& url, BlobCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) @@ -281,9 +283,9 @@ // VoidCallbacks -------------------------------------------------------------- -PassOwnPtr<AsyncFileSystemCallbacks> VoidCallbacks::create(VoidCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem) +std::unique_ptr<AsyncFileSystemCallbacks> VoidCallbacks::create(VoidCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem) { - return adoptPtr(new VoidCallbacks(successCallback, errorCallback, context, fileSystem)); + return wrapUnique(new VoidCallbacks(successCallback, errorCallback, context, fileSystem)); } VoidCallbacks::VoidCallbacks(VoidCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFileSystemBase* fileSystem)
diff --git a/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.h b/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.h index 0deb73a..937f0573 100644 --- a/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.h +++ b/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.h
@@ -36,6 +36,7 @@ #include "platform/FileSystemType.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -83,7 +84,7 @@ class EntryCallbacks final : public FileSystemCallbacksBase { public: - static PassOwnPtr<AsyncFileSystemCallbacks> create(EntryCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*, const String& expectedPath, bool isDirectory); + static std::unique_ptr<AsyncFileSystemCallbacks> create(EntryCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*, const String& expectedPath, bool isDirectory); void didSucceed() override; private: @@ -95,7 +96,7 @@ class EntriesCallbacks final : public FileSystemCallbacksBase { public: - static PassOwnPtr<AsyncFileSystemCallbacks> create(EntriesCallback*, ErrorCallback*, ExecutionContext*, DirectoryReaderBase*, const String& basePath); + static std::unique_ptr<AsyncFileSystemCallbacks> create(EntriesCallback*, ErrorCallback*, ExecutionContext*, DirectoryReaderBase*, const String& basePath); void didReadDirectoryEntry(const String& name, bool isDirectory) override; void didReadDirectoryEntries(bool hasMore) override; @@ -109,7 +110,7 @@ class FileSystemCallbacks final : public FileSystemCallbacksBase { public: - static PassOwnPtr<AsyncFileSystemCallbacks> create(FileSystemCallback*, ErrorCallback*, ExecutionContext*, FileSystemType); + static std::unique_ptr<AsyncFileSystemCallbacks> create(FileSystemCallback*, ErrorCallback*, ExecutionContext*, FileSystemType); void didOpenFileSystem(const String& name, const KURL& rootURL) override; private: @@ -120,7 +121,7 @@ class ResolveURICallbacks final : public FileSystemCallbacksBase { public: - static PassOwnPtr<AsyncFileSystemCallbacks> create(EntryCallback*, ErrorCallback*, ExecutionContext*); + static std::unique_ptr<AsyncFileSystemCallbacks> create(EntryCallback*, ErrorCallback*, ExecutionContext*); void didResolveURL(const String& name, const KURL& rootURL, FileSystemType, const String& filePath, bool isDirectry) override; private: @@ -130,7 +131,7 @@ class MetadataCallbacks final : public FileSystemCallbacksBase { public: - static PassOwnPtr<AsyncFileSystemCallbacks> create(MetadataCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*); + static std::unique_ptr<AsyncFileSystemCallbacks> create(MetadataCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*); void didReadMetadata(const FileMetadata&) override; private: @@ -140,8 +141,8 @@ class FileWriterBaseCallbacks final : public FileSystemCallbacksBase { public: - static PassOwnPtr<AsyncFileSystemCallbacks> create(FileWriterBase*, FileWriterBaseCallback*, ErrorCallback*, ExecutionContext*); - void didCreateFileWriter(PassOwnPtr<WebFileWriter>, long long length) override; + static std::unique_ptr<AsyncFileSystemCallbacks> create(FileWriterBase*, FileWriterBaseCallback*, ErrorCallback*, ExecutionContext*); + void didCreateFileWriter(std::unique_ptr<WebFileWriter>, long long length) override; private: FileWriterBaseCallbacks(FileWriterBase*, FileWriterBaseCallback*, ErrorCallback*, ExecutionContext*); @@ -151,7 +152,7 @@ class SnapshotFileCallback final : public FileSystemCallbacksBase { public: - static PassOwnPtr<AsyncFileSystemCallbacks> create(DOMFileSystemBase*, const String& name, const KURL&, BlobCallback*, ErrorCallback*, ExecutionContext*); + static std::unique_ptr<AsyncFileSystemCallbacks> create(DOMFileSystemBase*, const String& name, const KURL&, BlobCallback*, ErrorCallback*, ExecutionContext*); virtual void didCreateSnapshotFile(const FileMetadata&, PassRefPtr<BlobDataHandle> snapshot); private: @@ -163,7 +164,7 @@ class VoidCallbacks final : public FileSystemCallbacksBase { public: - static PassOwnPtr<AsyncFileSystemCallbacks> create(VoidCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*); + static std::unique_ptr<AsyncFileSystemCallbacks> create(VoidCallback*, ErrorCallback*, ExecutionContext*, DOMFileSystemBase*); void didSucceed() override; private:
diff --git a/third_party/WebKit/Source/modules/filesystem/FileSystemClient.h b/third_party/WebKit/Source/modules/filesystem/FileSystemClient.h index 7fb2fc30..772a179b 100644 --- a/third_party/WebKit/Source/modules/filesystem/FileSystemClient.h +++ b/third_party/WebKit/Source/modules/filesystem/FileSystemClient.h
@@ -36,6 +36,7 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -52,12 +53,12 @@ virtual ~FileSystemClient() { } virtual bool requestFileSystemAccessSync(ExecutionContext*) = 0; - virtual void requestFileSystemAccessAsync(ExecutionContext*, PassOwnPtr<ContentSettingCallbacks>) = 0; + virtual void requestFileSystemAccessAsync(ExecutionContext*, std::unique_ptr<ContentSettingCallbacks>) = 0; }; -MODULES_EXPORT void provideLocalFileSystemTo(LocalFrame&, PassOwnPtr<FileSystemClient>); +MODULES_EXPORT void provideLocalFileSystemTo(LocalFrame&, std::unique_ptr<FileSystemClient>); -MODULES_EXPORT void provideLocalFileSystemToWorker(WorkerClients*, PassOwnPtr<FileSystemClient>); +MODULES_EXPORT void provideLocalFileSystemToWorker(WorkerClients*, std::unique_ptr<FileSystemClient>); } // namespace blink
diff --git a/third_party/WebKit/Source/modules/filesystem/FileWriterBase.cpp b/third_party/WebKit/Source/modules/filesystem/FileWriterBase.cpp index ab9f91b..46da89cf 100644 --- a/third_party/WebKit/Source/modules/filesystem/FileWriterBase.cpp +++ b/third_party/WebKit/Source/modules/filesystem/FileWriterBase.cpp
@@ -34,6 +34,7 @@ #include "core/fileapi/Blob.h" #include "core/fileapi/FileError.h" #include "public/platform/WebFileWriter.h" +#include <memory> namespace blink { @@ -41,7 +42,7 @@ { } -void FileWriterBase::initialize(PassOwnPtr<WebFileWriter> writer, long long length) +void FileWriterBase::initialize(std::unique_ptr<WebFileWriter> writer, long long length) { ASSERT(!m_writer); ASSERT(length >= 0);
diff --git a/third_party/WebKit/Source/modules/filesystem/FileWriterBase.h b/third_party/WebKit/Source/modules/filesystem/FileWriterBase.h index 89d97d9..dcace75a0 100644 --- a/third_party/WebKit/Source/modules/filesystem/FileWriterBase.h +++ b/third_party/WebKit/Source/modules/filesystem/FileWriterBase.h
@@ -32,8 +32,7 @@ #define FileWriterBase_h #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -42,7 +41,7 @@ class FileWriterBase : public GarbageCollectedMixin { public: virtual ~FileWriterBase(); - void initialize(PassOwnPtr<WebFileWriter>, long long length); + void initialize(std::unique_ptr<WebFileWriter>, long long length); long long position() const { @@ -76,7 +75,7 @@ void seekInternal(long long position); private: - OwnPtr<WebFileWriter> m_writer; + std::unique_ptr<WebFileWriter> m_writer; long long m_position; long long m_length; };
diff --git a/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.cpp index 10feb91..3db0b122 100644 --- a/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.cpp +++ b/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.cpp
@@ -42,12 +42,13 @@ #include "public/platform/Platform.h" #include "public/platform/WebFileSystem.h" #include "wtf/Functional.h" +#include <memory> namespace blink { namespace { -void reportFailure(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileError::ErrorCode error) +void reportFailure(std::unique_ptr<AsyncFileSystemCallbacks> callbacks, FileError::ErrorCode error) { callbacks->didFail(error); } @@ -56,12 +57,12 @@ class CallbackWrapper final : public GarbageCollectedFinalized<CallbackWrapper> { public: - CallbackWrapper(PassOwnPtr<AsyncFileSystemCallbacks> c) + CallbackWrapper(std::unique_ptr<AsyncFileSystemCallbacks> c) : m_callbacks(std::move(c)) { } virtual ~CallbackWrapper() { } - PassOwnPtr<AsyncFileSystemCallbacks> release() + std::unique_ptr<AsyncFileSystemCallbacks> release() { return std::move(m_callbacks); } @@ -69,10 +70,10 @@ DEFINE_INLINE_TRACE() { } private: - OwnPtr<AsyncFileSystemCallbacks> m_callbacks; + std::unique_ptr<AsyncFileSystemCallbacks> m_callbacks; }; -LocalFileSystem* LocalFileSystem::create(PassOwnPtr<FileSystemClient> client) +LocalFileSystem* LocalFileSystem::create(std::unique_ptr<FileSystemClient> client) { return new LocalFileSystem(std::move(client)); } @@ -81,7 +82,7 @@ { } -void LocalFileSystem::resolveURL(ExecutionContext* context, const KURL& fileSystemURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void LocalFileSystem::resolveURL(ExecutionContext* context, const KURL& fileSystemURL, std::unique_ptr<AsyncFileSystemCallbacks> callbacks) { CallbackWrapper* wrapper = new CallbackWrapper(std::move(callbacks)); requestFileSystemAccessInternal(context, @@ -89,7 +90,7 @@ bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, context, wrapper)); } -void LocalFileSystem::requestFileSystem(ExecutionContext* context, FileSystemType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void LocalFileSystem::requestFileSystem(ExecutionContext* context, FileSystemType type, long long size, std::unique_ptr<AsyncFileSystemCallbacks> callbacks) { CallbackWrapper* wrapper = new CallbackWrapper(std::move(callbacks)); requestFileSystemAccessInternal(context, @@ -97,7 +98,7 @@ bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, context, wrapper)); } -void LocalFileSystem::deleteFileSystem(ExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +void LocalFileSystem::deleteFileSystem(ExecutionContext* context, FileSystemType type, std::unique_ptr<AsyncFileSystemCallbacks> callbacks) { ASSERT(context); ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); @@ -189,7 +190,7 @@ fileSystem->deleteFileSystem(storagePartition, static_cast<WebFileSystemType>(type), callbacks->release()); } -LocalFileSystem::LocalFileSystem(PassOwnPtr<FileSystemClient> client) +LocalFileSystem::LocalFileSystem(std::unique_ptr<FileSystemClient> client) : m_client(std::move(client)) { } @@ -209,12 +210,12 @@ return static_cast<LocalFileSystem*>(Supplement<WorkerClients>::from(clients, supplementName())); } -void provideLocalFileSystemTo(LocalFrame& frame, PassOwnPtr<FileSystemClient> client) +void provideLocalFileSystemTo(LocalFrame& frame, std::unique_ptr<FileSystemClient> client) { frame.provideSupplement(LocalFileSystem::supplementName(), LocalFileSystem::create(std::move(client))); } -void provideLocalFileSystemToWorker(WorkerClients* clients, PassOwnPtr<FileSystemClient> client) +void provideLocalFileSystemToWorker(WorkerClients* clients, std::unique_ptr<FileSystemClient> client) { clients->provideSupplement(LocalFileSystem::supplementName(), LocalFileSystem::create(std::move(client))); }
diff --git a/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.h b/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.h index 696d955..1255126 100644 --- a/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.h +++ b/third_party/WebKit/Source/modules/filesystem/LocalFileSystem.h
@@ -37,7 +37,7 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/Functional.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -53,12 +53,12 @@ USING_GARBAGE_COLLECTED_MIXIN(LocalFileSystem); WTF_MAKE_NONCOPYABLE(LocalFileSystem); public: - static LocalFileSystem* create(PassOwnPtr<FileSystemClient>); + static LocalFileSystem* create(std::unique_ptr<FileSystemClient>); ~LocalFileSystem(); - void resolveURL(ExecutionContext*, const KURL&, PassOwnPtr<AsyncFileSystemCallbacks>); - void requestFileSystem(ExecutionContext*, FileSystemType, long long size, PassOwnPtr<AsyncFileSystemCallbacks>); - void deleteFileSystem(ExecutionContext*, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks>); + void resolveURL(ExecutionContext*, const KURL&, std::unique_ptr<AsyncFileSystemCallbacks>); + void requestFileSystem(ExecutionContext*, FileSystemType, long long size, std::unique_ptr<AsyncFileSystemCallbacks>); + void deleteFileSystem(ExecutionContext*, FileSystemType, std::unique_ptr<AsyncFileSystemCallbacks>); FileSystemClient* client() const { return m_client.get(); } @@ -72,7 +72,7 @@ } private: - explicit LocalFileSystem(PassOwnPtr<FileSystemClient>); + explicit LocalFileSystem(std::unique_ptr<FileSystemClient>); WebFileSystem* getFileSystem() const; void fileSystemNotAvailable(ExecutionContext*, CallbackWrapper*); @@ -83,7 +83,7 @@ void resolveURLInternal(ExecutionContext*, const KURL&, CallbackWrapper*); void deleteFileSystemInternal(ExecutionContext*, FileSystemType, CallbackWrapper*); - OwnPtr<FileSystemClient> m_client; + std::unique_ptr<FileSystemClient> m_client; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp index 7a0841c0..b9e309b 100644 --- a/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp +++ b/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp
@@ -41,6 +41,7 @@ #include "modules/filesystem/SyncCallbackHelper.h" #include "platform/FileSystemType.h" #include "platform/weborigin/SecurityOrigin.h" +#include <memory> namespace blink { @@ -76,7 +77,7 @@ } FileSystemSyncCallbackHelper* helper = FileSystemSyncCallbackHelper::create(); - OwnPtr<AsyncFileSystemCallbacks> callbacks = FileSystemCallbacks::create(helper->getSuccessCallback(), helper->getErrorCallback(), &worker, fileSystemType); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks = FileSystemCallbacks::create(helper->getSuccessCallback(), helper->getErrorCallback(), &worker, fileSystemType); callbacks->setShouldBlockUntilCompletion(true); LocalFileSystem::from(worker)->requestFileSystem(&worker, fileSystemType, size, std::move(callbacks)); @@ -115,7 +116,7 @@ } EntrySyncCallbackHelper* resolveURLHelper = EntrySyncCallbackHelper::create(); - OwnPtr<AsyncFileSystemCallbacks> callbacks = ResolveURICallbacks::create(resolveURLHelper->getSuccessCallback(), resolveURLHelper->getErrorCallback(), &worker); + std::unique_ptr<AsyncFileSystemCallbacks> callbacks = ResolveURICallbacks::create(resolveURLHelper->getSuccessCallback(), resolveURLHelper->getErrorCallback(), &worker); callbacks->setShouldBlockUntilCompletion(true); LocalFileSystem::from(worker)->resolveURL(&worker, completedURL, std::move(callbacks));
diff --git a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp index 7e04c0c..fb0aaf17 100644 --- a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp +++ b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
@@ -20,6 +20,7 @@ #include "public/platform/ServiceRegistry.h" #include "public/platform/WebImageCaptureFrameGrabber.h" #include "public/platform/WebMediaStreamTrack.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -159,7 +160,7 @@ // Create |m_frameGrabber| the first time. if (!m_frameGrabber) - m_frameGrabber = adoptPtr(Platform::current()->createImageCaptureFrameGrabber()); + m_frameGrabber = wrapUnique(Platform::current()->createImageCaptureFrameGrabber()); if (!m_frameGrabber) { resolver->reject(DOMException::create(UnknownError, "Couldn't create platform resources"));
diff --git a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h index 93c396a..88662e5 100644 --- a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h +++ b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.h
@@ -13,6 +13,7 @@ #include "modules/EventTargetModules.h" #include "modules/ModulesExport.h" #include "platform/AsyncMethodRunner.h" +#include <memory> namespace blink { @@ -64,7 +65,7 @@ void onServiceConnectionError(); Member<MediaStreamTrack> m_streamTrack; - OwnPtr<WebImageCaptureFrameGrabber> m_frameGrabber; + std::unique_ptr<WebImageCaptureFrameGrabber> m_frameGrabber; media::mojom::blink::ImageCapturePtr m_service; HeapHashSet<Member<ScriptPromiseResolver>> m_serviceRequests;
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp index f0a5cfab..c168f0a2 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp
@@ -42,18 +42,19 @@ #include "public/platform/modules/indexeddb/WebIDBDatabase.h" #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" #include <limits> +#include <memory> using blink::WebIDBCursor; using blink::WebIDBDatabase; namespace blink { -IDBCursor* IDBCursor::create(PassOwnPtr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) +IDBCursor* IDBCursor::create(std::unique_ptr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) { return new IDBCursor(std::move(backend), direction, request, source, transaction); } -IDBCursor::IDBCursor(PassOwnPtr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) +IDBCursor::IDBCursor(std::unique_ptr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) : m_backend(std::move(backend)) , m_request(request) , m_direction(direction) @@ -148,7 +149,7 @@ m_request->setPendingCursor(this); m_gotValue = false; - m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).leakPtr()); + m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).release()); } void IDBCursor::continueFunction(ScriptState* scriptState, const ScriptValue& keyValue, ExceptionState& exceptionState) @@ -242,7 +243,7 @@ // will be on the original context openCursor was called on. Is this right? m_request->setPendingCursor(this); m_gotValue = false; - m_backend->continueFunction(key, primaryKey, WebIDBCallbacksImpl::create(m_request).leakPtr()); + m_backend->continueFunction(key, primaryKey, WebIDBCallbacksImpl::create(m_request).release()); } IDBRequest* IDBCursor::deleteFunction(ScriptState* scriptState, ExceptionState& exceptionState) @@ -282,7 +283,7 @@ ASSERT(!exceptionState.hadException()); IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - m_transaction->backendDB()->deleteRange(m_transaction->id(), effectiveObjectStore()->id(), keyRange, WebIDBCallbacksImpl::create(request).leakPtr()); + m_transaction->backendDB()->deleteRange(m_transaction->id(), effectiveObjectStore()->id(), keyRange, WebIDBCallbacksImpl::create(request).release()); return request; }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.h b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.h index e4af669..57c97d5 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.h
@@ -35,6 +35,7 @@ #include "public/platform/modules/indexeddb/WebIDBTypes.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -49,7 +50,7 @@ public: static WebIDBCursorDirection stringToDirection(const String& modeString); - static IDBCursor* create(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); + static IDBCursor* create(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); virtual ~IDBCursor(); DECLARE_TRACE(); void contextWillBeDestroyed() { m_backend.reset(); } @@ -83,12 +84,12 @@ virtual bool isCursorWithValue() const { return false; } protected: - IDBCursor(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); + IDBCursor(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); private: IDBObjectStore* effectiveObjectStore() const; - OwnPtr<WebIDBCursor> m_backend; + std::unique_ptr<WebIDBCursor> m_backend; Member<IDBRequest> m_request; const WebIDBCursorDirection m_direction; Member<IDBAny> m_source;
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.cpp index c5a2793..047993a 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.cpp
@@ -26,17 +26,18 @@ #include "modules/indexeddb/IDBCursorWithValue.h" #include "modules/indexeddb/IDBKey.h" +#include <memory> using blink::WebIDBCursor; namespace blink { -IDBCursorWithValue* IDBCursorWithValue::create(PassOwnPtr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) +IDBCursorWithValue* IDBCursorWithValue::create(std::unique_ptr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) { return new IDBCursorWithValue(std::move(backend), direction, request, source, transaction); } -IDBCursorWithValue::IDBCursorWithValue(PassOwnPtr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) +IDBCursorWithValue::IDBCursorWithValue(std::unique_ptr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) : IDBCursor(std::move(backend), direction, request, source, transaction) { }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.h b/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.h index 49ab3e51..9fac966 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBCursorWithValue.h
@@ -30,7 +30,7 @@ #include "modules/indexeddb/IndexedDB.h" #include "public/platform/modules/indexeddb/WebIDBCursor.h" #include "public/platform/modules/indexeddb/WebIDBTypes.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -41,7 +41,7 @@ class IDBCursorWithValue final : public IDBCursor { DEFINE_WRAPPERTYPEINFO(); public: - static IDBCursorWithValue* create(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); + static IDBCursorWithValue* create(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); ~IDBCursorWithValue() override; // The value attribute defined in the IDL is simply implemented in IDBCursor (but not exposed via @@ -51,7 +51,7 @@ bool isCursorWithValue() const override { return true; } private: - IDBCursorWithValue(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); + IDBCursorWithValue(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); }; DEFINE_TYPE_CASTS(IDBCursorWithValue, IDBCursor, cursor, cursor->isCursorWithValue(), cursor.isCursorWithValue());
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp index 48c1da54..fa8eda5 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
@@ -45,6 +45,7 @@ #include "public/platform/modules/indexeddb/WebIDBTypes.h" #include "wtf/Atomics.h" #include <limits> +#include <memory> using blink::WebIDBDatabase; @@ -66,14 +67,14 @@ const char IDBDatabase::transactionReadOnlyErrorMessage[] = "The transaction is read-only."; const char IDBDatabase::databaseClosedErrorMessage[] = "The database connection is closed."; -IDBDatabase* IDBDatabase::create(ExecutionContext* context, PassOwnPtr<WebIDBDatabase> database, IDBDatabaseCallbacks* callbacks) +IDBDatabase* IDBDatabase::create(ExecutionContext* context, std::unique_ptr<WebIDBDatabase> database, IDBDatabaseCallbacks* callbacks) { IDBDatabase* idbDatabase = new IDBDatabase(context, std::move(database), callbacks); idbDatabase->suspendIfNeeded(); return idbDatabase; } -IDBDatabase::IDBDatabase(ExecutionContext* context, PassOwnPtr<WebIDBDatabase> backend, IDBDatabaseCallbacks* callbacks) +IDBDatabase::IDBDatabase(ExecutionContext* context, std::unique_ptr<WebIDBDatabase> backend, IDBDatabaseCallbacks* callbacks) : ActiveScriptWrappable(this) , ActiveDOMObject(context) , m_backend(std::move(backend)) @@ -311,7 +312,7 @@ } int64_t transactionId = nextTransactionId(); - m_backend->createTransaction(transactionId, WebIDBDatabaseCallbacksImpl::create(m_databaseCallbacks).leakPtr(), objectStoreIds, mode); + m_backend->createTransaction(transactionId, WebIDBDatabaseCallbacksImpl::create(m_databaseCallbacks).release(), objectStoreIds, mode); return IDBTransaction::create(scriptState, transactionId, scope, mode, this); }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h index ff099ff..51fe135 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.h
@@ -43,10 +43,9 @@ #include "modules/indexeddb/IndexedDB.h" #include "platform/heap/Handle.h" #include "public/platform/modules/indexeddb/WebIDBDatabase.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -61,7 +60,7 @@ USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); DEFINE_WRAPPERTYPEINFO(); public: - static IDBDatabase* create(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, IDBDatabaseCallbacks*); + static IDBDatabase* create(ExecutionContext*, std::unique_ptr<WebIDBDatabase>, IDBDatabaseCallbacks*); ~IDBDatabase() override; DECLARE_VIRTUAL_TRACE(); @@ -140,13 +139,13 @@ DispatchEventResult dispatchEventInternal(Event*) override; private: - IDBDatabase(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, IDBDatabaseCallbacks*); + IDBDatabase(ExecutionContext*, std::unique_ptr<WebIDBDatabase>, IDBDatabaseCallbacks*); IDBObjectStore* createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, ExceptionState&); void closeConnection(); IDBDatabaseMetadata m_metadata; - OwnPtr<WebIDBDatabase> m_backend; + std::unique_ptr<WebIDBDatabase> m_backend; Member<IDBTransaction> m_versionChangeTransaction; HeapHashMap<int64_t, Member<IDBTransaction>> m_transactions;
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp index 2826402..7374353 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp
@@ -45,6 +45,7 @@ #include "public/platform/Platform.h" #include "public/platform/WebSecurityOrigin.h" #include "public/platform/modules/indexeddb/WebIDBFactory.h" +#include <memory> namespace blink { @@ -81,7 +82,7 @@ return request; } - Platform::current()->idbFactory()->getDatabaseNames(WebIDBCallbacksImpl::create(request).leakPtr(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); + Platform::current()->idbFactory()->getDatabaseNames(WebIDBCallbacksImpl::create(request).release(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); return request; } @@ -115,7 +116,7 @@ return request; } - Platform::current()->idbFactory()->open(name, version, transactionId, WebIDBCallbacksImpl::create(request).leakPtr(), WebIDBDatabaseCallbacksImpl::create(databaseCallbacks).leakPtr(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); + Platform::current()->idbFactory()->open(name, version, transactionId, WebIDBCallbacksImpl::create(request).release(), WebIDBDatabaseCallbacksImpl::create(databaseCallbacks).release(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); return request; } @@ -143,7 +144,7 @@ return request; } - Platform::current()->idbFactory()->deleteDatabase(name, WebIDBCallbacksImpl::create(request).leakPtr(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); + Platform::current()->idbFactory()->deleteDatabase(name, WebIDBCallbacksImpl::create(request).release(), WebSecurityOrigin(scriptState->getExecutionContext()->getSecurityOrigin())); return request; }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp index b7340d4..86e21667 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp
@@ -37,6 +37,7 @@ #include "modules/indexeddb/IDBTransaction.h" #include "modules/indexeddb/WebIDBCallbacksImpl.h" #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" +#include <memory> using blink::WebIDBCallbacks; using blink::WebIDBCursor; @@ -101,7 +102,7 @@ { IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); - backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, direction, false, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, direction, false, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).release()); return request; } @@ -131,7 +132,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->count(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->count(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, WebIDBCallbacksImpl::create(request).release()); return request; } @@ -161,7 +162,7 @@ IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); - backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).release()); return request; } @@ -227,7 +228,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->get(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, keyOnly, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->get(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, keyOnly, WebIDBCallbacksImpl::create(request).release()); return request; } @@ -258,7 +259,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->getAll(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, maxCount, keyOnly, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->getAll(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, maxCount, keyOnly, WebIDBCallbacksImpl::create(request).release()); return request; }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp index 98764c5e..2f035a20 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
@@ -46,6 +46,7 @@ #include "public/platform/WebVector.h" #include "public/platform/modules/indexeddb/WebIDBKey.h" #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" +#include <memory> #include <v8.h> using blink::WebBlobInfo; @@ -113,7 +114,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->get(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, false, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->get(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, false, WebIDBCallbacksImpl::create(request).release()); return request; } @@ -149,7 +150,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, maxCount, false, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, maxCount, false, WebIDBCallbacksImpl::create(request).release()); return request; } @@ -185,7 +186,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, maxCount, true, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, maxCount, true, WebIDBCallbacksImpl::create(request).release()); return request; } @@ -340,7 +341,7 @@ serializedValue->toWireBytes(wireBytes); RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes); - backendDB()->put(m_transaction->id(), id(), WebData(valueBuffer), blobInfo, key, static_cast<WebIDBPutMode>(putMode), WebIDBCallbacksImpl::create(request).leakPtr(), indexIds, indexKeys); + backendDB()->put(m_transaction->id(), id(), WebData(valueBuffer), blobInfo, key, static_cast<WebIDBPutMode>(putMode), WebIDBCallbacksImpl::create(request).release(), indexIds, indexKeys); return request; } @@ -377,7 +378,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->deleteRange(m_transaction->id(), id(), keyRange, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->deleteRange(m_transaction->id(), id(), keyRange, WebIDBCallbacksImpl::create(request).release()); return request; } @@ -406,7 +407,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(request).release()); return request; } @@ -665,7 +666,7 @@ IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); - backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, direction, false, taskType, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, direction, false, taskType, WebIDBCallbacksImpl::create(request).release()); return request; } @@ -698,7 +699,7 @@ IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); - backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).release()); return request; } @@ -728,7 +729,7 @@ } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); - backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, WebIDBCallbacksImpl::create(request).leakPtr()); + backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, WebIDBCallbacksImpl::create(request).release()); return request; }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.cpp index ce8ba0c..9be4f6b 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.cpp
@@ -33,6 +33,7 @@ #include "modules/indexeddb/IDBDatabaseCallbacks.h" #include "modules/indexeddb/IDBTracing.h" #include "modules/indexeddb/IDBVersionChangeEvent.h" +#include <memory> using blink::WebIDBDatabase; @@ -78,11 +79,11 @@ enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::blocked, oldVersion, newVersionNullable)); } -void IDBOpenDBRequest::onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<WebIDBDatabase> backend, const IDBDatabaseMetadata& metadata, WebIDBDataLoss dataLoss, String dataLossMessage) +void IDBOpenDBRequest::onUpgradeNeeded(int64_t oldVersion, std::unique_ptr<WebIDBDatabase> backend, const IDBDatabaseMetadata& metadata, WebIDBDataLoss dataLoss, String dataLossMessage) { IDB_TRACE("IDBOpenDBRequest::onUpgradeNeeded()"); if (m_contextStopped || !getExecutionContext()) { - OwnPtr<WebIDBDatabase> db = std::move(backend); + std::unique_ptr<WebIDBDatabase> db = std::move(backend); db->abort(m_transactionId); db->close(); return; @@ -110,11 +111,11 @@ enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, oldVersion, m_version, dataLoss, dataLossMessage)); } -void IDBOpenDBRequest::onSuccess(PassOwnPtr<WebIDBDatabase> backend, const IDBDatabaseMetadata& metadata) +void IDBOpenDBRequest::onSuccess(std::unique_ptr<WebIDBDatabase> backend, const IDBDatabaseMetadata& metadata) { IDB_TRACE("IDBOpenDBRequest::onSuccess()"); if (m_contextStopped || !getExecutionContext()) { - OwnPtr<WebIDBDatabase> db = std::move(backend); + std::unique_ptr<WebIDBDatabase> db = std::move(backend); if (db) db->close(); return;
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.h b/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.h index 8347cb6..637d1a28 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.h
@@ -29,6 +29,7 @@ #include "modules/ModulesExport.h" #include "modules/indexeddb/IDBRequest.h" #include "public/platform/modules/indexeddb/WebIDBDatabase.h" +#include <memory> namespace blink { @@ -44,8 +45,8 @@ using IDBRequest::onSuccess; void onBlocked(int64_t existingVersion) override; - void onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<WebIDBDatabase>, const IDBDatabaseMetadata&, WebIDBDataLoss, String dataLossMessage) override; - void onSuccess(PassOwnPtr<WebIDBDatabase>, const IDBDatabaseMetadata&) override; + void onUpgradeNeeded(int64_t oldVersion, std::unique_ptr<WebIDBDatabase>, const IDBDatabaseMetadata&, WebIDBDataLoss, String dataLossMessage) override; + void onSuccess(std::unique_ptr<WebIDBDatabase>, const IDBDatabaseMetadata&) override; void onSuccess(int64_t oldVersion) override; // EventTarget
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp index c4157b0..7c1d7d8 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp
@@ -44,6 +44,7 @@ #include "modules/indexeddb/IDBValue.h" #include "platform/SharedBuffer.h" #include "public/platform/WebBlobInfo.h" +#include <memory> using blink::WebIDBCursor; @@ -249,7 +250,7 @@ onSuccessInternal(IDBAny::create(domStringList)); } -void IDBRequest::onSuccess(PassOwnPtr<WebIDBCursor> backend, IDBKey* key, IDBKey* primaryKey, PassRefPtr<IDBValue> value) +void IDBRequest::onSuccess(std::unique_ptr<WebIDBCursor> backend, IDBKey* key, IDBKey* primaryKey, PassRefPtr<IDBValue> value) { IDB_TRACE("IDBRequest::onSuccess(IDBCursor)"); if (!shouldEnqueueEvent())
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h index 16e1875..112f0b0 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h
@@ -46,6 +46,7 @@ #include "public/platform/WebBlobInfo.h" #include "public/platform/modules/indexeddb/WebIDBCursor.h" #include "public/platform/modules/indexeddb/WebIDBTypes.h" +#include <memory> namespace blink { @@ -97,7 +98,7 @@ virtual void onError(DOMException*); virtual void onSuccess(const Vector<String>&); - virtual void onSuccess(PassOwnPtr<WebIDBCursor>, IDBKey*, IDBKey* primaryKey, PassRefPtr<IDBValue>); + virtual void onSuccess(std::unique_ptr<WebIDBCursor>, IDBKey*, IDBKey* primaryKey, PassRefPtr<IDBValue>); virtual void onSuccess(IDBKey*); virtual void onSuccess(PassRefPtr<IDBValue>); virtual void onSuccess(const Vector<RefPtr<IDBValue>>&); @@ -107,8 +108,8 @@ // Only IDBOpenDBRequest instances should receive these: virtual void onBlocked(int64_t oldVersion) { ASSERT_NOT_REACHED(); } - virtual void onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<WebIDBDatabase>, const IDBDatabaseMetadata&, WebIDBDataLoss, String dataLossMessage) { ASSERT_NOT_REACHED(); } - virtual void onSuccess(PassOwnPtr<WebIDBDatabase>, const IDBDatabaseMetadata&) { ASSERT_NOT_REACHED(); } + virtual void onUpgradeNeeded(int64_t oldVersion, std::unique_ptr<WebIDBDatabase>, const IDBDatabaseMetadata&, WebIDBDataLoss, String dataLossMessage) { ASSERT_NOT_REACHED(); } + virtual void onSuccess(std::unique_ptr<WebIDBDatabase>, const IDBDatabaseMetadata&) { ASSERT_NOT_REACHED(); } // ActiveScriptWrappable bool hasPendingActivity() const final;
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp index f594ece9..17c17087 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp
@@ -39,11 +39,10 @@ #include "modules/indexeddb/MockWebIDBDatabase.h" #include "platform/SharedBuffer.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include "wtf/dtoa/utils.h" +#include <memory> #include <v8.h> namespace blink { @@ -97,7 +96,7 @@ Persistent<IDBDatabaseCallbacks> callbacks = IDBDatabaseCallbacks::create(); { - OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); + std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); EXPECT_CALL(*backend, abort(transactionId)) .Times(1); EXPECT_CALL(*backend, close()) @@ -110,7 +109,7 @@ } { - OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); + std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); EXPECT_CALL(*backend, close()) .Times(1); IDBOpenDBRequest* request = IDBOpenDBRequest::create(scope.getScriptState(), callbacks, transactionId, version);
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp index 6bb3ca61..aa6524d 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
@@ -39,6 +39,8 @@ #include "modules/indexeddb/IDBObjectStore.h" #include "modules/indexeddb/IDBOpenDBRequest.h" #include "modules/indexeddb/IDBTracing.h" +#include "wtf/PtrUtil.h" +#include <memory> using blink::WebIDBDatabase; @@ -63,9 +65,9 @@ class DeactivateTransactionTask : public V8PerIsolateData::EndOfScopeTask { public: - static PassOwnPtr<DeactivateTransactionTask> create(IDBTransaction* transaction) + static std::unique_ptr<DeactivateTransactionTask> create(IDBTransaction* transaction) { - return adoptPtr(new DeactivateTransactionTask(transaction)); + return wrapUnique(new DeactivateTransactionTask(transaction)); } void run() override
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp index 6fde069..ce3a478 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
@@ -39,6 +39,7 @@ #include "modules/indexeddb/MockWebIDBDatabase.h" #include "platform/SharedBuffer.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> #include <v8.h> namespace blink { @@ -63,7 +64,7 @@ TEST(IDBTransactionTest, EnsureLifetime) { V8TestingScope scope; - OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); + std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); EXPECT_CALL(*backend, close()) .Times(1); Persistent<IDBDatabase> db = IDBDatabase::create(scope.getExecutionContext(), std::move(backend), FakeIDBDatabaseCallbacks::create()); @@ -98,7 +99,7 @@ V8TestingScope scope; const int64_t transactionId = 1234; - OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); + std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); EXPECT_CALL(*backend, commit(transactionId)) .Times(1); EXPECT_CALL(*backend, close())
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp index ca3bcd78..5e30bc95 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp
@@ -7,6 +7,7 @@ #include "platform/blob/BlobData.h" #include "public/platform/WebBlobInfo.h" #include "public/platform/modules/indexeddb/WebIDBValue.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -19,8 +20,8 @@ IDBValue::IDBValue(PassRefPtr<SharedBuffer> data, const WebVector<WebBlobInfo>& webBlobInfo, IDBKey* primaryKey, const IDBKeyPath& keyPath) : m_data(data) - , m_blobData(adoptPtr(new Vector<RefPtr<BlobDataHandle>>())) - , m_blobInfo(adoptPtr(new Vector<WebBlobInfo>(webBlobInfo.size()))) + , m_blobData(wrapUnique(new Vector<RefPtr<BlobDataHandle>>())) + , m_blobInfo(wrapUnique(new Vector<WebBlobInfo>(webBlobInfo.size()))) , m_primaryKey(primaryKey && primaryKey->isValid() ? primaryKey : nullptr) , m_keyPath(keyPath) { @@ -32,8 +33,8 @@ IDBValue::IDBValue(const IDBValue* value, IDBKey* primaryKey, const IDBKeyPath& keyPath) : m_data(value->m_data) - , m_blobData(adoptPtr(new Vector<RefPtr<BlobDataHandle>>())) - , m_blobInfo(adoptPtr(new Vector<WebBlobInfo>(value->m_blobInfo->size()))) + , m_blobData(wrapUnique(new Vector<RefPtr<BlobDataHandle>>())) + , m_blobInfo(wrapUnique(new Vector<WebBlobInfo>(value->m_blobInfo->size()))) , m_primaryKey(primaryKey) , m_keyPath(keyPath) {
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBValue.h b/third_party/WebKit/Source/modules/indexeddb/IDBValue.h index 69fd9c6a..84cccd7 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBValue.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBValue.h
@@ -10,8 +10,8 @@ #include "modules/indexeddb/IDBKeyPath.h" #include "platform/SharedBuffer.h" #include "public/platform/WebVector.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -39,8 +39,8 @@ IDBValue(const IDBValue*, IDBKey*, const IDBKeyPath&); const RefPtr<SharedBuffer> m_data; - const OwnPtr<Vector<RefPtr<BlobDataHandle>>> m_blobData; - const OwnPtr<Vector<WebBlobInfo>> m_blobInfo; + const std::unique_ptr<Vector<RefPtr<BlobDataHandle>>> m_blobData; + const std::unique_ptr<Vector<WebBlobInfo>> m_blobInfo; const Persistent<IDBKey> m_primaryKey; const IDBKeyPath m_keyPath; };
diff --git a/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.h b/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.h index ea13563..c66535c 100644 --- a/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.h +++ b/third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.h
@@ -34,7 +34,6 @@ #include "core/inspector/InspectorBaseAgent.h" #include "core/inspector/protocol/IndexedDB.h" #include "modules/ModulesExport.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.cpp b/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.cpp index af6d5d7..1d27732 100644 --- a/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.cpp
@@ -4,15 +4,18 @@ #include "MockWebIDBDatabase.h" +#include "wtf/PtrUtil.h" +#include <memory> + namespace blink { MockWebIDBDatabase::MockWebIDBDatabase() {} MockWebIDBDatabase::~MockWebIDBDatabase() {} -PassOwnPtr<MockWebIDBDatabase> MockWebIDBDatabase::create() +std::unique_ptr<MockWebIDBDatabase> MockWebIDBDatabase::create() { - return adoptPtr(new MockWebIDBDatabase()); + return wrapUnique(new MockWebIDBDatabase()); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h b/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h index 5492dac..30445548 100644 --- a/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h +++ b/third_party/WebKit/Source/modules/indexeddb/MockWebIDBDatabase.h
@@ -9,8 +9,8 @@ #include "modules/indexeddb/IDBKeyRange.h" #include "public/platform/modules/indexeddb/WebIDBDatabase.h" #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" -#include "wtf/PassOwnPtr.h" #include <gmock/gmock.h> +#include <memory> namespace blink { @@ -18,7 +18,7 @@ public: virtual ~MockWebIDBDatabase(); - static PassOwnPtr<MockWebIDBDatabase> create(); + static std::unique_ptr<MockWebIDBDatabase> create(); MOCK_METHOD5(createObjectStore, void(long long transactionId, long long objectStoreId, const WebString& name, const WebIDBKeyPath&, bool autoIncrement)); MOCK_METHOD2(deleteObjectStore, void(long long transactionId, long long objectStoreId));
diff --git a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp index b97c3024..abecd340 100644 --- a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp
@@ -39,6 +39,8 @@ #include "public/platform/modules/indexeddb/WebIDBDatabaseError.h" #include "public/platform/modules/indexeddb/WebIDBKey.h" #include "public/platform/modules/indexeddb/WebIDBValue.h" +#include "wtf/PtrUtil.h" +#include <memory> using blink::WebIDBCursor; using blink::WebIDBDatabase; @@ -52,9 +54,9 @@ namespace blink { // static -PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* request) +std::unique_ptr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* request) { - return adoptPtr(new WebIDBCallbacksImpl(request)); + return wrapUnique(new WebIDBCallbacksImpl(request)); } WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request) @@ -86,13 +88,13 @@ void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebIDBValue& value) { InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this); - m_request->onSuccess(adoptPtr(cursor), key, primaryKey, IDBValue::create(value)); + m_request->onSuccess(wrapUnique(cursor), key, primaryKey, IDBValue::create(value)); } void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadata& metadata) { InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this); - m_request->onSuccess(adoptPtr(backend), IDBDatabaseMetadata(metadata)); + m_request->onSuccess(wrapUnique(backend), IDBDatabaseMetadata(metadata)); } void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) @@ -143,7 +145,7 @@ void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase* database, const WebIDBMetadata& metadata, unsigned short dataLoss, WebString dataLossMessage) { InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this); - m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), IDBDatabaseMetadata(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); + m_request->onUpgradeNeeded(oldVersion, wrapUnique(database), IDBDatabaseMetadata(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h index 4f8d0c23..6443648 100644 --- a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h +++ b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h
@@ -30,9 +30,9 @@ #define WebIDBCallbacksImpl_h #include "public/platform/modules/indexeddb/WebIDBCallbacks.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -47,7 +47,7 @@ class WebIDBCallbacksImpl final : public WebIDBCallbacks { USING_FAST_MALLOC(WebIDBCallbacksImpl); public: - static PassOwnPtr<WebIDBCallbacksImpl> create(IDBRequest*); + static std::unique_ptr<WebIDBCallbacksImpl> create(IDBRequest*); ~WebIDBCallbacksImpl() override;
diff --git a/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.cpp b/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.cpp index 89bcc52..d134a77f 100644 --- a/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.cpp
@@ -26,13 +26,15 @@ #include "modules/indexeddb/WebIDBDatabaseCallbacksImpl.h" #include "core/dom/DOMException.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { // static -PassOwnPtr<WebIDBDatabaseCallbacksImpl> WebIDBDatabaseCallbacksImpl::create(IDBDatabaseCallbacks* callbacks) +std::unique_ptr<WebIDBDatabaseCallbacksImpl> WebIDBDatabaseCallbacksImpl::create(IDBDatabaseCallbacks* callbacks) { - return adoptPtr(new WebIDBDatabaseCallbacksImpl(callbacks)); + return wrapUnique(new WebIDBDatabaseCallbacksImpl(callbacks)); } WebIDBDatabaseCallbacksImpl::WebIDBDatabaseCallbacksImpl(IDBDatabaseCallbacks* callbacks)
diff --git a/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.h b/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.h index 25fd433..0f2067945 100644 --- a/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.h +++ b/third_party/WebKit/Source/modules/indexeddb/WebIDBDatabaseCallbacksImpl.h
@@ -30,16 +30,16 @@ #include "public/platform/WebString.h" #include "public/platform/modules/indexeddb/WebIDBDatabaseCallbacks.h" #include "public/platform/modules/indexeddb/WebIDBDatabaseError.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { class WebIDBDatabaseCallbacksImpl final : public WebIDBDatabaseCallbacks { USING_FAST_MALLOC(WebIDBDatabaseCallbacksImpl); public: - static PassOwnPtr<WebIDBDatabaseCallbacksImpl> create(IDBDatabaseCallbacks*); + static std::unique_ptr<WebIDBDatabaseCallbacksImpl> create(IDBDatabaseCallbacks*); ~WebIDBDatabaseCallbacksImpl() override;
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.cpp index d5aca1b..1109202 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.cpp +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.cpp
@@ -4,15 +4,17 @@ #include "modules/mediacapturefromelement/AutoCanvasDrawListener.h" +#include <memory> + namespace blink { -AutoCanvasDrawListener::AutoCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler> handler) +AutoCanvasDrawListener::AutoCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler> handler) : CanvasDrawListener(std::move(handler)) { } // static -AutoCanvasDrawListener* AutoCanvasDrawListener::create(PassOwnPtr<WebCanvasCaptureHandler> handler) +AutoCanvasDrawListener* AutoCanvasDrawListener::create(std::unique_ptr<WebCanvasCaptureHandler> handler) { return new AutoCanvasDrawListener(std::move(handler)); }
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.h b/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.h index 4a3fdf31d..2d58d4dd 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.h +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/AutoCanvasDrawListener.h
@@ -8,18 +8,19 @@ #include "core/html/canvas/CanvasDrawListener.h" #include "platform/heap/Handle.h" #include "public/platform/WebCanvasCaptureHandler.h" +#include <memory> namespace blink { class AutoCanvasDrawListener final : public GarbageCollectedFinalized<AutoCanvasDrawListener>, public CanvasDrawListener { USING_GARBAGE_COLLECTED_MIXIN(AutoCanvasDrawListener); public: - static AutoCanvasDrawListener* create(PassOwnPtr<WebCanvasCaptureHandler>); + static AutoCanvasDrawListener* create(std::unique_ptr<WebCanvasCaptureHandler>); ~AutoCanvasDrawListener() {} DEFINE_INLINE_TRACE() {} private: - AutoCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler>); + AutoCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler>); }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.cpp index 023e959..7fd5002 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.cpp +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.cpp
@@ -9,15 +9,16 @@ #include "modules/mediacapturefromelement/OnRequestCanvasDrawListener.h" #include "modules/mediacapturefromelement/TimedCanvasDrawListener.h" #include "platform/mediastream/MediaStreamCenter.h" +#include <memory> namespace blink { -CanvasCaptureMediaStreamTrack* CanvasCaptureMediaStreamTrack::create(MediaStreamComponent* component, HTMLCanvasElement* element, PassOwnPtr<WebCanvasCaptureHandler> handler) +CanvasCaptureMediaStreamTrack* CanvasCaptureMediaStreamTrack::create(MediaStreamComponent* component, HTMLCanvasElement* element, std::unique_ptr<WebCanvasCaptureHandler> handler) { return new CanvasCaptureMediaStreamTrack(component, element, std::move(handler)); } -CanvasCaptureMediaStreamTrack* CanvasCaptureMediaStreamTrack::create(MediaStreamComponent* component, HTMLCanvasElement* element, PassOwnPtr<WebCanvasCaptureHandler> handler, double frameRate) +CanvasCaptureMediaStreamTrack* CanvasCaptureMediaStreamTrack::create(MediaStreamComponent* component, HTMLCanvasElement* element, std::unique_ptr<WebCanvasCaptureHandler> handler, double frameRate) { return new CanvasCaptureMediaStreamTrack(component, element, std::move(handler), frameRate); } @@ -56,7 +57,7 @@ m_canvasElement->addListener(m_drawListener.get()); } -CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack(MediaStreamComponent* component, HTMLCanvasElement* element, PassOwnPtr<WebCanvasCaptureHandler> handler) +CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack(MediaStreamComponent* component, HTMLCanvasElement* element, std::unique_ptr<WebCanvasCaptureHandler> handler) : MediaStreamTrack(element->getExecutionContext(), component) , m_canvasElement(element) { @@ -65,7 +66,7 @@ m_canvasElement->addListener(m_drawListener.get()); } -CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack(MediaStreamComponent* component, HTMLCanvasElement* element, PassOwnPtr<WebCanvasCaptureHandler> handler, double frameRate) +CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack(MediaStreamComponent* component, HTMLCanvasElement* element, std::unique_ptr<WebCanvasCaptureHandler> handler, double frameRate) : MediaStreamTrack(element->getExecutionContext(), component) , m_canvasElement(element) {
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.h b/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.h index a906bf1..6aae39b 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.h +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.h
@@ -8,6 +8,7 @@ #include "core/html/canvas/CanvasDrawListener.h" #include "modules/mediastream/MediaStreamTrack.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -17,8 +18,8 @@ class CanvasCaptureMediaStreamTrack final : public MediaStreamTrack { DEFINE_WRAPPERTYPEINFO(); public: - static CanvasCaptureMediaStreamTrack* create(MediaStreamComponent*, HTMLCanvasElement*, PassOwnPtr<WebCanvasCaptureHandler>); - static CanvasCaptureMediaStreamTrack* create(MediaStreamComponent*, HTMLCanvasElement*, PassOwnPtr<WebCanvasCaptureHandler>, double frameRate); + static CanvasCaptureMediaStreamTrack* create(MediaStreamComponent*, HTMLCanvasElement*, std::unique_ptr<WebCanvasCaptureHandler>); + static CanvasCaptureMediaStreamTrack* create(MediaStreamComponent*, HTMLCanvasElement*, std::unique_ptr<WebCanvasCaptureHandler>, double frameRate); HTMLCanvasElement* canvas() const; void requestFrame(); @@ -29,8 +30,8 @@ private: CanvasCaptureMediaStreamTrack(const CanvasCaptureMediaStreamTrack&, MediaStreamComponent*); - CanvasCaptureMediaStreamTrack(MediaStreamComponent*, HTMLCanvasElement*, PassOwnPtr<WebCanvasCaptureHandler>); - CanvasCaptureMediaStreamTrack(MediaStreamComponent*, HTMLCanvasElement*, PassOwnPtr<WebCanvasCaptureHandler>, double frameRate); + CanvasCaptureMediaStreamTrack(MediaStreamComponent*, HTMLCanvasElement*, std::unique_ptr<WebCanvasCaptureHandler>); + CanvasCaptureMediaStreamTrack(MediaStreamComponent*, HTMLCanvasElement*, std::unique_ptr<WebCanvasCaptureHandler>, double frameRate); Member<HTMLCanvasElement> m_canvasElement; Member<CanvasDrawListener> m_drawListener;
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp index cdf1317e..cb88f4c 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp
@@ -12,6 +12,8 @@ #include "public/platform/WebCanvasCaptureHandler.h" #include "public/platform/WebMediaStream.h" #include "public/platform/WebMediaStreamTrack.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace { const double kDefaultFrameRate = 60.0; @@ -43,11 +45,11 @@ WebMediaStreamTrack track; const WebSize size(element.width(), element.height()); - OwnPtr<WebCanvasCaptureHandler> handler; + std::unique_ptr<WebCanvasCaptureHandler> handler; if (givenFrameRate) - handler = adoptPtr(Platform::current()->createCanvasCaptureHandler(size, frameRate, &track)); + handler = wrapUnique(Platform::current()->createCanvasCaptureHandler(size, frameRate, &track)); else - handler = adoptPtr(Platform::current()->createCanvasCaptureHandler(size, kDefaultFrameRate, &track)); + handler = wrapUnique(Platform::current()->createCanvasCaptureHandler(size, kDefaultFrameRate, &track)); if (!handler) { exceptionState.throwDOMException(NotSupportedError, "No CanvasCapture handler can be created.");
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.cpp index 87cee32..2cad4d3 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.cpp +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.cpp
@@ -4,9 +4,11 @@ #include "modules/mediacapturefromelement/OnRequestCanvasDrawListener.h" +#include <memory> + namespace blink { -OnRequestCanvasDrawListener::OnRequestCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler> handler) +OnRequestCanvasDrawListener::OnRequestCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler> handler) : CanvasDrawListener(std::move(handler)) { } @@ -14,7 +16,7 @@ OnRequestCanvasDrawListener::~OnRequestCanvasDrawListener() {} // static -OnRequestCanvasDrawListener* OnRequestCanvasDrawListener::create(PassOwnPtr<WebCanvasCaptureHandler> handler) +OnRequestCanvasDrawListener* OnRequestCanvasDrawListener::create(std::unique_ptr<WebCanvasCaptureHandler> handler) { return new OnRequestCanvasDrawListener(std::move(handler)); }
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.h b/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.h index 5992b90..d84e024 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.h +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/OnRequestCanvasDrawListener.h
@@ -8,6 +8,7 @@ #include "core/html/canvas/CanvasDrawListener.h" #include "platform/heap/Handle.h" #include "public/platform/WebCanvasCaptureHandler.h" +#include <memory> namespace blink { @@ -15,12 +16,12 @@ USING_GARBAGE_COLLECTED_MIXIN(OnRequestCanvasDrawListener); public: ~OnRequestCanvasDrawListener(); - static OnRequestCanvasDrawListener* create(PassOwnPtr<WebCanvasCaptureHandler>); + static OnRequestCanvasDrawListener* create(std::unique_ptr<WebCanvasCaptureHandler>); void sendNewFrame(const WTF::PassRefPtr<SkImage>&) override; DEFINE_INLINE_TRACE() {} private: - OnRequestCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler>); + OnRequestCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler>); }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp index 60a8586..7615cc5 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp
@@ -4,9 +4,11 @@ #include "modules/mediacapturefromelement/TimedCanvasDrawListener.h" +#include <memory> + namespace blink { -TimedCanvasDrawListener::TimedCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler> handler, double frameRate) +TimedCanvasDrawListener::TimedCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler> handler, double frameRate) : CanvasDrawListener(std::move(handler)) , m_frameInterval(1 / frameRate) , m_requestFrameTimer(this, &TimedCanvasDrawListener::requestFrameTimerFired) @@ -16,7 +18,7 @@ TimedCanvasDrawListener::~TimedCanvasDrawListener() {} // static -TimedCanvasDrawListener* TimedCanvasDrawListener::create(PassOwnPtr<WebCanvasCaptureHandler> handler, double frameRate) +TimedCanvasDrawListener* TimedCanvasDrawListener::create(std::unique_ptr<WebCanvasCaptureHandler> handler, double frameRate) { TimedCanvasDrawListener* listener = new TimedCanvasDrawListener(std::move(handler), frameRate); listener->m_requestFrameTimer.startRepeating(listener->m_frameInterval, BLINK_FROM_HERE);
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.h b/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.h index 1786473..039fc16 100644 --- a/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.h +++ b/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.h
@@ -9,6 +9,7 @@ #include "platform/Timer.h" #include "platform/heap/Handle.h" #include "public/platform/WebCanvasCaptureHandler.h" +#include <memory> namespace blink { @@ -16,12 +17,12 @@ USING_GARBAGE_COLLECTED_MIXIN(TimedCanvasDrawListener); public: ~TimedCanvasDrawListener(); - static TimedCanvasDrawListener* create(PassOwnPtr<WebCanvasCaptureHandler>, double frameRate); + static TimedCanvasDrawListener* create(std::unique_ptr<WebCanvasCaptureHandler>, double frameRate); void sendNewFrame(const WTF::PassRefPtr<SkImage>&) override; DEFINE_INLINE_TRACE() {} private: - TimedCanvasDrawListener(PassOwnPtr<WebCanvasCaptureHandler>, double frameRate); + TimedCanvasDrawListener(std::unique_ptr<WebCanvasCaptureHandler>, double frameRate); // Implementation of TimerFiredFunction. void requestFrameTimerFired(Timer<TimedCanvasDrawListener>*);
diff --git a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp index c7dd954..4d415e0 100644 --- a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp +++ b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
@@ -14,6 +14,7 @@ #include "platform/blob/BlobData.h" #include "public/platform/Platform.h" #include "public/platform/WebMediaStream.h" +#include "wtf/PtrUtil.h" #include <algorithm> namespace blink { @@ -145,7 +146,7 @@ { DCHECK(m_stream->getTracks().size()); - m_recorderHandler = adoptPtr(Platform::current()->createMediaRecorderHandler()); + m_recorderHandler = wrapUnique(Platform::current()->createMediaRecorderHandler()); DCHECK(m_recorderHandler); if (!m_recorderHandler) {
diff --git a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.h b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.h index 52de037c..a0972e0 100644 --- a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.h +++ b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.h
@@ -15,6 +15,7 @@ #include "platform/AsyncMethodRunner.h" #include "public/platform/WebMediaRecorderHandler.h" #include "public/platform/WebMediaRecorderHandlerClient.h" +#include <memory> namespace blink { @@ -102,9 +103,9 @@ State m_state; - OwnPtr<BlobData> m_blobData; + std::unique_ptr<BlobData> m_blobData; - OwnPtr<WebMediaRecorderHandler> m_recorderHandler; + std::unique_ptr<WebMediaRecorderHandler> m_recorderHandler; Member<AsyncMethodRunner<MediaRecorder>> m_dispatchScheduledEventRunner; HeapVector<Member<Event>> m_scheduledEvents;
diff --git a/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp b/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp index d5062dd8..5f47c82 100644 --- a/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp +++ b/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp
@@ -14,10 +14,11 @@ #include "core/loader/FrameLoaderClient.h" #include "modules/mediasession/MediaMetadata.h" #include "modules/mediasession/MediaSessionError.h" +#include <memory> namespace blink { -MediaSession::MediaSession(PassOwnPtr<WebMediaSession> webMediaSession) +MediaSession::MediaSession(std::unique_ptr<WebMediaSession> webMediaSession) : m_webMediaSession(std::move(webMediaSession)) { DCHECK(m_webMediaSession); @@ -28,7 +29,7 @@ Document* document = toDocument(context); LocalFrame* frame = document->frame(); FrameLoaderClient* client = frame->loader().client(); - OwnPtr<WebMediaSession> webMediaSession = client->createWebMediaSession(); + std::unique_ptr<WebMediaSession> webMediaSession = client->createWebMediaSession(); if (!webMediaSession) { exceptionState.throwDOMException(NotSupportedError, "Missing platform implementation."); return nullptr;
diff --git a/third_party/WebKit/Source/modules/mediasession/MediaSession.h b/third_party/WebKit/Source/modules/mediasession/MediaSession.h index 8501a3bd4..07c250043 100644 --- a/third_party/WebKit/Source/modules/mediasession/MediaSession.h +++ b/third_party/WebKit/Source/modules/mediasession/MediaSession.h
@@ -10,7 +10,7 @@ #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" #include "public/platform/modules/mediasession/WebMediaSession.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -37,9 +37,9 @@ private: friend class MediaSessionTest; - explicit MediaSession(PassOwnPtr<WebMediaSession>); + explicit MediaSession(std::unique_ptr<WebMediaSession>); - OwnPtr<WebMediaSession> m_webMediaSession; + std::unique_ptr<WebMediaSession> m_webMediaSession; Member<MediaMetadata> m_metadata; };
diff --git a/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp b/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp index 654d9b6..165d225e 100644 --- a/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp +++ b/third_party/WebKit/Source/modules/mediasession/MediaSessionTest.cpp
@@ -11,6 +11,8 @@ #include "public/platform/modules/mediasession/WebMediaSession.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> using ::testing::_; using ::testing::Invoke; @@ -27,13 +29,13 @@ { // The MediaSession takes ownership of the WebMediaSession, and the // caller must take care to not end up with a stale pointer. - return new MediaSession(adoptPtr(webMediaSession)); + return new MediaSession(wrapUnique(webMediaSession)); } Document& document() { return m_page->document(); } ScriptState* mainScriptState() { return ScriptState::forMainWorld(document().frame()); } private: - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; }; namespace {
diff --git a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp index 2ab2e78..6ff989d 100644 --- a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp +++ b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp
@@ -46,7 +46,9 @@ #include "platform/TraceEvent.h" #include "public/platform/WebMediaSource.h" #include "public/platform/WebSourceBuffer.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" +#include <memory> using blink::WebMediaSource; using blink::WebSourceBuffer; @@ -148,7 +150,7 @@ // 5. Create a new SourceBuffer object and associated resources. ContentType contentType(type); String codecs = contentType.parameter("codecs"); - OwnPtr<WebSourceBuffer> webSourceBuffer = createWebSourceBuffer(contentType.type(), codecs, exceptionState); + std::unique_ptr<WebSourceBuffer> webSourceBuffer = createWebSourceBuffer(contentType.type(), codecs, exceptionState); if (!webSourceBuffer) { DCHECK(exceptionState.code() == NotSupportedError || exceptionState.code() == QuotaExceededError); @@ -285,7 +287,7 @@ ActiveDOMObject::trace(visitor); } -void MediaSource::setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource> webMediaSource) +void MediaSource::setWebMediaSourceAndOpen(std::unique_ptr<WebMediaSource> webMediaSource) { TRACE_EVENT_ASYNC_END0("media", "MediaSource::attachToElement", this); DCHECK(webMediaSource); @@ -577,13 +579,13 @@ m_webMediaSource.reset(); } -PassOwnPtr<WebSourceBuffer> MediaSource::createWebSourceBuffer(const String& type, const String& codecs, ExceptionState& exceptionState) +std::unique_ptr<WebSourceBuffer> MediaSource::createWebSourceBuffer(const String& type, const String& codecs, ExceptionState& exceptionState) { WebSourceBuffer* webSourceBuffer = 0; switch (m_webMediaSource->addSourceBuffer(type, codecs, &webSourceBuffer)) { case WebMediaSource::AddStatusOk: - return adoptPtr(webSourceBuffer); + return wrapUnique(webSourceBuffer); case WebMediaSource::AddStatusNotSupported: DCHECK(!webSourceBuffer); // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type
diff --git a/third_party/WebKit/Source/modules/mediasource/MediaSource.h b/third_party/WebKit/Source/modules/mediasource/MediaSource.h index 6c0a4d6..d022f7d 100644 --- a/third_party/WebKit/Source/modules/mediasource/MediaSource.h +++ b/third_party/WebKit/Source/modules/mediasource/MediaSource.h
@@ -39,8 +39,8 @@ #include "modules/mediasource/SourceBuffer.h" #include "modules/mediasource/SourceBufferList.h" #include "public/platform/WebMediaSource.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -78,7 +78,7 @@ // HTMLMediaSource bool attachToElement(HTMLMediaElement*) override; - void setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource>) override; + void setWebMediaSourceAndOpen(std::unique_ptr<WebMediaSource>) override; void close() override; bool isClosed() const override; double duration() const override; @@ -118,7 +118,7 @@ bool isUpdating() const; - PassOwnPtr<WebSourceBuffer> createWebSourceBuffer(const String& type, const String& codecs, ExceptionState&); + std::unique_ptr<WebSourceBuffer> createWebSourceBuffer(const String& type, const String& codecs, ExceptionState&); void scheduleEvent(const AtomicString& eventName); void endOfStreamInternal(const WebMediaSource::EndOfStreamStatus, ExceptionState&); @@ -126,7 +126,7 @@ // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#duration-change-algorithm void durationChangeAlgorithm(double newDuration); - OwnPtr<WebMediaSource> m_webMediaSource; + std::unique_ptr<WebMediaSource> m_webMediaSource; AtomicString m_readyState; Member<GenericEventQueue> m_asyncEventQueue; WeakMember<HTMLMediaElement> m_attachedElement;
diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp index 2405720e..67c78a8a 100644 --- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp +++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
@@ -53,8 +53,8 @@ #include "platform/TraceEvent.h" #include "public/platform/WebSourceBuffer.h" #include "wtf/MathExtras.h" - #include <limits> +#include <memory> #include <sstream> using blink::WebSourceBuffer; @@ -96,14 +96,14 @@ } // namespace -SourceBuffer* SourceBuffer::create(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue) +SourceBuffer* SourceBuffer::create(std::unique_ptr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue) { SourceBuffer* sourceBuffer = new SourceBuffer(std::move(webSourceBuffer), source, asyncEventQueue); sourceBuffer->suspendIfNeeded(); return sourceBuffer; } -SourceBuffer::SourceBuffer(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue) +SourceBuffer::SourceBuffer(std::unique_ptr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue) : ActiveScriptWrappable(this) , ActiveDOMObject(source->getExecutionContext()) , m_webSourceBuffer(std::move(webSourceBuffer))
diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h index 5add19d..2d38752 100644 --- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h +++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h
@@ -40,6 +40,7 @@ #include "platform/weborigin/KURL.h" #include "public/platform/WebSourceBufferClient.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -65,7 +66,7 @@ DEFINE_WRAPPERTYPEINFO(); USING_PRE_FINALIZER(SourceBuffer, dispose); public: - static SourceBuffer* create(PassOwnPtr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); + static SourceBuffer* create(std::unique_ptr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); static const AtomicString& segmentsKeyword(); static const AtomicString& sequenceKeyword(); @@ -115,7 +116,7 @@ DECLARE_VIRTUAL_TRACE(); private: - SourceBuffer(PassOwnPtr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); + SourceBuffer(std::unique_ptr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); void dispose(); bool isRemoved() const; @@ -142,7 +143,7 @@ void didFinishLoading() override; void didFail(FileError::ErrorCode) override; - OwnPtr<WebSourceBuffer> m_webSourceBuffer; + std::unique_ptr<WebSourceBuffer> m_webSourceBuffer; Member<MediaSource> m_source; Member<TrackDefaultList> m_trackDefaults; Member<GenericEventQueue> m_asyncEventQueue; @@ -168,7 +169,7 @@ unsigned long long m_streamMaxSize; Member<AsyncMethodRunner<SourceBuffer>> m_appendStreamAsyncPartRunner; Member<Stream> m_stream; - OwnPtr<FileReaderLoader> m_loader; + std::unique_ptr<FileReaderLoader> m_loader; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaDevicesRequest.h b/third_party/WebKit/Source/modules/mediastream/MediaDevicesRequest.h index 39c35ca2..8819abb 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaDevicesRequest.h +++ b/third_party/WebKit/Source/modules/mediastream/MediaDevicesRequest.h
@@ -31,7 +31,6 @@ #include "modules/ModulesExport.h" #include "modules/mediastream/MediaDeviceInfo.h" #include "platform/heap/Handle.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp index 3ead30dc..26670613 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
@@ -42,6 +42,7 @@ #include "public/platform/WebMediaStreamTrack.h" #include "public/platform/WebSourceInfo.h" #include "wtf/Assertions.h" +#include <memory> namespace blink { @@ -255,7 +256,7 @@ return !ended() && hasEventListeners(EventTypeNames::ended); } -PassOwnPtr<AudioSourceProvider> MediaStreamTrack::createWebAudioSource() +std::unique_ptr<AudioSourceProvider> MediaStreamTrack::createWebAudioSource() { return MediaStreamCenter::instance().createWebAudioSourceFromMediaStreamTrack(component()); }
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h index 99ed5f8..31f11568 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h
@@ -35,6 +35,7 @@ #include "platform/mediastream/MediaStreamSource.h" #include "public/platform/WebMediaConstraints.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -99,7 +100,7 @@ // ActiveDOMObject void stop() override; - PassOwnPtr<AudioSourceProvider> createWebAudioSource(); + std::unique_ptr<AudioSourceProvider> createWebAudioSource(); DECLARE_VIRTUAL_TRACE();
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrackSourcesRequestImpl.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrackSourcesRequestImpl.cpp index f16f517..3d800b0 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrackSourcesRequestImpl.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrackSourcesRequestImpl.cpp
@@ -32,7 +32,6 @@ #include "public/platform/WebSourceInfo.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Functional.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCCertificate.cpp b/third_party/WebKit/Source/modules/mediastream/RTCCertificate.cpp index 96ecb6c..f80a229 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCCertificate.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCCertificate.cpp
@@ -30,10 +30,12 @@ #include "modules/mediastream/RTCCertificate.h" +#include "wtf/PtrUtil.h" + namespace blink { RTCCertificate::RTCCertificate(std::unique_ptr<WebRTCCertificate> certificate) - : m_certificate(adoptPtr(certificate.release())) + : m_certificate(wrapUnique(certificate.release())) { }
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCCertificate.h b/third_party/WebKit/Source/modules/mediastream/RTCCertificate.h index a3e155f..d51268a 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCCertificate.h +++ b/third_party/WebKit/Source/modules/mediastream/RTCCertificate.h
@@ -35,8 +35,6 @@ #include "core/dom/DOMTimeStamp.h" #include "platform/heap/GarbageCollected.h" #include "public/platform/WebRTCCertificate.h" -#include "wtf/OwnPtr.h" - #include <memory> namespace blink { @@ -57,7 +55,7 @@ DOMTimeStamp expires() const; private: - OwnPtr<WebRTCCertificate> m_certificate; + std::unique_ptr<WebRTCCertificate> m_certificate; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.cpp b/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.cpp index fcde7c0..d1a433f 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.cpp
@@ -34,6 +34,8 @@ #include "public/platform/WebMediaStreamTrack.h" #include "public/platform/WebRTCDTMFSenderHandler.h" #include "public/platform/WebRTCPeerConnectionHandler.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -45,7 +47,7 @@ RTCDTMFSender* RTCDTMFSender::create(ExecutionContext* context, WebRTCPeerConnectionHandler* peerConnectionHandler, MediaStreamTrack* track, ExceptionState& exceptionState) { - OwnPtr<WebRTCDTMFSenderHandler> handler = adoptPtr(peerConnectionHandler->createDTMFSender(track->component())); + std::unique_ptr<WebRTCDTMFSenderHandler> handler = wrapUnique(peerConnectionHandler->createDTMFSender(track->component())); if (!handler) { exceptionState.throwDOMException(NotSupportedError, "The MediaStreamTrack provided is not an element of a MediaStream that's currently in the local streams set."); return nullptr; @@ -56,7 +58,7 @@ return dtmfSender; } -RTCDTMFSender::RTCDTMFSender(ExecutionContext* context, MediaStreamTrack* track, PassOwnPtr<WebRTCDTMFSenderHandler> handler) +RTCDTMFSender::RTCDTMFSender(ExecutionContext* context, MediaStreamTrack* track, std::unique_ptr<WebRTCDTMFSenderHandler> handler) : ActiveDOMObject(context) , m_track(track) , m_duration(defaultToneDurationMs)
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.h b/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.h index 9518f11..dbe33121 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.h +++ b/third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.h
@@ -30,6 +30,7 @@ #include "modules/EventTargetModules.h" #include "platform/Timer.h" #include "public/platform/WebRTCDTMFSenderHandlerClient.h" +#include <memory> namespace blink { @@ -71,7 +72,7 @@ DECLARE_VIRTUAL_TRACE(); private: - RTCDTMFSender(ExecutionContext*, MediaStreamTrack*, PassOwnPtr<WebRTCDTMFSenderHandler>); + RTCDTMFSender(ExecutionContext*, MediaStreamTrack*, std::unique_ptr<WebRTCDTMFSenderHandler>); void dispose(); void scheduleDispatchEvent(Event*); @@ -84,7 +85,7 @@ int m_duration; int m_interToneGap; - OwnPtr<WebRTCDTMFSenderHandler> m_handler; + std::unique_ptr<WebRTCDTMFSenderHandler> m_handler; bool m_stopped;
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp index e054159b..a3e9296d 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp
@@ -33,6 +33,8 @@ #include "core/fileapi/Blob.h" #include "modules/mediastream/RTCPeerConnection.h" #include "public/platform/WebRTCPeerConnectionHandler.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -51,7 +53,7 @@ exceptionState.throwDOMException(NotSupportedError, "Blob support not implemented yet"); } -RTCDataChannel* RTCDataChannel::create(ExecutionContext* context, PassOwnPtr<WebRTCDataChannelHandler> handler) +RTCDataChannel* RTCDataChannel::create(ExecutionContext* context, std::unique_ptr<WebRTCDataChannelHandler> handler) { DCHECK(handler); RTCDataChannel* channel = new RTCDataChannel(context, std::move(handler)); @@ -62,7 +64,7 @@ RTCDataChannel* RTCDataChannel::create(ExecutionContext* context, WebRTCPeerConnectionHandler* peerConnectionHandler, const String& label, const WebRTCDataChannelInit& init, ExceptionState& exceptionState) { - OwnPtr<WebRTCDataChannelHandler> handler = adoptPtr(peerConnectionHandler->createDataChannel(label, init)); + std::unique_ptr<WebRTCDataChannelHandler> handler = wrapUnique(peerConnectionHandler->createDataChannel(label, init)); if (!handler) { exceptionState.throwDOMException(NotSupportedError, "RTCDataChannel is not supported"); return nullptr; @@ -73,7 +75,7 @@ return channel; } -RTCDataChannel::RTCDataChannel(ExecutionContext* context, PassOwnPtr<WebRTCDataChannelHandler> handler) +RTCDataChannel::RTCDataChannel(ExecutionContext* context, std::unique_ptr<WebRTCDataChannelHandler> handler) : ActiveScriptWrappable(this) , ActiveDOMObject(context) , m_handler(std::move(handler))
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h index ed92c02..6091d2b 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h +++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h
@@ -34,6 +34,7 @@ #include "public/platform/WebRTCDataChannelHandler.h" #include "public/platform/WebRTCDataChannelHandlerClient.h" #include "wtf/Compiler.h" +#include <memory> namespace blink { @@ -55,7 +56,7 @@ DEFINE_WRAPPERTYPEINFO(); USING_PRE_FINALIZER(RTCDataChannel, dispose); public: - static RTCDataChannel* create(ExecutionContext*, PassOwnPtr<WebRTCDataChannelHandler>); + static RTCDataChannel* create(ExecutionContext*, std::unique_ptr<WebRTCDataChannelHandler>); static RTCDataChannel* create(ExecutionContext*, WebRTCPeerConnectionHandler*, const String& label, const WebRTCDataChannelInit&, ExceptionState&); ~RTCDataChannel() override; @@ -116,13 +117,13 @@ void didDetectError() override; private: - RTCDataChannel(ExecutionContext*, PassOwnPtr<WebRTCDataChannelHandler>); + RTCDataChannel(ExecutionContext*, std::unique_ptr<WebRTCDataChannelHandler>); void dispose(); void scheduleDispatchEvent(Event*); void scheduledEventTimerFired(Timer<RTCDataChannel>*); - OwnPtr<WebRTCDataChannelHandler> m_handler; + std::unique_ptr<WebRTCDataChannelHandler> m_handler; WebRTCDataChannelHandlerClient::ReadyState m_readyState;
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp b/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp index 500a4c2..de660958 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannelTest.cpp
@@ -12,6 +12,7 @@ #include "public/platform/WebRTCDataChannelHandler.h" #include "public/platform/WebVector.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" @@ -77,7 +78,7 @@ TEST(RTCDataChannelTest, BufferedAmount) { MockHandler* handler = new MockHandler(); - RTCDataChannel* channel = RTCDataChannel::create(0, adoptPtr(handler)); + RTCDataChannel* channel = RTCDataChannel::create(0, wrapUnique(handler)); handler->changeState(WebRTCDataChannelHandlerClient::ReadyStateOpen); String message(std::string(100, 'A').c_str()); @@ -88,7 +89,7 @@ TEST(RTCDataChannelTest, BufferedAmountLow) { MockHandler* handler = new MockHandler(); - RTCDataChannel* channel = RTCDataChannel::create(0, adoptPtr(handler)); + RTCDataChannel* channel = RTCDataChannel::create(0, wrapUnique(handler)); // Add and drain 100 bytes handler->changeState(WebRTCDataChannelHandlerClient::ReadyStateOpen);
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp index 0467f453..a421337 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
@@ -90,7 +90,7 @@ #include "public/platform/WebRTCStatsRequest.h" #include "public/platform/WebRTCVoidRequest.h" #include "wtf/CurrentTime.h" - +#include "wtf/PtrUtil.h" #include <memory> namespace blink { @@ -455,7 +455,7 @@ return; } - m_peerHandler = adoptPtr(Platform::current()->createRTCPeerConnectionHandler(this)); + m_peerHandler = wrapUnique(Platform::current()->createRTCPeerConnectionHandler(this)); if (!m_peerHandler) { m_closed = true; m_stopped = true; @@ -747,7 +747,7 @@ } DCHECK(!keyParams.isNull()); - OwnPtr<WebRTCCertificateGenerator> certificateGenerator = adoptPtr( + std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator = wrapUnique( Platform::current()->createRTCCertificateGenerator()); // |keyParams| was successfully constructed, but does the certificate generator support these parameters? @@ -1102,7 +1102,7 @@ if (m_signalingState == SignalingStateClosed) return; - RTCDataChannel* channel = RTCDataChannel::create(getExecutionContext(), adoptPtr(handler)); + RTCDataChannel* channel = RTCDataChannel::create(getExecutionContext(), wrapUnique(handler)); scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachannel, false, false, channel)); }
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.h b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.h index 560b210..823d949d 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.h +++ b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.h
@@ -43,6 +43,7 @@ #include "public/platform/WebMediaConstraints.h" #include "public/platform/WebRTCPeerConnectionHandler.h" #include "public/platform/WebRTCPeerConnectionHandlerClient.h" +#include <memory> namespace blink { class ExceptionState; @@ -204,7 +205,7 @@ MediaStreamVector m_localStreams; MediaStreamVector m_remoteStreams; - OwnPtr<WebRTCPeerConnectionHandler> m_peerHandler; + std::unique_ptr<WebRTCPeerConnectionHandler> m_peerHandler; Member<AsyncMethodRunner<RTCPeerConnection>> m_dispatchScheduledEventRunner; HeapVector<Member<EventWrapper>> m_scheduledEvents;
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCSessionDescriptionRequestImpl.h b/third_party/WebKit/Source/modules/mediastream/RTCSessionDescriptionRequestImpl.h index a8a7f183..11dbf432 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCSessionDescriptionRequestImpl.h +++ b/third_party/WebKit/Source/modules/mediastream/RTCSessionDescriptionRequestImpl.h
@@ -34,7 +34,6 @@ #include "core/dom/ActiveDOMObject.h" #include "platform/heap/Handle.h" #include "platform/mediastream/RTCSessionDescriptionRequest.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/mediastream/UserMediaController.h b/third_party/WebKit/Source/modules/mediastream/UserMediaController.h index 471a42b..d185880 100644 --- a/third_party/WebKit/Source/modules/mediastream/UserMediaController.h +++ b/third_party/WebKit/Source/modules/mediastream/UserMediaController.h
@@ -27,7 +27,6 @@ #include "core/frame/LocalFrame.h" #include "modules/mediastream/UserMediaClient.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.h b/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.h index 2708fb3..d510d47e 100644 --- a/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.h +++ b/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.h
@@ -31,7 +31,6 @@ #include "modules/navigatorcontentutils/NavigatorContentUtilsClient.h" #include "platform/Supplementable.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp index 41f05f7..3b545f9 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp +++ b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp
@@ -17,6 +17,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "wtf/CurrentTime.h" #include "wtf/Threading.h" +#include <memory> namespace blink { @@ -93,7 +94,7 @@ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, fileSizeHistogram, new CustomCountHistogram("Notifications.Icon.FileSize", 1, 10000000 /* ~10mb max */, 50 /* buckets */)); fileSizeHistogram.count(m_data->size()); - OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*m_data.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); + std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(*m_data.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); if (decoder) { decoder->setData(m_data.get(), true /* allDataReceived */); // The |ImageFrame*| is owned by the decoder.
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h index 8aeb557..363b4fb 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h +++ b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h
@@ -10,9 +10,8 @@ #include "platform/SharedBuffer.h" #include "platform/heap/Handle.h" #include "wtf/Functional.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> class SkBitmap; @@ -56,7 +55,7 @@ double m_startTime; RefPtr<SharedBuffer> m_data; std::unique_ptr<ImageCallback> m_imageCallback; - OwnPtr<ThreadableLoader> m_threadableLoader; + std::unique_ptr<ThreadableLoader> m_threadableLoader; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationPermissionClient.h b/third_party/WebKit/Source/modules/notifications/NotificationPermissionClient.h index 26e2243c..fda8a9b5 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationPermissionClient.h +++ b/third_party/WebKit/Source/modules/notifications/NotificationPermissionClient.h
@@ -8,7 +8,6 @@ #include "bindings/core/v8/ScriptPromise.h" #include "modules/ModulesExport.h" #include "platform/Supplementable.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoader.h b/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoader.h index a3424d83..238a53d 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoader.h +++ b/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoader.h
@@ -13,8 +13,6 @@ #include "platform/heap/ThreadState.h" #include "third_party/skia/include/core/SkBitmap.h" #include "wtf/Functional.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include <memory>
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp b/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp index cd82f45d..c3aba1c 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp +++ b/third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.cpp
@@ -84,7 +84,7 @@ } private: - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; Persistent<NotificationResourcesLoader> m_loader; std::unique_ptr<WebNotificationResources> m_resources; };
diff --git a/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp b/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp index d5967e45..990ea7a 100644 --- a/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp +++ b/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
@@ -21,7 +21,9 @@ #include "public/platform/WebSecurityOrigin.h" #include "public/platform/modules/notifications/WebNotificationData.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { namespace { @@ -76,7 +78,7 @@ ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); ScriptPromise promise = resolver->promise(); - OwnPtr<WebNotificationShowCallbacks> callbacks = adoptPtr(new CallbackPromiseAdapter<void, void>(resolver)); + std::unique_ptr<WebNotificationShowCallbacks> callbacks = wrapUnique(new CallbackPromiseAdapter<void, void>(resolver)); ServiceWorkerRegistrationNotifications::from(executionContext, registration).prepareShow(data, std::move(callbacks)); return promise; @@ -125,22 +127,22 @@ return *supplement; } -void ServiceWorkerRegistrationNotifications::prepareShow(const WebNotificationData& data, PassOwnPtr<WebNotificationShowCallbacks> callbacks) +void ServiceWorkerRegistrationNotifications::prepareShow(const WebNotificationData& data, std::unique_ptr<WebNotificationShowCallbacks> callbacks) { RefPtr<SecurityOrigin> origin = getExecutionContext()->getSecurityOrigin(); - NotificationResourcesLoader* loader = new NotificationResourcesLoader(bind<NotificationResourcesLoader*>(&ServiceWorkerRegistrationNotifications::didLoadResources, WeakPersistentThisPointer<ServiceWorkerRegistrationNotifications>(this), origin.release(), data, passed(std::move(callbacks)))); + NotificationResourcesLoader* loader = new NotificationResourcesLoader(WTF::bind<NotificationResourcesLoader*>(&ServiceWorkerRegistrationNotifications::didLoadResources, WeakPersistentThisPointer<ServiceWorkerRegistrationNotifications>(this), origin.release(), data, passed(std::move(callbacks)))); m_loaders.add(loader); loader->start(getExecutionContext(), data); } -void ServiceWorkerRegistrationNotifications::didLoadResources(PassRefPtr<SecurityOrigin> origin, const WebNotificationData& data, PassOwnPtr<WebNotificationShowCallbacks> callbacks, NotificationResourcesLoader* loader) +void ServiceWorkerRegistrationNotifications::didLoadResources(PassRefPtr<SecurityOrigin> origin, const WebNotificationData& data, std::unique_ptr<WebNotificationShowCallbacks> callbacks, NotificationResourcesLoader* loader) { DCHECK(m_loaders.contains(loader)); WebNotificationManager* notificationManager = Platform::current()->notificationManager(); DCHECK(notificationManager); - notificationManager->showPersistent(WebSecurityOrigin(origin.get()), data, loader->getResources(), m_registration->webRegistration(), callbacks.leakPtr()); + notificationManager->showPersistent(WebSecurityOrigin(origin.get()), data, loader->getResources(), m_registration->webRegistration(), callbacks.release()); m_loaders.remove(loader); }
diff --git a/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.h b/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.h index 53c3b55..445c3e6a 100644 --- a/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.h +++ b/third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.h
@@ -14,9 +14,8 @@ #include "platform/heap/Visitor.h" #include "public/platform/modules/notifications/WebNotificationManager.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include <memory> namespace blink { @@ -48,8 +47,8 @@ static const char* supplementName(); static ServiceWorkerRegistrationNotifications& from(ExecutionContext*, ServiceWorkerRegistration&); - void prepareShow(const WebNotificationData&, PassOwnPtr<WebNotificationShowCallbacks>); - void didLoadResources(PassRefPtr<SecurityOrigin>, const WebNotificationData&, PassOwnPtr<WebNotificationShowCallbacks>, NotificationResourcesLoader*); + void prepareShow(const WebNotificationData&, std::unique_ptr<WebNotificationShowCallbacks>); + void didLoadResources(PassRefPtr<SecurityOrigin>, const WebNotificationData&, std::unique_ptr<WebNotificationShowCallbacks>, NotificationResourcesLoader*); Member<ServiceWorkerRegistration> m_registration; HeapHashSet<Member<NotificationResourcesLoader>> m_loaders;
diff --git a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h index 89bcba6..6fef3c01 100644 --- a/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h +++ b/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h
@@ -9,6 +9,7 @@ #include "core/html/canvas/CanvasRenderingContext.h" #include "core/html/canvas/CanvasRenderingContextFactory.h" #include "modules/canvas2d/BaseRenderingContext2D.h" +#include <memory> namespace blink { @@ -80,7 +81,7 @@ private: bool m_hasAlpha; bool m_needsMatrixClipRestore = false; - OwnPtr<ImageBuffer> m_imageBuffer; + std::unique_ptr<ImageBuffer> m_imageBuffer; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp index eaf46a0..260ca91 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp
@@ -12,7 +12,6 @@ #include "modules/payments/PaymentDetails.h" #include "modules/payments/PaymentTestHelper.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" #include <ostream> // NOLINT namespace blink {
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp index b0d152c..ce0d4a7 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp
@@ -12,7 +12,7 @@ #include "modules/payments/PaymentUpdater.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { namespace {
diff --git a/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp index 12812b4..577877f 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp
@@ -13,7 +13,7 @@ #include "modules/payments/PaymentTestHelper.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" +#include <memory> #include <utility> namespace blink {
diff --git a/third_party/WebKit/Source/modules/permissions/Permissions.cpp b/third_party/WebKit/Source/modules/permissions/Permissions.cpp index 64f5741a..a0530be 100644 --- a/third_party/WebKit/Source/modules/permissions/Permissions.cpp +++ b/third_party/WebKit/Source/modules/permissions/Permissions.cpp
@@ -23,7 +23,9 @@ #include "public/platform/Platform.h" #include "public/platform/modules/permissions/WebPermissionClient.h" #include "wtf/NotFound.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -167,8 +169,8 @@ return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "In its current state, the global scope can't request permissions.")); ExceptionState exceptionState(ExceptionState::GetterContext, "request", "Permissions", scriptState->context()->Global(), scriptState->isolate()); - OwnPtr<Vector<WebPermissionType>> internalPermissions = adoptPtr(new Vector<WebPermissionType>()); - OwnPtr<Vector<int>> callerIndexToInternalIndex = adoptPtr(new Vector<int>(rawPermissions.size())); + std::unique_ptr<Vector<WebPermissionType>> internalPermissions = wrapUnique(new Vector<WebPermissionType>()); + std::unique_ptr<Vector<int>> callerIndexToInternalIndex = wrapUnique(new Vector<int>(rawPermissions.size())); for (size_t i = 0; i < rawPermissions.size(); ++i) { const Dictionary& rawPermission = rawPermissions[i];
diff --git a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp index b60a017..5e8006a8 100644 --- a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp +++ b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp
@@ -6,10 +6,12 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "modules/permissions/PermissionStatus.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PermissionsCallback::PermissionsCallback(ScriptPromiseResolver* resolver, PassOwnPtr<Vector<WebPermissionType>> internalPermissions, PassOwnPtr<Vector<int>> callerIndexToInternalIndex) +PermissionsCallback::PermissionsCallback(ScriptPromiseResolver* resolver, std::unique_ptr<Vector<WebPermissionType>> internalPermissions, std::unique_ptr<Vector<int>> callerIndexToInternalIndex) : m_resolver(resolver) , m_internalPermissions(std::move(internalPermissions)) , m_callerIndexToInternalIndex(std::move(callerIndexToInternalIndex)) @@ -22,7 +24,7 @@ if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; - OwnPtr<WebVector<WebPermissionStatus>> statusPtr = adoptPtr(permissionStatus.release()); + std::unique_ptr<WebVector<WebPermissionStatus>> statusPtr = wrapUnique(permissionStatus.release()); HeapVector<Member<PermissionStatus>> result(m_callerIndexToInternalIndex->size()); // Create the response vector by finding the status for each index by
diff --git a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h index a2351c9..2173f58e 100644 --- a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h +++ b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h
@@ -13,7 +13,6 @@ #include "wtf/Noncopyable.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" - #include <memory> namespace blink { @@ -27,7 +26,7 @@ class PermissionsCallback final : public WebCallbacks<std::unique_ptr<WebVector<WebPermissionStatus>>, void> { public: - PermissionsCallback(ScriptPromiseResolver*, PassOwnPtr<Vector<WebPermissionType>>, PassOwnPtr<Vector<int>>); + PermissionsCallback(ScriptPromiseResolver*, std::unique_ptr<Vector<WebPermissionType>>, std::unique_ptr<Vector<int>>); ~PermissionsCallback() = default; void onSuccess(std::unique_ptr<WebVector<WebPermissionStatus>>) override; @@ -37,12 +36,12 @@ Persistent<ScriptPromiseResolver> m_resolver; // The permission types which were passed to the client to be requested. - OwnPtr<Vector<WebPermissionType>> m_internalPermissions; + std::unique_ptr<Vector<WebPermissionType>> m_internalPermissions; // Maps each index in the caller vector to the corresponding index in the // internal vector (i.e. the vector passsed to the client) such that both // indices have the same WebPermissionType. - OwnPtr<Vector<int>> m_callerIndexToInternalIndex; + std::unique_ptr<Vector<int>> m_callerIndexToInternalIndex; WTF_MAKE_NONCOPYABLE(PermissionsCallback); };
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp index 70c9c53..c1ccce2 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
@@ -24,8 +24,8 @@ #include "modules/presentation/PresentationRequest.h" #include "public/platform/modules/presentation/WebPresentationConnectionClient.h" #include "wtf/Assertions.h" -#include "wtf/OwnPtr.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -171,7 +171,7 @@ } // static -PresentationConnection* PresentationConnection::take(ScriptPromiseResolver* resolver, PassOwnPtr<WebPresentationConnectionClient> client, PresentationRequest* request) +PresentationConnection* PresentationConnection::take(ScriptPromiseResolver* resolver, std::unique_ptr<WebPresentationConnectionClient> client, PresentationRequest* request) { ASSERT(resolver); ASSERT(client); @@ -190,7 +190,7 @@ } // static -PresentationConnection* PresentationConnection::take(PresentationController* controller, PassOwnPtr<WebPresentationConnectionClient> client, PresentationRequest* request) +PresentationConnection* PresentationConnection::take(PresentationController* controller, std::unique_ptr<WebPresentationConnectionClient> client, PresentationRequest* request) { ASSERT(controller); ASSERT(request); @@ -355,7 +355,7 @@ switch (m_binaryType) { case BinaryTypeBlob: { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->appendBytes(data, length); Blob* blob = Blob::create(BlobDataHandle::create(std::move(blobData), length)); dispatchEvent(MessageEvent::create(blob));
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.h b/third_party/WebKit/Source/modules/presentation/PresentationConnection.h index 130fbcf2..4c1cc29 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationConnection.h +++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.h
@@ -11,8 +11,8 @@ #include "core/frame/DOMWindowProperty.h" #include "platform/heap/Handle.h" #include "public/platform/modules/presentation/WebPresentationConnectionClient.h" -#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { class AtomicString; @@ -32,10 +32,10 @@ DEFINE_WRAPPERTYPEINFO(); public: // For CallbackPromiseAdapter. - using WebType = OwnPtr<WebPresentationConnectionClient>; + using WebType = std::unique_ptr<WebPresentationConnectionClient>; - static PresentationConnection* take(ScriptPromiseResolver*, PassOwnPtr<WebPresentationConnectionClient>, PresentationRequest*); - static PresentationConnection* take(PresentationController*, PassOwnPtr<WebPresentationConnectionClient>, PresentationRequest*); + static PresentationConnection* take(ScriptPromiseResolver*, std::unique_ptr<WebPresentationConnectionClient>, PresentationRequest*); + static PresentationConnection* take(PresentationController*, std::unique_ptr<WebPresentationConnectionClient>, PresentationRequest*); ~PresentationConnection() override; // EventTarget implementation.
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp index a9d211b..e9511d1 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp
@@ -10,6 +10,8 @@ #include "modules/presentation/PresentationRequest.h" #include "public/platform/modules/presentation/WebPresentationConnectionClient.h" #include "public/platform/modules/presentation/WebPresentationError.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -23,7 +25,7 @@ void PresentationConnectionCallbacks::onSuccess(std::unique_ptr<WebPresentationConnectionClient> PresentationConnectionClient) { - OwnPtr<WebPresentationConnectionClient> result(adoptPtr(PresentationConnectionClient.release())); + std::unique_ptr<WebPresentationConnectionClient> result(wrapUnique(PresentationConnectionClient.release())); if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return;
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationController.cpp b/third_party/WebKit/Source/modules/presentation/PresentationController.cpp index f0904d2f..2cc3b32 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationController.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationController.cpp
@@ -7,6 +7,8 @@ #include "core/frame/LocalFrame.h" #include "modules/presentation/PresentationConnection.h" #include "public/platform/modules/presentation/WebPresentationClient.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -65,12 +67,12 @@ { if (!m_presentation || !m_presentation->defaultRequest()) return; - PresentationConnection::take(this, adoptPtr(connectionClient), m_presentation->defaultRequest()); + PresentationConnection::take(this, wrapUnique(connectionClient), m_presentation->defaultRequest()); } void PresentationController::didChangeSessionState(WebPresentationConnectionClient* connectionClient, WebPresentationConnectionState state) { - OwnPtr<WebPresentationConnectionClient> client = adoptPtr(connectionClient); + std::unique_ptr<WebPresentationConnectionClient> client = wrapUnique(connectionClient); PresentationConnection* connection = findConnection(client.get()); if (!connection) @@ -80,7 +82,7 @@ void PresentationController::didCloseConnection(WebPresentationConnectionClient* connectionClient, WebPresentationConnectionCloseReason reason, const WebString& message) { - OwnPtr<WebPresentationConnectionClient> client = adoptPtr(connectionClient); + std::unique_ptr<WebPresentationConnectionClient> client = wrapUnique(connectionClient); PresentationConnection* connection = findConnection(client.get()); if (!connection) @@ -90,7 +92,7 @@ void PresentationController::didReceiveSessionTextMessage(WebPresentationConnectionClient* connectionClient, const WebString& message) { - OwnPtr<WebPresentationConnectionClient> client = adoptPtr(connectionClient); + std::unique_ptr<WebPresentationConnectionClient> client = wrapUnique(connectionClient); PresentationConnection* connection = findConnection(client.get()); if (!connection) @@ -100,7 +102,7 @@ void PresentationController::didReceiveSessionBinaryMessage(WebPresentationConnectionClient* connectionClient, const uint8_t* data, size_t length) { - OwnPtr<WebPresentationConnectionClient> client = adoptPtr(connectionClient); + std::unique_ptr<WebPresentationConnectionClient> client = wrapUnique(connectionClient); PresentationConnection* connection = findConnection(client.get()); if (!connection)
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationError.cpp b/third_party/WebKit/Source/modules/presentation/PresentationError.cpp index cb35d89..cf37005 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationError.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationError.cpp
@@ -7,7 +7,6 @@ #include "core/dom/DOMException.h" #include "core/dom/ExceptionCode.h" #include "public/platform/modules/presentation/WebPresentationError.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushController.cpp b/third_party/WebKit/Source/modules/push_messaging/PushController.cpp index 2172060..5bb8e508 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushController.cpp +++ b/third_party/WebKit/Source/modules/push_messaging/PushController.cpp
@@ -6,7 +6,6 @@ #include "public/platform/modules/push_messaging/WebPushClient.h" #include "wtf/Assertions.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushController.h b/third_party/WebKit/Source/modules/push_messaging/PushController.h index 797c023..eb29149c 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushController.h +++ b/third_party/WebKit/Source/modules/push_messaging/PushController.h
@@ -10,7 +10,6 @@ #include "platform/Supplementable.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp b/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp index 08bda90d..91c2a586 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp +++ b/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp
@@ -13,7 +13,7 @@ #include "platform/blob/BlobData.h" #include "wtf/Assertions.h" #include "wtf/text/TextEncoding.h" - +#include <memory> #include <v8.h> namespace blink { @@ -63,7 +63,7 @@ Blob* PushMessageData::blob() const { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->appendBytes(m_data.data(), m_data.size()); // Note that the content type of the Blob object is deliberately not being
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp index a83699c..01363e82 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp +++ b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp
@@ -13,12 +13,12 @@ #include "public/platform/modules/push_messaging/WebPushProvider.h" #include "public/platform/modules/push_messaging/WebPushSubscription.h" #include "wtf/Assertions.h" -#include "wtf/OwnPtr.h" #include "wtf/text/Base64.h" +#include <memory> namespace blink { -PushSubscription* PushSubscription::take(ScriptPromiseResolver*, PassOwnPtr<WebPushSubscription> pushSubscription, ServiceWorkerRegistration* serviceWorkerRegistration) +PushSubscription* PushSubscription::take(ScriptPromiseResolver*, std::unique_ptr<WebPushSubscription> pushSubscription, ServiceWorkerRegistration* serviceWorkerRegistration) { if (!pushSubscription) return nullptr;
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h index be6fd12d..e21dcbd 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h +++ b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h
@@ -13,6 +13,7 @@ #include "platform/weborigin/KURL.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -24,7 +25,7 @@ class PushSubscription final : public GarbageCollectedFinalized<PushSubscription>, public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); public: - static PushSubscription* take(ScriptPromiseResolver*, PassOwnPtr<WebPushSubscription>, ServiceWorkerRegistration*); + static PushSubscription* take(ScriptPromiseResolver*, std::unique_ptr<WebPushSubscription>, ServiceWorkerRegistration*); static void dispose(WebPushSubscription* subscriptionRaw); virtual ~PushSubscription();
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionCallbacks.cpp b/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionCallbacks.cpp index 8dea001..fa77180 100644 --- a/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionCallbacks.cpp +++ b/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionCallbacks.cpp
@@ -10,6 +10,7 @@ #include "modules/serviceworkers/ServiceWorkerRegistration.h" #include "public/platform/modules/push_messaging/WebPushSubscription.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -30,7 +31,7 @@ if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; - m_resolver->resolve(PushSubscription::take(m_resolver.get(), adoptPtr(webPushSubscription.release()), m_serviceWorkerRegistration)); + m_resolver->resolve(PushSubscription::take(m_resolver.get(), wrapUnique(webPushSubscription.release()), m_serviceWorkerRegistration)); } void PushSubscriptionCallbacks::onError(const WebPushError& error)
diff --git a/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuota.h b/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuota.h index 01936d8..f39bdda5 100644 --- a/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuota.h +++ b/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuota.h
@@ -33,7 +33,6 @@ #include "bindings/core/v8/ScriptWrappable.h" #include "platform/heap/Handle.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuotaCallbacksImpl.h b/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuotaCallbacksImpl.h index 5b80d08..8529807 100644 --- a/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuotaCallbacksImpl.h +++ b/third_party/WebKit/Source/modules/quota/DeprecatedStorageQuotaCallbacksImpl.h
@@ -36,7 +36,6 @@ #include "modules/quota/StorageQuotaCallback.h" #include "modules/quota/StorageUsageCallback.h" #include "platform/StorageQuotaCallbacks.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/modules/quota/StorageQuotaCallbacksImpl.h b/third_party/WebKit/Source/modules/quota/StorageQuotaCallbacksImpl.h index 14300b3..d12e720 100644 --- a/third_party/WebKit/Source/modules/quota/StorageQuotaCallbacksImpl.h +++ b/third_party/WebKit/Source/modules/quota/StorageQuotaCallbacksImpl.h
@@ -34,7 +34,6 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "modules/ModulesExport.h" #include "platform/StorageQuotaCallbacks.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp index bb3e62cc..f3b58f8 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp
@@ -41,6 +41,7 @@ #include "public/platform/WebSecurityOrigin.h" #include "public/platform/WebString.h" #include "public/platform/modules/serviceworker/WebServiceWorkerState.h" +#include <memory> namespace blink { @@ -58,7 +59,7 @@ } // Disentangle the port in preparation for sending it to the remote context. - OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); + std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); if (exceptionState.hadException()) return; if (m_handle->serviceWorker()->state() == WebServiceWorkerStateRedundant) { @@ -70,8 +71,8 @@ context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "ServiceWorker cannot send an ArrayBuffer as a transferable object yet. See http://crbug.com/511119")); WebString messageString = message->toWireString(); - OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePortChannelArray(std::move(channels)); - m_handle->serviceWorker()->postMessage(client->provider(), messageString, WebSecurityOrigin(getExecutionContext()->getSecurityOrigin()), webChannels.leakPtr()); + std::unique_ptr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePortChannelArray(std::move(channels)); + m_handle->serviceWorker()->postMessage(client->provider(), messageString, WebSecurityOrigin(getExecutionContext()->getSecurityOrigin()), webChannels.release()); } void ServiceWorker::internalsTerminate() @@ -112,7 +113,7 @@ } } -ServiceWorker* ServiceWorker::from(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorker::Handle> handle) +ServiceWorker* ServiceWorker::from(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorker::Handle> handle) { return getOrCreate(executionContext, std::move(handle)); } @@ -129,7 +130,7 @@ m_wasStopped = true; } -ServiceWorker* ServiceWorker::getOrCreate(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorker::Handle> handle) +ServiceWorker* ServiceWorker::getOrCreate(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorker::Handle> handle) { if (!handle) return nullptr; @@ -145,7 +146,7 @@ return newWorker; } -ServiceWorker::ServiceWorker(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorker::Handle> handle) +ServiceWorker::ServiceWorker(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorker::Handle> handle) : AbstractWorker(executionContext) , ActiveScriptWrappable(this) , m_handle(std::move(handle))
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.h index 1d93fa0..fdd2d3f 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.h
@@ -38,9 +38,8 @@ #include "modules/ModulesExport.h" #include "public/platform/modules/serviceworker/WebServiceWorker.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProxy.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include <memory> namespace blink { @@ -50,7 +49,7 @@ DEFINE_WRAPPERTYPEINFO(); USING_GARBAGE_COLLECTED_MIXIN(ServiceWorker); public: - static ServiceWorker* from(ExecutionContext*, PassOwnPtr<WebServiceWorker::Handle>); + static ServiceWorker* from(ExecutionContext*, std::unique_ptr<WebServiceWorker::Handle>); ~ServiceWorker() override; DECLARE_VIRTUAL_TRACE(); @@ -72,8 +71,8 @@ void internalsTerminate(); private: - static ServiceWorker* getOrCreate(ExecutionContext*, PassOwnPtr<WebServiceWorker::Handle>); - ServiceWorker(ExecutionContext*, PassOwnPtr<WebServiceWorker::Handle>); + static ServiceWorker* getOrCreate(ExecutionContext*, std::unique_ptr<WebServiceWorker::Handle>); + ServiceWorker(ExecutionContext*, std::unique_ptr<WebServiceWorker::Handle>); // ActiveScriptWrappable overrides. bool hasPendingActivity() const final; @@ -82,7 +81,7 @@ void stop() override; // A handle to the service worker representation in the embedder. - OwnPtr<WebServiceWorker::Handle> m_handle; + std::unique_ptr<WebServiceWorker::Handle> m_handle; bool m_wasStopped; };
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp index ae934b81..c77396fd 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp
@@ -12,10 +12,11 @@ #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" #include "public/platform/WebString.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { -ServiceWorkerClient* ServiceWorkerClient::take(ScriptPromiseResolver*, PassOwnPtr<WebServiceWorkerClientInfo> webClient) +ServiceWorkerClient* ServiceWorkerClient::take(ScriptPromiseResolver*, std::unique_ptr<WebServiceWorkerClientInfo> webClient) { if (!webClient) return nullptr; @@ -70,7 +71,7 @@ void ServiceWorkerClient::postMessage(ExecutionContext* context, PassRefPtr<SerializedScriptValue> message, const MessagePortArray& ports, ExceptionState& exceptionState) { // Disentangle the port in preparation for sending it to the remote context. - OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); + std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); if (exceptionState.hadException()) return; @@ -78,7 +79,7 @@ context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "ServiceWorkerClient cannot send an ArrayBuffer as a transferable object yet. See http://crbug.com/511119")); WebString messageString = message->toWireString(); - OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePortChannelArray(std::move(channels)); + std::unique_ptr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePortChannelArray(std::move(channels)); ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(m_uuid, messageString, std::move(webChannels)); }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h index 4a2419d..b847b72 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h
@@ -12,6 +12,7 @@ #include "platform/heap/Handle.h" #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -23,9 +24,9 @@ DEFINE_WRAPPERTYPEINFO(); public: // To be used by CallbackPromiseAdapter. - using WebType = OwnPtr<WebServiceWorkerClientInfo>; + using WebType = std::unique_ptr<WebServiceWorkerClientInfo>; - static ServiceWorkerClient* take(ScriptPromiseResolver*, PassOwnPtr<WebServiceWorkerClientInfo>); + static ServiceWorkerClient* take(ScriptPromiseResolver*, std::unique_ptr<WebServiceWorkerClientInfo>); static ServiceWorkerClient* create(const WebServiceWorkerClientInfo&); virtual ~ServiceWorkerClient();
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp index 85cad8a..ab56d4f 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp
@@ -16,10 +16,10 @@ #include "modules/serviceworkers/ServiceWorkerWindowClientCallback.h" #include "public/platform/modules/serviceworker/WebServiceWorkerClientQueryOptions.h" #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -68,7 +68,7 @@ void onSuccess(std::unique_ptr<WebServiceWorkerClientInfo> webClient) override { - OwnPtr<WebServiceWorkerClientInfo> client = adoptPtr(webClient.release()); + std::unique_ptr<WebServiceWorkerClientInfo> client = wrapUnique(webClient.release()); if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; if (!client) {
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp index efd57b7..7298ac3 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
@@ -56,6 +56,8 @@ #include "public/platform/modules/serviceworker/WebServiceWorker.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -69,7 +71,7 @@ { if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; - m_resolver->resolve(ServiceWorkerRegistration::getOrCreate(m_resolver->getExecutionContext(), adoptPtr(handle.release()))); + m_resolver->resolve(ServiceWorkerRegistration::getOrCreate(m_resolver->getExecutionContext(), wrapUnique(handle.release()))); } void onError(const WebServiceWorkerError& error) override @@ -96,7 +98,7 @@ void onSuccess(std::unique_ptr<WebServiceWorkerRegistration::Handle> webPassHandle) override { - OwnPtr<WebServiceWorkerRegistration::Handle> handle = adoptPtr(webPassHandle.release()); + std::unique_ptr<WebServiceWorkerRegistration::Handle> handle = wrapUnique(webPassHandle.release()); if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; if (!handle) { @@ -127,10 +129,10 @@ void onSuccess(std::unique_ptr<WebVector<WebServiceWorkerRegistration::Handle*>> webPassRegistrations) override { - Vector<OwnPtr<WebServiceWorkerRegistration::Handle>> handles; - OwnPtr<WebVector<WebServiceWorkerRegistration::Handle*>> webRegistrations = adoptPtr(webPassRegistrations.release()); + Vector<std::unique_ptr<WebServiceWorkerRegistration::Handle>> handles; + std::unique_ptr<WebVector<WebServiceWorkerRegistration::Handle*>> webRegistrations = wrapUnique(webPassRegistrations.release()); for (auto& handle : *webRegistrations) { - handles.append(adoptPtr(handle)); + handles.append(wrapUnique(handle)); } if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) @@ -161,7 +163,7 @@ ASSERT(m_ready->getState() == ReadyProperty::Pending); if (m_ready->getExecutionContext() && !m_ready->getExecutionContext()->activeDOMObjectsAreStopped()) - m_ready->resolve(ServiceWorkerRegistration::getOrCreate(m_ready->getExecutionContext(), adoptPtr(handle.release()))); + m_ready->resolve(ServiceWorkerRegistration::getOrCreate(m_ready->getExecutionContext(), wrapUnique(handle.release()))); } private: @@ -195,7 +197,7 @@ ContextLifecycleObserver::trace(visitor); } -void ServiceWorkerContainer::registerServiceWorkerImpl(ExecutionContext* executionContext, const KURL& rawScriptURL, const KURL& scope, PassOwnPtr<RegistrationCallbacks> callbacks) +void ServiceWorkerContainer::registerServiceWorkerImpl(ExecutionContext* executionContext, const KURL& rawScriptURL, const KURL& scope, std::unique_ptr<RegistrationCallbacks> callbacks) { if (!m_provider) { callbacks->onError(WebServiceWorkerError(WebServiceWorkerError::ErrorTypeState, "Failed to register a ServiceWorker: The document is in an invalid state.")); @@ -255,7 +257,7 @@ } } - m_provider->registerServiceWorker(patternURL, scriptURL, callbacks.leakPtr()); + m_provider->registerServiceWorker(patternURL, scriptURL, callbacks.release()); } ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptState, const String& url, const RegistrationOptions& options) @@ -282,7 +284,7 @@ else patternURL = enteredExecutionContext(scriptState->isolate())->completeURL(options.scope()); - registerServiceWorkerImpl(executionContext, scriptURL, patternURL, adoptPtr(new RegistrationCallback(resolver))); + registerServiceWorkerImpl(executionContext, scriptURL, patternURL, wrapUnique(new RegistrationCallback(resolver))); return promise; } @@ -385,7 +387,7 @@ { if (!getExecutionContext()) return; - m_controller = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release())); + m_controller = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); if (m_controller) UseCounter::count(getExecutionContext(), UseCounter::ServiceWorkerControlledPage); if (shouldNotifyControllerChange) @@ -399,7 +401,7 @@ MessagePortArray* ports = MessagePort::toMessagePortArray(getExecutionContext(), webChannels); RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message); - ServiceWorker* source = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release())); + ServiceWorker* source = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); dispatchEvent(ServiceWorkerMessageEvent::create(ports, value, source, getExecutionContext()->getSecurityOrigin()->toString())); }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.h index 0103990..b912d7c 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.h
@@ -44,6 +44,7 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -72,7 +73,7 @@ ScriptPromise ready(ScriptState*); WebServiceWorkerProvider* provider() { return m_provider; } - void registerServiceWorkerImpl(ExecutionContext*, const KURL& scriptURL, const KURL& scope, PassOwnPtr<RegistrationCallbacks>); + void registerServiceWorkerImpl(ExecutionContext*, const KURL& scriptURL, const KURL& scope, std::unique_ptr<RegistrationCallbacks>); ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, const RegistrationOptions&); ScriptPromise getRegistration(ScriptState*, const String& documentURL);
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp index 8842166..7237bfab 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp
@@ -10,15 +10,16 @@ #include "core/loader/FrameLoaderClient.h" #include "core/workers/WorkerGlobalScope.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" +#include <memory> namespace blink { -ServiceWorkerContainerClient* ServiceWorkerContainerClient::create(PassOwnPtr<WebServiceWorkerProvider> provider) +ServiceWorkerContainerClient* ServiceWorkerContainerClient::create(std::unique_ptr<WebServiceWorkerProvider> provider) { return new ServiceWorkerContainerClient(std::move(provider)); } -ServiceWorkerContainerClient::ServiceWorkerContainerClient(PassOwnPtr<WebServiceWorkerProvider> provider) +ServiceWorkerContainerClient::ServiceWorkerContainerClient(std::unique_ptr<WebServiceWorkerProvider> provider) : m_provider(std::move(provider)) { } @@ -51,7 +52,7 @@ return client; } -void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, PassOwnPtr<WebServiceWorkerProvider> provider) +void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, std::unique_ptr<WebServiceWorkerProvider> provider) { clients->provideSupplement(ServiceWorkerContainerClient::supplementName(), ServiceWorkerContainerClient::create(std::move(provider))); }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.h index 28e63b6a..e28b38b 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerClient.h
@@ -9,6 +9,7 @@ #include "core/workers/WorkerClients.h" #include "modules/ModulesExport.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -24,7 +25,7 @@ USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainerClient); WTF_MAKE_NONCOPYABLE(ServiceWorkerContainerClient); public: - static ServiceWorkerContainerClient* create(PassOwnPtr<WebServiceWorkerProvider>); + static ServiceWorkerContainerClient* create(std::unique_ptr<WebServiceWorkerProvider>); virtual ~ServiceWorkerContainerClient(); WebServiceWorkerProvider* provider() { return m_provider.get(); } @@ -39,12 +40,12 @@ } protected: - explicit ServiceWorkerContainerClient(PassOwnPtr<WebServiceWorkerProvider>); + explicit ServiceWorkerContainerClient(std::unique_ptr<WebServiceWorkerProvider>); - OwnPtr<WebServiceWorkerProvider> m_provider; + std::unique_ptr<WebServiceWorkerProvider> m_provider; }; -MODULES_EXPORT void provideServiceWorkerContainerClientToWorker(WorkerClients*, PassOwnPtr<WebServiceWorkerProvider>); +MODULES_EXPORT void provideServiceWorkerContainerClientToWorker(WorkerClients*, std::unique_ptr<WebServiceWorkerProvider>); } // namespace blink
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp index fbc9c84..f57b4ce 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
@@ -23,9 +23,9 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" +#include <memory> #include <v8.h> namespace blink { @@ -162,7 +162,7 @@ v8::Isolate* isolate() { return v8::Isolate::GetCurrent(); } ScriptState* getScriptState() { return ScriptState::forMainWorld(m_page->document().frame()); } - void provide(PassOwnPtr<WebServiceWorkerProvider> provider) + void provide(std::unique_ptr<WebServiceWorkerProvider> provider) { Supplement<Document>::provideTo(m_page->document(), ServiceWorkerContainerClient::supplementName(), ServiceWorkerContainerClient::create(std::move(provider))); } @@ -180,7 +180,7 @@ { // When the registration is rejected, a register call must not reach // the provider. - provide(adoptPtr(new NotReachedWebServiceWorkerProvider())); + provide(wrapUnique(new NotReachedWebServiceWorkerProvider())); ServiceWorkerContainer* container = ServiceWorkerContainer::create(getExecutionContext()); ScriptState::Scope scriptScope(getScriptState()); @@ -194,7 +194,7 @@ void testGetRegistrationRejected(const String& documentURL, const ScriptValueTest& valueTest) { - provide(adoptPtr(new NotReachedWebServiceWorkerProvider())); + provide(wrapUnique(new NotReachedWebServiceWorkerProvider())); ServiceWorkerContainer* container = ServiceWorkerContainer::create(getExecutionContext()); ScriptState::Scope scriptScope(getScriptState()); @@ -205,7 +205,7 @@ } private: - OwnPtr<DummyPageHolder> m_page; + std::unique_ptr<DummyPageHolder> m_page; }; TEST_F(ServiceWorkerContainerTest, Register_NonSecureOriginIsRejected) @@ -263,9 +263,9 @@ // StubWebServiceWorkerProvider, but |registerServiceWorker| and // other methods must not be called after the // StubWebServiceWorkerProvider dies. - PassOwnPtr<WebServiceWorkerProvider> provider() + std::unique_ptr<WebServiceWorkerProvider> provider() { - return adoptPtr(new WebServiceWorkerProviderImpl(*this)); + return wrapUnique(new WebServiceWorkerProviderImpl(*this)); } size_t registerCallCount() { return m_registerCallCount; } @@ -289,14 +289,14 @@ m_owner.m_registerCallCount++; m_owner.m_registerScope = pattern; m_owner.m_registerScriptURL = scriptURL; - m_registrationCallbacksToDelete.append(adoptPtr(callbacks)); + m_registrationCallbacksToDelete.append(wrapUnique(callbacks)); } void getRegistration(const WebURL& documentURL, WebServiceWorkerGetRegistrationCallbacks* callbacks) override { m_owner.m_getRegistrationCallCount++; m_owner.m_getRegistrationURL = documentURL; - m_getRegistrationCallbacksToDelete.append(adoptPtr(callbacks)); + m_getRegistrationCallbacksToDelete.append(wrapUnique(callbacks)); } bool validateScopeAndScriptURL(const WebURL& scope, const WebURL& scriptURL, WebString* errorMessage) @@ -306,8 +306,8 @@ private: StubWebServiceWorkerProvider& m_owner; - Vector<OwnPtr<WebServiceWorkerRegistrationCallbacks>> m_registrationCallbacksToDelete; - Vector<OwnPtr<WebServiceWorkerGetRegistrationCallbacks>> m_getRegistrationCallbacksToDelete; + Vector<std::unique_ptr<WebServiceWorkerRegistrationCallbacks>> m_registrationCallbacksToDelete; + Vector<std::unique_ptr<WebServiceWorkerGetRegistrationCallbacks>> m_getRegistrationCallbacksToDelete; }; private:
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.h index c2054d7b..9145d11 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.h
@@ -33,8 +33,6 @@ #include "platform/heap/Handle.h" #include "public/platform/modules/serviceworker/WebServiceWorkerError.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp index de78c5e..82d10cd 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
@@ -62,10 +62,12 @@ #include "public/platform/Platform.h" #include "public/platform/WebURL.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -ServiceWorkerGlobalScope* ServiceWorkerGlobalScope::create(ServiceWorkerThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData) +ServiceWorkerGlobalScope* ServiceWorkerGlobalScope::create(ServiceWorkerThread* thread, std::unique_ptr<WorkerThreadStartupData> startupData) { // Note: startupData is finalized on return. After the relevant parts has been // passed along to the created 'context'. @@ -79,7 +81,7 @@ return context; } -ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const KURL& url, const String& userAgent, ServiceWorkerThread* thread, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) +ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const KURL& url, const String& userAgent, ServiceWorkerThread* thread, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) : WorkerGlobalScope(url, userAgent, thread, timeOrigin, std::move(starterOriginPrivilegeData), workerClients) , m_didEvaluateScript(false) , m_hadErrorInTopLevelEventHandler(false) @@ -142,7 +144,7 @@ { if (!getExecutionContext()) return; - m_registration = ServiceWorkerRegistration::getOrCreate(getExecutionContext(), adoptPtr(handle.release())); + m_registration = ServiceWorkerRegistration::getOrCreate(getExecutionContext(), wrapUnique(handle.release())); } bool ServiceWorkerGlobalScope::addEventListenerInternal(const AtomicString& eventType, EventListener* listener, const AddEventListenerOptions& options) @@ -208,7 +210,7 @@ return ServiceWorkerScriptCachedMetadataHandler::create(this, scriptURL, metaData); } -void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation> location) +void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation> location) { WorkerGlobalScope::logExceptionToConsole(errorMessage, location->clone()); ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location));
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.h index 330860b..7abf63fb 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.h
@@ -37,6 +37,7 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" #include "wtf/Assertions.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -55,7 +56,7 @@ class MODULES_EXPORT ServiceWorkerGlobalScope final : public WorkerGlobalScope { DEFINE_WRAPPERTYPEINFO(); public: - static ServiceWorkerGlobalScope* create(ServiceWorkerThread*, PassOwnPtr<WorkerThreadStartupData>); + static ServiceWorkerGlobalScope* create(ServiceWorkerThread*, std::unique_ptr<WorkerThreadStartupData>); ~ServiceWorkerGlobalScope() override; bool isServiceWorkerGlobalScope() const override { return true; } @@ -92,10 +93,10 @@ bool addEventListenerInternal(const AtomicString& eventType, EventListener*, const AddEventListenerOptions&) override; private: - ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorkerThread*, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData>, WorkerClients*); + ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorkerThread*, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, WorkerClients*); void importScripts(const Vector<String>& urls, ExceptionState&) override; CachedMetadataHandler* createWorkerScriptCachedMetadataHandler(const KURL& scriptURL, const Vector<char>* metaData) override; - void logExceptionToConsole(const String& errorMessage, PassOwnPtr<SourceLocation>) override; + void logExceptionToConsole(const String& errorMessage, std::unique_ptr<SourceLocation>) override; void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) override; Member<ServiceWorkerClients> m_clients;
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h index 91d839f..8040ac1 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h
@@ -41,6 +41,7 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerSkipWaitingCallbacks.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -79,8 +80,8 @@ virtual void didHandleNotificationCloseEvent(int eventID, WebServiceWorkerEventResult) = 0; virtual void didHandlePushEvent(int pushEventID, WebServiceWorkerEventResult) = 0; virtual void didHandleSyncEvent(int syncEventID, WebServiceWorkerEventResult) = 0; - virtual void postMessageToClient(const WebString& clientUUID, const WebString& message, PassOwnPtr<WebMessagePortChannelArray>) = 0; - virtual void postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient&, const WebString& message, PassOwnPtr<WebMessagePortChannelArray>) = 0; + virtual void postMessageToClient(const WebString& clientUUID, const WebString& message, std::unique_ptr<WebMessagePortChannelArray>) = 0; + virtual void postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient&, const WebString& message, std::unique_ptr<WebMessagePortChannelArray>) = 0; virtual void skipWaiting(WebServiceWorkerSkipWaitingCallbacks*) = 0; virtual void claim(WebServiceWorkerClientsClaimCallbacks*) = 0; virtual void focus(const WebString& clientUUID, WebServiceWorkerClientCallbacks*) = 0;
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp index 255f515d..effb5e78 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp
@@ -13,6 +13,7 @@ #include "modules/serviceworkers/ServiceWorkerContainer.h" #include "public/platform/Platform.h" #include "public/platform/WebScheduler.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -72,7 +73,7 @@ TrackExceptionState exceptionState; - NavigatorServiceWorker::serviceWorker(&document, *document.frame()->domWindow()->navigator(), exceptionState)->registerServiceWorkerImpl(&document, scriptURL, scopeURL, adoptPtr(new RegistrationCallback(m_owner))); + NavigatorServiceWorker::serviceWorker(&document, *document.frame()->domWindow()->navigator(), exceptionState)->registerServiceWorkerImpl(&document, scriptURL, scopeURL, wrapUnique(new RegistrationCallback(m_owner))); } bool ServiceWorkerLinkResource::hasLoaded() const
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.h index 5ea5f60..3e372dd 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.h
@@ -8,7 +8,6 @@ #include "core/html/LinkResource.h" #include "modules/ModulesExport.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp index 6572f6d..1582384 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.cpp
@@ -15,6 +15,8 @@ #include "modules/serviceworkers/ServiceWorkerContainerClient.h" #include "modules/serviceworkers/ServiceWorkerError.h" #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -32,24 +34,24 @@ { if (!getExecutionContext()) return; - m_installing = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release())); + m_installing = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); } void ServiceWorkerRegistration::setWaiting(std::unique_ptr<WebServiceWorker::Handle> handle) { if (!getExecutionContext()) return; - m_waiting = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release())); + m_waiting = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); } void ServiceWorkerRegistration::setActive(std::unique_ptr<WebServiceWorker::Handle> handle) { if (!getExecutionContext()) return; - m_active = ServiceWorker::from(getExecutionContext(), adoptPtr(handle.release())); + m_active = ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); } -ServiceWorkerRegistration* ServiceWorkerRegistration::getOrCreate(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorkerRegistration::Handle> handle) +ServiceWorkerRegistration* ServiceWorkerRegistration::getOrCreate(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) { ASSERT(handle); @@ -93,7 +95,7 @@ return promise; } -ServiceWorkerRegistration::ServiceWorkerRegistration(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorkerRegistration::Handle> handle) +ServiceWorkerRegistration::ServiceWorkerRegistration(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) : ActiveScriptWrappable(this) , ActiveDOMObject(executionContext) , m_handle(std::move(handle))
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h index 1368c7e..bff04eb6 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h
@@ -15,7 +15,7 @@ #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" #include "public/platform/modules/serviceworker/WebServiceWorkerRegistrationProxy.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -48,7 +48,7 @@ // Returns an existing registration object for the handle if it exists. // Otherwise, returns a new registration object. - static ServiceWorkerRegistration* getOrCreate(ExecutionContext*, PassOwnPtr<WebServiceWorkerRegistration::Handle>); + static ServiceWorkerRegistration* getOrCreate(ExecutionContext*, std::unique_ptr<WebServiceWorkerRegistration::Handle>); ServiceWorker* installing() { return m_installing; } ServiceWorker* waiting() { return m_waiting; } @@ -68,7 +68,7 @@ DECLARE_VIRTUAL_TRACE(); private: - ServiceWorkerRegistration(ExecutionContext*, PassOwnPtr<WebServiceWorkerRegistration::Handle>); + ServiceWorkerRegistration(ExecutionContext*, std::unique_ptr<WebServiceWorkerRegistration::Handle>); void dispose(); // ActiveScriptWrappable overrides. @@ -78,7 +78,7 @@ void stop() override; // A handle to the registration representation in the embedder. - OwnPtr<WebServiceWorkerRegistration::Handle> m_handle; + std::unique_ptr<WebServiceWorkerRegistration::Handle> m_handle; Member<ServiceWorker> m_installing; Member<ServiceWorker> m_waiting; @@ -90,7 +90,7 @@ class ServiceWorkerRegistrationArray { STATIC_ONLY(ServiceWorkerRegistrationArray); public: - static HeapVector<Member<ServiceWorkerRegistration>> take(ScriptPromiseResolver* resolver, Vector<OwnPtr<WebServiceWorkerRegistration::Handle>>* webServiceWorkerRegistrations) + static HeapVector<Member<ServiceWorkerRegistration>> take(ScriptPromiseResolver* resolver, Vector<std::unique_ptr<WebServiceWorkerRegistration::Handle>>* webServiceWorkerRegistrations) { HeapVector<Member<ServiceWorkerRegistration>> registrations; for (auto& registration : *webServiceWorkerRegistrations)
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h index a6beb078..45feb02 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h
@@ -8,7 +8,6 @@ #include "core/fetch/CachedMetadataHandler.h" #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.cpp index 933be5c..831291fd 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.cpp
@@ -33,12 +33,14 @@ #include "core/workers/WorkerBackingThread.h" #include "core/workers/WorkerThreadStartupData.h" #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<ServiceWorkerThread> ServiceWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) +std::unique_ptr<ServiceWorkerThread> ServiceWorkerThread::create(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) { - return adoptPtr(new ServiceWorkerThread(workerLoaderProxy, workerReportingProxy)); + return wrapUnique(new ServiceWorkerThread(workerLoaderProxy, workerReportingProxy)); } ServiceWorkerThread::ServiceWorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) @@ -51,7 +53,7 @@ { } -WorkerGlobalScope* ServiceWorkerThread::createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData> startupData) +WorkerGlobalScope* ServiceWorkerThread::createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData> startupData) { return ServiceWorkerGlobalScope::create(this, std::move(startupData)); }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.h index 0a178d4a..7328fbf 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.h
@@ -33,6 +33,7 @@ #include "core/frame/csp/ContentSecurityPolicy.h" #include "core/workers/WorkerThread.h" #include "modules/ModulesExport.h" +#include <memory> namespace blink { @@ -40,17 +41,17 @@ class MODULES_EXPORT ServiceWorkerThread final : public WorkerThread { public: - static PassOwnPtr<ServiceWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); + static std::unique_ptr<ServiceWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); ~ServiceWorkerThread() override; WorkerBackingThread& workerBackingThread() override { return *m_workerBackingThread; } protected: - WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override; + WorkerGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) override; private: ServiceWorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); - OwnPtr<WorkerBackingThread> m_workerBackingThread; + std::unique_ptr<WorkerBackingThread> m_workerBackingThread; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.cpp index 3bf05a0..5064c5e 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.cpp
@@ -16,10 +16,11 @@ #include "modules/serviceworkers/ServiceWorkerWindowClientCallback.h" #include "public/platform/WebString.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { -ServiceWorkerWindowClient* ServiceWorkerWindowClient::take(ScriptPromiseResolver*, PassOwnPtr<WebServiceWorkerClientInfo> webClient) +ServiceWorkerWindowClient* ServiceWorkerWindowClient::take(ScriptPromiseResolver*, std::unique_ptr<WebServiceWorkerClientInfo> webClient) { return webClient ? ServiceWorkerWindowClient::create(*webClient) : nullptr; }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.h index c0c714f..8ecc696a 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.h +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClient.h
@@ -10,8 +10,7 @@ #include "modules/serviceworkers/ServiceWorkerClient.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -22,9 +21,9 @@ DEFINE_WRAPPERTYPEINFO(); public: // To be used by CallbackPromiseAdapter. - using WebType = OwnPtr<WebServiceWorkerClientInfo>; + using WebType = std::unique_ptr<WebServiceWorkerClientInfo>; - static ServiceWorkerWindowClient* take(ScriptPromiseResolver*, PassOwnPtr<WebServiceWorkerClientInfo>); + static ServiceWorkerWindowClient* take(ScriptPromiseResolver*, std::unique_ptr<WebServiceWorkerClientInfo>); static ServiceWorkerWindowClient* create(const WebServiceWorkerClientInfo&); ~ServiceWorkerWindowClient() override;
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp index 2658542..36a1fab 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp
@@ -8,6 +8,7 @@ #include "core/dom/DOMException.h" #include "modules/serviceworkers/ServiceWorkerError.h" #include "modules/serviceworkers/ServiceWorkerWindowClient.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -15,7 +16,7 @@ { if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) return; - m_resolver->resolve(ServiceWorkerWindowClient::take(m_resolver.get(), adoptPtr(clientInfo.release()))); + m_resolver->resolve(ServiceWorkerWindowClient::take(m_resolver.get(), wrapUnique(clientInfo.release()))); } void NavigateClientCallback::onError(const WebServiceWorkerError& error)
diff --git a/third_party/WebKit/Source/modules/speech/SpeechRecognitionClient.h b/third_party/WebKit/Source/modules/speech/SpeechRecognitionClient.h index 80d6f9b..4fdbe5f 100644 --- a/third_party/WebKit/Source/modules/speech/SpeechRecognitionClient.h +++ b/third_party/WebKit/Source/modules/speech/SpeechRecognitionClient.h
@@ -28,6 +28,7 @@ #include "modules/ModulesExport.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -45,7 +46,7 @@ virtual ~SpeechRecognitionClient() { } }; -MODULES_EXPORT void provideSpeechRecognitionTo(Page&, PassOwnPtr<SpeechRecognitionClient>); +MODULES_EXPORT void provideSpeechRecognitionTo(Page&, std::unique_ptr<SpeechRecognitionClient>); } // namespace blink
diff --git a/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.cpp b/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.cpp index 7867771..ed82c39 100644 --- a/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.cpp +++ b/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.cpp
@@ -25,6 +25,8 @@ #include "modules/speech/SpeechRecognitionController.h" +#include <memory> + namespace blink { const char* SpeechRecognitionController::supplementName() @@ -32,7 +34,7 @@ return "SpeechRecognitionController"; } -SpeechRecognitionController::SpeechRecognitionController(PassOwnPtr<SpeechRecognitionClient> client) +SpeechRecognitionController::SpeechRecognitionController(std::unique_ptr<SpeechRecognitionClient> client) : m_client(std::move(client)) { } @@ -42,12 +44,12 @@ // FIXME: Call m_client->pageDestroyed(); once we have implemented a client. } -SpeechRecognitionController* SpeechRecognitionController::create(PassOwnPtr<SpeechRecognitionClient> client) +SpeechRecognitionController* SpeechRecognitionController::create(std::unique_ptr<SpeechRecognitionClient> client) { return new SpeechRecognitionController(std::move(client)); } -void provideSpeechRecognitionTo(Page& page, PassOwnPtr<SpeechRecognitionClient> client) +void provideSpeechRecognitionTo(Page& page, std::unique_ptr<SpeechRecognitionClient> client) { SpeechRecognitionController::provideTo(page, SpeechRecognitionController::supplementName(), SpeechRecognitionController::create(std::move(client))); }
diff --git a/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.h b/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.h index 6eced0e..68971af 100644 --- a/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.h +++ b/third_party/WebKit/Source/modules/speech/SpeechRecognitionController.h
@@ -28,7 +28,7 @@ #include "core/page/Page.h" #include "modules/speech/SpeechRecognitionClient.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -47,16 +47,16 @@ void stop(SpeechRecognition* recognition) { m_client->stop(recognition); } void abort(SpeechRecognition* recognition) { m_client->abort(recognition); } - static SpeechRecognitionController* create(PassOwnPtr<SpeechRecognitionClient>); + static SpeechRecognitionController* create(std::unique_ptr<SpeechRecognitionClient>); static const char* supplementName(); static SpeechRecognitionController* from(Page* page) { return static_cast<SpeechRecognitionController*>(Supplement<Page>::from(page, supplementName())); } DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<Page>::trace(visitor); } private: - explicit SpeechRecognitionController(PassOwnPtr<SpeechRecognitionClient>); + explicit SpeechRecognitionController(std::unique_ptr<SpeechRecognitionClient>); - OwnPtr<SpeechRecognitionClient> m_client; + std::unique_ptr<SpeechRecognitionClient> m_client; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/storage/InspectorDOMStorageAgent.h b/third_party/WebKit/Source/modules/storage/InspectorDOMStorageAgent.h index 34b7370..13d50e5 100644 --- a/third_party/WebKit/Source/modules/storage/InspectorDOMStorageAgent.h +++ b/third_party/WebKit/Source/modules/storage/InspectorDOMStorageAgent.h
@@ -34,7 +34,6 @@ #include "modules/ModulesExport.h" #include "modules/storage/StorageArea.h" #include "wtf/HashMap.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/storage/Storage.cpp b/third_party/WebKit/Source/modules/storage/Storage.cpp index 06bb4ecb..323111b 100644 --- a/third_party/WebKit/Source/modules/storage/Storage.cpp +++ b/third_party/WebKit/Source/modules/storage/Storage.cpp
@@ -26,7 +26,6 @@ #include "modules/storage/Storage.h" #include "bindings/core/v8/ExceptionState.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/modules/storage/StorageArea.cpp b/third_party/WebKit/Source/modules/storage/StorageArea.cpp index ca5f398..7447f5b 100644 --- a/third_party/WebKit/Source/modules/storage/StorageArea.cpp +++ b/third_party/WebKit/Source/modules/storage/StorageArea.cpp
@@ -43,15 +43,16 @@ #include "public/platform/WebStorageArea.h" #include "public/platform/WebString.h" #include "public/platform/WebURL.h" +#include <memory> namespace blink { -StorageArea* StorageArea::create(PassOwnPtr<WebStorageArea> storageArea, StorageType storageType) +StorageArea* StorageArea::create(std::unique_ptr<WebStorageArea> storageArea, StorageType storageType) { return new StorageArea(std::move(storageArea), storageType); } -StorageArea::StorageArea(PassOwnPtr<WebStorageArea> storageArea, StorageType storageType) +StorageArea::StorageArea(std::unique_ptr<WebStorageArea> storageArea, StorageType storageType) : LocalFrameLifecycleObserver(nullptr) , m_storageArea(std::move(storageArea)) , m_storageType(storageType) @@ -209,7 +210,7 @@ { ASSERT(storage); StorageArea* area = storage->area(); - return area->m_storageArea == sourceAreaInstance; + return area->m_storageArea.get() == sourceAreaInstance; } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/storage/StorageArea.h b/third_party/WebKit/Source/modules/storage/StorageArea.h index 406012a8..3f28860 100644 --- a/third_party/WebKit/Source/modules/storage/StorageArea.h +++ b/third_party/WebKit/Source/modules/storage/StorageArea.h
@@ -29,9 +29,8 @@ #include "core/frame/LocalFrameLifecycleObserver.h" #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -51,7 +50,7 @@ class MODULES_EXPORT StorageArea final : public GarbageCollectedFinalized<StorageArea>, public LocalFrameLifecycleObserver { USING_GARBAGE_COLLECTED_MIXIN(StorageArea); public: - static StorageArea* create(PassOwnPtr<WebStorageArea>, StorageType); + static StorageArea* create(std::unique_ptr<WebStorageArea>, StorageType); virtual ~StorageArea(); @@ -74,11 +73,11 @@ DECLARE_TRACE(); private: - StorageArea(PassOwnPtr<WebStorageArea>, StorageType); + StorageArea(std::unique_ptr<WebStorageArea>, StorageType); static bool isEventSource(Storage*, WebStorageArea* sourceAreaInstance); - OwnPtr<WebStorageArea> m_storageArea; + std::unique_ptr<WebStorageArea> m_storageArea; StorageType m_storageType; bool m_canAccessStorageCachedResult; };
diff --git a/third_party/WebKit/Source/modules/storage/StorageClient.h b/third_party/WebKit/Source/modules/storage/StorageClient.h index ef98e4a1..ef26ffec 100644 --- a/third_party/WebKit/Source/modules/storage/StorageClient.h +++ b/third_party/WebKit/Source/modules/storage/StorageClient.h
@@ -6,7 +6,7 @@ #define StorageClient_h #include "modules/storage/StorageArea.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -16,7 +16,7 @@ public: virtual ~StorageClient() { } - virtual PassOwnPtr<StorageNamespace> createSessionStorageNamespace() = 0; + virtual std::unique_ptr<StorageNamespace> createSessionStorageNamespace() = 0; virtual bool canAccessStorage(LocalFrame*, StorageType) const = 0; };
diff --git a/third_party/WebKit/Source/modules/storage/StorageNamespace.cpp b/third_party/WebKit/Source/modules/storage/StorageNamespace.cpp index 60f68693..1ad21f84 100644 --- a/third_party/WebKit/Source/modules/storage/StorageNamespace.cpp +++ b/third_party/WebKit/Source/modules/storage/StorageNamespace.cpp
@@ -30,10 +30,12 @@ #include "public/platform/Platform.h" #include "public/platform/WebStorageArea.h" #include "public/platform/WebStorageNamespace.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -StorageNamespace::StorageNamespace(PassOwnPtr<WebStorageNamespace> webStorageNamespace) +StorageNamespace::StorageNamespace(std::unique_ptr<WebStorageNamespace> webStorageNamespace) : m_webStorageNamespace(std::move(webStorageNamespace)) { } @@ -48,12 +50,12 @@ static WebStorageNamespace* localStorageNamespace = nullptr; if (!localStorageNamespace) localStorageNamespace = Platform::current()->createLocalStorageNamespace(); - return StorageArea::create(adoptPtr(localStorageNamespace->createStorageArea(origin->toString())), LocalStorage); + return StorageArea::create(wrapUnique(localStorageNamespace->createStorageArea(origin->toString())), LocalStorage); } StorageArea* StorageNamespace::storageArea(SecurityOrigin* origin) { - return StorageArea::create(adoptPtr(m_webStorageNamespace->createStorageArea(origin->toString())), SessionStorage); + return StorageArea::create(wrapUnique(m_webStorageNamespace->createStorageArea(origin->toString())), SessionStorage); } bool StorageNamespace::isSameNamespace(const WebStorageNamespace& sessionNamespace) const
diff --git a/third_party/WebKit/Source/modules/storage/StorageNamespace.h b/third_party/WebKit/Source/modules/storage/StorageNamespace.h index 1161c6e..48565ba 100644 --- a/third_party/WebKit/Source/modules/storage/StorageNamespace.h +++ b/third_party/WebKit/Source/modules/storage/StorageNamespace.h
@@ -28,8 +28,7 @@ #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -40,7 +39,7 @@ class MODULES_EXPORT StorageNamespace { USING_FAST_MALLOC(StorageNamespace); public: - explicit StorageNamespace(PassOwnPtr<WebStorageNamespace>); + explicit StorageNamespace(std::unique_ptr<WebStorageNamespace>); ~StorageNamespace(); static StorageArea* localStorageArea(SecurityOrigin*); @@ -49,7 +48,7 @@ bool isSameNamespace(const WebStorageNamespace& sessionNamespace) const; private: - OwnPtr<WebStorageNamespace> m_webStorageNamespace; + std::unique_ptr<WebStorageNamespace> m_webStorageNamespace; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/storage/StorageNamespaceController.h b/third_party/WebKit/Source/modules/storage/StorageNamespaceController.h index 8ac6cb08..b0deffaf 100644 --- a/third_party/WebKit/Source/modules/storage/StorageNamespaceController.h +++ b/third_party/WebKit/Source/modules/storage/StorageNamespaceController.h
@@ -8,7 +8,7 @@ #include "core/page/Page.h" #include "modules/ModulesExport.h" #include "platform/Supplementable.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -33,7 +33,7 @@ private: explicit StorageNamespaceController(StorageClient*); static const char* supplementName(); - OwnPtr<StorageNamespace> m_sessionStorage; + std::unique_ptr<StorageNamespace> m_sessionStorage; StorageClient* m_client; Member<InspectorDOMStorageAgent> m_inspectorAgent; };
diff --git a/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.cpp b/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.cpp index 0bc7237..e0aa660 100644 --- a/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.cpp
@@ -22,9 +22,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/AsyncAudioDecoder.h" #include "core/dom/DOMArrayBuffer.h" #include "modules/webaudio/AbstractAudioContext.h" +#include "modules/webaudio/AsyncAudioDecoder.h" #include "modules/webaudio/AudioBuffer.h" #include "modules/webaudio/AudioBufferCallback.h" #include "platform/ThreadSafeFunctional.h" @@ -32,12 +32,12 @@ #include "platform/audio/AudioFileReader.h" #include "public/platform/Platform.h" #include "public/platform/WebTraceLocation.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" namespace blink { AsyncAudioDecoder::AsyncAudioDecoder() - : m_thread(adoptPtr(Platform::current()->createThread("Audio Decoder"))) + : m_thread(wrapUnique(Platform::current()->createThread("Audio Decoder"))) { }
diff --git a/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.h b/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.h index 859e59f3..b05694c 100644 --- a/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.h +++ b/third_party/WebKit/Source/modules/webaudio/AsyncAudioDecoder.h
@@ -27,8 +27,8 @@ #include "platform/heap/Handle.h" #include "public/platform/WebThread.h" -#include "wtf/OwnPtr.h" #include "wtf/build_config.h" +#include <memory> namespace blink { @@ -59,7 +59,7 @@ static void decode(DOMArrayBuffer* audioData, float sampleRate, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback, ScriptPromiseResolver*, AbstractAudioContext*); static void notifyComplete(DOMArrayBuffer* audioData, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback, AudioBus*, ScriptPromiseResolver*, AbstractAudioContext*); - OwnPtr<WebThread> m_thread; + std::unique_ptr<WebThread> m_thread; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.cpp b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.cpp index 9e6cc6a..2d7a126 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.cpp
@@ -27,10 +27,11 @@ #include "modules/webaudio/AudioNodeOutput.h" #include "platform/audio/AudioBus.h" #include "platform/audio/AudioProcessor.h" +#include <memory> namespace blink { -AudioBasicProcessorHandler::AudioBasicProcessorHandler(NodeType nodeType, AudioNode& node, float sampleRate, PassOwnPtr<AudioProcessor> processor) +AudioBasicProcessorHandler::AudioBasicProcessorHandler(NodeType nodeType, AudioNode& node, float sampleRate, std::unique_ptr<AudioProcessor> processor) : AudioHandler(nodeType, node, sampleRate) , m_processor(std::move(processor)) { @@ -38,7 +39,7 @@ addOutput(1); } -PassRefPtr<AudioBasicProcessorHandler> AudioBasicProcessorHandler::create(NodeType nodeType, AudioNode& node, float sampleRate, PassOwnPtr<AudioProcessor> processor) +PassRefPtr<AudioBasicProcessorHandler> AudioBasicProcessorHandler::create(NodeType nodeType, AudioNode& node, float sampleRate, std::unique_ptr<AudioProcessor> processor) { return adoptRef(new AudioBasicProcessorHandler(nodeType, node, sampleRate, std::move(processor))); }
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.h b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.h index 2b8ab3d77..46677685 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandler.h
@@ -28,6 +28,7 @@ #include "modules/ModulesExport.h" #include "modules/webaudio/AudioNode.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -38,7 +39,7 @@ // where the input and output have the same number of channels. class MODULES_EXPORT AudioBasicProcessorHandler : public AudioHandler { public: - static PassRefPtr<AudioBasicProcessorHandler> create(NodeType, AudioNode&, float sampleRate, PassOwnPtr<AudioProcessor>); + static PassRefPtr<AudioBasicProcessorHandler> create(NodeType, AudioNode&, float sampleRate, std::unique_ptr<AudioProcessor>); ~AudioBasicProcessorHandler() override; // AudioHandler @@ -55,11 +56,11 @@ AudioProcessor* processor() { return m_processor.get(); } private: - AudioBasicProcessorHandler(NodeType, AudioNode&, float sampleRate, PassOwnPtr<AudioProcessor>); + AudioBasicProcessorHandler(NodeType, AudioNode&, float sampleRate, std::unique_ptr<AudioProcessor>); double tailTime() const final; double latencyTime() const final; - OwnPtr<AudioProcessor> m_processor; + std::unique_ptr<AudioProcessor> m_processor; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp index 612c176..535d1a1 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioBasicProcessorHandlerTest.cpp
@@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "modules/webaudio/AudioBasicProcessorHandler.h" #include "core/testing/DummyPageHolder.h" +#include "modules/webaudio/AudioBasicProcessorHandler.h" #include "modules/webaudio/OfflineAudioContext.h" #include "platform/audio/AudioProcessor.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -28,14 +30,14 @@ MockProcessorNode(AbstractAudioContext& context) : AudioNode(context) { - setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShaper, *this, 48000, adoptPtr(new MockAudioProcessor()))); + setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShaper, *this, 48000, wrapUnique(new MockAudioProcessor()))); handler().initialize(); } }; TEST(AudioBasicProcessorHandlerTest, ProcessorFinalization) { - OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); + std::unique_ptr<DummyPageHolder> page = DummyPageHolder::create(); OfflineAudioContext* context = OfflineAudioContext::create(&page->document(), 2, 1, 48000, ASSERT_NO_EXCEPTION); MockProcessorNode* node = new MockProcessorNode(*context); AudioBasicProcessorHandler& handler = static_cast<AudioBasicProcessorHandler&>(node->handler());
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp index bb0d054..f660a33 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp
@@ -22,16 +22,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/AudioBufferSourceNode.h" #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "core/frame/UseCounter.h" #include "modules/webaudio/AbstractAudioContext.h" +#include "modules/webaudio/AudioBufferSourceNode.h" #include "modules/webaudio/AudioNodeOutput.h" #include "platform/FloatConversion.h" #include "platform/audio/AudioUtilities.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" #include <algorithm> namespace blink { @@ -369,8 +370,8 @@ output(0).setNumberOfChannels(numberOfChannels); - m_sourceChannels = adoptArrayPtr(new const float* [numberOfChannels]); - m_destinationChannels = adoptArrayPtr(new float* [numberOfChannels]); + m_sourceChannels = wrapArrayUnique(new const float* [numberOfChannels]); + m_destinationChannels = wrapArrayUnique(new float* [numberOfChannels]); for (unsigned i = 0; i < numberOfChannels; ++i) m_sourceChannels[i] = buffer->getChannelData(i)->data();
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h index 35f1c1e4..70de4a2 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h
@@ -30,10 +30,10 @@ #include "modules/webaudio/AudioScheduledSourceNode.h" #include "modules/webaudio/PannerNode.h" #include "platform/audio/AudioBus.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Threading.h" +#include <memory> namespace blink { @@ -103,8 +103,8 @@ Persistent<AudioBuffer> m_buffer; // Pointers for the buffer and destination. - OwnPtr<const float*[]> m_sourceChannels; - OwnPtr<float*[]> m_destinationChannels; + std::unique_ptr<const float*[]> m_sourceChannels; + std::unique_ptr<float*[]> m_destinationChannels; RefPtr<AudioParamHandler> m_playbackRate; RefPtr<AudioParamHandler> m_detune;
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNode.h b/third_party/WebKit/Source/modules/webaudio/AudioNode.h index 15a3bd5..9d7fda8 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioNode.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioNode.h
@@ -29,12 +29,11 @@ #include "modules/ModulesExport.h" #include "platform/audio/AudioBus.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/Vector.h" #include "wtf/build_config.h" +#include <memory> #define DEBUG_AUDIONODE_REFERENCES 0 @@ -252,8 +251,8 @@ UntracedMember<AbstractAudioContext> m_context; float m_sampleRate; - Vector<OwnPtr<AudioNodeInput>> m_inputs; - Vector<OwnPtr<AudioNodeOutput>> m_outputs; + Vector<std::unique_ptr<AudioNodeInput>> m_inputs; + Vector<std::unique_ptr<AudioNodeOutput>> m_outputs; double m_lastProcessingTime; double m_lastNonSilentTime;
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.cpp b/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.cpp index a6af8e30..090af4fb 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.cpp
@@ -24,7 +24,9 @@ #include "modules/webaudio/AudioNodeInput.h" #include "modules/webaudio/AudioNodeOutput.h" +#include "wtf/PtrUtil.h" #include <algorithm> +#include <memory> namespace blink { @@ -36,9 +38,9 @@ m_internalSummingBus = AudioBus::create(1, AudioHandler::ProcessingSizeInFrames); } -PassOwnPtr<AudioNodeInput> AudioNodeInput::create(AudioHandler& handler) +std::unique_ptr<AudioNodeInput> AudioNodeInput::create(AudioHandler& handler) { - return adoptPtr(new AudioNodeInput(handler)); + return wrapUnique(new AudioNodeInput(handler)); } void AudioNodeInput::connect(AudioNodeOutput& output)
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.h b/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.h index c790d9ae..3af2208 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioNodeInput.h
@@ -30,6 +30,7 @@ #include "platform/audio/AudioBus.h" #include "wtf/Allocator.h" #include "wtf/HashSet.h" +#include <memory> namespace blink { @@ -42,7 +43,7 @@ class AudioNodeInput final : public AudioSummingJunction { USING_FAST_MALLOC(AudioNodeInput); public: - static PassOwnPtr<AudioNodeInput> create(AudioHandler&); + static std::unique_ptr<AudioNodeInput> create(AudioHandler&); // AudioSummingJunction void didUpdate() override;
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp index 1bc384d6..ed17124 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp
@@ -22,10 +22,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/AudioNodeOutput.h" #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/AudioNodeInput.h" +#include "modules/webaudio/AudioNodeOutput.h" +#include "wtf/PtrUtil.h" #include "wtf/Threading.h" +#include <memory> namespace blink { @@ -46,9 +48,9 @@ m_internalBus = AudioBus::create(numberOfChannels, AudioHandler::ProcessingSizeInFrames); } -PassOwnPtr<AudioNodeOutput> AudioNodeOutput::create(AudioHandler* handler, unsigned numberOfChannels) +std::unique_ptr<AudioNodeOutput> AudioNodeOutput::create(AudioHandler* handler, unsigned numberOfChannels) { - return adoptPtr(new AudioNodeOutput(handler, numberOfChannels)); + return wrapUnique(new AudioNodeOutput(handler, numberOfChannels)); } void AudioNodeOutput::dispose()
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h index ebddbff..8fe931c 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h
@@ -30,6 +30,7 @@ #include "platform/audio/AudioBus.h" #include "wtf/HashSet.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -42,7 +43,7 @@ public: // It's OK to pass 0 for numberOfChannels in which case // setNumberOfChannels() must be called later on. - static PassOwnPtr<AudioNodeOutput> create(AudioHandler*, unsigned numberOfChannels); + static std::unique_ptr<AudioNodeOutput> create(AudioHandler*, unsigned numberOfChannels); void dispose(); // Causes our AudioNode to process if it hasn't already for this render quantum.
diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp index 68a13022..7053583 100644 --- a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp
@@ -23,8 +23,10 @@ */ #include "modules/webaudio/BiquadFilterNode.h" + #include "modules/webaudio/AudioBasicProcessorHandler.h" #include "platform/Histogram.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -39,7 +41,7 @@ AudioHandler::NodeTypeBiquadFilter, *this, context.sampleRate(), - adoptPtr(new BiquadProcessor( + wrapUnique(new BiquadProcessor( context.sampleRate(), 1, m_frequency->handler(),
diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp b/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp index 110dff4..a665e78b 100644 --- a/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp +++ b/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp
@@ -22,8 +22,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/BiquadProcessor.h" #include "modules/webaudio/BiquadDSPKernel.h" +#include "modules/webaudio/BiquadProcessor.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -45,9 +47,9 @@ uninitialize(); } -PassOwnPtr<AudioDSPKernel> BiquadProcessor::createKernel() +std::unique_ptr<AudioDSPKernel> BiquadProcessor::createKernel() { - return adoptPtr(new BiquadDSPKernel(this)); + return wrapUnique(new BiquadDSPKernel(this)); } void BiquadProcessor::checkForDirtyCoefficients() @@ -110,7 +112,7 @@ // to avoid interfering with the processing running in the audio // thread on the main kernels. - OwnPtr<BiquadDSPKernel> responseKernel = adoptPtr(new BiquadDSPKernel(this)); + std::unique_ptr<BiquadDSPKernel> responseKernel = wrapUnique(new BiquadDSPKernel(this)); responseKernel->getFrequencyResponse(nFrequencies, frequencyHz, magResponse, phaseResponse); }
diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.h b/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.h index c9d29e2..13fe5bb 100644 --- a/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.h +++ b/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.h
@@ -31,6 +31,7 @@ #include "platform/audio/AudioDSPKernelProcessor.h" #include "platform/audio/Biquad.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -53,7 +54,7 @@ BiquadProcessor(float sampleRate, size_t numberOfChannels, AudioParamHandler& frequency, AudioParamHandler& q, AudioParamHandler& gain, AudioParamHandler& detune); ~BiquadProcessor() override; - PassOwnPtr<AudioDSPKernel> createKernel() override; + std::unique_ptr<AudioDSPKernel> createKernel() override; void process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) override;
diff --git a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp index 3413e7a..dee1806 100644 --- a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp
@@ -22,13 +22,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/ConvolverNode.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "modules/webaudio/AudioBuffer.h" #include "modules/webaudio/AudioNodeInput.h" #include "modules/webaudio/AudioNodeOutput.h" +#include "modules/webaudio/ConvolverNode.h" #include "platform/audio/Reverb.h" +#include "wtf/PtrUtil.h" +#include <memory> // Note about empirical tuning: // The maximum FFT size affects reverb performance and accuracy. @@ -127,7 +129,7 @@ bufferBus->setSampleRate(buffer->sampleRate()); // Create the reverb with the given impulse response. - OwnPtr<Reverb> reverb = adoptPtr(new Reverb(bufferBus.get(), ProcessingSizeInFrames, MaxFFTSize, 2, context() && context()->hasRealtimeConstraint(), m_normalize)); + std::unique_ptr<Reverb> reverb = wrapUnique(new Reverb(bufferBus.get(), ProcessingSizeInFrames, MaxFFTSize, 2, context() && context()->hasRealtimeConstraint(), m_normalize)); { // Synchronize with process().
diff --git a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.h b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.h index 294fde6..d27be4e 100644 --- a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.h +++ b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.h
@@ -28,9 +28,9 @@ #include "base/gtest_prod_util.h" #include "modules/ModulesExport.h" #include "modules/webaudio/AudioNode.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> namespace blink { @@ -58,7 +58,7 @@ double tailTime() const override; double latencyTime() const override; - OwnPtr<Reverb> m_reverb; + std::unique_ptr<Reverb> m_reverb; // This Persistent doesn't make a reference cycle including the owner // ConvolverNode. Persistent<AudioBuffer> m_buffer;
diff --git a/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp index 04d5122..ff2545cd 100644 --- a/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/ConvolverNodeTest.cpp
@@ -2,16 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "modules/webaudio/ConvolverNode.h" #include "core/testing/DummyPageHolder.h" +#include "modules/webaudio/ConvolverNode.h" #include "modules/webaudio/OfflineAudioContext.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { TEST(ConvolverNodeTest, ReverbLifetime) { - OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); + std::unique_ptr<DummyPageHolder> page = DummyPageHolder::create(); OfflineAudioContext* context = OfflineAudioContext::create(&page->document(), 2, 1, 48000, ASSERT_NO_EXCEPTION); ConvolverNode* node = context->createConvolver(ASSERT_NO_EXCEPTION); ConvolverHandler& handler = node->convolverHandler();
diff --git a/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.h b/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.h index 9b6a8d2..4940ac8 100644 --- a/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.h +++ b/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.h
@@ -27,7 +27,7 @@ #include "modules/webaudio/AudioDestinationNode.h" #include "platform/audio/AudioDestination.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -54,7 +54,7 @@ explicit DefaultAudioDestinationHandler(AudioNode&); void createDestination(); - OwnPtr<AudioDestination> m_destination; + std::unique_ptr<AudioDestination> m_destination; String m_inputDeviceId; unsigned m_numberOfInputChannels; };
diff --git a/third_party/WebKit/Source/modules/webaudio/DelayNode.cpp b/third_party/WebKit/Source/modules/webaudio/DelayNode.cpp index b8d530f..eb35ee1 100644 --- a/third_party/WebKit/Source/modules/webaudio/DelayNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/DelayNode.cpp
@@ -22,13 +22,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/DelayNode.h" #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "modules/webaudio/AudioBasicProcessorHandler.h" +#include "modules/webaudio/DelayNode.h" #include "modules/webaudio/DelayProcessor.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -42,7 +43,7 @@ AudioHandler::NodeTypeDelay, *this, context.sampleRate(), - adoptPtr(new DelayProcessor( + wrapUnique(new DelayProcessor( context.sampleRate(), 1, m_delayTime->handler(),
diff --git a/third_party/WebKit/Source/modules/webaudio/DelayProcessor.cpp b/third_party/WebKit/Source/modules/webaudio/DelayProcessor.cpp index 3a35f865..c502851 100644 --- a/third_party/WebKit/Source/modules/webaudio/DelayProcessor.cpp +++ b/third_party/WebKit/Source/modules/webaudio/DelayProcessor.cpp
@@ -22,8 +22,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/DelayProcessor.h" #include "modules/webaudio/DelayDSPKernel.h" +#include "modules/webaudio/DelayProcessor.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -40,9 +42,9 @@ uninitialize(); } -PassOwnPtr<AudioDSPKernel> DelayProcessor::createKernel() +std::unique_ptr<AudioDSPKernel> DelayProcessor::createKernel() { - return adoptPtr(new DelayDSPKernel(this)); + return wrapUnique(new DelayDSPKernel(this)); } } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/DelayProcessor.h b/third_party/WebKit/Source/modules/webaudio/DelayProcessor.h index 20278f6..a8223e5 100644 --- a/third_party/WebKit/Source/modules/webaudio/DelayProcessor.h +++ b/third_party/WebKit/Source/modules/webaudio/DelayProcessor.h
@@ -27,8 +27,8 @@ #include "modules/webaudio/AudioParam.h" #include "platform/audio/AudioDSPKernelProcessor.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -39,7 +39,7 @@ DelayProcessor(float sampleRate, unsigned numberOfChannels, AudioParamHandler& delayTime, double maxDelayTime); ~DelayProcessor() override; - PassOwnPtr<AudioDSPKernel> createKernel() override; + std::unique_ptr<AudioDSPKernel> createKernel() override; AudioParamHandler& delayTime() const { return *m_delayTime; } double maxDelayTime() { return m_maxDelayTime; }
diff --git a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.cpp b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.cpp index b259ddb..d12764d 100644 --- a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.cpp
@@ -22,10 +22,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/DynamicsCompressorNode.h" #include "modules/webaudio/AudioNodeInput.h" #include "modules/webaudio/AudioNodeOutput.h" +#include "modules/webaudio/DynamicsCompressorNode.h" #include "platform/audio/DynamicsCompressor.h" +#include "wtf/PtrUtil.h" // Set output to stereo by default. static const unsigned defaultNumberOfOutputChannels = 2; @@ -105,7 +106,7 @@ return; AudioHandler::initialize(); - m_dynamicsCompressor = adoptPtr(new DynamicsCompressor(sampleRate(), defaultNumberOfOutputChannels)); + m_dynamicsCompressor = wrapUnique(new DynamicsCompressor(sampleRate(), defaultNumberOfOutputChannels)); } void DynamicsCompressorHandler::clearInternalStateWhenDisabled()
diff --git a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.h b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.h index 6eb63ca..27e2201 100644 --- a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.h +++ b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNode.h
@@ -29,7 +29,7 @@ #include "modules/ModulesExport.h" #include "modules/webaudio/AudioNode.h" #include "modules/webaudio/AudioParam.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -67,7 +67,7 @@ double tailTime() const override; double latencyTime() const override; - OwnPtr<DynamicsCompressor> m_dynamicsCompressor; + std::unique_ptr<DynamicsCompressor> m_dynamicsCompressor; RefPtr<AudioParamHandler> m_threshold; RefPtr<AudioParamHandler> m_knee; RefPtr<AudioParamHandler> m_ratio;
diff --git a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp index 67bd8b7..e04a567 100644 --- a/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/DynamicsCompressorNodeTest.cpp
@@ -2,17 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "modules/webaudio/DynamicsCompressorNode.h" #include "core/testing/DummyPageHolder.h" #include "modules/webaudio/AbstractAudioContext.h" +#include "modules/webaudio/DynamicsCompressorNode.h" #include "modules/webaudio/OfflineAudioContext.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { TEST(DynamicsCompressorNodeTest, ProcessorLifetime) { - OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); + std::unique_ptr<DummyPageHolder> page = DummyPageHolder::create(); OfflineAudioContext* context = OfflineAudioContext::create(&page->document(), 2, 1, 48000, ASSERT_NO_EXCEPTION); DynamicsCompressorNode* node = context->createDynamicsCompressor(ASSERT_NO_EXCEPTION); DynamicsCompressorHandler& handler = node->dynamicsCompressorHandler();
diff --git a/third_party/WebKit/Source/modules/webaudio/IIRFilterNode.cpp b/third_party/WebKit/Source/modules/webaudio/IIRFilterNode.cpp index bde304df..98d008e 100644 --- a/third_party/WebKit/Source/modules/webaudio/IIRFilterNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/IIRFilterNode.cpp
@@ -10,6 +10,7 @@ #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/AudioBasicProcessorHandler.h" #include "platform/Histogram.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -18,7 +19,7 @@ { setHandler(AudioBasicProcessorHandler::create( AudioHandler::NodeTypeIIRFilter, *this, context.sampleRate(), - adoptPtr(new IIRProcessor(context.sampleRate(), 1, feedforwardCoef, feedbackCoef)))); + wrapUnique(new IIRProcessor(context.sampleRate(), 1, feedforwardCoef, feedbackCoef)))); // Histogram of the IIRFilter order. createIIRFilter ensures that the length of |feedbackCoef| // is in the range [1, IIRFilter::kMaxOrder + 1]. The order is one less than the length of this
diff --git a/third_party/WebKit/Source/modules/webaudio/IIRProcessor.cpp b/third_party/WebKit/Source/modules/webaudio/IIRProcessor.cpp index 660dd44..e6ce38f 100644 --- a/third_party/WebKit/Source/modules/webaudio/IIRProcessor.cpp +++ b/third_party/WebKit/Source/modules/webaudio/IIRProcessor.cpp
@@ -5,6 +5,8 @@ #include "modules/webaudio/IIRProcessor.h" #include "modules/webaudio/IIRDSPKernel.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -46,7 +48,7 @@ m_feedback[0] = 1; } - m_responseKernel = adoptPtr(new IIRDSPKernel(this)); + m_responseKernel = wrapUnique(new IIRDSPKernel(this)); } IIRProcessor::~IIRProcessor() @@ -55,9 +57,9 @@ uninitialize(); } -PassOwnPtr<AudioDSPKernel> IIRProcessor::createKernel() +std::unique_ptr<AudioDSPKernel> IIRProcessor::createKernel() { - return adoptPtr(new IIRDSPKernel(this)); + return wrapUnique(new IIRDSPKernel(this)); } void IIRProcessor::process(const AudioBus* source, AudioBus* destination, size_t framesToProcess)
diff --git a/third_party/WebKit/Source/modules/webaudio/IIRProcessor.h b/third_party/WebKit/Source/modules/webaudio/IIRProcessor.h index e6866c0b..11b39be6 100644 --- a/third_party/WebKit/Source/modules/webaudio/IIRProcessor.h +++ b/third_party/WebKit/Source/modules/webaudio/IIRProcessor.h
@@ -9,6 +9,7 @@ #include "platform/audio/AudioDSPKernel.h" #include "platform/audio/AudioDSPKernelProcessor.h" #include "platform/audio/IIRFilter.h" +#include <memory> namespace blink { @@ -20,7 +21,7 @@ const Vector<double>& feedforwardCoef, const Vector<double>& feedbackCoef); ~IIRProcessor() override; - PassOwnPtr<AudioDSPKernel> createKernel() override; + std::unique_ptr<AudioDSPKernel> createKernel() override; void process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) override; @@ -36,7 +37,7 @@ AudioDoubleArray m_feedback; AudioDoubleArray m_feedforward; // This holds the IIR kernel for computing the frequency response. - OwnPtr<IIRDSPKernel> m_responseKernel; + std::unique_ptr<IIRDSPKernel> m_responseKernel; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.cpp b/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.cpp index c1fb73a..f4309bb 100644 --- a/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.cpp
@@ -22,16 +22,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/MediaElementAudioSourceNode.h" #include "core/dom/CrossThreadTask.h" #include "core/html/HTMLMediaElement.h" #include "core/inspector/ConsoleMessage.h" #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/AudioNodeOutput.h" +#include "modules/webaudio/MediaElementAudioSourceNode.h" #include "platform/Logging.h" #include "platform/audio/AudioUtilities.h" #include "platform/weborigin/SecurityOrigin.h" #include "wtf/Locker.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -90,7 +91,7 @@ if (sourceSampleRate != sampleRate()) { double scaleFactor = sourceSampleRate / sampleRate(); - m_multiChannelResampler = adoptPtr(new MultiChannelResampler(scaleFactor, numberOfChannels)); + m_multiChannelResampler = wrapUnique(new MultiChannelResampler(scaleFactor, numberOfChannels)); } else { // Bypass resampling. m_multiChannelResampler.reset();
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.h b/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.h index c0181005..20fa9a6 100644 --- a/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.h +++ b/third_party/WebKit/Source/modules/webaudio/MediaElementAudioSourceNode.h
@@ -28,9 +28,9 @@ #include "modules/webaudio/AudioSourceNode.h" #include "platform/audio/AudioSourceProviderClient.h" #include "platform/audio/MultiChannelResampler.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> namespace blink { @@ -78,7 +78,7 @@ unsigned m_sourceNumberOfChannels; double m_sourceSampleRate; - OwnPtr<MultiChannelResampler> m_multiChannelResampler; + std::unique_ptr<MultiChannelResampler> m_multiChannelResampler; // |m_passesCurrentSrcCORSAccessCheck| holds the value of // context()->getSecurityOrigin() && context()->getSecurityOrigin()->canRequest(mediaElement()->currentSrc()),
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.h b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.h index cf4989d..2267b15 100644 --- a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.h +++ b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.h
@@ -28,7 +28,6 @@ #include "modules/mediastream/MediaStream.h" #include "modules/webaudio/AudioBasicInspectorNode.h" #include "platform/audio/AudioBus.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp index 0a911f61..e976165 100644 --- a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp
@@ -29,10 +29,11 @@ #include "modules/webaudio/AudioNodeOutput.h" #include "platform/Logging.h" #include "wtf/Locker.h" +#include <memory> namespace blink { -MediaStreamAudioSourceHandler::MediaStreamAudioSourceHandler(AudioNode& node, MediaStream& mediaStream, MediaStreamTrack* audioTrack, PassOwnPtr<AudioSourceProvider> audioSourceProvider) +MediaStreamAudioSourceHandler::MediaStreamAudioSourceHandler(AudioNode& node, MediaStream& mediaStream, MediaStreamTrack* audioTrack, std::unique_ptr<AudioSourceProvider> audioSourceProvider) : AudioHandler(NodeTypeMediaStreamAudioSource, node, node.context()->sampleRate()) , m_mediaStream(mediaStream) , m_audioTrack(audioTrack) @@ -46,7 +47,7 @@ initialize(); } -PassRefPtr<MediaStreamAudioSourceHandler> MediaStreamAudioSourceHandler::create(AudioNode& node, MediaStream& mediaStream, MediaStreamTrack* audioTrack, PassOwnPtr<AudioSourceProvider> audioSourceProvider) +PassRefPtr<MediaStreamAudioSourceHandler> MediaStreamAudioSourceHandler::create(AudioNode& node, MediaStream& mediaStream, MediaStreamTrack* audioTrack, std::unique_ptr<AudioSourceProvider> audioSourceProvider) { return adoptRef(new MediaStreamAudioSourceHandler(node, mediaStream, audioTrack, std::move(audioSourceProvider))); } @@ -110,7 +111,7 @@ // ---------------------------------------------------------------- -MediaStreamAudioSourceNode::MediaStreamAudioSourceNode(AbstractAudioContext& context, MediaStream& mediaStream, MediaStreamTrack* audioTrack, PassOwnPtr<AudioSourceProvider> audioSourceProvider) +MediaStreamAudioSourceNode::MediaStreamAudioSourceNode(AbstractAudioContext& context, MediaStream& mediaStream, MediaStreamTrack* audioTrack, std::unique_ptr<AudioSourceProvider> audioSourceProvider) : AudioSourceNode(context) { setHandler(MediaStreamAudioSourceHandler::create(*this, mediaStream, audioTrack, std::move(audioSourceProvider))); @@ -135,7 +136,7 @@ // Use the first audio track in the media stream. MediaStreamTrack* audioTrack = audioTracks[0]; - OwnPtr<AudioSourceProvider> provider = audioTrack->createWebAudioSource(); + std::unique_ptr<AudioSourceProvider> provider = audioTrack->createWebAudioSource(); MediaStreamAudioSourceNode* node = new MediaStreamAudioSourceNode(context, mediaStream, audioTrack, std::move(provider));
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.h b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.h index da461bc..d0f448d 100644 --- a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.h +++ b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.h
@@ -29,9 +29,9 @@ #include "modules/webaudio/AudioSourceNode.h" #include "platform/audio/AudioSourceProvider.h" #include "platform/audio/AudioSourceProviderClient.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Threading.h" +#include <memory> namespace blink { @@ -39,7 +39,7 @@ class MediaStreamAudioSourceHandler final : public AudioHandler { public: - static PassRefPtr<MediaStreamAudioSourceHandler> create(AudioNode&, MediaStream&, MediaStreamTrack*, PassOwnPtr<AudioSourceProvider>); + static PassRefPtr<MediaStreamAudioSourceHandler> create(AudioNode&, MediaStream&, MediaStreamTrack*, std::unique_ptr<AudioSourceProvider>); ~MediaStreamAudioSourceHandler() override; MediaStream* getMediaStream() { return m_mediaStream.get(); } @@ -54,7 +54,7 @@ AudioSourceProvider* getAudioSourceProvider() const { return m_audioSourceProvider.get(); } private: - MediaStreamAudioSourceHandler(AudioNode&, MediaStream&, MediaStreamTrack*, PassOwnPtr<AudioSourceProvider>); + MediaStreamAudioSourceHandler(AudioNode&, MediaStream&, MediaStreamTrack*, std::unique_ptr<AudioSourceProvider>); // As an audio source, we will never propagate silence. bool propagatesSilence() const override { return false; } @@ -62,7 +62,7 @@ // MediaStreamAudioSourceNode. Persistent<MediaStream> m_mediaStream; Persistent<MediaStreamTrack> m_audioTrack; - OwnPtr<AudioSourceProvider> m_audioSourceProvider; + std::unique_ptr<AudioSourceProvider> m_audioSourceProvider; Mutex m_processLock; @@ -83,7 +83,7 @@ void setFormat(size_t numberOfChannels, float sampleRate) override; private: - MediaStreamAudioSourceNode(AbstractAudioContext&, MediaStream&, MediaStreamTrack*, PassOwnPtr<AudioSourceProvider>); + MediaStreamAudioSourceNode(AbstractAudioContext&, MediaStream&, MediaStreamTrack*, std::unique_ptr<AudioSourceProvider>); }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp index 92696e0..b1a943e8 100644 --- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
@@ -22,16 +22,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/OfflineAudioDestinationNode.h" #include "core/dom/CrossThreadTask.h" #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/AudioNodeInput.h" #include "modules/webaudio/AudioNodeOutput.h" #include "modules/webaudio/OfflineAudioContext.h" +#include "modules/webaudio/OfflineAudioDestinationNode.h" #include "platform/audio/AudioBus.h" #include "platform/audio/DenormalDisabler.h" #include "platform/audio/HRTFDatabaseLoader.h" #include "public/platform/Platform.h" +#include "wtf/PtrUtil.h" #include <algorithm> namespace blink { @@ -41,7 +42,7 @@ OfflineAudioDestinationHandler::OfflineAudioDestinationHandler(AudioNode& node, AudioBuffer* renderTarget) : AudioDestinationHandler(node, renderTarget->sampleRate()) , m_renderTarget(renderTarget) - , m_renderThread(adoptPtr(Platform::current()->createThread("offline audio renderer"))) + , m_renderThread(wrapUnique(Platform::current()->createThread("offline audio renderer"))) , m_framesProcessed(0) , m_framesToProcess(0) , m_isRenderingStarted(false)
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h index 69a700b..b4a4716 100644 --- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h +++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h
@@ -31,6 +31,7 @@ #include "public/platform/WebThread.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -98,7 +99,7 @@ RefPtr<AudioBus> m_renderBus; // Rendering thread. - OwnPtr<WebThread> m_renderThread; + std::unique_ptr<WebThread> m_renderThread; // These variables are for counting the number of frames for the current // progress and the remaining frames to be processed.
diff --git a/third_party/WebKit/Source/modules/webaudio/OscillatorNode.h b/third_party/WebKit/Source/modules/webaudio/OscillatorNode.h index 841bad2..f515946e 100644 --- a/third_party/WebKit/Source/modules/webaudio/OscillatorNode.h +++ b/third_party/WebKit/Source/modules/webaudio/OscillatorNode.h
@@ -28,7 +28,6 @@ #include "modules/webaudio/AudioParam.h" #include "modules/webaudio/AudioScheduledSourceNode.h" #include "platform/audio/AudioBus.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Threading.h"
diff --git a/third_party/WebKit/Source/modules/webaudio/PannerNode.h b/third_party/WebKit/Source/modules/webaudio/PannerNode.h index e360a27..ca5fde4 100644 --- a/third_party/WebKit/Source/modules/webaudio/PannerNode.h +++ b/third_party/WebKit/Source/modules/webaudio/PannerNode.h
@@ -34,6 +34,7 @@ #include "platform/audio/Panner.h" #include "platform/geometry/FloatPoint3D.h" #include "wtf/HashMap.h" +#include <memory> namespace blink { @@ -152,7 +153,7 @@ // This Persistent doesn't make a reference cycle including the owner // PannerNode. Persistent<AudioListener> m_listener; - OwnPtr<Panner> m_panner; + std::unique_ptr<Panner> m_panner; unsigned m_panningModel; unsigned m_distanceModel;
diff --git a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp index cbe3d43..fdd7ebd 100644 --- a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp +++ b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
@@ -26,15 +26,17 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/PeriodicWave.h" #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/OscillatorNode.h" +#include "modules/webaudio/PeriodicWave.h" #include "platform/audio/FFTFrame.h" #include "platform/audio/VectorMath.h" +#include "wtf/PtrUtil.h" #include <algorithm> +#include <memory> namespace blink { @@ -242,7 +244,7 @@ // Create the band-limited table. unsigned waveSize = periodicWaveSize(); - OwnPtr<AudioFloatArray> table = adoptPtr(new AudioFloatArray(waveSize)); + std::unique_ptr<AudioFloatArray> table = wrapUnique(new AudioFloatArray(waveSize)); adjustV8ExternalMemory(waveSize * sizeof(float)); m_bandLimitedTables.append(std::move(table));
diff --git a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.h b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.h index 17a7844..a5629b9 100644 --- a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.h +++ b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.h
@@ -34,6 +34,7 @@ #include "platform/audio/AudioArray.h" #include "wtf/Forward.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -104,7 +105,7 @@ // Creates tables based on numberOfComponents Fourier coefficients. void createBandLimitedTables(const float* real, const float* imag, unsigned numberOfComponents, bool disableNormalization); - Vector<OwnPtr<AudioFloatArray>> m_bandLimitedTables; + Vector<std::unique_ptr<AudioFloatArray>> m_bandLimitedTables; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp b/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp index 212e4d0..3acf089 100644 --- a/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp +++ b/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp
@@ -27,6 +27,7 @@ #include "platform/audio/AudioUtilities.h" #include "platform/audio/VectorMath.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" #include <algorithm> #include <complex> #include <limits.h> @@ -54,7 +55,7 @@ , m_maxDecibels(DefaultMaxDecibels) , m_lastAnalysisTime(-1) { - m_analysisFrame = adoptPtr(new FFTFrame(DefaultFFTSize)); + m_analysisFrame = wrapUnique(new FFTFrame(DefaultFFTSize)); } bool RealtimeAnalyser::setFftSize(size_t size) @@ -69,7 +70,7 @@ return false; if (m_fftSize != size) { - m_analysisFrame = adoptPtr(new FFTFrame(size)); + m_analysisFrame = wrapUnique(new FFTFrame(size)); // m_magnitudeBuffer has size = fftSize / 2 because it contains floats reduced from complex values in m_analysisFrame. m_magnitudeBuffer.allocate(size / 2); m_fftSize = size;
diff --git a/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.h b/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.h index 2b27a00..6d61f94 100644 --- a/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.h +++ b/third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.h
@@ -29,7 +29,7 @@ #include "platform/audio/AudioArray.h" #include "platform/audio/FFTFrame.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -81,7 +81,7 @@ RefPtr<AudioBus> m_downMixBus; size_t m_fftSize; - OwnPtr<FFTFrame> m_analysisFrame; + std::unique_ptr<FFTFrame> m_analysisFrame; void doFFTAnalysis(); // Convert the contents of magnitudeBuffer to byte values, saving the result in |destination|.
diff --git a/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp index db38a7d..d22af2d 100644 --- a/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/ScriptProcessorNodeTest.cpp
@@ -2,16 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "modules/webaudio/ScriptProcessorNode.h" #include "core/testing/DummyPageHolder.h" #include "modules/webaudio/OfflineAudioContext.h" +#include "modules/webaudio/ScriptProcessorNode.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { TEST(ScriptProcessorNodeTest, BufferLifetime) { - OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); + std::unique_ptr<DummyPageHolder> page = DummyPageHolder::create(); OfflineAudioContext* context = OfflineAudioContext::create(&page->document(), 2, 1, 48000, ASSERT_NO_EXCEPTION); ScriptProcessorNode* node = context->createScriptProcessor(ASSERT_NO_EXCEPTION); ScriptProcessorHandler& handler = static_cast<ScriptProcessorHandler&>(node->handler());
diff --git a/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.h b/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.h index 32f1d9b1..4837c43 100644 --- a/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.h +++ b/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.h
@@ -10,6 +10,7 @@ #include "modules/webaudio/AudioParam.h" #include "platform/audio/AudioBus.h" #include "platform/audio/Spatializer.h" +#include <memory> namespace blink { @@ -31,7 +32,7 @@ private: StereoPannerHandler(AudioNode&, float sampleRate, AudioParamHandler& pan); - OwnPtr<Spatializer> m_stereoPanner; + std::unique_ptr<Spatializer> m_stereoPanner; RefPtr<AudioParamHandler> m_pan; AudioFloatArray m_sampleAccuratePanValues;
diff --git a/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp b/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp index a195c09a..2f02f60 100644 --- a/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/StereoPannerNodeTest.cpp
@@ -2,16 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "modules/webaudio/StereoPannerNode.h" #include "core/testing/DummyPageHolder.h" #include "modules/webaudio/OfflineAudioContext.h" +#include "modules/webaudio/StereoPannerNode.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { TEST(StereoPannerNodeTest, StereoPannerLifetime) { - OwnPtr<DummyPageHolder> page = DummyPageHolder::create(); + std::unique_ptr<DummyPageHolder> page = DummyPageHolder::create(); OfflineAudioContext* context = OfflineAudioContext::create(&page->document(), 2, 1, 48000, ASSERT_NO_EXCEPTION); StereoPannerNode* node = context->createStereoPanner(ASSERT_NO_EXCEPTION); StereoPannerHandler& handler = static_cast<StereoPannerHandler&>(node->handler());
diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp b/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp index fdd64071..f841b05 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp
@@ -23,6 +23,7 @@ */ #include "modules/webaudio/WaveShaperDSPKernel.h" +#include "wtf/PtrUtil.h" #include "wtf/Threading.h" #include <algorithm> @@ -40,12 +41,12 @@ void WaveShaperDSPKernel::lazyInitializeOversampling() { if (!m_tempBuffer) { - m_tempBuffer = adoptPtr(new AudioFloatArray(RenderingQuantum * 2)); - m_tempBuffer2 = adoptPtr(new AudioFloatArray(RenderingQuantum * 4)); - m_upSampler = adoptPtr(new UpSampler(RenderingQuantum)); - m_downSampler = adoptPtr(new DownSampler(RenderingQuantum * 2)); - m_upSampler2 = adoptPtr(new UpSampler(RenderingQuantum * 2)); - m_downSampler2 = adoptPtr(new DownSampler(RenderingQuantum * 4)); + m_tempBuffer = wrapUnique(new AudioFloatArray(RenderingQuantum * 2)); + m_tempBuffer2 = wrapUnique(new AudioFloatArray(RenderingQuantum * 4)); + m_upSampler = wrapUnique(new UpSampler(RenderingQuantum)); + m_downSampler = wrapUnique(new DownSampler(RenderingQuantum * 2)); + m_upSampler2 = wrapUnique(new UpSampler(RenderingQuantum * 2)); + m_downSampler2 = wrapUnique(new DownSampler(RenderingQuantum * 4)); } }
diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.h b/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.h index 7d8c2dd3..67d143a 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.h +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.h
@@ -30,7 +30,7 @@ #include "platform/audio/AudioDSPKernel.h" #include "platform/audio/DownSampler.h" #include "platform/audio/UpSampler.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -62,12 +62,12 @@ WaveShaperProcessor* getWaveShaperProcessor() { return static_cast<WaveShaperProcessor*>(processor()); } // Oversampling. - OwnPtr<AudioFloatArray> m_tempBuffer; - OwnPtr<AudioFloatArray> m_tempBuffer2; - OwnPtr<UpSampler> m_upSampler; - OwnPtr<DownSampler> m_downSampler; - OwnPtr<UpSampler> m_upSampler2; - OwnPtr<DownSampler> m_downSampler2; + std::unique_ptr<AudioFloatArray> m_tempBuffer; + std::unique_ptr<AudioFloatArray> m_tempBuffer2; + std::unique_ptr<UpSampler> m_upSampler; + std::unique_ptr<DownSampler> m_downSampler; + std::unique_ptr<UpSampler> m_upSampler2; + std::unique_ptr<DownSampler> m_downSampler2; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp b/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp index 6247608..ae9ae322 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp
@@ -22,19 +22,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/WaveShaperNode.h" #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "modules/webaudio/AbstractAudioContext.h" #include "modules/webaudio/AudioBasicProcessorHandler.h" +#include "modules/webaudio/WaveShaperNode.h" +#include "wtf/PtrUtil.h" namespace blink { WaveShaperNode::WaveShaperNode(AbstractAudioContext& context) : AudioNode(context) { - setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShaper, *this, context.sampleRate(), adoptPtr(new WaveShaperProcessor(context.sampleRate(), 1)))); + setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShaper, *this, context.sampleRate(), wrapUnique(new WaveShaperProcessor(context.sampleRate(), 1)))); handler().initialize(); }
diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp index a289cb7a..3ad18df 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp
@@ -22,8 +22,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "modules/webaudio/WaveShaperProcessor.h" #include "modules/webaudio/WaveShaperDSPKernel.h" +#include "modules/webaudio/WaveShaperProcessor.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -39,9 +41,9 @@ uninitialize(); } -PassOwnPtr<AudioDSPKernel> WaveShaperProcessor::createKernel() +std::unique_ptr<AudioDSPKernel> WaveShaperProcessor::createKernel() { - return adoptPtr(new WaveShaperDSPKernel(this)); + return wrapUnique(new WaveShaperDSPKernel(this)); } void WaveShaperProcessor::setCurve(DOMFloat32Array* curve)
diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h index 3a54e9b..b6b6708 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h
@@ -31,6 +31,7 @@ #include "platform/audio/AudioDSPKernelProcessor.h" #include "wtf/RefPtr.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> namespace blink { @@ -48,7 +49,7 @@ ~WaveShaperProcessor() override; - PassOwnPtr<AudioDSPKernel> createKernel() override; + std::unique_ptr<AudioDSPKernel> createKernel() override; void process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) override;
diff --git a/third_party/WebKit/Source/modules/webdatabase/ChangeVersionWrapper.h b/third_party/WebKit/Source/modules/webdatabase/ChangeVersionWrapper.h index dbf4c20..00d7b1c 100644 --- a/third_party/WebKit/Source/modules/webdatabase/ChangeVersionWrapper.h +++ b/third_party/WebKit/Source/modules/webdatabase/ChangeVersionWrapper.h
@@ -31,6 +31,7 @@ #include "modules/webdatabase/SQLTransactionBackend.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -50,7 +51,7 @@ String m_oldVersion; String m_newVersion; - OwnPtr<SQLErrorData> m_sqlError; + std::unique_ptr<SQLErrorData> m_sqlError; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webdatabase/Database.cpp b/third_party/WebKit/Source/modules/webdatabase/Database.cpp index 2f31777..101fb0a7 100644 --- a/third_party/WebKit/Source/modules/webdatabase/Database.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
@@ -55,6 +55,7 @@ #include "public/platform/WebSecurityOrigin.h" #include "wtf/Atomics.h" #include "wtf/CurrentTime.h" +#include <memory> // Registering "opened" databases with the DatabaseTracker // ======================================================= @@ -265,7 +266,7 @@ DatabaseTracker::tracker().prepareToOpenDatabase(this); bool success = false; - OwnPtr<DatabaseOpenTask> task = DatabaseOpenTask::create(this, setVersionInNewDatabase, &synchronizer, error, errorMessage, success); + std::unique_ptr<DatabaseOpenTask> task = DatabaseOpenTask::create(this, setVersionInNewDatabase, &synchronizer, error, errorMessage, success); getDatabaseContext()->databaseThread()->scheduleTask(std::move(task)); synchronizer.waitForTaskCompletion(); @@ -331,7 +332,7 @@ transaction = m_transactionQueue.takeFirst(); if (transaction && getDatabaseContext()->databaseThreadAvailable()) { - OwnPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); + std::unique_ptr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); WTF_LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for transaction %p\n", task.get(), task->transaction()); m_transactionInProgress = true; getDatabaseContext()->databaseThread()->scheduleTask(std::move(task)); @@ -345,7 +346,7 @@ if (!getDatabaseContext()->databaseThreadAvailable()) return; - OwnPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); + std::unique_ptr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); WTF_LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for the transaction step\n", task.get()); getDatabaseContext()->databaseThread()->scheduleTask(std::move(task)); } @@ -809,7 +810,7 @@ runTransaction(callback, errorCallback, successCallback, true); } -static void callTransactionErrorCallback(SQLTransactionErrorCallback* callback, PassOwnPtr<SQLErrorData> errorData) +static void callTransactionErrorCallback(SQLTransactionErrorCallback* callback, std::unique_ptr<SQLErrorData> errorData) { callback->handleEvent(SQLError::create(*errorData)); } @@ -835,7 +836,7 @@ SQLTransactionErrorCallback* callback = transaction->releaseErrorCallback(); ASSERT(callback == originalErrorCallback); if (callback) { - OwnPtr<SQLErrorData> error = SQLErrorData::create(SQLError::UNKNOWN_ERR, "database has been closed"); + std::unique_ptr<SQLErrorData> error = SQLErrorData::create(SQLError::UNKNOWN_ERR, "database has been closed"); getExecutionContext()->postTask(BLINK_FROM_HERE, createSameThreadTask(&callTransactionErrorCallback, callback, passed(std::move(error)))); } } @@ -887,7 +888,7 @@ if (!getDatabaseContext()->databaseThreadAvailable()) return result; - OwnPtr<DatabaseTableNamesTask> task = DatabaseTableNamesTask::create(this, &synchronizer, result); + std::unique_ptr<DatabaseTableNamesTask> task = DatabaseTableNamesTask::create(this, &synchronizer, result); getDatabaseContext()->databaseThread()->scheduleTask(std::move(task)); synchronizer.waitForTaskCompletion();
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseTask.h b/third_party/WebKit/Source/modules/webdatabase/DatabaseTask.h index 84deeb1..6102d48 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseTask.h +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseTask.h
@@ -35,11 +35,11 @@ #include "modules/webdatabase/SQLTransactionBackend.h" #include "platform/TaskSynchronizer.h" #include "platform/heap/Handle.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Threading.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -73,9 +73,9 @@ class Database::DatabaseOpenTask final : public DatabaseTask { public: - static PassOwnPtr<DatabaseOpenTask> create(Database* db, bool setVersionInNewDatabase, TaskSynchronizer* synchronizer, DatabaseError& error, String& errorMessage, bool& success) + static std::unique_ptr<DatabaseOpenTask> create(Database* db, bool setVersionInNewDatabase, TaskSynchronizer* synchronizer, DatabaseError& error, String& errorMessage, bool& success) { - return adoptPtr(new DatabaseOpenTask(db, setVersionInNewDatabase, synchronizer, error, errorMessage, success)); + return wrapUnique(new DatabaseOpenTask(db, setVersionInNewDatabase, synchronizer, error, errorMessage, success)); } private: @@ -94,9 +94,9 @@ class Database::DatabaseCloseTask final : public DatabaseTask { public: - static PassOwnPtr<DatabaseCloseTask> create(Database* db, TaskSynchronizer* synchronizer) + static std::unique_ptr<DatabaseCloseTask> create(Database* db, TaskSynchronizer* synchronizer) { - return adoptPtr(new DatabaseCloseTask(db, synchronizer)); + return wrapUnique(new DatabaseCloseTask(db, synchronizer)); } private: @@ -113,9 +113,9 @@ ~DatabaseTransactionTask() override; // Transaction task is never synchronous, so no 'synchronizer' parameter. - static PassOwnPtr<DatabaseTransactionTask> create(SQLTransactionBackend* transaction) + static std::unique_ptr<DatabaseTransactionTask> create(SQLTransactionBackend* transaction) { - return adoptPtr(new DatabaseTransactionTask(transaction)); + return wrapUnique(new DatabaseTransactionTask(transaction)); } SQLTransactionBackend* transaction() const { return m_transaction.get(); } @@ -134,9 +134,9 @@ class Database::DatabaseTableNamesTask final : public DatabaseTask { public: - static PassOwnPtr<DatabaseTableNamesTask> create(Database* db, TaskSynchronizer* synchronizer, Vector<String>& names) + static std::unique_ptr<DatabaseTableNamesTask> create(Database* db, TaskSynchronizer* synchronizer, Vector<String>& names) { - return adoptPtr(new DatabaseTableNamesTask(db, synchronizer, names)); + return wrapUnique(new DatabaseTableNamesTask(db, synchronizer, names)); } private:
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp index 0fe5777..e6bc6f22 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp
@@ -36,11 +36,13 @@ #include "platform/ThreadSafeFunctional.h" #include "platform/WebThreadSupportingGC.h" #include "public/platform/Platform.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { DatabaseThread::DatabaseThread() - : m_transactionClient(adoptPtr(new SQLTransactionClient())) + : m_transactionClient(wrapUnique(new SQLTransactionClient())) , m_cleanupSync(nullptr) , m_terminationRequested(false) { @@ -160,7 +162,7 @@ return !isMainThread(); } -void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) +void DatabaseThread::scheduleTask(std::unique_ptr<DatabaseTask> task) { ASSERT(m_thread); #if ENABLE(ASSERT)
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.h b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.h index 26355298..afe5454 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.h +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.h
@@ -31,9 +31,8 @@ #include "platform/WebThreadSupportingGC.h" #include "platform/heap/Handle.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> namespace blink { @@ -54,7 +53,7 @@ void terminate(); // Callable from the main thread or the database thread. - void scheduleTask(PassOwnPtr<DatabaseTask>); + void scheduleTask(std::unique_ptr<DatabaseTask>); bool isDatabaseThread() const; // Callable only from the database thread. @@ -72,14 +71,14 @@ void cleanupDatabaseThread(); void cleanupDatabaseThreadCompleted(); - OwnPtr<WebThreadSupportingGC> m_thread; + std::unique_ptr<WebThreadSupportingGC> m_thread; // This set keeps track of the open databases that have been used on this thread. // This must be updated in the database thread though it is constructed and // destructed in the context thread. HashSet<CrossThreadPersistent<Database>> m_openDatabaseSet; - OwnPtr<SQLTransactionClient> m_transactionClient; + std::unique_ptr<SQLTransactionClient> m_transactionClient; CrossThreadPersistent<SQLTransactionCoordinator> m_transactionCoordinator; TaskSynchronizer* m_cleanupSync;
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp index d19c06e4..3c31da46 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp
@@ -88,7 +88,7 @@ { MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); if (!m_openDatabaseMap) - m_openDatabaseMap = adoptPtr(new DatabaseOriginMap); + m_openDatabaseMap = wrapUnique(new DatabaseOriginMap); String originString = database->getSecurityOrigin()->toRawString(); DatabaseNameMap* nameMap = m_openDatabaseMap->get(originString);
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.h b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.h index 03a57a7..3a8bc64 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.h +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.h
@@ -38,6 +38,7 @@ #include "wtf/ThreadingPrimitives.h" #include "wtf/text/StringHash.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -85,7 +86,7 @@ Mutex m_openDatabaseMapGuard; - mutable OwnPtr<DatabaseOriginMap> m_openDatabaseMap; + mutable std::unique_ptr<DatabaseOriginMap> m_openDatabaseMap; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.h b/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.h index 5ceb9c1..b8ec23c 100644 --- a/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.h +++ b/third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.h
@@ -35,7 +35,6 @@ #include "platform/heap/Handle.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLError.h b/third_party/WebKit/Source/modules/webdatabase/SQLError.h index 25187680..730f5c9 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLError.h +++ b/third_party/WebKit/Source/modules/webdatabase/SQLError.h
@@ -30,24 +30,26 @@ #define SQLError_h #include "bindings/core/v8/ScriptWrappable.h" +#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { class SQLErrorData { USING_FAST_MALLOC(SQLErrorData); public: - static PassOwnPtr<SQLErrorData> create(unsigned code, const String& message) + static std::unique_ptr<SQLErrorData> create(unsigned code, const String& message) { - return adoptPtr(new SQLErrorData(code, message)); + return wrapUnique(new SQLErrorData(code, message)); } - static PassOwnPtr<SQLErrorData> create(unsigned code, const char* message, int sqliteCode, const char* sqliteMessage) + static std::unique_ptr<SQLErrorData> create(unsigned code, const char* message, int sqliteCode, const char* sqliteMessage) { return create(code, String::format("%s (%d %s)", message, sqliteCode, sqliteMessage)); } - static PassOwnPtr<SQLErrorData> create(const SQLErrorData& data) + static std::unique_ptr<SQLErrorData> create(const SQLErrorData& data) { return create(data.code(), data.message()); }
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.h b/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.h index 204d50b..1f789c6 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.h +++ b/third_party/WebKit/Source/modules/webdatabase/SQLStatementBackend.h
@@ -33,6 +33,7 @@ #include "wtf/Forward.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -71,7 +72,7 @@ bool m_hasCallback; bool m_hasErrorCallback; - OwnPtr<SQLErrorData> m_error; + std::unique_ptr<SQLErrorData> m_error; Member<SQLResultSet> m_resultSet; int m_permissions;
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h b/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h index 21e5eaf7..ed47e55 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h +++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h
@@ -35,6 +35,7 @@ #include "modules/webdatabase/SQLStatement.h" #include "modules/webdatabase/SQLTransactionStateMachine.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -110,7 +111,7 @@ Member<SQLTransactionErrorCallback> m_errorCallback; bool m_executeSqlAllowed; - OwnPtr<SQLErrorData> m_transactionError; + std::unique_ptr<SQLErrorData> m_transactionError; bool m_readOnly; };
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp index d1f589f8..8a4f350 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.cpp
@@ -41,7 +41,9 @@ #include "modules/webdatabase/sqlite/SQLValue.h" #include "modules/webdatabase/sqlite/SQLiteTransaction.h" #include "platform/Logging.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" +#include <memory> // How does a SQLTransaction work? @@ -253,7 +255,7 @@ // // When executing the transaction (in DatabaseThread::databaseThread()): // ==================================================================== -// OwnPtr<DatabaseTask> task; // points to ... +// std::unique_ptr<DatabaseTask> task; // points to ... // --> DatabaseTransactionTask // Member<SQLTransactionBackend> m_transaction points to ... // --> SQLTransactionBackend // Member<SQLTransaction> m_frontend; // --> SQLTransaction // Member<SQLTransactionBackend> m_backend points to ... @@ -277,7 +279,7 @@ // However, there will still be a DatabaseTask pointing to the SQLTransactionBackend (see // the "When executing the transaction" chain above). This will keep the // SQLTransactionBackend alive until DatabaseThread::databaseThread() releases its -// task OwnPtr. +// task std::unique_ptr. // // What happens if a transaction is interrupted? // ============================================ @@ -561,7 +563,7 @@ m_database->sqliteDatabase().setMaximumSize(m_database->maximumSize()); ASSERT(!m_sqliteTransaction); - m_sqliteTransaction = adoptPtr(new SQLiteTransaction(m_database->sqliteDatabase(), m_readOnly)); + m_sqliteTransaction = wrapUnique(new SQLiteTransaction(m_database->sqliteDatabase(), m_readOnly)); m_database->resetDeletes(); m_database->disableAuthorizer();
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.h b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.h index c3504d8d..989d733 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.h +++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionBackend.h
@@ -35,6 +35,7 @@ #include "wtf/Deque.h" #include "wtf/Forward.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> namespace blink { @@ -110,7 +111,7 @@ Member<Database> m_database; Member<SQLTransactionWrapper> m_wrapper; - OwnPtr<SQLErrorData> m_transactionError; + std::unique_ptr<SQLErrorData> m_transactionError; bool m_hasCallback; bool m_hasSuccessCallback; @@ -124,7 +125,7 @@ Mutex m_statementMutex; Deque<CrossThreadPersistent<SQLStatementBackend>> m_statementQueue; - OwnPtr<SQLiteTransaction> m_sqliteTransaction; + std::unique_ptr<SQLiteTransaction> m_sqliteTransaction; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp index 9b0db26..230486d9 100644 --- a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp
@@ -30,7 +30,9 @@ #include "platform/heap/SafePoint.h" #include "third_party/sqlite/sqlite3.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" +#include <memory> // SQLite 3.6.16 makes sqlite3_prepare_v2 automatically retry preparing the statement // once if the database scheme has changed. We rely on this behavior. @@ -100,8 +102,8 @@ // Need to pass non-stack |const char*| and |sqlite3_stmt*| to avoid race // with Oilpan stack scanning. - OwnPtr<const char*> tail = adoptPtr(new const char*); - OwnPtr<sqlite3_stmt*> statement = adoptPtr(new sqlite3_stmt*); + std::unique_ptr<const char*> tail = wrapUnique(new const char*); + std::unique_ptr<sqlite3_stmt*> statement = wrapUnique(new sqlite3_stmt*); *tail = nullptr; *statement = nullptr; int error;
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp index 0f85d11..a9ddea2 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp
@@ -28,6 +28,7 @@ #include "platform/graphics/gpu/DrawingBuffer.h" #include "public/platform/Platform.h" #include "public/platform/WebGraphicsContext3DProvider.h" +#include <memory> namespace blink { @@ -39,11 +40,11 @@ } WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); - OwnPtr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(canvas, attributes, 2)); + std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(canvas, attributes, 2)); if (!contextProvider) return nullptr; gpu::gles2::GLES2Interface* gl = contextProvider->contextGL(); - OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); + std::unique_ptr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); if (!extensionsUtil) return nullptr; if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { @@ -69,7 +70,7 @@ canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, error)); } -WebGL2RenderingContext::WebGL2RenderingContext(HTMLCanvasElement* passedCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGL2RenderingContext::WebGL2RenderingContext(HTMLCanvasElement* passedCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGL2RenderingContextBase(passedCanvas, std::move(contextProvider), requestedAttributes) { }
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.h b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.h index ea07b6d..68959acd 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.h +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.h
@@ -7,6 +7,7 @@ #include "core/html/canvas/CanvasRenderingContextFactory.h" #include "modules/webgl/WebGL2RenderingContextBase.h" +#include <memory> namespace blink { @@ -42,7 +43,7 @@ DECLARE_VIRTUAL_TRACE_WRAPPERS(); protected: - WebGL2RenderingContext(HTMLCanvasElement* passedCanvas, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes& requestedAttributes); + WebGL2RenderingContext(HTMLCanvasElement* passedCanvas, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes& requestedAttributes); Member<EXTColorBufferFloat> m_extColorBufferFloat; Member<EXTDisjointTimerQuery> m_extDisjointTimerQuery;
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp index d5e7e456..1a18fb1 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -26,9 +26,9 @@ #include "modules/webgl/WebGLVertexArrayObject.h" #include "platform/CheckedInt.h" #include "public/platform/WebGraphicsContext3DProvider.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" +#include <memory> using WTF::String; @@ -114,7 +114,7 @@ GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, }; -WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passedCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passedCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGLRenderingContextBase(passedCanvas, std::move(contextProvider), requestedAttributes) { m_supportedInternalFormatsStorage.insert(kSupportedInternalFormatsStorage, kSupportedInternalFormatsStorage + WTF_ARRAY_LENGTH(kSupportedInternalFormatsStorage)); @@ -405,20 +405,20 @@ switch (pname) { case GL_SAMPLES: { - OwnPtr<GLint[]> values; + std::unique_ptr<GLint[]> values; GLint length = -1; if (!floatType) { contextGL()->GetInternalformativ(target, internalformat, GL_NUM_SAMPLE_COUNTS, 1, &length); if (length <= 0) return WebGLAny(scriptState, DOMInt32Array::create(0)); - values = adoptArrayPtr(new GLint[length]); + values = wrapArrayUnique(new GLint[length]); for (GLint ii = 0; ii < length; ++ii) values[ii] = 0; contextGL()->GetInternalformativ(target, internalformat, GL_SAMPLES, length, values.get()); } else { length = 1; - values = adoptArrayPtr(new GLint[1]); + values = wrapArrayUnique(new GLint[1]); values[0] = 1; } return WebGLAny(scriptState, DOMInt32Array::create(values.get(), length)); @@ -2116,7 +2116,7 @@ if (maxNameLength <= 0) { return nullptr; } - OwnPtr<GLchar[]> name = adoptArrayPtr(new GLchar[maxNameLength]); + std::unique_ptr<GLchar[]> name = wrapArrayUnique(new GLchar[maxNameLength]); GLsizei length = 0; GLsizei size = 0; GLenum type = 0; @@ -2409,7 +2409,7 @@ synthesizeGLError(GL_INVALID_VALUE, "getActiveUniformBlockName", "invalid uniform block index"); return String(); } - OwnPtr<GLchar[]> name = adoptArrayPtr(new GLchar[maxNameLength]); + std::unique_ptr<GLchar[]> name = wrapArrayUnique(new GLchar[maxNameLength]); GLsizei length = 0; contextGL()->GetActiveUniformBlockName(objectOrZero(program), uniformBlockIndex, maxNameLength, &length, name.get());
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h index 9910182c..60d9fd2 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h
@@ -7,6 +7,7 @@ #include "modules/webgl/WebGLExtension.h" #include "modules/webgl/WebGLRenderingContextBase.h" +#include <memory> namespace blink { @@ -217,7 +218,7 @@ DECLARE_VIRTUAL_TRACE(); protected: - WebGL2RenderingContextBase(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes& requestedAttributes); + WebGL2RenderingContextBase(HTMLCanvasElement*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes& requestedAttributes); // Helper function to validate target and the attachment combination for getFramebufferAttachmentParameters. // Generate GL error and return false if parameters are illegal.
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.cpp index 377dc58..c2509ac 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.cpp
@@ -62,6 +62,7 @@ #include "platform/graphics/gpu/DrawingBuffer.h" #include "public/platform/Platform.h" #include "public/platform/WebGraphicsContext3DProvider.h" +#include <memory> namespace blink { @@ -72,7 +73,7 @@ if (!contextProvider) return false; gpu::gles2::GLES2Interface* gl = contextProvider->contextGL(); - OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); + std::unique_ptr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); if (!extensionsUtil) return false; if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { @@ -85,7 +86,7 @@ CanvasRenderingContext* WebGLRenderingContext::Factory::create(ScriptState* scriptState, OffscreenCanvas* offscreenCanvas, const CanvasContextCreationAttributes& attrs) { WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); - OwnPtr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(scriptState, attributes, 1)); + std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(scriptState, attributes, 1)); if (!shouldCreateContext(contextProvider.get())) return nullptr; @@ -101,7 +102,7 @@ CanvasRenderingContext* WebGLRenderingContext::Factory::create(HTMLCanvasElement* canvas, const CanvasContextCreationAttributes& attrs, Document&) { WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); - OwnPtr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(canvas, attributes, 1)); + std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContext3DProvider(canvas, attributes, 1)); if (!shouldCreateContext(contextProvider.get())) return nullptr; @@ -121,12 +122,12 @@ canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, error)); } -WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGLRenderingContextBase(passedCanvas, std::move(contextProvider), requestedAttributes) { } -WebGLRenderingContext::WebGLRenderingContext(OffscreenCanvas* passedOffscreenCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGLRenderingContext::WebGLRenderingContext(OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGLRenderingContextBase(passedOffscreenCanvas, std::move(contextProvider), requestedAttributes) { }
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h index bd12bf1..d3d7b2bd 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h
@@ -28,6 +28,7 @@ #include "core/html/canvas/CanvasRenderingContextFactory.h" #include "modules/webgl/WebGLRenderingContextBase.h" +#include <memory> namespace blink { @@ -64,8 +65,8 @@ DECLARE_VIRTUAL_TRACE_WRAPPERS(); private: - WebGLRenderingContext(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); - WebGLRenderingContext(OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); + WebGLRenderingContext(HTMLCanvasElement*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); + WebGLRenderingContext(OffscreenCanvas*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); // Enabled extension objects. Member<ANGLEInstancedArrays> m_angleInstancedArrays;
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp index 8bff5927..548a2cd 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -93,11 +93,10 @@ #include "public/platform/Platform.h" #include "public/platform/functional/WebFunction.h" #include "wtf/Functional.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/StringUTF8Adaptor.h" #include "wtf/typed_arrays/ArrayBufferContents.h" - #include <memory> namespace blink { @@ -537,18 +536,18 @@ Platform::GraphicsInfo* glInfo; ScriptState* scriptState; // Outputs. - OwnPtr<WebGraphicsContext3DProvider> createdContextProvider; + std::unique_ptr<WebGraphicsContext3DProvider> createdContextProvider; }; static void createContextProviderOnMainThread(ContextProviderCreationInfo* creationInfo, WaitableEvent* waitableEvent) { ASSERT(isMainThread()); - creationInfo->createdContextProvider = adoptPtr(Platform::current()->createOffscreenGraphicsContext3DProvider( + creationInfo->createdContextProvider = wrapUnique(Platform::current()->createOffscreenGraphicsContext3DProvider( creationInfo->contextAttributes, creationInfo->scriptState->getExecutionContext()->url(), 0, creationInfo->glInfo)); waitableEvent->signal(); } -static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderOnWorkerThread(Platform::ContextAttributes contextAttributes, Platform::GraphicsInfo* glInfo, ScriptState* scriptState) +static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderOnWorkerThread(Platform::ContextAttributes contextAttributes, Platform::GraphicsInfo* glInfo, ScriptState* scriptState) { WaitableEvent waitableEvent; ContextProviderCreationInfo creationInfo; @@ -561,7 +560,7 @@ return std::move(creationInfo.createdContextProvider); } -PassOwnPtr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createContextProviderInternal(HTMLCanvasElement* canvas, ScriptState* scriptState, WebGLContextAttributes attributes, unsigned webGLVersion) +std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createContextProviderInternal(HTMLCanvasElement* canvas, ScriptState* scriptState, WebGLContextAttributes attributes, unsigned webGLVersion) { // Exactly one of these must be provided. DCHECK_EQ(!canvas, !!scriptState); @@ -570,10 +569,10 @@ Platform::ContextAttributes contextAttributes = toPlatformContextAttributes(attributes, webGLVersion); Platform::GraphicsInfo glInfo; - OwnPtr<WebGraphicsContext3DProvider> contextProvider; + std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; if (isMainThread()) { const auto& url = canvas ? canvas->document().topDocument().url() : scriptState->getExecutionContext()->url(); - contextProvider = adoptPtr(Platform::current()->createOffscreenGraphicsContext3DProvider( + contextProvider = wrapUnique(Platform::current()->createOffscreenGraphicsContext3DProvider( contextAttributes, url, 0, &glInfo)); } else { contextProvider = createContextProviderOnWorkerThread(contextAttributes, &glInfo, scriptState); @@ -599,7 +598,7 @@ return contextProvider; } -PassOwnPtr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createWebGraphicsContext3DProvider(HTMLCanvasElement* canvas, WebGLContextAttributes attributes, unsigned webGLVersion) +std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createWebGraphicsContext3DProvider(HTMLCanvasElement* canvas, WebGLContextAttributes attributes, unsigned webGLVersion) { Document& document = canvas->document(); LocalFrame* frame = document.frame(); @@ -619,7 +618,7 @@ return createContextProviderInternal(canvas, nullptr, attributes, webGLVersion); } -PassOwnPtr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createWebGraphicsContext3DProvider(ScriptState* scriptState, WebGLContextAttributes attributes, unsigned webGLVersion) +std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createWebGraphicsContext3DProvider(ScriptState* scriptState, WebGLContextAttributes attributes, unsigned webGLVersion) { return createContextProviderInternal(nullptr, scriptState, attributes, webGLVersion); } @@ -878,15 +877,15 @@ } // namespace -WebGLRenderingContextBase::WebGLRenderingContextBase(OffscreenCanvas* passedOffscreenCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGLRenderingContextBase::WebGLRenderingContextBase(OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGLRenderingContextBase(nullptr, passedOffscreenCanvas, std::move(contextProvider), requestedAttributes) { } -WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : WebGLRenderingContextBase(passedCanvas, nullptr, std::move(contextProvider), requestedAttributes) { } -WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, OffscreenCanvas* passedOffscreenCanvas, PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) +WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes) : CanvasRenderingContext(passedCanvas, passedOffscreenCanvas) , m_isHidden(false) , m_contextLostMode(NotLostContext) @@ -937,7 +936,7 @@ ADD_VALUES_TO_SET(m_supportedTypes, kSupportedTypesES2); } -PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider) +PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(std::unique_ptr<WebGraphicsContext3DProvider> contextProvider) { bool premultipliedAlpha = m_requestedAttributes.premultipliedAlpha(); bool wantAlphaChannel = m_requestedAttributes.alpha(); @@ -4434,9 +4433,9 @@ } // Try using an accelerated image buffer, this allows YUV conversion to be done on the GPU. - OwnPtr<ImageBufferSurface> surface = adoptPtr(new AcceleratedImageBufferSurface(IntSize(video->videoWidth(), video->videoHeight()))); + std::unique_ptr<ImageBufferSurface> surface = wrapUnique(new AcceleratedImageBufferSurface(IntSize(video->videoWidth(), video->videoHeight()))); if (surface->isValid()) { - OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(std::move(surface))); + std::unique_ptr<ImageBuffer> imageBuffer(ImageBuffer::create(std::move(surface))); if (imageBuffer) { // The video element paints an RGBA frame into our surface here. By using an AcceleratedImageBufferSurface, // we enable the WebMediaPlayer implementation to do any necessary color space conversion on the GPU (though it @@ -4486,7 +4485,7 @@ ASSERT(bitmap->bitmapImage()); RefPtr<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); SkPixmap pixmap; - OwnPtr<uint8_t[]> pixelData; + std::unique_ptr<uint8_t[]> pixelData; uint8_t* pixelDataPtr = nullptr; // TODO(crbug.com/613411): peekPixels fails if the SkImage is texture-backed // Use texture mailbox in that case. @@ -6091,7 +6090,7 @@ Platform::ContextAttributes attributes = toPlatformContextAttributes(m_requestedAttributes, version()); Platform::GraphicsInfo glInfo; - OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::current()->createOffscreenGraphicsContext3DProvider( + std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(Platform::current()->createOffscreenGraphicsContext3DProvider( attributes, canvas()->document().topDocument().url(), 0, &glInfo)); RefPtr<DrawingBuffer> buffer; if (contextProvider->bindToCurrentThread()) { @@ -6133,7 +6132,7 @@ } WebGLRenderingContextBase::LRUImageBufferCache::LRUImageBufferCache(int capacity) - : m_buffers(adoptArrayPtr(new OwnPtr<ImageBuffer>[capacity])) + : m_buffers(wrapArrayUnique(new std::unique_ptr<ImageBuffer>[capacity])) , m_capacity(capacity) { } @@ -6151,7 +6150,7 @@ return buf; } - OwnPtr<ImageBuffer> temp(ImageBuffer::create(size)); + std::unique_ptr<ImageBuffer> temp(ImageBuffer::create(size)); if (!temp) return nullptr; i = std::min(m_capacity - 1, i);
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h index db23380a..ed747be 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
@@ -48,9 +48,8 @@ #include "public/platform/Platform.h" #include "public/platform/WebGraphicsContext3DProvider.h" #include "third_party/khronos/GLES2/gl2.h" -#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" - +#include <memory> #include <set> namespace blink { @@ -140,8 +139,8 @@ static unsigned getWebGLVersion(const CanvasRenderingContext*); - static PassOwnPtr<WebGraphicsContext3DProvider> createWebGraphicsContext3DProvider(HTMLCanvasElement*, WebGLContextAttributes, unsigned webGLVersion); - static PassOwnPtr<WebGraphicsContext3DProvider> createWebGraphicsContext3DProvider(ScriptState*, WebGLContextAttributes, unsigned webGLVersion); + static std::unique_ptr<WebGraphicsContext3DProvider> createWebGraphicsContext3DProvider(HTMLCanvasElement*, WebGLContextAttributes, unsigned webGLVersion); + static std::unique_ptr<WebGraphicsContext3DProvider> createWebGraphicsContext3DProvider(ScriptState*, WebGLContextAttributes, unsigned webGLVersion); static void forceNextWebGLContextCreationToFail(); int drawingBufferWidth() const; @@ -431,9 +430,9 @@ friend class ScopedTexture2DRestorer; friend class ScopedFramebufferRestorer; - WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); - WebGLRenderingContextBase(OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); - PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<WebGraphicsContext3DProvider>); + WebGLRenderingContextBase(HTMLCanvasElement*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); + WebGLRenderingContextBase(OffscreenCanvas*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); + PassRefPtr<DrawingBuffer> createDrawingBuffer(std::unique_ptr<WebGraphicsContext3DProvider>); void setupFlags(); // CanvasRenderingContext implementation. @@ -537,7 +536,7 @@ ImageBuffer* imageBuffer(const IntSize&); private: void bubbleToFront(int idx); - OwnPtr<OwnPtr<ImageBuffer>[]> m_buffers; + std::unique_ptr<std::unique_ptr<ImageBuffer>[]> m_buffers; int m_capacity; }; LRUImageBufferCache m_generatedImageCache; @@ -586,7 +585,7 @@ unsigned long m_onePlusMaxNonDefaultTextureUnit; - OwnPtr<Extensions3DUtil> m_extensionsUtil; + std::unique_ptr<Extensions3DUtil> m_extensionsUtil; enum ExtensionFlags { ApprovedExtension = 0x00, @@ -1104,8 +1103,8 @@ static const char* getTexImageFunctionName(TexImageFunctionID); private: - WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); - static PassOwnPtr<WebGraphicsContext3DProvider> createContextProviderInternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); + WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, std::unique_ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); + static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderInternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); }; DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, context->is3d(), context.is3d());
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIAccess.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIAccess.cpp index 4fdf4f1..bb99e15 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIAccess.cpp +++ b/third_party/WebKit/Source/modules/webmidi/MIDIAccess.cpp
@@ -42,12 +42,13 @@ #include "modules/webmidi/MIDIOutputMap.h" #include "modules/webmidi/MIDIPort.h" #include "platform/AsyncMethodRunner.h" +#include <memory> namespace blink { using PortState = MIDIAccessor::MIDIPortState; -MIDIAccess::MIDIAccess(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext* executionContext) +MIDIAccess::MIDIAccess(std::unique_ptr<MIDIAccessor> accessor, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext* executionContext) : ActiveScriptWrappable(this) , ActiveDOMObject(executionContext) , m_accessor(std::move(accessor))
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIAccess.h b/third_party/WebKit/Source/modules/webmidi/MIDIAccess.h index 6484a205..b6e61ad 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIAccess.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIAccess.h
@@ -40,6 +40,7 @@ #include "modules/webmidi/MIDIAccessorClient.h" #include "platform/heap/Handle.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -54,7 +55,7 @@ USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); USING_PRE_FINALIZER(MIDIAccess, dispose); public: - static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext* executionContext) + static MIDIAccess* create(std::unique_ptr<MIDIAccessor> accessor, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext* executionContext) { MIDIAccess* access = new MIDIAccess(std::move(accessor), sysexEnabled, ports, executionContext); access->suspendIfNeeded(); @@ -102,10 +103,10 @@ DECLARE_VIRTUAL_TRACE(); private: - MIDIAccess(PassOwnPtr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>&, ExecutionContext*); + MIDIAccess(std::unique_ptr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAccessInitializer::PortDescriptor>&, ExecutionContext*); void dispose(); - OwnPtr<MIDIAccessor> m_accessor; + std::unique_ptr<MIDIAccessor> m_accessor; bool m_sysexEnabled; bool m_hasPendingActivity; HeapVector<Member<MIDIInput>> m_inputs;
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.h b/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.h index 727630c..ed1e4e5e7 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.h
@@ -12,8 +12,8 @@ #include "modules/webmidi/MIDIAccessorClient.h" #include "modules/webmidi/MIDIOptions.h" #include "modules/webmidi/MIDIPort.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -73,7 +73,7 @@ void contextDestroyed() override; - OwnPtr<MIDIAccessor> m_accessor; + std::unique_ptr<MIDIAccessor> m_accessor; Vector<PortDescriptor> m_portDescriptors; MIDIOptions m_options; bool m_hasBeenDisposed;
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.cpp index 47d2bce..262b448 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.cpp +++ b/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.cpp
@@ -32,16 +32,18 @@ #include "modules/webmidi/MIDIAccessorClient.h" #include "public/platform/Platform.h" +#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" +#include <memory> using blink::WebString; namespace blink { // Factory method -PassOwnPtr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) +std::unique_ptr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) { - return adoptPtr(new MIDIAccessor(client)); + return wrapUnique(new MIDIAccessor(client)); } MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) @@ -49,7 +51,7 @@ { DCHECK(client); - m_accessor = adoptPtr(Platform::current()->createMIDIAccessor(this)); + m_accessor = wrapUnique(Platform::current()->createMIDIAccessor(this)); DCHECK(m_accessor); }
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.h b/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.h index 43b8e921..66a8863 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIAccessor.h
@@ -34,8 +34,7 @@ #include "public/platform/modules/webmidi/WebMIDIAccessor.h" #include "public/platform/modules/webmidi/WebMIDIAccessorClient.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -44,7 +43,7 @@ class MIDIAccessor final : public WebMIDIAccessorClient { USING_FAST_MALLOC(MIDIAccessor); public: - static PassOwnPtr<MIDIAccessor> create(MIDIAccessorClient*); + static std::unique_ptr<MIDIAccessor> create(MIDIAccessorClient*); ~MIDIAccessor() override { } @@ -67,7 +66,7 @@ explicit MIDIAccessor(MIDIAccessorClient*); MIDIAccessorClient* m_client; - OwnPtr<WebMIDIAccessor> m_accessor; + std::unique_ptr<WebMIDIAccessor> m_accessor; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIClient.h b/third_party/WebKit/Source/modules/webmidi/MIDIClient.h index f260923e..c5a93e34 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIClient.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIClient.h
@@ -33,6 +33,7 @@ #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -48,7 +49,7 @@ virtual ~MIDIClient() { } }; -MODULES_EXPORT void provideMIDITo(LocalFrame&, PassOwnPtr<MIDIClient>); +MODULES_EXPORT void provideMIDITo(LocalFrame&, std::unique_ptr<MIDIClient>); } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIController.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIController.cpp index 8ea0a21..3ae61d7 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIController.cpp +++ b/third_party/WebKit/Source/modules/webmidi/MIDIController.cpp
@@ -32,6 +32,7 @@ #include "modules/webmidi/MIDIAccessInitializer.h" #include "modules/webmidi/MIDIClient.h" +#include <memory> namespace blink { @@ -40,7 +41,7 @@ return "MIDIController"; } -MIDIController::MIDIController(PassOwnPtr<MIDIClient> client) +MIDIController::MIDIController(std::unique_ptr<MIDIClient> client) : m_client(std::move(client)) { DCHECK(m_client); @@ -50,7 +51,7 @@ { } -MIDIController* MIDIController::create(PassOwnPtr<MIDIClient> client) +MIDIController* MIDIController::create(std::unique_ptr<MIDIClient> client) { return new MIDIController(std::move(client)); } @@ -65,7 +66,7 @@ m_client->cancelPermissionRequest(initializer); } -void provideMIDITo(LocalFrame& frame, PassOwnPtr<MIDIClient> client) +void provideMIDITo(LocalFrame& frame, std::unique_ptr<MIDIClient> client) { MIDIController::provideTo(frame, MIDIController::supplementName(), MIDIController::create(std::move(client))); }
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIController.h b/third_party/WebKit/Source/modules/webmidi/MIDIController.h index 4cf7bdf..cdb7d4a 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIController.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIController.h
@@ -33,6 +33,7 @@ #include "core/frame/LocalFrame.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -48,17 +49,17 @@ void requestPermission(MIDIAccessInitializer*, const MIDIOptions&); void cancelPermissionRequest(MIDIAccessInitializer*); - static MIDIController* create(PassOwnPtr<MIDIClient>); + static MIDIController* create(std::unique_ptr<MIDIClient>); static const char* supplementName(); static MIDIController* from(LocalFrame* frame) { return static_cast<MIDIController*>(Supplement<LocalFrame>::from(frame, supplementName())); } DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<LocalFrame>::trace(visitor); } protected: - explicit MIDIController(PassOwnPtr<MIDIClient>); + explicit MIDIController(std::unique_ptr<MIDIClient>); private: - OwnPtr<MIDIClient> m_client; + std::unique_ptr<MIDIClient> m_client; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp index 8a008b84..b30348d 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp
@@ -58,11 +58,11 @@ #include "public/platform/WebInsecureRequestPolicy.h" #include "wtf/Assertions.h" #include "wtf/HashSet.h" -#include "wtf/PassOwnPtr.h" #include "wtf/StdLibExtras.h" #include "wtf/text/CString.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -638,7 +638,7 @@ m_eventQueue->dispatch(MessageEvent::create(msg, SecurityOrigin::create(m_url)->toString())); } -void DOMWebSocket::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> binaryData) +void DOMWebSocket::didReceiveBinaryMessage(std::unique_ptr<Vector<char>> binaryData) { WTF_LOG(Network, "WebSocket %p didReceiveBinaryMessage() %lu byte binary message", this, static_cast<unsigned long>(binaryData->size())); switch (m_binaryType) { @@ -646,7 +646,7 @@ size_t size = binaryData->size(); RefPtr<RawData> rawData = RawData::create(); binaryData->swap(*rawData->mutableData()); - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile); Blob* blob = Blob::create(BlobDataHandle::create(std::move(blobData), size)); recordReceiveTypeHistogram(WebSocketReceiveTypeBlob);
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h index 2badc24..15fb738 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h
@@ -48,6 +48,7 @@ #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" +#include <memory> #include <stdint.h> namespace blink { @@ -127,7 +128,7 @@ // WebSocketChannelClient functions. void didConnect(const String& subprotocol, const String& extensions) override; void didReceiveTextMessage(const String& message) override; - void didReceiveBinaryMessage(PassOwnPtr<Vector<char>>) override; + void didReceiveBinaryMessage(std::unique_ptr<Vector<char>>) override; void didError() override; void didConsumeBufferedAmount(uint64_t) override; void didStartClosingHandshake() override;
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp index d41105e..8ca88848 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp
@@ -18,10 +18,10 @@ #include "public/platform/WebInsecureRequestPolicy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" +#include <memory> #include <v8.h> using testing::_; @@ -52,19 +52,19 @@ MOCK_METHOD3(send, void(const DOMArrayBuffer&, unsigned, unsigned)); MOCK_METHOD1(send, void(PassRefPtr<BlobDataHandle>)); MOCK_METHOD1(sendTextAsCharVectorMock, void(Vector<char>*)); - void sendTextAsCharVector(PassOwnPtr<Vector<char>> vector) + void sendTextAsCharVector(std::unique_ptr<Vector<char>> vector) { sendTextAsCharVectorMock(vector.get()); } MOCK_METHOD1(sendBinaryAsCharVectorMock, void(Vector<char>*)); - void sendBinaryAsCharVector(PassOwnPtr<Vector<char>> vector) + void sendBinaryAsCharVector(std::unique_ptr<Vector<char>> vector) { sendBinaryAsCharVectorMock(vector.get()); } MOCK_CONST_METHOD0(bufferedAmount, unsigned()); MOCK_METHOD2(close, void(int, const String&)); MOCK_METHOD3(failMock, void(const String&, MessageLevel, SourceLocation*)); - void fail(const String& reason, MessageLevel level, PassOwnPtr<SourceLocation> location) + void fail(const String& reason, MessageLevel level, std::unique_ptr<SourceLocation> location) { failMock(reason, level, location.get()); }
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp index ca91d4b9..f329365 100644 --- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp +++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
@@ -55,6 +55,8 @@ #include "public/platform/WebVector.h" #include "public/platform/modules/websockets/WebSocketHandshakeRequestInfo.h" #include "public/platform/modules/websockets/WebSocketHandshakeResponseInfo.h" +#include "wtf/PtrUtil.h" +#include <memory> using blink::WebSocketHandle; @@ -89,7 +91,7 @@ explicit Message(PassRefPtr<BlobDataHandle>); explicit Message(DOMArrayBuffer*); // For WorkerWebSocketChannel - explicit Message(PassOwnPtr<Vector<char>>, MessageType); + explicit Message(std::unique_ptr<Vector<char>>, MessageType); // Close message Message(unsigned short code, const String& reason); @@ -103,7 +105,7 @@ CString text; RefPtr<BlobDataHandle> blobDataHandle; Member<DOMArrayBuffer> arrayBuffer; - OwnPtr<Vector<char>> vectorData; + std::unique_ptr<Vector<char>> vectorData; unsigned short code; String reason; }; @@ -134,9 +136,9 @@ // |this| is deleted here. } -DocumentWebSocketChannel::DocumentWebSocketChannel(Document* document, WebSocketChannelClient* client, PassOwnPtr<SourceLocation> location, WebSocketHandle *handle) +DocumentWebSocketChannel::DocumentWebSocketChannel(Document* document, WebSocketChannelClient* client, std::unique_ptr<SourceLocation> location, WebSocketHandle *handle) : ContextLifecycleObserver(document) - , m_handle(adoptPtr(handle ? handle : Platform::current()->createWebSocketHandle())) + , m_handle(wrapUnique(handle ? handle : Platform::current()->createWebSocketHandle())) , m_client(client) , m_identifier(createUniqueIdentifier()) , m_sendingQuota(0) @@ -226,7 +228,7 @@ processSendQueue(); } -void DocumentWebSocketChannel::sendTextAsCharVector(PassOwnPtr<Vector<char>> data) +void DocumentWebSocketChannel::sendTextAsCharVector(std::unique_ptr<Vector<char>> data) { WTF_LOG(Network, "DocumentWebSocketChannel %p sendTextAsCharVector(%p, %llu)", this, data.get(), static_cast<unsigned long long>(data->size())); // FIXME: Change the inspector API to show the entire message instead @@ -236,7 +238,7 @@ processSendQueue(); } -void DocumentWebSocketChannel::sendBinaryAsCharVector(PassOwnPtr<Vector<char>> data) +void DocumentWebSocketChannel::sendBinaryAsCharVector(std::unique_ptr<Vector<char>> data) { WTF_LOG(Network, "DocumentWebSocketChannel %p sendBinaryAsCharVector(%p, %llu)", this, data.get(), static_cast<unsigned long long>(data->size())); // FIXME: Change the inspector API to show the entire message instead @@ -255,7 +257,7 @@ processSendQueue(); } -void DocumentWebSocketChannel::fail(const String& reason, MessageLevel level, PassOwnPtr<SourceLocation> location) +void DocumentWebSocketChannel::fail(const String& reason, MessageLevel level, std::unique_ptr<SourceLocation> location) { WTF_LOG(Network, "DocumentWebSocketChannel %p fail(%s)", this, reason.utf8().data()); // m_handle and m_client can be null here. @@ -297,7 +299,7 @@ : type(MessageTypeArrayBuffer) , arrayBuffer(arrayBuffer) { } -DocumentWebSocketChannel::Message::Message(PassOwnPtr<Vector<char>> vectorData, MessageType type) +DocumentWebSocketChannel::Message::Message(std::unique_ptr<Vector<char>> vectorData, MessageType type) : type(type) , vectorData(std::move(vectorData)) { @@ -416,7 +418,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didConnect(%p, %s, %s)", this, handle, selectedProtocol.utf8().c_str(), extensions.utf8().c_str()); ASSERT(m_handle); - ASSERT(handle == m_handle); + ASSERT(handle == m_handle.get()); ASSERT(m_client); m_client->didConnect(selectedProtocol, extensions); @@ -427,7 +429,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didStartOpeningHandshake(%p)", this, handle); ASSERT(m_handle); - ASSERT(handle == m_handle); + ASSERT(handle == m_handle.get()); TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketSendHandshakeRequest", TRACE_EVENT_SCOPE_THREAD, "data", InspectorWebSocketEvent::data(document(), m_identifier)); InspectorInstrumentation::willSendWebSocketHandshakeRequest(document(), m_identifier, &request.toCoreRequest()); @@ -439,7 +441,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didFinishOpeningHandshake(%p)", this, handle); ASSERT(m_handle); - ASSERT(handle == m_handle); + ASSERT(handle == m_handle.get()); TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketReceiveHandshakeResponse", TRACE_EVENT_SCOPE_THREAD, "data", InspectorWebSocketEvent::data(document(), m_identifier)); InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(document(), m_identifier, m_handshakeRequest.get(), &response.toCoreResponse()); @@ -451,7 +453,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didFail(%p, %s)", this, handle, message.utf8().data()); ASSERT(m_handle); - ASSERT(handle == m_handle); + ASSERT(handle == m_handle.get()); // This function is called when the browser is required to fail the // WebSocketConnection. Hence we fail this channel by calling @@ -465,7 +467,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didReceiveData(%p, %d, %d, (%p, %zu))", this, handle, fin, type, data, size); ASSERT(m_handle); - ASSERT(handle == m_handle); + ASSERT(handle == m_handle.get()); ASSERT(m_client); // Non-final frames cannot be empty. ASSERT(fin || size); @@ -505,7 +507,7 @@ m_client->didReceiveTextMessage(message); } } else { - OwnPtr<Vector<char>> binaryData = adoptPtr(new Vector<char>); + std::unique_ptr<Vector<char>> binaryData = wrapUnique(new Vector<char>); binaryData->swap(m_receivingMessageData); m_client->didReceiveBinaryMessage(std::move(binaryData)); } @@ -516,7 +518,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didClose(%p, %d, %u, %s)", this, handle, wasClean, code, String(reason).utf8().data()); ASSERT(m_handle); - ASSERT(handle == m_handle); + ASSERT(handle == m_handle.get()); m_handle.reset(); @@ -535,7 +537,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didReceiveFlowControl(%p, %ld)", this, handle, static_cast<long>(quota)); ASSERT(m_handle); - ASSERT(handle == m_handle); + ASSERT(handle == m_handle.get()); ASSERT(quota >= 0); m_sendingQuota += quota; @@ -547,7 +549,7 @@ WTF_LOG(Network, "DocumentWebSocketChannel %p didStartClosingHandshake(%p)", this, handle); ASSERT(m_handle); - ASSERT(handle == m_handle); + ASSERT(handle == m_handle.get()); if (m_client) m_client->didStartClosingHandshake();
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h index ae655665..9b964e5 100644 --- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h +++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h
@@ -43,13 +43,12 @@ #include "public/platform/modules/websockets/WebSocketHandle.h" #include "public/platform/modules/websockets/WebSocketHandleClient.h" #include "wtf/Deque.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" +#include <memory> #include <stdint.h> namespace blink { @@ -69,7 +68,7 @@ // In the usual case, they are set automatically and you don't have to // pass it. // Specify handle explicitly only in tests. - static DocumentWebSocketChannel* create(Document* document, WebSocketChannelClient* client, PassOwnPtr<SourceLocation> location, WebSocketHandle *handle = 0) + static DocumentWebSocketChannel* create(Document* document, WebSocketChannelClient* client, std::unique_ptr<SourceLocation> location, WebSocketHandle *handle = 0) { return new DocumentWebSocketChannel(document, client, std::move(location), handle); } @@ -80,12 +79,12 @@ void send(const CString& message) override; void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteLength) override; void send(PassRefPtr<BlobDataHandle>) override; - void sendTextAsCharVector(PassOwnPtr<Vector<char>> data) override; - void sendBinaryAsCharVector(PassOwnPtr<Vector<char>> data) override; + void sendTextAsCharVector(std::unique_ptr<Vector<char>> data) override; + void sendBinaryAsCharVector(std::unique_ptr<Vector<char>> data) override; // Start closing handshake. Use the CloseEventCodeNotSpecified for the code // argument to omit payload. void close(int code, const String& reason) override; - void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>) override; + void fail(const String& reason, MessageLevel, std::unique_ptr<SourceLocation>) override; void disconnect() override; DECLARE_VIRTUAL_TRACE(); @@ -108,7 +107,7 @@ Vector<char> data; }; - DocumentWebSocketChannel(Document*, WebSocketChannelClient*, PassOwnPtr<SourceLocation>, WebSocketHandle*); + DocumentWebSocketChannel(Document*, WebSocketChannelClient*, std::unique_ptr<SourceLocation>, WebSocketHandle*); void sendInternal(WebSocketHandle::MessageType, const char* data, size_t totalSize, uint64_t* consumedBufferedAmount); void processSendQueue(); void flowControlIfNecessary(); @@ -133,7 +132,7 @@ // m_handle is a handle of the connection. // m_handle == 0 means this channel is closed. - OwnPtr<WebSocketHandle> m_handle; + std::unique_ptr<WebSocketHandle> m_handle; // m_client can be deleted while this channel is alive, but this class // expects that disconnect() is called before the deletion. @@ -150,7 +149,7 @@ uint64_t m_receivedDataSizeForFlowControl; size_t m_sentSizeOfTopMessage; - OwnPtr<SourceLocation> m_locationAtConstruction; + std::unique_ptr<SourceLocation> m_locationAtConstruction; RefPtr<WebSocketHandshakeRequest> m_handshakeRequest; static const uint64_t receivedDataSizeForFlowControlHighWaterMark = 1 << 15;
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp index 73b697cb..6903609 100644 --- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp +++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
@@ -21,9 +21,10 @@ #include "public/platform/modules/websockets/WebSocketHandleClient.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> #include <stdint.h> using testing::_; @@ -52,7 +53,7 @@ MOCK_METHOD2(didConnect, void(const String&, const String&)); MOCK_METHOD1(didReceiveTextMessage, void(const String&)); - void didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload) override + void didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) override { didReceiveBinaryMessageMock(*payload); } @@ -141,7 +142,7 @@ ::testing::Mock::VerifyAndClearExpectations(this); } - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; Persistent<MockWebSocketChannelClient> m_channelClient; MockWebSocketHandle* m_handle; Persistent<DocumentWebSocketChannel> m_channel; @@ -240,7 +241,7 @@ Vector<char> fooVector; fooVector.append("foo", 3); - channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(fooVector))); + channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(fooVector))); EXPECT_EQ(3ul, m_sumOfConsumedBufferedAmount); } @@ -262,22 +263,22 @@ { Vector<char> v; v.append("\0ar", 3); - channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); } { Vector<char> v; v.append("b\0z", 3); - channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); } { Vector<char> v; v.append("qu\0", 3); - channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); } { Vector<char> v; v.append("\0\0\0", 3); - channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); } EXPECT_EQ(12ul, m_sumOfConsumedBufferedAmount); @@ -293,7 +294,7 @@ Vector<char> v; v.append("\xe7\x8b\x90", 3); - channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); EXPECT_EQ(3ul, m_sumOfConsumedBufferedAmount); } @@ -308,7 +309,7 @@ Vector<char> v; v.append("\x80\xff\xe7", 3); - channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); EXPECT_EQ(3ul, m_sumOfConsumedBufferedAmount); } @@ -329,7 +330,7 @@ Vector<char> v; v.append("\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90\xe7\x8b\x90", 18); - channel()->sendBinaryAsCharVector(adoptPtr(new Vector<char>(v))); + channel()->sendBinaryAsCharVector(wrapUnique(new Vector<char>(v))); checkpoint.Call(1); handleClient()->didReceiveFlowControl(handle(), 16);
diff --git a/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.cpp b/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.cpp index e95695f1..c48f7c56 100644 --- a/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.cpp +++ b/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.cpp
@@ -6,12 +6,13 @@ #include "core/dom/Document.h" #include "platform/weborigin/KURL.h" +#include <memory> namespace blink { -PassOwnPtr<TracedValue> InspectorWebSocketCreateEvent::data(Document* document, unsigned long identifier, const KURL& url, const String& protocol) +std::unique_ptr<TracedValue> InspectorWebSocketCreateEvent::data(Document* document, unsigned long identifier, const KURL& url, const String& protocol) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setInteger("identifier", identifier); value->setString("url", url.getString()); value->setString("frame", toHexString(document->frame())); @@ -21,9 +22,9 @@ return value; } -PassOwnPtr<TracedValue> InspectorWebSocketEvent::data(Document* document, unsigned long identifier) +std::unique_ptr<TracedValue> InspectorWebSocketEvent::data(Document* document, unsigned long identifier) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setInteger("identifier", identifier); value->setString("frame", toHexString(document->frame())); setCallStack(value.get());
diff --git a/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.h b/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.h index 418f0e66..35ed61f57 100644 --- a/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.h +++ b/third_party/WebKit/Source/modules/websockets/InspectorWebSocketEvents.h
@@ -11,6 +11,7 @@ #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/Functional.h" +#include <memory> namespace blink { @@ -20,13 +21,13 @@ class InspectorWebSocketCreateEvent { STATIC_ONLY(InspectorWebSocketCreateEvent); public: - static PassOwnPtr<TracedValue> data(Document*, unsigned long identifier, const KURL&, const String& protocol); + static std::unique_ptr<TracedValue> data(Document*, unsigned long identifier, const KURL&, const String& protocol); }; class InspectorWebSocketEvent { STATIC_ONLY(InspectorWebSocketEvent); public: - static PassOwnPtr<TracedValue> data(Document*, unsigned long identifier); + static std::unique_ptr<TracedValue> data(Document*, unsigned long identifier); }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/websockets/WebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/WebSocketChannel.cpp index 49e46a1..3cbc754 100644 --- a/third_party/WebKit/Source/modules/websockets/WebSocketChannel.cpp +++ b/third_party/WebKit/Source/modules/websockets/WebSocketChannel.cpp
@@ -38,6 +38,7 @@ #include "modules/websockets/DocumentWebSocketChannel.h" #include "modules/websockets/WebSocketChannelClient.h" #include "modules/websockets/WorkerWebSocketChannel.h" +#include <memory> namespace blink { @@ -46,7 +47,7 @@ ASSERT(context); ASSERT(client); - OwnPtr<SourceLocation> location = SourceLocation::capture(context); + std::unique_ptr<SourceLocation> location = SourceLocation::capture(context); if (context->isWorkerGlobalScope()) { WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
diff --git a/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h b/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h index 14cdd686..b702aaa 100644 --- a/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h +++ b/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h
@@ -37,6 +37,7 @@ #include "platform/v8_inspector/public/ConsoleTypes.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -77,8 +78,8 @@ virtual void send(PassRefPtr<BlobDataHandle>) = 0; // For WorkerWebSocketChannel. - virtual void sendTextAsCharVector(PassOwnPtr<Vector<char>>) = 0; - virtual void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>) = 0; + virtual void sendTextAsCharVector(std::unique_ptr<Vector<char>>) = 0; + virtual void sendBinaryAsCharVector(std::unique_ptr<Vector<char>>) = 0; // Do not call |send| after calling this method. virtual void close(int code, const String& reason) = 0; @@ -91,7 +92,7 @@ // and the "current" location in the sense of JavaScript execution // may be shown if this method is called in a JS execution context. // Location should not be null. - virtual void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>) = 0; + virtual void fail(const String& reason, MessageLevel, std::unique_ptr<SourceLocation>) = 0; // Do not call any methods after calling this method. virtual void disconnect() = 0; // Will suppress didClose().
diff --git a/third_party/WebKit/Source/modules/websockets/WebSocketChannelClient.h b/third_party/WebKit/Source/modules/websockets/WebSocketChannelClient.h index 3777408..25f1926 100644 --- a/third_party/WebKit/Source/modules/websockets/WebSocketChannelClient.h +++ b/third_party/WebKit/Source/modules/websockets/WebSocketChannelClient.h
@@ -34,8 +34,8 @@ #include "modules/ModulesExport.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" +#include <memory> #include <stdint.h> namespace blink { @@ -45,7 +45,7 @@ virtual ~WebSocketChannelClient() { } virtual void didConnect(const String& subprotocol, const String& extensions) { } virtual void didReceiveTextMessage(const String&) { } - virtual void didReceiveBinaryMessage(PassOwnPtr<Vector<char>>) { } + virtual void didReceiveBinaryMessage(std::unique_ptr<Vector<char>>) { } virtual void didError() { } virtual void didConsumeBufferedAmount(uint64_t consumed) { } virtual void didStartClosingHandshake() { }
diff --git a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp index 3fe0bd7..51a29d6 100644 --- a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp +++ b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
@@ -45,8 +45,10 @@ #include "public/platform/Platform.h" #include "wtf/Assertions.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -58,7 +60,7 @@ // thread. signalWorkerThread() must be called before any getters are called. class WebSocketChannelSyncHelper : public GarbageCollectedFinalized<WebSocketChannelSyncHelper> { public: - static WebSocketChannelSyncHelper* create(PassOwnPtr<WaitableEvent> event) + static WebSocketChannelSyncHelper* create(std::unique_ptr<WaitableEvent> event) { return new WebSocketChannelSyncHelper(std::move(event)); } @@ -93,17 +95,17 @@ DEFINE_INLINE_TRACE() { } private: - explicit WebSocketChannelSyncHelper(PassOwnPtr<WaitableEvent> event) + explicit WebSocketChannelSyncHelper(std::unique_ptr<WaitableEvent> event) : m_event(std::move(event)) , m_connectRequestResult(false) { } - OwnPtr<WaitableEvent> m_event; + std::unique_ptr<WaitableEvent> m_event; bool m_connectRequestResult; }; -WorkerWebSocketChannel::WorkerWebSocketChannel(WorkerGlobalScope& workerGlobalScope, WebSocketChannelClient* client, PassOwnPtr<SourceLocation> location) +WorkerWebSocketChannel::WorkerWebSocketChannel(WorkerGlobalScope& workerGlobalScope, WebSocketChannelClient* client, std::unique_ptr<SourceLocation> location) : m_bridge(new Bridge(client, workerGlobalScope)) , m_locationAtConnection(std::move(location)) { @@ -145,12 +147,12 @@ m_bridge->close(code, reason); } -void WorkerWebSocketChannel::fail(const String& reason, MessageLevel level, PassOwnPtr<SourceLocation> location) +void WorkerWebSocketChannel::fail(const String& reason, MessageLevel level, std::unique_ptr<SourceLocation> location) { if (!m_bridge) return; - OwnPtr<SourceLocation> capturedLocation = SourceLocation::capture(); + std::unique_ptr<SourceLocation> capturedLocation = SourceLocation::capture(); if (!capturedLocation->isUnknown()) { // If we are in JavaScript context, use the current location instead // of passed one - it's more precise. @@ -192,7 +194,7 @@ DCHECK(isMainThread()); } -bool Peer::initialize(PassOwnPtr<SourceLocation> location, ExecutionContext* context) +bool Peer::initialize(std::unique_ptr<SourceLocation> location, ExecutionContext* context) { ASSERT(isMainThread()); if (wasContextDestroyedBeforeObserverCreation()) @@ -215,14 +217,14 @@ m_syncHelper->signalWorkerThread(); } -void Peer::sendTextAsCharVector(PassOwnPtr<Vector<char>> data) +void Peer::sendTextAsCharVector(std::unique_ptr<Vector<char>> data) { ASSERT(isMainThread()); if (m_mainWebSocketChannel) m_mainWebSocketChannel->sendTextAsCharVector(std::move(data)); } -void Peer::sendBinaryAsCharVector(PassOwnPtr<Vector<char>> data) +void Peer::sendBinaryAsCharVector(std::unique_ptr<Vector<char>> data) { ASSERT(isMainThread()); if (m_mainWebSocketChannel) @@ -245,7 +247,7 @@ m_mainWebSocketChannel->close(code, reason); } -void Peer::fail(const String& reason, MessageLevel level, PassOwnPtr<SourceLocation> location) +void Peer::fail(const String& reason, MessageLevel level, std::unique_ptr<SourceLocation> location) { ASSERT(isMainThread()); ASSERT(m_syncHelper); @@ -291,14 +293,14 @@ m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlobalScopeDidReceiveTextMessage, m_bridge, payload)); } -static void workerGlobalScopeDidReceiveBinaryMessage(Bridge* bridge, PassOwnPtr<Vector<char>> payload, ExecutionContext* context) +static void workerGlobalScopeDidReceiveBinaryMessage(Bridge* bridge, std::unique_ptr<Vector<char>> payload, ExecutionContext* context) { ASSERT_UNUSED(context, context->isWorkerGlobalScope()); if (bridge->client()) bridge->client()->didReceiveBinaryMessage(std::move(payload)); } -void Peer::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload) +void Peer::didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) { ASSERT(isMainThread()); m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlobalScopeDidReceiveBinaryMessage, m_bridge, passed(std::move(payload)))); @@ -382,7 +384,7 @@ : m_client(client) , m_workerGlobalScope(workerGlobalScope) , m_loaderProxy(m_workerGlobalScope->thread()->workerLoaderProxy()) - , m_syncHelper(WebSocketChannelSyncHelper::create(adoptPtr(new WaitableEvent()))) + , m_syncHelper(WebSocketChannelSyncHelper::create(wrapUnique(new WaitableEvent()))) { } @@ -391,7 +393,7 @@ ASSERT(!m_peer); } -void Bridge::createPeerOnMainThread(PassOwnPtr<SourceLocation> location, WorkerThreadLifecycleContext* workerThreadLifecycleContext, ExecutionContext* context) +void Bridge::createPeerOnMainThread(std::unique_ptr<SourceLocation> location, WorkerThreadLifecycleContext* workerThreadLifecycleContext, ExecutionContext* context) { DCHECK(isMainThread()); DCHECK(!m_peer); @@ -401,7 +403,7 @@ m_syncHelper->signalWorkerThread(); } -void Bridge::initialize(PassOwnPtr<SourceLocation> location) +void Bridge::initialize(std::unique_ptr<SourceLocation> location) { // Wait for completion of the task on the main thread because the connection // must synchronously be established (see Bridge::connect). @@ -427,7 +429,7 @@ void Bridge::send(const CString& message) { ASSERT(m_peer); - OwnPtr<Vector<char>> data = adoptPtr(new Vector<char>(message.length())); + std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>(message.length())); if (message.length()) memcpy(data->data(), static_cast<const char*>(message.data()), message.length()); @@ -438,7 +440,7 @@ { ASSERT(m_peer); // ArrayBuffer isn't thread-safe, hence the content of ArrayBuffer is copied into Vector<char>. - OwnPtr<Vector<char>> data = adoptPtr(new Vector<char>(byteLength)); + std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>(byteLength)); if (binaryData.byteLength()) memcpy(data->data(), static_cast<const char*>(binaryData.data()) + byteOffset, byteLength); @@ -457,7 +459,7 @@ m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::close, wrapCrossThreadPersistent(m_peer.get()), code, reason)); } -void Bridge::fail(const String& reason, MessageLevel level, PassOwnPtr<SourceLocation> location) +void Bridge::fail(const String& reason, MessageLevel level, std::unique_ptr<SourceLocation> location) { ASSERT(m_peer); m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::fail, wrapCrossThreadPersistent(m_peer.get()), reason, level, passed(std::move(location))));
diff --git a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.h b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.h index 9a6b4ee..1efba5f 100644 --- a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.h +++ b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.h
@@ -39,10 +39,10 @@ #include "platform/v8_inspector/public/ConsoleTypes.h" #include "wtf/Assertions.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> #include <stdint.h> namespace blink { @@ -58,7 +58,7 @@ class WorkerWebSocketChannel final : public WebSocketChannel { WTF_MAKE_NONCOPYABLE(WorkerWebSocketChannel); public: - static WebSocketChannel* create(WorkerGlobalScope& workerGlobalScope, WebSocketChannelClient* client, PassOwnPtr<SourceLocation> location) + static WebSocketChannel* create(WorkerGlobalScope& workerGlobalScope, WebSocketChannelClient* client, std::unique_ptr<SourceLocation> location) { return new WorkerWebSocketChannel(workerGlobalScope, client, std::move(location)); } @@ -69,16 +69,16 @@ void send(const CString&) override; void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteLength) override; void send(PassRefPtr<BlobDataHandle>) override; - void sendTextAsCharVector(PassOwnPtr<Vector<char>>) override + void sendTextAsCharVector(std::unique_ptr<Vector<char>>) override { ASSERT_NOT_REACHED(); } - void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>) override + void sendBinaryAsCharVector(std::unique_ptr<Vector<char>>) override { ASSERT_NOT_REACHED(); } void close(int code, const String& reason) override; - void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>) override; + void fail(const String& reason, MessageLevel, std::unique_ptr<SourceLocation>) override; void disconnect() override; // Will suppress didClose(). DECLARE_VIRTUAL_TRACE(); @@ -93,14 +93,14 @@ ~Peer() override; // SourceLocation parameter may be shown when the connection fails. - bool initialize(PassOwnPtr<SourceLocation>, ExecutionContext*); + bool initialize(std::unique_ptr<SourceLocation>, ExecutionContext*); void connect(const KURL&, const String& protocol); - void sendTextAsCharVector(PassOwnPtr<Vector<char>>); - void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>); + void sendTextAsCharVector(std::unique_ptr<Vector<char>>); + void sendBinaryAsCharVector(std::unique_ptr<Vector<char>>); void sendBlob(PassRefPtr<BlobDataHandle>); void close(int code, const String& reason); - void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>); + void fail(const String& reason, MessageLevel, std::unique_ptr<SourceLocation>); void disconnect(); DECLARE_VIRTUAL_TRACE(); @@ -110,7 +110,7 @@ // WebSocketChannelClient functions. void didConnect(const String& subprotocol, const String& extensions) override; void didReceiveTextMessage(const String& payload) override; - void didReceiveBinaryMessage(PassOwnPtr<Vector<char>>) override; + void didReceiveBinaryMessage(std::unique_ptr<Vector<char>>) override; void didConsumeBufferedAmount(uint64_t) override; void didStartClosingHandshake() override; void didClose(ClosingHandshakeCompletionStatus, unsigned short code, const String& reason) override; @@ -133,16 +133,16 @@ Bridge(WebSocketChannelClient*, WorkerGlobalScope&); ~Bridge(); // SourceLocation parameter may be shown when the connection fails. - void initialize(PassOwnPtr<SourceLocation>); + void initialize(std::unique_ptr<SourceLocation>); bool connect(const KURL&, const String& protocol); void send(const CString& message); void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteLength); void send(PassRefPtr<BlobDataHandle>); void close(int code, const String& reason); - void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocation>); + void fail(const String& reason, MessageLevel, std::unique_ptr<SourceLocation>); void disconnect(); - void createPeerOnMainThread(PassOwnPtr<SourceLocation>, WorkerThreadLifecycleContext*, ExecutionContext*); + void createPeerOnMainThread(std::unique_ptr<SourceLocation>, WorkerThreadLifecycleContext*, ExecutionContext*); // Returns null when |disconnect| has already been called. WebSocketChannelClient* client() { return m_client; } @@ -163,10 +163,10 @@ }; private: - WorkerWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, PassOwnPtr<SourceLocation>); + WorkerWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, std::unique_ptr<SourceLocation>); Member<Bridge> m_bridge; - OwnPtr<SourceLocation> m_locationAtConnection; + std::unique_ptr<SourceLocation> m_locationAtConnection; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/AsyncFileSystemCallbacks.h b/third_party/WebKit/Source/platform/AsyncFileSystemCallbacks.h index 0285d3b..5ec265c 100644 --- a/third_party/WebKit/Source/platform/AsyncFileSystemCallbacks.h +++ b/third_party/WebKit/Source/platform/AsyncFileSystemCallbacks.h
@@ -39,6 +39,7 @@ #include "wtf/Assertions.h" #include "wtf/Noncopyable.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -70,7 +71,7 @@ virtual void didReadDirectoryEntries(bool hasMore) { ASSERT_NOT_REACHED(); } // Called when an AsyncFileWrter has been created successfully. - virtual void didCreateFileWriter(PassOwnPtr<WebFileWriter>, long long length) { ASSERT_NOT_REACHED(); } + virtual void didCreateFileWriter(std::unique_ptr<WebFileWriter>, long long length) { ASSERT_NOT_REACHED(); } // Called when there was an error. virtual void didFail(int code) = 0;
diff --git a/third_party/WebKit/Source/platform/CalculationValue.h b/third_party/WebKit/Source/platform/CalculationValue.h index 9ec1c61..68bf3163 100644 --- a/third_party/WebKit/Source/platform/CalculationValue.h +++ b/third_party/WebKit/Source/platform/CalculationValue.h
@@ -33,8 +33,6 @@ #include "platform/Length.h" #include "platform/LengthFunctions.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/ContentSettingCallbacks.cpp b/third_party/WebKit/Source/platform/ContentSettingCallbacks.cpp index 7431999..76a3143 100644 --- a/third_party/WebKit/Source/platform/ContentSettingCallbacks.cpp +++ b/third_party/WebKit/Source/platform/ContentSettingCallbacks.cpp
@@ -30,11 +30,14 @@ #include "platform/ContentSettingCallbacks.h" +#include "wtf/PtrUtil.h" +#include <memory> + namespace blink { -PassOwnPtr<ContentSettingCallbacks> ContentSettingCallbacks::create(std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied) +std::unique_ptr<ContentSettingCallbacks> ContentSettingCallbacks::create(std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied) { - return adoptPtr(new ContentSettingCallbacks(std::move(allowed), std::move(denied))); + return wrapUnique(new ContentSettingCallbacks(std::move(allowed), std::move(denied))); } ContentSettingCallbacks::ContentSettingCallbacks(std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied)
diff --git a/third_party/WebKit/Source/platform/ContentSettingCallbacks.h b/third_party/WebKit/Source/platform/ContentSettingCallbacks.h index 2a76970..08f52831 100644 --- a/third_party/WebKit/Source/platform/ContentSettingCallbacks.h +++ b/third_party/WebKit/Source/platform/ContentSettingCallbacks.h
@@ -9,8 +9,7 @@ #include "wtf/Allocator.h" #include "wtf/Functional.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -18,7 +17,7 @@ USING_FAST_MALLOC(ContentSettingCallbacks); WTF_MAKE_NONCOPYABLE(ContentSettingCallbacks); public: - static PassOwnPtr<ContentSettingCallbacks> create(std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied); + static std::unique_ptr<ContentSettingCallbacks> create(std::unique_ptr<SameThreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied); virtual ~ContentSettingCallbacks() { } void onAllowed() { (*m_allowed)(); }
diff --git a/third_party/WebKit/Source/platform/ContextMenuItem.h b/third_party/WebKit/Source/platform/ContextMenuItem.h index 854c9fb..29690412 100644 --- a/third_party/WebKit/Source/platform/ContextMenuItem.h +++ b/third_party/WebKit/Source/platform/ContextMenuItem.h
@@ -29,7 +29,6 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/CrossThreadCopier.cpp b/third_party/WebKit/Source/platform/CrossThreadCopier.cpp index f5b4c797..80337ad 100644 --- a/third_party/WebKit/Source/platform/CrossThreadCopier.cpp +++ b/third_party/WebKit/Source/platform/CrossThreadCopier.cpp
@@ -35,6 +35,7 @@ #include "platform/network/ResourceResponse.h" #include "platform/weborigin/KURL.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -113,11 +114,11 @@ >::value), "Raw pointer RefCounted test"); -// Verify that PassOwnPtr gets passed through. +// Verify that std::unique_ptr gets passed through. static_assert((std::is_same< - PassOwnPtr<float>, - CrossThreadCopier<PassOwnPtr<float>>::Type + std::unique_ptr<float>, + CrossThreadCopier<std::unique_ptr<float>>::Type >::value), - "PassOwnPtr test"); + "std::unique_ptr test"); } // namespace blink
diff --git a/third_party/WebKit/Source/platform/CrossThreadCopier.h b/third_party/WebKit/Source/platform/CrossThreadCopier.h index 40fca7bc..cfb46fa 100644 --- a/third_party/WebKit/Source/platform/CrossThreadCopier.h +++ b/third_party/WebKit/Source/platform/CrossThreadCopier.h
@@ -35,11 +35,11 @@ #include "platform/heap/Handle.h" #include "wtf/Assertions.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/TypeTraits.h" +#include <memory> class SkRefCnt; @@ -134,16 +134,6 @@ STATIC_ONLY(CrossThreadCopier); }; -template <typename T> -struct CrossThreadCopier<PassOwnPtr<T>> { - STATIC_ONLY(CrossThreadCopier); - typedef PassOwnPtr<T> Type; - static Type copy(Type ownPtr) - { - return ownPtr; - } -}; - template <typename T, typename Deleter> struct CrossThreadCopier<std::unique_ptr<T, Deleter>> { STATIC_ONLY(CrossThreadCopier); @@ -205,14 +195,14 @@ template <> struct CrossThreadCopier<ResourceRequest> { STATIC_ONLY(CrossThreadCopier); - typedef WTF::PassedWrapper<PassOwnPtr<CrossThreadResourceRequestData>> Type; + typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceRequestData>> Type; PLATFORM_EXPORT static Type copy(const ResourceRequest&); }; template <> struct CrossThreadCopier<ResourceResponse> { STATIC_ONLY(CrossThreadCopier); - typedef WTF::PassedWrapper<PassOwnPtr<CrossThreadResourceResponseData>> Type; + typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceResponseData>> Type; PLATFORM_EXPORT static Type copy(const ResourceResponse&); };
diff --git a/third_party/WebKit/Source/platform/Crypto.cpp b/third_party/WebKit/Source/platform/Crypto.cpp index 00cdd51..79fa67b 100644 --- a/third_party/WebKit/Source/platform/Crypto.cpp +++ b/third_party/WebKit/Source/platform/Crypto.cpp
@@ -7,6 +7,8 @@ #include "public/platform/Platform.h" #include "public/platform/WebCrypto.h" #include "public/platform/WebCryptoAlgorithm.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -36,7 +38,7 @@ ASSERT(crypto); - OwnPtr<WebCryptoDigestor> digestor = adoptPtr(crypto->createDigestor(algorithmId)); + std::unique_ptr<WebCryptoDigestor> digestor = wrapUnique(crypto->createDigestor(algorithmId)); if (!digestor.get() || !digestor->consume(reinterpret_cast<const unsigned char*>(digestable), length) || !digestor->finish(result, resultSize)) return false; @@ -44,9 +46,9 @@ return true; } -PassOwnPtr<WebCryptoDigestor> createDigestor(HashAlgorithm algorithm) +std::unique_ptr<WebCryptoDigestor> createDigestor(HashAlgorithm algorithm) { - return adoptPtr(Platform::current()->crypto()->createDigestor(toWebCryptoAlgorithmId(algorithm))); + return wrapUnique(Platform::current()->crypto()->createDigestor(toWebCryptoAlgorithmId(algorithm))); } void finishDigestor(WebCryptoDigestor* digestor, DigestValue& digestResult)
diff --git a/third_party/WebKit/Source/platform/Crypto.h b/third_party/WebKit/Source/platform/Crypto.h index 891d685d..388462e 100644 --- a/third_party/WebKit/Source/platform/Crypto.h +++ b/third_party/WebKit/Source/platform/Crypto.h
@@ -17,6 +17,7 @@ #include "wtf/HashSet.h" #include "wtf/StringHasher.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -32,7 +33,7 @@ }; PLATFORM_EXPORT bool computeDigest(HashAlgorithm, const char* digestable, size_t length, DigestValue& digestResult); -PLATFORM_EXPORT PassOwnPtr<WebCryptoDigestor> createDigestor(HashAlgorithm); +PLATFORM_EXPORT std::unique_ptr<WebCryptoDigestor> createDigestor(HashAlgorithm); PLATFORM_EXPORT void finishDigestor(WebCryptoDigestor*, DigestValue& digestResult); } // namespace blink
diff --git a/third_party/WebKit/Source/platform/DragImage.cpp b/third_party/WebKit/Source/platform/DragImage.cpp index 52e7c7e..35e3a2c 100644 --- a/third_party/WebKit/Source/platform/DragImage.cpp +++ b/third_party/WebKit/Source/platform/DragImage.cpp
@@ -50,11 +50,11 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkMatrix.h" #include "third_party/skia/include/core/SkSurface.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" - #include <algorithm> +#include <memory> namespace blink { @@ -132,7 +132,7 @@ return imageScale; } -PassOwnPtr<DragImage> DragImage::create(Image* image, +std::unique_ptr<DragImage> DragImage::create(Image* image, RespectImageOrientationEnum shouldRespectImageOrientation, float deviceScaleFactor, InterpolationQuality interpolationQuality, float opacity, FloatSize imageScale) { @@ -153,7 +153,7 @@ if (!resizedImage || !resizedImage->asLegacyBitmap(&bm, SkImage::kRO_LegacyBitmapMode)) return nullptr; - return adoptPtr(new DragImage(bm, deviceScaleFactor, interpolationQuality)); + return wrapUnique(new DragImage(bm, deviceScaleFactor, interpolationQuality)); } static Font deriveDragLabelFont(int size, FontWeight fontWeight, const FontDescription& systemFont) @@ -167,7 +167,7 @@ return result; } -PassOwnPtr<DragImage> DragImage::create(const KURL& url, const String& inLabel, const FontDescription& systemFont, float deviceScaleFactor) +std::unique_ptr<DragImage> DragImage::create(const KURL& url, const String& inLabel, const FontDescription& systemFont, float deviceScaleFactor) { const Font labelFont = deriveDragLabelFont(kDragLinkLabelFontSize, FontWeightBold, systemFont); const Font urlFont = deriveDragLabelFont(kDragLinkUrlFontSize, FontWeightNormal, systemFont); @@ -213,7 +213,7 @@ // fill the background IntSize scaledImageSize = imageSize; scaledImageSize.scale(deviceScaleFactor); - OwnPtr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize)); + std::unique_ptr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize)); if (!buffer) return nullptr;
diff --git a/third_party/WebKit/Source/platform/DragImage.h b/third_party/WebKit/Source/platform/DragImage.h index 64f458ae..9fd422c7 100644 --- a/third_party/WebKit/Source/platform/DragImage.h +++ b/third_party/WebKit/Source/platform/DragImage.h
@@ -34,6 +34,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "wtf/Allocator.h" #include "wtf/Forward.h" +#include <memory> class SkImage; @@ -47,12 +48,12 @@ USING_FAST_MALLOC(DragImage); WTF_MAKE_NONCOPYABLE(DragImage); public: - static PassOwnPtr<DragImage> create(Image*, + static std::unique_ptr<DragImage> create(Image*, RespectImageOrientationEnum = DoNotRespectImageOrientation, float deviceScaleFactor = 1, InterpolationQuality = InterpolationHigh, float opacity = 1, FloatSize imageScale = FloatSize(1, 1)); - static PassOwnPtr<DragImage> create(const KURL&, const String& label, const FontDescription& systemFont, float deviceScaleFactor); + static std::unique_ptr<DragImage> create(const KURL&, const String& label, const FontDescription& systemFont, float deviceScaleFactor); ~DragImage(); static FloatSize clampedImageScale(const IntSize&, const IntSize&, const IntSize& maxSize);
diff --git a/third_party/WebKit/Source/platform/DragImageTest.cpp b/third_party/WebKit/Source/platform/DragImageTest.cpp index ba67881..d8f295e 100644 --- a/third_party/WebKit/Source/platform/DragImageTest.cpp +++ b/third_party/WebKit/Source/platform/DragImageTest.cpp
@@ -43,10 +43,9 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkPixelRef.h" #include "third_party/skia/include/core/SkSurface.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -125,7 +124,7 @@ TEST(DragImageTest, NonNullHandling) { RefPtr<TestImage> testImage(TestImage::create(IntSize(2, 2))); - OwnPtr<DragImage> dragImage = DragImage::create(testImage.get()); + std::unique_ptr<DragImage> dragImage = DragImage::create(testImage.get()); ASSERT_TRUE(dragImage); dragImage->scale(0.5, 0.5); @@ -158,9 +157,9 @@ fontDescription.setWeight(FontWeightNormal); fontDescription.setStyle(FontStyleNormal); - OwnPtr<DragImage> testImage = + std::unique_ptr<DragImage> testImage = DragImage::create(url, testLabel, fontDescription, deviceScaleFactor); - OwnPtr<DragImage> expectedImage = + std::unique_ptr<DragImage> expectedImage = DragImage::create(url, expectedLabel, fontDescription, deviceScaleFactor); EXPECT_EQ(testImage->size().width(), expectedImage->size().width()); @@ -193,7 +192,7 @@ // Create a DragImage from it. In MSAN builds, this will cause a failure if // the pixel memory is not initialized, if we have to respect non-default // orientation. - OwnPtr<DragImage> dragImage = DragImage::create(image.get(), RespectImageOrientation); + std::unique_ptr<DragImage> dragImage = DragImage::create(image.get(), RespectImageOrientation); // With an invalid pixel ref, BitmapImage should have no backing SkImage => we don't allocate // a DragImage. @@ -223,7 +222,7 @@ } RefPtr<TestImage> testImage = TestImage::create(fromSkSp(SkImage::MakeFromBitmap(testBitmap))); - OwnPtr<DragImage> dragImage = DragImage::create(testImage.get(), DoNotRespectImageOrientation, 1, InterpolationNone); + std::unique_ptr<DragImage> dragImage = DragImage::create(testImage.get(), DoNotRespectImageOrientation, 1, InterpolationNone); ASSERT_TRUE(dragImage); dragImage->scale(2, 2); const SkBitmap& dragBitmap = dragImage->bitmap();
diff --git a/third_party/WebKit/Source/platform/EventTracer.cpp b/third_party/WebKit/Source/platform/EventTracer.cpp index 6e6b386..7e5d35ab 100644 --- a/third_party/WebKit/Source/platform/EventTracer.cpp +++ b/third_party/WebKit/Source/platform/EventTracer.cpp
@@ -37,6 +37,7 @@ #include "public/platform/Platform.h" #include "wtf/Assertions.h" #include "wtf/text/StringUTF8Adaptor.h" +#include <memory> #include <stdio.h> namespace blink { @@ -72,8 +73,8 @@ const char* name, const char* scope, unsigned long long id, unsigned long long bindId, double timestamp, int numArgs, const char* argNames[], const unsigned char argTypes[], const unsigned long long argValues[], - PassOwnPtr<TracedValue> tracedValue1, - PassOwnPtr<TracedValue> tracedValue2, + std::unique_ptr<TracedValue> tracedValue1, + std::unique_ptr<TracedValue> tracedValue2, unsigned flags) { std::unique_ptr<base::trace_event::ConvertableToTraceFormat> convertables[2];
diff --git a/third_party/WebKit/Source/platform/EventTracer.h b/third_party/WebKit/Source/platform/EventTracer.h index 4f896619..2b1f9c1 100644 --- a/third_party/WebKit/Source/platform/EventTracer.h +++ b/third_party/WebKit/Source/platform/EventTracer.h
@@ -33,9 +33,7 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" - #include <memory> #include <stdint.h> @@ -78,8 +76,8 @@ const char* argNames[], const unsigned char argTypes[], const unsigned long long argValues[], - PassOwnPtr<TracedValue>, - PassOwnPtr<TracedValue>, + std::unique_ptr<TracedValue>, + std::unique_ptr<TracedValue>, unsigned flags); static TraceEvent::TraceEventHandle addTraceEvent(char phase, const unsigned char* categoryEnabledFlag,
diff --git a/third_party/WebKit/Source/platform/PODArena.h b/third_party/WebKit/Source/platform/PODArena.h index 3250e786..d8ebf83 100644 --- a/third_party/WebKit/Source/platform/PODArena.h +++ b/third_party/WebKit/Source/platform/PODArena.h
@@ -29,11 +29,11 @@ #include "wtf/Allocator.h" #include "wtf/Assertions.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" #include "wtf/allocator/Partitions.h" +#include <memory> #include <stdint.h> namespace blink { @@ -132,7 +132,7 @@ if (!ptr) { if (roundedSize > m_currentChunkSize) m_currentChunkSize = roundedSize; - m_chunks.append(adoptPtr(new Chunk(m_allocator.get(), m_currentChunkSize))); + m_chunks.append(wrapUnique(new Chunk(m_allocator.get(), m_currentChunkSize))); m_current = m_chunks.last().get(); ptr = m_current->allocate(roundedSize); } @@ -194,7 +194,7 @@ RefPtr<Allocator> m_allocator; Chunk* m_current; size_t m_currentChunkSize; - Vector<OwnPtr<Chunk>> m_chunks; + Vector<std::unique_ptr<Chunk>> m_chunks; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/PurgeableVector.cpp b/third_party/WebKit/Source/platform/PurgeableVector.cpp index b193230b..5c42bd1 100644 --- a/third_party/WebKit/Source/platform/PurgeableVector.cpp +++ b/third_party/WebKit/Source/platform/PurgeableVector.cpp
@@ -34,11 +34,8 @@ #include "base/memory/discardable_memory_allocator.h" #include "platform/web_process_memory_dump.h" #include "wtf/Assertions.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/StringUTF8Adaptor.h" #include "wtf/text/WTFString.h" - #include <cstring> #include <utility>
diff --git a/third_party/WebKit/Source/platform/SharedBuffer.h b/third_party/WebKit/Source/platform/SharedBuffer.h index 7b522cb..9edad438 100644 --- a/third_party/WebKit/Source/platform/SharedBuffer.h +++ b/third_party/WebKit/Source/platform/SharedBuffer.h
@@ -31,7 +31,6 @@ #include "platform/PurgeableVector.h" #include "third_party/skia/include/core/SkData.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/platform/SharedBufferTest.cpp b/third_party/WebKit/Source/platform/SharedBufferTest.cpp index 5dfda03d..a93154e 100644 --- a/third_party/WebKit/Source/platform/SharedBufferTest.cpp +++ b/third_party/WebKit/Source/platform/SharedBufferTest.cpp
@@ -31,12 +31,12 @@ #include "platform/SharedBuffer.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include <algorithm> #include <cstdlib> +#include <memory> namespace blink { @@ -51,7 +51,7 @@ sharedBuffer->append(testData2, strlen(testData2)); const size_t size = sharedBuffer->size(); - OwnPtr<char[]> data = adoptArrayPtr(new char[size]); + std::unique_ptr<char[]> data = wrapArrayUnique(new char[size]); ASSERT_TRUE(sharedBuffer->getAsBytes(data.get(), size)); char expectedConcatenation[] = "HelloWorldGoodbye"; @@ -76,7 +76,7 @@ sharedBuffer->append(vector2); const size_t size = sharedBuffer->size(); - OwnPtr<char[]> data = adoptArrayPtr(new char[size]); + std::unique_ptr<char[]> data = wrapArrayUnique(new char[size]); ASSERT_TRUE(sharedBuffer->getAsBytes(data.get(), size)); ASSERT_EQ(0x4000U + 0x4000U + 0x4000U, size);
diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp index 22a5a8a..dec68506 100644 --- a/third_party/WebKit/Source/platform/TimerTest.cpp +++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -11,7 +11,9 @@ #include "public/platform/WebViewScheduler.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" +#include <memory> #include <queue> using testing::ElementsAre; @@ -20,10 +22,10 @@ namespace { double gCurrentTimeSecs = 0.0; -// This class exists because gcc doesn't know how to move an OwnPtr. +// This class exists because gcc doesn't know how to move an std::unique_ptr. class RefCountedTaskContainer : public RefCounted<RefCountedTaskContainer> { public: - explicit RefCountedTaskContainer(WebTaskRunner::Task* task) : m_task(adoptPtr(task)) { } + explicit RefCountedTaskContainer(WebTaskRunner::Task* task) : m_task(wrapUnique(task)) { } ~RefCountedTaskContainer() { } @@ -33,7 +35,7 @@ } private: - OwnPtr<WebTaskRunner::Task> m_task; + std::unique_ptr<WebTaskRunner::Task> m_task; }; class DelayedTask { @@ -200,7 +202,7 @@ class FakeWebThread : public WebThread { public: - FakeWebThread() : m_webScheduler(adoptPtr(new MockWebScheduler())) { } + FakeWebThread() : m_webScheduler(wrapUnique(new MockWebScheduler())) { } ~FakeWebThread() override { } virtual bool isCurrentThread() const @@ -237,13 +239,13 @@ } private: - OwnPtr<MockWebScheduler> m_webScheduler; + std::unique_ptr<MockWebScheduler> m_webScheduler; }; class TimerTestPlatform : public TestingPlatformSupport { public: TimerTestPlatform() - : m_webThread(adoptPtr(new FakeWebThread())) { } + : m_webThread(wrapUnique(new FakeWebThread())) { } ~TimerTestPlatform() override { } WebThread* currentThread() override @@ -282,7 +284,7 @@ return static_cast<MockWebScheduler*>(m_webThread->scheduler()); } - OwnPtr<FakeWebThread> m_webThread; + std::unique_ptr<FakeWebThread> m_webThread; }; class TimerTest : public testing::Test {
diff --git a/third_party/WebKit/Source/platform/TraceEvent.h b/third_party/WebKit/Source/platform/TraceEvent.h index 6fca921..bbb08f2 100644 --- a/third_party/WebKit/Source/platform/TraceEvent.h +++ b/third_party/WebKit/Source/platform/TraceEvent.h
@@ -37,8 +37,8 @@ #include "wtf/Allocator.h" #include "wtf/DynamicAnnotations.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/CString.h" +#include <memory> //////////////////////////////////////////////////////////////////////////////// // Implementation specific tracing API definitions. @@ -116,7 +116,7 @@ // const char** arg_names, // const unsigned char* arg_types, // const unsigned long long* arg_values, -// PassOwnPtr<TracedValue> tracedValues[], +// std::unique_ptr<TracedValue> tracedValues[], // unsigned char flags) #define TRACE_EVENT_API_ADD_TRACE_EVENT \ blink::EventTracer::addTraceEvent @@ -427,22 +427,22 @@ *type = TRACE_VALUE_TYPE_CONVERTABLE; } -template<typename T> static inline void setTraceValue(const PassOwnPtr<T>& ptr, unsigned char* type, unsigned long long* value) +template<typename T> static inline void setTraceValue(const std::unique_ptr<T>& ptr, unsigned char* type, unsigned long long* value) { setTraceValue(ptr.get(), type, value); } template<typename T> struct TracedValueTraits { static const bool isTracedValue = false; - static PassOwnPtr<TracedValue> moveFromIfTracedValue(const T&) + static std::unique_ptr<TracedValue> moveFromIfTracedValue(const T&) { return nullptr; } }; -template<typename T> struct TracedValueTraits<PassOwnPtr<T>> { +template<typename T> struct TracedValueTraits<std::unique_ptr<T>> { static const bool isTracedValue = std::is_convertible<T*, TracedValue*>::value; - static PassOwnPtr<TracedValue> moveFromIfTracedValue(PassOwnPtr<T>&& tracedValue) + static std::unique_ptr<TracedValue> moveFromIfTracedValue(std::unique_ptr<T>&& tracedValue) { return std::move(tracedValue); } @@ -453,7 +453,7 @@ return TracedValueTraits<T>::isTracedValue; } -template<typename T> PassOwnPtr<TracedValue> moveFromIfTracedValue(T&& value) +template<typename T> std::unique_ptr<TracedValue> moveFromIfTracedValue(T&& value) { return TracedValueTraits<T>::moveFromIfTracedValue(std::forward<T>(value)); }
diff --git a/third_party/WebKit/Source/platform/TraceEventCommon.h b/third_party/WebKit/Source/platform/TraceEventCommon.h index b38208d..95addda 100644 --- a/third_party/WebKit/Source/platform/TraceEventCommon.h +++ b/third_party/WebKit/Source/platform/TraceEventCommon.h
@@ -148,8 +148,8 @@ // class MyData { // public: // MyData() {} -// PassOwnPtr<TracedValue> toTracedValue() { -// OwnPtr<TracedValue> tracedValue = TracedValue::create(); +// std::unique_ptr<TracedValue> toTracedValue() { +// std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); // tracedValue->setInteger("foo", 1); // tracedValue->beginArray("bar"); // tracedValue->pushInteger(2);
diff --git a/third_party/WebKit/Source/platform/TracedValue.cpp b/third_party/WebKit/Source/platform/TracedValue.cpp index 3302698e..d60ad77f 100644 --- a/third_party/WebKit/Source/platform/TracedValue.cpp +++ b/third_party/WebKit/Source/platform/TracedValue.cpp
@@ -5,13 +5,15 @@ #include "platform/TracedValue.h" #include "base/trace_event/trace_event_argument.h" +#include "wtf/PtrUtil.h" #include "wtf/text/StringUTF8Adaptor.h" +#include <memory> namespace blink { -PassOwnPtr<TracedValue> TracedValue::create() +std::unique_ptr<TracedValue> TracedValue::create() { - return adoptPtr(new TracedValue()); + return wrapUnique(new TracedValue()); } TracedValue::TracedValue()
diff --git a/third_party/WebKit/Source/platform/TracedValue.h b/third_party/WebKit/Source/platform/TracedValue.h index 2423700ac..f3b315b0 100644 --- a/third_party/WebKit/Source/platform/TracedValue.h +++ b/third_party/WebKit/Source/platform/TracedValue.h
@@ -7,8 +7,8 @@ #include "base/memory/ref_counted.h" #include "platform/EventTracer.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace base { namespace trace_event { @@ -25,7 +25,7 @@ public: ~TracedValue(); - static PassOwnPtr<TracedValue> create(); + static std::unique_ptr<TracedValue> create(); void endDictionary(); void endArray();
diff --git a/third_party/WebKit/Source/platform/TracedValueTest.cpp b/third_party/WebKit/Source/platform/TracedValueTest.cpp index b2357545..7a35df6 100644 --- a/third_party/WebKit/Source/platform/TracedValueTest.cpp +++ b/third_party/WebKit/Source/platform/TracedValueTest.cpp
@@ -7,10 +7,11 @@ #include "base/json/json_reader.h" #include "base/values.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { -std::unique_ptr<base::Value> parseTracedValue(PassOwnPtr<TracedValue> value) +std::unique_ptr<base::Value> parseTracedValue(std::unique_ptr<TracedValue> value) { base::JSONReader reader; CString utf8 = value->toString().utf8(); @@ -19,7 +20,7 @@ TEST(TracedValueTest, FlatDictionary) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setInteger("int", 2014); value->setDouble("double", 0.0); value->setBoolean("bool", true); @@ -41,7 +42,7 @@ TEST(TracedValueTest, Hierarchy) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setInteger("i0", 2014); value->beginDictionary("dict1"); value->setInteger("i1", 2014); @@ -102,7 +103,7 @@ TEST(TracedValueTest, Escape) { - OwnPtr<TracedValue> value = TracedValue::create(); + std::unique_ptr<TracedValue> value = TracedValue::create(); value->setString("s0", "value0\\"); value->setString("s1", "value\n1"); value->setString("s2", "\"value2\"");
diff --git a/third_party/WebKit/Source/platform/WaitableEvent.cpp b/third_party/WebKit/Source/platform/WaitableEvent.cpp index 6c5f9ee..3bbb8577 100644 --- a/third_party/WebKit/Source/platform/WaitableEvent.cpp +++ b/third_party/WebKit/Source/platform/WaitableEvent.cpp
@@ -5,15 +5,14 @@ #include "platform/WaitableEvent.h" #include "base/synchronization/waitable_event.h" -#include "wtf/PassOwnPtr.h" - +#include "wtf/PtrUtil.h" #include <vector> namespace blink { WaitableEvent::WaitableEvent(ResetPolicy policy, InitialState state) { - m_impl = adoptPtr(new base::WaitableEvent( + m_impl = wrapUnique(new base::WaitableEvent( policy == ResetPolicy::Manual ? base::WaitableEvent::ResetPolicy::MANUAL : base::WaitableEvent::ResetPolicy::AUTOMATIC,
diff --git a/third_party/WebKit/Source/platform/WaitableEvent.h b/third_party/WebKit/Source/platform/WaitableEvent.h index 8b227cc..dad4a30 100644 --- a/third_party/WebKit/Source/platform/WaitableEvent.h +++ b/third_party/WebKit/Source/platform/WaitableEvent.h
@@ -32,8 +32,8 @@ #define WaitableEvent_h #include "platform/PlatformExport.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace base { class WaitableEvent; @@ -78,7 +78,7 @@ WaitableEvent(const WaitableEvent&) = delete; void operator=(const WaitableEvent&) = delete; - OwnPtr<base::WaitableEvent> m_impl; + std::unique_ptr<base::WaitableEvent> m_impl; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/WebScheduler.cpp b/third_party/WebKit/Source/platform/WebScheduler.cpp index 7e0a116..7cb3420 100644 --- a/third_party/WebKit/Source/platform/WebScheduler.cpp +++ b/third_party/WebKit/Source/platform/WebScheduler.cpp
@@ -7,7 +7,6 @@ #include "public/platform/WebFrameScheduler.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Assertions.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp b/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp index 6c7f2cdc..bb85da48 100644 --- a/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp +++ b/third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp
@@ -6,18 +6,20 @@ #include "platform/heap/SafePoint.h" #include "public/platform/WebScheduler.h" +#include "wtf/PtrUtil.h" #include "wtf/Threading.h" +#include <memory> namespace blink { -PassOwnPtr<WebThreadSupportingGC> WebThreadSupportingGC::create(const char* name, bool perThreadHeapEnabled) +std::unique_ptr<WebThreadSupportingGC> WebThreadSupportingGC::create(const char* name, bool perThreadHeapEnabled) { - return adoptPtr(new WebThreadSupportingGC(name, nullptr, perThreadHeapEnabled)); + return wrapUnique(new WebThreadSupportingGC(name, nullptr, perThreadHeapEnabled)); } -PassOwnPtr<WebThreadSupportingGC> WebThreadSupportingGC::createForThread(WebThread* thread, bool perThreadHeapEnabled) +std::unique_ptr<WebThreadSupportingGC> WebThreadSupportingGC::createForThread(WebThread* thread, bool perThreadHeapEnabled) { - return adoptPtr(new WebThreadSupportingGC(nullptr, thread, perThreadHeapEnabled)); + return wrapUnique(new WebThreadSupportingGC(nullptr, thread, perThreadHeapEnabled)); } WebThreadSupportingGC::WebThreadSupportingGC(const char* name, WebThread* thread, bool perThreadHeapEnabled) @@ -32,7 +34,7 @@ #endif if (!m_thread) { // If |thread| is not given, create a new one and own it. - m_owningThread = adoptPtr(Platform::current()->createThread(name)); + m_owningThread = wrapUnique(Platform::current()->createThread(name)); m_thread = m_owningThread.get(); } } @@ -49,7 +51,7 @@ void WebThreadSupportingGC::initialize() { ThreadState::attachCurrentThread(m_perThreadHeapEnabled); - m_gcTaskRunner = adoptPtr(new GCTaskRunner(m_thread)); + m_gcTaskRunner = wrapUnique(new GCTaskRunner(m_thread)); } void WebThreadSupportingGC::shutdown()
diff --git a/third_party/WebKit/Source/platform/WebThreadSupportingGC.h b/third_party/WebKit/Source/platform/WebThreadSupportingGC.h index faeacc2d..184365c 100644 --- a/third_party/WebKit/Source/platform/WebThreadSupportingGC.h +++ b/third_party/WebKit/Source/platform/WebThreadSupportingGC.h
@@ -11,8 +11,7 @@ #include "public/platform/WebThread.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -29,8 +28,8 @@ USING_FAST_MALLOC(WebThreadSupportingGC); WTF_MAKE_NONCOPYABLE(WebThreadSupportingGC); public: - static PassOwnPtr<WebThreadSupportingGC> create(const char* name, bool perThreadHeapEnabled = false); - static PassOwnPtr<WebThreadSupportingGC> createForThread(WebThread*, bool perThreadHeapEnabled = false); + static std::unique_ptr<WebThreadSupportingGC> create(const char* name, bool perThreadHeapEnabled = false); + static std::unique_ptr<WebThreadSupportingGC> createForThread(WebThread*, bool perThreadHeapEnabled = false); ~WebThreadSupportingGC(); void postTask(const WebTraceLocation& location, std::unique_ptr<SameThreadClosure> task) @@ -80,13 +79,13 @@ private: WebThreadSupportingGC(const char* name, WebThread*, bool perThreadHeapEnabled); - OwnPtr<GCTaskRunner> m_gcTaskRunner; + std::unique_ptr<GCTaskRunner> m_gcTaskRunner; // m_thread is guaranteed to be non-null after this instance is constructed. // m_owningThread is non-null unless this instance is constructed for an // existing thread via createForThread(). WebThread* m_thread = nullptr; - OwnPtr<WebThread> m_owningThread; + std::unique_ptr<WebThread> m_owningThread; bool m_perThreadHeapEnabled; };
diff --git a/third_party/WebKit/Source/platform/animation/AnimationTranslationUtilTest.cpp b/third_party/WebKit/Source/platform/animation/AnimationTranslationUtilTest.cpp index 0e9ac9b..4a1934b 100644 --- a/third_party/WebKit/Source/platform/animation/AnimationTranslationUtilTest.cpp +++ b/third_party/WebKit/Source/platform/animation/AnimationTranslationUtilTest.cpp
@@ -34,13 +34,14 @@ #include "platform/transforms/TranslateTransformOperation.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { TEST(AnimationTranslationUtilTest, transformsWork) { TransformOperations ops; - OwnPtr<CompositorTransformOperations> outOps = CompositorTransformOperations::create(); + std::unique_ptr<CompositorTransformOperations> outOps = CompositorTransformOperations::create(); ops.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TranslateX)); ops.operations().append(RotateTransformOperation::create(0.1, 0.2, 0.3, 200000.4, TransformOperation::Rotate3D)); @@ -73,7 +74,7 @@ TEST(AnimationTranslationUtilTest, filtersWork) { FilterOperations ops; - OwnPtr<CompositorFilterOperations> outOps = CompositorFilterOperations::create(); + std::unique_ptr<CompositorFilterOperations> outOps = CompositorFilterOperations::create(); ops.operations().append(BasicColorMatrixFilterOperation::create(0.5, FilterOperation::SATURATE)); ops.operations().append(BasicColorMatrixFilterOperation::create(0.2, FilterOperation::GRAYSCALE));
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp index 2b73cd8..63becca 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp
@@ -13,6 +13,7 @@ #include "platform/animation/CompositorFloatAnimationCurve.h" #include "platform/animation/CompositorScrollOffsetAnimationCurve.h" #include "platform/animation/CompositorTransformAnimationCurve.h" +#include <memory> using cc::Animation; using cc::AnimationIdProvider; @@ -126,7 +127,7 @@ return std::move(m_animation); } -PassOwnPtr<CompositorFloatAnimationCurve> CompositorAnimation::floatCurveForTesting() const +std::unique_ptr<CompositorFloatAnimationCurve> CompositorAnimation::floatCurveForTesting() const { const cc::AnimationCurve* curve = m_animation->curve(); DCHECK_EQ(cc::AnimationCurve::FLOAT, curve->Type());
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimation.h b/third_party/WebKit/Source/platform/animation/CompositorAnimation.h index c3e7bd85..681141a 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimation.h +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimation.h
@@ -9,8 +9,7 @@ #include "platform/PlatformExport.h" #include "platform/animation/CompositorTargetProperty.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" - +#include "wtf/PtrUtil.h" #include <memory> namespace cc { @@ -29,9 +28,9 @@ using Direction = cc::Animation::Direction; using FillMode = cc::Animation::FillMode; - static PassOwnPtr<CompositorAnimation> create(const blink::CompositorAnimationCurve& curve, CompositorTargetProperty::Type target, int groupId, int animationId) + static std::unique_ptr<CompositorAnimation> create(const blink::CompositorAnimationCurve& curve, CompositorTargetProperty::Type target, int groupId, int animationId) { - return adoptPtr(new CompositorAnimation(curve, target, animationId, groupId)); + return wrapUnique(new CompositorAnimation(curve, target, animationId, groupId)); } ~CompositorAnimation(); @@ -68,7 +67,7 @@ std::unique_ptr<cc::Animation> passAnimation(); - PassOwnPtr<CompositorFloatAnimationCurve> floatCurveForTesting() const; + std::unique_ptr<CompositorFloatAnimationCurve> floatCurveForTesting() const; private: CompositorAnimation(const CompositorAnimationCurve&, CompositorTargetProperty::Type, int animationId, int groupId);
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationHostTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationHostTest.cpp index 1514d2d4..30b47359 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationHostTest.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationHostTest.cpp
@@ -8,6 +8,8 @@ #include "platform/animation/CompositorAnimationTimeline.h" #include "platform/testing/CompositorTest.h" #include "platform/testing/WebLayerTreeViewImplForTesting.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -16,13 +18,13 @@ TEST_F(CompositorAnimationHostTest, AnimationHostNullWhenTimelineDetached) { - OwnPtr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); + std::unique_ptr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); scoped_refptr<cc::AnimationTimeline> ccTimeline = timeline->animationTimeline(); EXPECT_FALSE(ccTimeline->animation_host()); EXPECT_TRUE(timeline->compositorAnimationHost().isNull()); - OwnPtr<WebLayerTreeView> layerTreeHost = adoptPtr(new WebLayerTreeViewImplForTesting); + std::unique_ptr<WebLayerTreeView> layerTreeHost = wrapUnique(new WebLayerTreeViewImplForTesting); DCHECK(layerTreeHost); layerTreeHost->attachCompositorAnimationTimeline(timeline->animationTimeline());
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h index 117ffcc..003ae77 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h
@@ -12,8 +12,7 @@ #include "cc/animation/animation_player.h" #include "platform/PlatformExport.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" - +#include "wtf/PtrUtil.h" #include <memory> namespace blink { @@ -26,9 +25,9 @@ class PLATFORM_EXPORT CompositorAnimationPlayer : public cc::AnimationDelegate { WTF_MAKE_NONCOPYABLE(CompositorAnimationPlayer); public: - static PassOwnPtr<CompositorAnimationPlayer> create() + static std::unique_ptr<CompositorAnimationPlayer> create() { - return adoptPtr(new CompositorAnimationPlayer()); + return wrapUnique(new CompositorAnimationPlayer()); } ~CompositorAnimationPlayer();
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp index 25d8fdc..daa8206 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp
@@ -44,7 +44,7 @@ return m_player.get(); } - OwnPtr<CompositorAnimationPlayer> m_player; + std::unique_ptr<CompositorAnimationPlayer> m_player; }; class CompositorAnimationPlayerTest : public CompositorTest { @@ -56,7 +56,7 @@ { std::unique_ptr<CompositorAnimationDelegateForTesting> delegate(new CompositorAnimationDelegateForTesting); - OwnPtr<CompositorAnimationPlayer> player = CompositorAnimationPlayer::create(); + std::unique_ptr<CompositorAnimationPlayer> player = CompositorAnimationPlayer::create(); cc::AnimationPlayer* ccPlayer = player->animationPlayer(); player->setAnimationDelegate(delegate.get()); @@ -76,7 +76,7 @@ { std::unique_ptr<CompositorAnimationDelegateForTesting> delegate(new CompositorAnimationDelegateForTesting); - OwnPtr<CompositorAnimationPlayer> player = CompositorAnimationPlayer::create(); + std::unique_ptr<CompositorAnimationPlayer> player = CompositorAnimationPlayer::create(); scoped_refptr<cc::AnimationPlayer> ccPlayer = player->animationPlayer(); player->setAnimationDelegate(delegate.get()); @@ -92,7 +92,7 @@ TEST_F(CompositorAnimationPlayerTest, CompositorPlayerDeletionDetachesFromCCTimeline) { - OwnPtr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); + std::unique_ptr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); std::unique_ptr<CompositorAnimationPlayerTestClient> client(new CompositorAnimationPlayerTestClient); scoped_refptr<cc::AnimationTimeline> ccTimeline = timeline->animationTimeline();
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp index 066b14e..b230193 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp
@@ -11,8 +11,8 @@ TEST(WebCompositorAnimationTest, DefaultSettings) { - OwnPtr<CompositorAnimationCurve> curve = CompositorFloatAnimationCurve::create(); - OwnPtr<CompositorAnimation> animation = CompositorAnimation::create( + std::unique_ptr<CompositorAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create( *curve, CompositorTargetProperty::OPACITY, 1, 0); // Ensure that the defaults are correct. @@ -24,8 +24,8 @@ TEST(WebCompositorAnimationTest, ModifiedSettings) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); - OwnPtr<CompositorAnimation> animation = CompositorAnimation::create( + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create( *curve, CompositorTargetProperty::OPACITY, 1, 0); animation->setIterations(2); animation->setStartTime(2);
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationTimeline.h b/third_party/WebKit/Source/platform/animation/CompositorAnimationTimeline.h index 384c1a2..7a8eece 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationTimeline.h +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationTimeline.h
@@ -9,8 +9,7 @@ #include "cc/animation/animation_timeline.h" #include "platform/PlatformExport.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" - +#include "wtf/PtrUtil.h" #include <memory> namespace blink { @@ -22,9 +21,9 @@ class PLATFORM_EXPORT CompositorAnimationTimeline { WTF_MAKE_NONCOPYABLE(CompositorAnimationTimeline); public: - static PassOwnPtr<CompositorAnimationTimeline> create() + static std::unique_ptr<CompositorAnimationTimeline> create() { - return adoptPtr(new CompositorAnimationTimeline()); + return wrapUnique(new CompositorAnimationTimeline()); } ~CompositorAnimationTimeline();
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationTimelineTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationTimelineTest.cpp index 99912f9..c4d4d5d 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorAnimationTimelineTest.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationTimelineTest.cpp
@@ -9,6 +9,8 @@ #include "platform/animation/CompositorAnimationPlayer.h" #include "platform/testing/CompositorTest.h" #include "platform/testing/WebLayerTreeViewImplForTesting.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -17,12 +19,12 @@ TEST_F(CompositorAnimationTimelineTest, CompositorTimelineDeletionDetachesFromAnimationHost) { - OwnPtr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); + std::unique_ptr<CompositorAnimationTimeline> timeline = CompositorAnimationTimeline::create(); scoped_refptr<cc::AnimationTimeline> ccTimeline = timeline->animationTimeline(); EXPECT_FALSE(ccTimeline->animation_host()); - OwnPtr<WebLayerTreeView> layerTreeHost = adoptPtr(new WebLayerTreeViewImplForTesting); + std::unique_ptr<WebLayerTreeView> layerTreeHost = wrapUnique(new WebLayerTreeViewImplForTesting); DCHECK(layerTreeHost); layerTreeHost->attachCompositorAnimationTimeline(timeline->animationTimeline());
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFilterAnimationCurve.h b/third_party/WebKit/Source/platform/animation/CompositorFilterAnimationCurve.h index 9984335..4b621f1 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFilterAnimationCurve.h +++ b/third_party/WebKit/Source/platform/animation/CompositorFilterAnimationCurve.h
@@ -10,7 +10,8 @@ #include "platform/animation/CompositorFilterKeyframe.h" #include "platform/animation/TimingFunction.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace cc { class KeyframedFilterAnimationCurve; @@ -26,9 +27,9 @@ class PLATFORM_EXPORT CompositorFilterAnimationCurve : public CompositorAnimationCurve { WTF_MAKE_NONCOPYABLE(CompositorFilterAnimationCurve); public: - static PassOwnPtr<CompositorFilterAnimationCurve> create() + static std::unique_ptr<CompositorFilterAnimationCurve> create() { - return adoptPtr(new CompositorFilterAnimationCurve()); + return wrapUnique(new CompositorFilterAnimationCurve()); } ~CompositorFilterAnimationCurve() override;
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.cpp b/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.cpp index 1758ee89..d67ba928 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.cpp
@@ -4,9 +4,11 @@ #include "platform/animation/CompositorFilterKeyframe.h" +#include <memory> + namespace blink { -CompositorFilterKeyframe::CompositorFilterKeyframe(double time, PassOwnPtr<CompositorFilterOperations> value) +CompositorFilterKeyframe::CompositorFilterKeyframe(double time, std::unique_ptr<CompositorFilterOperations> value) : m_time(time) , m_value(std::move(value)) {
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.h b/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.h index 75a8687..bbecf3fa 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.h +++ b/third_party/WebKit/Source/platform/animation/CompositorFilterKeyframe.h
@@ -7,14 +7,13 @@ #include "platform/PlatformExport.h" #include "platform/graphics/CompositorFilterOperations.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { class PLATFORM_EXPORT CompositorFilterKeyframe { public: - CompositorFilterKeyframe(double time, PassOwnPtr<CompositorFilterOperations>); + CompositorFilterKeyframe(double time, std::unique_ptr<CompositorFilterOperations>); ~CompositorFilterKeyframe(); double time() const { return m_time; } @@ -23,7 +22,7 @@ private: double m_time; - OwnPtr<CompositorFilterOperations> m_value; + std::unique_ptr<CompositorFilterOperations> m_value; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp index 47fd8da..5c6a461 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp
@@ -7,6 +7,8 @@ #include "cc/animation/animation_curve.h" #include "cc/animation/keyframed_animation_curve.h" #include "cc/animation/timing_function.h" +#include "wtf/PtrUtil.h" +#include <memory> using blink::CompositorFloatKeyframe; @@ -26,9 +28,9 @@ { } -PassOwnPtr<CompositorFloatAnimationCurve> CompositorFloatAnimationCurve::CreateForTesting(std::unique_ptr<cc::KeyframedFloatAnimationCurve> curve) +std::unique_ptr<CompositorFloatAnimationCurve> CompositorFloatAnimationCurve::CreateForTesting(std::unique_ptr<cc::KeyframedFloatAnimationCurve> curve) { - return adoptPtr(new CompositorFloatAnimationCurve(std::move(curve))); + return wrapUnique(new CompositorFloatAnimationCurve(std::move(curve))); } Vector<CompositorFloatKeyframe> CompositorFloatAnimationCurve::keyframesForTesting() const
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.h b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.h index 2ddc495..69340ce 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.h +++ b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.h
@@ -10,8 +10,9 @@ #include "platform/animation/CompositorFloatKeyframe.h" #include "platform/animation/TimingFunction.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace cc { class KeyframedFloatAnimationCurve; @@ -27,14 +28,14 @@ class PLATFORM_EXPORT CompositorFloatAnimationCurve : public CompositorAnimationCurve { WTF_MAKE_NONCOPYABLE(CompositorFloatAnimationCurve); public: - static PassOwnPtr<CompositorFloatAnimationCurve> create() + static std::unique_ptr<CompositorFloatAnimationCurve> create() { - return adoptPtr(new CompositorFloatAnimationCurve()); + return wrapUnique(new CompositorFloatAnimationCurve()); } ~CompositorFloatAnimationCurve() override; - static PassOwnPtr<CompositorFloatAnimationCurve> CreateForTesting(std::unique_ptr<cc::KeyframedFloatAnimationCurve>); + static std::unique_ptr<CompositorFloatAnimationCurve> CreateForTesting(std::unique_ptr<cc::KeyframedFloatAnimationCurve>); Vector<CompositorFloatKeyframe> keyframesForTesting() const; // TODO(loyso): Erase these methods once blink/cc timing functions unified.
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurveTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurveTest.cpp index 23900099..dc34795 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurveTest.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurveTest.cpp
@@ -18,7 +18,7 @@ // Tests that a float animation with one keyframe works as expected. TEST(WebFloatAnimationCurveTest, OneFloatKeyframe) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 2)); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); EXPECT_FLOAT_EQ(2, curve->getValue(0)); @@ -30,7 +30,7 @@ // Tests that a float animation with two keyframes works as expected. TEST(WebFloatAnimationCurveTest, TwoFloatKeyframe) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 2)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 4)); EXPECT_FLOAT_EQ(2, curve->getValue(-1)); @@ -43,7 +43,7 @@ // Tests that a float animation with three keyframes works as expected. TEST(WebFloatAnimationCurveTest, ThreeFloatKeyframe) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 2)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 4)); curve->addLinearKeyframe(CompositorFloatKeyframe(2, 8)); @@ -59,7 +59,7 @@ // Tests that a float animation with multiple keys at a given time works sanely. TEST(WebFloatAnimationCurveTest, RepeatedFloatKeyTimes) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 4)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 4)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 6)); @@ -81,7 +81,7 @@ // Tests that the keyframes may be added out of order. TEST(WebFloatAnimationCurveTest, UnsortedKeyframes) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(2, 8)); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 2)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 4)); @@ -98,7 +98,7 @@ // Tests that a cubic bezier timing function works as expected. TEST(WebFloatAnimationCurveTest, CubicBezierTimingFunction) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), 0.25, 0, 0.75, 1); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -114,7 +114,7 @@ // Tests that an ease timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseTimingFunction) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), CubicBezierTimingFunction::EaseType::EASE); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -129,7 +129,7 @@ // Tests using a linear timing function. TEST(WebFloatAnimationCurveTest, LinearTimingFunction) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addLinearKeyframe(CompositorFloatKeyframe(0, 0)); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -142,7 +142,7 @@ // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseInTimingFunction) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), CubicBezierTimingFunction::EaseType::EASE_IN); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -157,7 +157,7 @@ // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseOutTimingFunction) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), CubicBezierTimingFunction::EaseType::EASE_OUT); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -172,7 +172,7 @@ // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, EaseInOutTimingFunction) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), CubicBezierTimingFunction::EaseType::EASE_IN_OUT); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1)); @@ -187,7 +187,7 @@ // Tests that an ease in timing function works as expected. TEST(WebFloatAnimationCurveTest, CustomBezierTimingFunction) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); double x1 = 0.3; double y1 = 0.2; double x2 = 0.8; @@ -206,7 +206,7 @@ // Tests that the default timing function is indeed ease. TEST(WebFloatAnimationCurveTest, DefaultTimingFunction) { - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, 0), CubicBezierTimingFunction::EaseType::EASE); curve->addLinearKeyframe(CompositorFloatKeyframe(1, 1));
diff --git a/third_party/WebKit/Source/platform/animation/CompositorScrollOffsetAnimationCurve.h b/third_party/WebKit/Source/platform/animation/CompositorScrollOffsetAnimationCurve.h index af799e3c..fc6a25d77 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorScrollOffsetAnimationCurve.h +++ b/third_party/WebKit/Source/platform/animation/CompositorScrollOffsetAnimationCurve.h
@@ -9,7 +9,8 @@ #include "platform/animation/CompositorAnimationCurve.h" #include "platform/geometry/FloatPoint.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace cc { class ScrollOffsetAnimationCurve; @@ -26,13 +27,13 @@ ScrollDurationInverseDelta }; - static PassOwnPtr<CompositorScrollOffsetAnimationCurve> create(FloatPoint targetValue, CompositorScrollOffsetAnimationCurve::ScrollDurationBehavior durationBehavior) + static std::unique_ptr<CompositorScrollOffsetAnimationCurve> create(FloatPoint targetValue, CompositorScrollOffsetAnimationCurve::ScrollDurationBehavior durationBehavior) { - return adoptPtr(new CompositorScrollOffsetAnimationCurve(targetValue, durationBehavior)); + return wrapUnique(new CompositorScrollOffsetAnimationCurve(targetValue, durationBehavior)); } - static PassOwnPtr<CompositorScrollOffsetAnimationCurve> create(cc::ScrollOffsetAnimationCurve* curve) + static std::unique_ptr<CompositorScrollOffsetAnimationCurve> create(cc::ScrollOffsetAnimationCurve* curve) { - return adoptPtr(new CompositorScrollOffsetAnimationCurve(curve)); + return wrapUnique(new CompositorScrollOffsetAnimationCurve(curve)); } ~CompositorScrollOffsetAnimationCurve() override;
diff --git a/third_party/WebKit/Source/platform/animation/CompositorTransformAnimationCurve.h b/third_party/WebKit/Source/platform/animation/CompositorTransformAnimationCurve.h index fcab856..1b882e3 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorTransformAnimationCurve.h +++ b/third_party/WebKit/Source/platform/animation/CompositorTransformAnimationCurve.h
@@ -10,7 +10,8 @@ #include "platform/animation/CompositorTransformKeyframe.h" #include "platform/animation/TimingFunction.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace cc { class KeyframedTransformAnimationCurve; @@ -26,9 +27,9 @@ class PLATFORM_EXPORT CompositorTransformAnimationCurve : public CompositorAnimationCurve { WTF_MAKE_NONCOPYABLE(CompositorTransformAnimationCurve); public: - static PassOwnPtr<CompositorTransformAnimationCurve> create() + static std::unique_ptr<CompositorTransformAnimationCurve> create() { - return adoptPtr(new CompositorTransformAnimationCurve()); + return wrapUnique(new CompositorTransformAnimationCurve()); } ~CompositorTransformAnimationCurve() override;
diff --git a/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.cpp b/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.cpp index dc7e32a..0bcc1d2 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.cpp +++ b/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.cpp
@@ -4,9 +4,11 @@ #include "platform/animation/CompositorTransformKeyframe.h" +#include <memory> + namespace blink { -CompositorTransformKeyframe::CompositorTransformKeyframe(double time, PassOwnPtr<CompositorTransformOperations> value) +CompositorTransformKeyframe::CompositorTransformKeyframe(double time, std::unique_ptr<CompositorTransformOperations> value) : m_time(time) , m_value(std::move(value)) {
diff --git a/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.h b/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.h index 4188a38f..1eeecd6 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.h +++ b/third_party/WebKit/Source/platform/animation/CompositorTransformKeyframe.h
@@ -8,15 +8,14 @@ #include "platform/PlatformExport.h" #include "platform/animation/CompositorTransformOperations.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { class PLATFORM_EXPORT CompositorTransformKeyframe { WTF_MAKE_NONCOPYABLE(CompositorTransformKeyframe); public: - CompositorTransformKeyframe(double time, PassOwnPtr<CompositorTransformOperations> value); + CompositorTransformKeyframe(double time, std::unique_ptr<CompositorTransformOperations> value); ~CompositorTransformKeyframe(); double time() const; @@ -24,7 +23,7 @@ private: double m_time; - OwnPtr<CompositorTransformOperations> m_value; + std::unique_ptr<CompositorTransformOperations> m_value; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/animation/CompositorTransformOperations.h b/third_party/WebKit/Source/platform/animation/CompositorTransformOperations.h index 418a3a9..6bf5254 100644 --- a/third_party/WebKit/Source/platform/animation/CompositorTransformOperations.h +++ b/third_party/WebKit/Source/platform/animation/CompositorTransformOperations.h
@@ -8,7 +8,8 @@ #include "cc/animation/transform_operations.h" #include "platform/PlatformExport.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> class SkMatrix44; @@ -17,9 +18,9 @@ class PLATFORM_EXPORT CompositorTransformOperations { WTF_MAKE_NONCOPYABLE(CompositorTransformOperations); public: - static PassOwnPtr<CompositorTransformOperations> create() + static std::unique_ptr<CompositorTransformOperations> create() { - return adoptPtr(new CompositorTransformOperations()); + return wrapUnique(new CompositorTransformOperations()); } const cc::TransformOperations& asTransformOperations() const;
diff --git a/third_party/WebKit/Source/platform/animation/TimingFunction.h b/third_party/WebKit/Source/platform/animation/TimingFunction.h index caab057..fb84a1d 100644 --- a/third_party/WebKit/Source/platform/animation/TimingFunction.h +++ b/third_party/WebKit/Source/platform/animation/TimingFunction.h
@@ -30,8 +30,6 @@ #include "platform/heap/Handle.h" #include "platform/heap/Heap.h" #include "ui/gfx/geometry/cubic_bezier.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/StdLibExtras.h"
diff --git a/third_party/WebKit/Source/platform/audio/AudioBus.cpp b/third_party/WebKit/Source/platform/audio/AudioBus.cpp index 2c8d4f4..91483ad 100644 --- a/third_party/WebKit/Source/platform/audio/AudioBus.cpp +++ b/third_party/WebKit/Source/platform/audio/AudioBus.cpp
@@ -33,10 +33,11 @@ #include "platform/audio/VectorMath.h" #include "public/platform/Platform.h" #include "public/platform/WebAudioBus.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <algorithm> #include <assert.h> #include <math.h> -#include <algorithm> +#include <memory> namespace blink { @@ -62,7 +63,7 @@ m_channels.reserveInitialCapacity(numberOfChannels); for (unsigned i = 0; i < numberOfChannels; ++i) { - PassOwnPtr<AudioChannel> channel = allocate ? adoptPtr(new AudioChannel(length)) : adoptPtr(new AudioChannel(0, length)); + std::unique_ptr<AudioChannel> channel = allocate ? wrapUnique(new AudioChannel(length)) : wrapUnique(new AudioChannel(0, length)); m_channels.append(std::move(channel)); } @@ -489,7 +490,7 @@ if (framesToDezipper) { if (!m_dezipperGainValues.get() || m_dezipperGainValues->size() < framesToDezipper) - m_dezipperGainValues = adoptPtr(new AudioFloatArray(framesToDezipper)); + m_dezipperGainValues = wrapUnique(new AudioFloatArray(framesToDezipper)); float* gainValues = m_dezipperGainValues->data(); for (unsigned i = 0; i < framesToDezipper; ++i) {
diff --git a/third_party/WebKit/Source/platform/audio/AudioBus.h b/third_party/WebKit/Source/platform/audio/AudioBus.h index eb20236..6f661961 100644 --- a/third_party/WebKit/Source/platform/audio/AudioBus.h +++ b/third_party/WebKit/Source/platform/audio/AudioBus.h
@@ -31,9 +31,9 @@ #include "platform/audio/AudioChannel.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -159,10 +159,10 @@ void sumFromByDownMixing(const AudioBus&); size_t m_length; - Vector<OwnPtr<AudioChannel>> m_channels; + Vector<std::unique_ptr<AudioChannel>> m_channels; int m_layout; float m_busGain; - OwnPtr<AudioFloatArray> m_dezipperGainValues; + std::unique_ptr<AudioFloatArray> m_dezipperGainValues; bool m_isFirstTime; float m_sampleRate; // 0.0 if unknown or N/A };
diff --git a/third_party/WebKit/Source/platform/audio/AudioChannel.cpp b/third_party/WebKit/Source/platform/audio/AudioChannel.cpp index 9c8edc63..d6c089f 100644 --- a/third_party/WebKit/Source/platform/audio/AudioChannel.cpp +++ b/third_party/WebKit/Source/platform/audio/AudioChannel.cpp
@@ -28,7 +28,6 @@ #include "platform/audio/AudioChannel.h" #include "platform/audio/VectorMath.h" -#include "wtf/OwnPtr.h" #include <algorithm> #include <math.h>
diff --git a/third_party/WebKit/Source/platform/audio/AudioChannel.h b/third_party/WebKit/Source/platform/audio/AudioChannel.h index f156911..472227b 100644 --- a/third_party/WebKit/Source/platform/audio/AudioChannel.h +++ b/third_party/WebKit/Source/platform/audio/AudioChannel.h
@@ -32,7 +32,8 @@ #include "platform/PlatformExport.h" #include "platform/audio/AudioArray.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -58,7 +59,7 @@ , m_rawPointer(nullptr) , m_silent(true) { - m_memBuffer = adoptPtr(new AudioFloatArray(length)); + m_memBuffer = wrapUnique(new AudioFloatArray(length)); } // A "blank" audio channel -- must call set() before it's useful... @@ -133,7 +134,7 @@ size_t m_length; float* m_rawPointer; - OwnPtr<AudioFloatArray> m_memBuffer; + std::unique_ptr<AudioFloatArray> m_memBuffer; bool m_silent; };
diff --git a/third_party/WebKit/Source/platform/audio/AudioDSPKernelProcessor.h b/third_party/WebKit/Source/platform/audio/AudioDSPKernelProcessor.h index ac02a9c0..abc1e20 100644 --- a/third_party/WebKit/Source/platform/audio/AudioDSPKernelProcessor.h +++ b/third_party/WebKit/Source/platform/audio/AudioDSPKernelProcessor.h
@@ -33,10 +33,9 @@ #include "platform/audio/AudioBus.h" #include "platform/audio/AudioProcessor.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -55,7 +54,7 @@ // Subclasses create the appropriate type of processing kernel here. // We'll call this to create a kernel for each channel. - virtual PassOwnPtr<AudioDSPKernel> createKernel() = 0; + virtual std::unique_ptr<AudioDSPKernel> createKernel() = 0; // AudioProcessor methods void initialize() override; @@ -69,7 +68,7 @@ double latencyTime() const override; protected: - Vector<OwnPtr<AudioDSPKernel>> m_kernels; + Vector<std::unique_ptr<AudioDSPKernel>> m_kernels; mutable Mutex m_processLock; bool m_hasJustReset; };
diff --git a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp index 53c329f..145baa8 100644 --- a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp +++ b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp
@@ -33,6 +33,8 @@ #include "platform/audio/AudioPullFIFO.h" #include "public/platform/Platform.h" #include "public/platform/WebSecurityOrigin.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -43,9 +45,9 @@ const size_t fifoSize = 8192; // Factory method: Chromium-implementation -PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate, const PassRefPtr<SecurityOrigin>& securityOrigin) +std::unique_ptr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate, const PassRefPtr<SecurityOrigin>& securityOrigin) { - return adoptPtr(new AudioDestination(callback, inputDeviceId, numberOfInputChannels, numberOfOutputChannels, sampleRate, securityOrigin)); + return wrapUnique(new AudioDestination(callback, inputDeviceId, numberOfInputChannels, numberOfOutputChannels, sampleRate, securityOrigin)); } AudioDestination::AudioDestination(AudioIOCallback& callback, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate, const PassRefPtr<SecurityOrigin>& securityOrigin) @@ -89,7 +91,7 @@ if (m_callbackBufferSize + renderBufferSize > fifoSize) return; - m_audioDevice = adoptPtr(Platform::current()->createAudioDevice(m_callbackBufferSize, numberOfInputChannels, numberOfOutputChannels, sampleRate, this, inputDeviceId, securityOrigin)); + m_audioDevice = wrapUnique(Platform::current()->createAudioDevice(m_callbackBufferSize, numberOfInputChannels, numberOfOutputChannels, sampleRate, this, inputDeviceId, securityOrigin)); ASSERT(m_audioDevice); // Record the sizes if we successfully created an output device. @@ -101,10 +103,10 @@ // contains enough data, the data will be provided directly. // Otherwise, the FIFO will call the provider enough times to // satisfy the request for data. - m_fifo = adoptPtr(new AudioPullFIFO(*this, numberOfOutputChannels, fifoSize, renderBufferSize)); + m_fifo = wrapUnique(new AudioPullFIFO(*this, numberOfOutputChannels, fifoSize, renderBufferSize)); // Input buffering. - m_inputFifo = adoptPtr(new AudioFIFO(numberOfInputChannels, fifoSize)); + m_inputFifo = wrapUnique(new AudioFIFO(numberOfInputChannels, fifoSize)); // If the callback size does not match the render size, then we need to buffer some // extra silence for the input. Otherwise, we can over-consume the input FIFO.
diff --git a/third_party/WebKit/Source/platform/audio/AudioDestination.h b/third_party/WebKit/Source/platform/audio/AudioDestination.h index 70b4780e..14c8f91 100644 --- a/third_party/WebKit/Source/platform/audio/AudioDestination.h +++ b/third_party/WebKit/Source/platform/audio/AudioDestination.h
@@ -37,6 +37,7 @@ #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -55,7 +56,7 @@ // Pass in (numberOfInputChannels > 0) if live/local audio input is desired. // Port-specific device identification information for live/local input streams can be passed in the inputDeviceId. - static PassOwnPtr<AudioDestination> create(AudioIOCallback&, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate, const PassRefPtr<SecurityOrigin>&); + static std::unique_ptr<AudioDestination> create(AudioIOCallback&, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate, const PassRefPtr<SecurityOrigin>&); virtual void start(); virtual void stop(); @@ -86,11 +87,11 @@ RefPtr<AudioBus> m_renderBus; float m_sampleRate; bool m_isPlaying; - OwnPtr<WebAudioDevice> m_audioDevice; + std::unique_ptr<WebAudioDevice> m_audioDevice; size_t m_callbackBufferSize; - OwnPtr<AudioFIFO> m_inputFifo; - OwnPtr<AudioPullFIFO> m_fifo; + std::unique_ptr<AudioFIFO> m_inputFifo; + std::unique_ptr<AudioPullFIFO> m_fifo; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/audio/AudioResampler.cpp b/third_party/WebKit/Source/platform/audio/AudioResampler.cpp index 175a5e1..2e6e3d9 100644 --- a/third_party/WebKit/Source/platform/audio/AudioResampler.cpp +++ b/third_party/WebKit/Source/platform/audio/AudioResampler.cpp
@@ -23,8 +23,9 @@ */ #include "platform/audio/AudioResampler.h" -#include <algorithm> #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" +#include <algorithm> namespace blink { @@ -33,7 +34,7 @@ AudioResampler::AudioResampler() : m_rate(1.0) { - m_kernels.append(adoptPtr(new AudioResamplerKernel(this))); + m_kernels.append(wrapUnique(new AudioResamplerKernel(this))); m_sourceBus = AudioBus::create(1, 0, false); } @@ -41,7 +42,7 @@ : m_rate(1.0) { for (unsigned i = 0; i < numberOfChannels; ++i) - m_kernels.append(adoptPtr(new AudioResamplerKernel(this))); + m_kernels.append(wrapUnique(new AudioResamplerKernel(this))); m_sourceBus = AudioBus::create(numberOfChannels, 0, false); } @@ -55,7 +56,7 @@ // First deal with adding or removing kernels. if (numberOfChannels > currentSize) { for (unsigned i = currentSize; i < numberOfChannels; ++i) - m_kernels.append(adoptPtr(new AudioResamplerKernel(this))); + m_kernels.append(wrapUnique(new AudioResamplerKernel(this))); } else m_kernels.resize(numberOfChannels);
diff --git a/third_party/WebKit/Source/platform/audio/AudioResampler.h b/third_party/WebKit/Source/platform/audio/AudioResampler.h index 5fc4636..1f6298c 100644 --- a/third_party/WebKit/Source/platform/audio/AudioResampler.h +++ b/third_party/WebKit/Source/platform/audio/AudioResampler.h
@@ -30,8 +30,8 @@ #include "platform/audio/AudioSourceProvider.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -63,7 +63,7 @@ private: double m_rate; - Vector<OwnPtr<AudioResamplerKernel>> m_kernels; + Vector<std::unique_ptr<AudioResamplerKernel>> m_kernels; RefPtr<AudioBus> m_sourceBus; };
diff --git a/third_party/WebKit/Source/platform/audio/DynamicsCompressor.cpp b/third_party/WebKit/Source/platform/audio/DynamicsCompressor.cpp index 2658a871..163e21bfe 100644 --- a/third_party/WebKit/Source/platform/audio/DynamicsCompressor.cpp +++ b/third_party/WebKit/Source/platform/audio/DynamicsCompressor.cpp
@@ -26,10 +26,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/DynamicsCompressor.h" #include "platform/audio/AudioBus.h" #include "platform/audio/AudioUtilities.h" +#include "platform/audio/DynamicsCompressor.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -195,8 +196,8 @@ void DynamicsCompressor::setNumberOfChannels(unsigned numberOfChannels) { - m_sourceChannels = adoptArrayPtr(new const float* [numberOfChannels]); - m_destinationChannels = adoptArrayPtr(new float* [numberOfChannels]); + m_sourceChannels = wrapArrayUnique(new const float* [numberOfChannels]); + m_destinationChannels = wrapArrayUnique(new float* [numberOfChannels]); m_compressor.setNumberOfChannels(numberOfChannels); m_numberOfChannels = numberOfChannels;
diff --git a/third_party/WebKit/Source/platform/audio/DynamicsCompressor.h b/third_party/WebKit/Source/platform/audio/DynamicsCompressor.h index a27ec22..b799cad 100644 --- a/third_party/WebKit/Source/platform/audio/DynamicsCompressor.h +++ b/third_party/WebKit/Source/platform/audio/DynamicsCompressor.h
@@ -34,7 +34,7 @@ #include "platform/audio/ZeroPole.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -98,8 +98,8 @@ float m_lastAnchor; float m_lastFilterStageGain; - OwnPtr<const float*[]> m_sourceChannels; - OwnPtr<float*[]> m_destinationChannels; + std::unique_ptr<const float*[]> m_sourceChannels; + std::unique_ptr<float*[]> m_destinationChannels; // The core compressor. DynamicsCompressorKernel m_compressor;
diff --git a/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp b/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp index 81fab59..cdb8282 100644 --- a/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp +++ b/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp
@@ -26,10 +26,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/DynamicsCompressorKernel.h" #include "platform/audio/AudioUtilities.h" #include "platform/audio/DenormalDisabler.h" +#include "platform/audio/DynamicsCompressorKernel.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" #include <algorithm> #include <cmath> @@ -72,7 +73,7 @@ m_preDelayBuffers.clear(); for (unsigned i = 0; i < numberOfChannels; ++i) - m_preDelayBuffers.append(adoptPtr(new AudioFloatArray(MaxPreDelayFrames))); + m_preDelayBuffers.append(wrapUnique(new AudioFloatArray(MaxPreDelayFrames))); } void DynamicsCompressorKernel::setPreDelayTime(float preDelayTime)
diff --git a/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.h b/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.h index e743ede..32da625 100644 --- a/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.h +++ b/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.h
@@ -33,8 +33,7 @@ #include "platform/audio/AudioArray.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -92,7 +91,7 @@ unsigned m_lastPreDelayFrames; void setPreDelayTime(float); - Vector<OwnPtr<AudioFloatArray>> m_preDelayBuffers; + Vector<std::unique_ptr<AudioFloatArray>> m_preDelayBuffers; int m_preDelayReadIndex; int m_preDelayWriteIndex;
diff --git a/third_party/WebKit/Source/platform/audio/FFTFrame.cpp b/third_party/WebKit/Source/platform/audio/FFTFrame.cpp index 9d70364c..9e167e8 100644 --- a/third_party/WebKit/Source/platform/audio/FFTFrame.cpp +++ b/third_party/WebKit/Source/platform/audio/FFTFrame.cpp
@@ -30,8 +30,9 @@ #include "platform/audio/VectorMath.h" #include "platform/Logging.h" #include "wtf/MathExtras.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include <complex> +#include <memory> #ifndef NDEBUG #include <stdio.h> @@ -49,9 +50,9 @@ doFFT(paddedResponse.data()); } -PassOwnPtr<FFTFrame> FFTFrame::createInterpolatedFrame(const FFTFrame& frame1, const FFTFrame& frame2, double x) +std::unique_ptr<FFTFrame> FFTFrame::createInterpolatedFrame(const FFTFrame& frame1, const FFTFrame& frame2, double x) { - OwnPtr<FFTFrame> newFrame = adoptPtr(new FFTFrame(frame1.fftSize())); + std::unique_ptr<FFTFrame> newFrame = wrapUnique(new FFTFrame(frame1.fftSize())); newFrame->interpolateFrequencyComponents(frame1, frame2, x);
diff --git a/third_party/WebKit/Source/platform/audio/FFTFrame.h b/third_party/WebKit/Source/platform/audio/FFTFrame.h index 2450084..fccda3b 100644 --- a/third_party/WebKit/Source/platform/audio/FFTFrame.h +++ b/third_party/WebKit/Source/platform/audio/FFTFrame.h
@@ -33,8 +33,8 @@ #include "platform/audio/AudioArray.h" #include "wtf/Allocator.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Threading.h" +#include <memory> #if OS(MACOSX) #include <Accelerate/Accelerate.h> @@ -74,7 +74,7 @@ // The remaining public methods have cross-platform implementations: // Interpolates from frame1 -> frame2 as x goes from 0.0 -> 1.0 - static PassOwnPtr<FFTFrame> createInterpolatedFrame(const FFTFrame& frame1, const FFTFrame& frame2, double x); + static std::unique_ptr<FFTFrame> createInterpolatedFrame(const FFTFrame& frame1, const FFTFrame& frame2, double x); void doPaddedFFT(const float* data, size_t dataSize); // zero-padding with dataSize <= fftSize double extractAverageGroupDelay(); void addConstantGroupDelay(double sampleFrameDelay);
diff --git a/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp b/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp index 7b88489..6b79e7f 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp +++ b/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp
@@ -29,6 +29,8 @@ #include "platform/audio/HRTFDatabase.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -39,9 +41,9 @@ const unsigned HRTFDatabase::InterpolationFactor = 1; const unsigned HRTFDatabase::NumberOfTotalElevations = NumberOfRawElevations * InterpolationFactor; -PassOwnPtr<HRTFDatabase> HRTFDatabase::create(float sampleRate) +std::unique_ptr<HRTFDatabase> HRTFDatabase::create(float sampleRate) { - return adoptPtr(new HRTFDatabase(sampleRate)); + return wrapUnique(new HRTFDatabase(sampleRate)); } HRTFDatabase::HRTFDatabase(float sampleRate) @@ -50,7 +52,7 @@ { unsigned elevationIndex = 0; for (int elevation = MinElevation; elevation <= MaxElevation; elevation += RawElevationAngleSpacing) { - OwnPtr<HRTFElevation> hrtfElevation = HRTFElevation::createForSubject("Composite", elevation, sampleRate); + std::unique_ptr<HRTFElevation> hrtfElevation = HRTFElevation::createForSubject("Composite", elevation, sampleRate); ASSERT(hrtfElevation.get()); if (!hrtfElevation.get()) return;
diff --git a/third_party/WebKit/Source/platform/audio/HRTFDatabase.h b/third_party/WebKit/Source/platform/audio/HRTFDatabase.h index 1674f90..81d8ada 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFDatabase.h +++ b/third_party/WebKit/Source/platform/audio/HRTFDatabase.h
@@ -33,9 +33,9 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -45,7 +45,7 @@ USING_FAST_MALLOC(HRTFDatabase); WTF_MAKE_NONCOPYABLE(HRTFDatabase); public: - static PassOwnPtr<HRTFDatabase> create(float sampleRate); + static std::unique_ptr<HRTFDatabase> create(float sampleRate); // getKernelsFromAzimuthElevation() returns a left and right ear kernel, and an interpolated left and right frame delay for the given azimuth and elevation. // azimuthBlend must be in the range 0 -> 1. @@ -78,7 +78,7 @@ // Returns the index for the correct HRTFElevation given the elevation angle. static unsigned indexFromElevationAngle(double); - Vector<OwnPtr<HRTFElevation>> m_elevations; + Vector<std::unique_ptr<HRTFElevation>> m_elevations; float m_sampleRate; };
diff --git a/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp b/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp index d57b760..6a150874 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp +++ b/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp
@@ -26,12 +26,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/HRTFDatabaseLoader.h" #include "platform/TaskSynchronizer.h" #include "platform/ThreadSafeFunctional.h" +#include "platform/audio/HRTFDatabaseLoader.h" #include "public/platform/Platform.h" #include "public/platform/WebTaskRunner.h" #include "public/platform/WebTraceLocation.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -92,7 +93,7 @@ MutexLocker locker(m_lock); if (!m_hrtfDatabase && !m_thread) { // Start the asynchronous database loading process. - m_thread = adoptPtr(Platform::current()->createThread("HRTF database loader")); + m_thread = wrapUnique(Platform::current()->createThread("HRTF database loader")); // TODO(alexclarke): Should this be posted as a loading task? m_thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&HRTFDatabaseLoader::loadTask, AllowCrossThreadAccess(this))); }
diff --git a/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.h b/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.h index 2b630880..bf8ec64 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.h +++ b/third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.h
@@ -34,6 +34,7 @@ #include "wtf/HashMap.h" #include "wtf/RefCounted.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> namespace blink { @@ -76,9 +77,9 @@ // Holding a m_lock is required when accessing m_hrtfDatabase since we access it from multiple threads. Mutex m_lock; - OwnPtr<HRTFDatabase> m_hrtfDatabase; + std::unique_ptr<HRTFDatabase> m_hrtfDatabase; - OwnPtr<WebThread> m_thread; + std::unique_ptr<WebThread> m_thread; float m_databaseSampleRate; };
diff --git a/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp b/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp index aa8ca147..c51917d 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp +++ b/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp
@@ -26,13 +26,15 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/HRTFElevation.h" -#include <math.h> -#include <algorithm> #include "platform/audio/AudioBus.h" +#include "platform/audio/HRTFElevation.h" #include "platform/audio/HRTFPanner.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/text/StringHash.h" +#include <algorithm> +#include <math.h> +#include <memory> namespace blink { @@ -96,7 +98,7 @@ } #endif -bool HRTFElevation::calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName, OwnPtr<HRTFKernel>& kernelL, OwnPtr<HRTFKernel>& kernelR) +bool HRTFElevation::calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName, std::unique_ptr<HRTFKernel>& kernelL, std::unique_ptr<HRTFKernel>& kernelR) { // Valid values for azimuth are 0 -> 345 in 15 degree increments. // Valid values for elevation are -45 -> +90 in 15 degree increments. @@ -219,15 +221,15 @@ 45 // 345 }; -PassOwnPtr<HRTFElevation> HRTFElevation::createForSubject(const String& subjectName, int elevation, float sampleRate) +std::unique_ptr<HRTFElevation> HRTFElevation::createForSubject(const String& subjectName, int elevation, float sampleRate) { bool isElevationGood = elevation >= -45 && elevation <= 90 && (elevation / 15) * 15 == elevation; ASSERT(isElevationGood); if (!isElevationGood) return nullptr; - OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); - OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); + std::unique_ptr<HRTFKernelList> kernelListL = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); + std::unique_ptr<HRTFKernelList> kernelListR = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); // Load convolution kernels from HRTF files. int interpolatedIndex = 0; @@ -256,11 +258,11 @@ } } - OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), elevation, sampleRate)); + std::unique_ptr<HRTFElevation> hrtfElevation = wrapUnique(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), elevation, sampleRate)); return hrtfElevation; } -PassOwnPtr<HRTFElevation> HRTFElevation::createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate) +std::unique_ptr<HRTFElevation> HRTFElevation::createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate) { ASSERT(hrtfElevation1 && hrtfElevation2); if (!hrtfElevation1 || !hrtfElevation2) @@ -268,8 +270,8 @@ ASSERT(x >= 0.0 && x < 1.0); - OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); - OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); + std::unique_ptr<HRTFKernelList> kernelListL = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); + std::unique_ptr<HRTFKernelList> kernelListR = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); HRTFKernelList* kernelListL1 = hrtfElevation1->kernelListL(); HRTFKernelList* kernelListR1 = hrtfElevation1->kernelListR(); @@ -285,7 +287,7 @@ // Interpolate elevation angle. double angle = (1.0 - x) * hrtfElevation1->elevationAngle() + x * hrtfElevation2->elevationAngle(); - OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), static_cast<int>(angle), sampleRate)); + std::unique_ptr<HRTFElevation> hrtfElevation = wrapUnique(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), static_cast<int>(angle), sampleRate)); return hrtfElevation; }
diff --git a/third_party/WebKit/Source/platform/audio/HRTFElevation.h b/third_party/WebKit/Source/platform/audio/HRTFElevation.h index 988a204..f3786c3d 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFElevation.h +++ b/third_party/WebKit/Source/platform/audio/HRTFElevation.h
@@ -32,12 +32,11 @@ #include "platform/audio/HRTFKernel.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -51,10 +50,10 @@ // Normally, there will only be a single HRTF database set, but this API supports the possibility of multiple ones with different names. // Interpolated azimuths will be generated based on InterpolationFactor. // Valid values for elevation are -45 -> +90 in 15 degree increments. - static PassOwnPtr<HRTFElevation> createForSubject(const String& subjectName, int elevation, float sampleRate); + static std::unique_ptr<HRTFElevation> createForSubject(const String& subjectName, int elevation, float sampleRate); // Given two HRTFElevations, and an interpolation factor x: 0 -> 1, returns an interpolated HRTFElevation. - static PassOwnPtr<HRTFElevation> createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate); + static std::unique_ptr<HRTFElevation> createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate); // Returns the list of left or right ear HRTFKernels for all the azimuths going from 0 to 360 degrees. HRTFKernelList* kernelListL() { return m_kernelListL.get(); } @@ -84,10 +83,10 @@ // Valid values for azimuth are 0 -> 345 in 15 degree increments. // Valid values for elevation are -45 -> +90 in 15 degree increments. // Returns true on success. - static bool calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName, OwnPtr<HRTFKernel>& kernelL, OwnPtr<HRTFKernel>& kernelR); + static bool calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName, std::unique_ptr<HRTFKernel>& kernelL, std::unique_ptr<HRTFKernel>& kernelR); private: - HRTFElevation(PassOwnPtr<HRTFKernelList> kernelListL, PassOwnPtr<HRTFKernelList> kernelListR, int elevation, float sampleRate) + HRTFElevation(std::unique_ptr<HRTFKernelList> kernelListL, std::unique_ptr<HRTFKernelList> kernelListR, int elevation, float sampleRate) : m_kernelListL(std::move(kernelListL)) , m_kernelListR(std::move(kernelListR)) , m_elevationAngle(elevation) @@ -95,8 +94,8 @@ { } - OwnPtr<HRTFKernelList> m_kernelListL; - OwnPtr<HRTFKernelList> m_kernelListR; + std::unique_ptr<HRTFKernelList> m_kernelListL; + std::unique_ptr<HRTFKernelList> m_kernelListR; double m_elevationAngle; float m_sampleRate; };
diff --git a/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp b/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp index 6ef5208b..df21d79 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp +++ b/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp
@@ -26,11 +26,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/HRTFKernel.h" -#include "platform/audio/AudioChannel.h" #include "platform/FloatConversion.h" +#include "platform/audio/AudioChannel.h" +#include "platform/audio/HRTFKernel.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" #include <algorithm> +#include <memory> namespace blink { @@ -86,13 +88,13 @@ } } - m_fftFrame = adoptPtr(new FFTFrame(fftSize)); + m_fftFrame = wrapUnique(new FFTFrame(fftSize)); m_fftFrame->doPaddedFFT(impulseResponse, truncatedResponseLength); } -PassOwnPtr<AudioChannel> HRTFKernel::createImpulseResponse() +std::unique_ptr<AudioChannel> HRTFKernel::createImpulseResponse() { - OwnPtr<AudioChannel> channel = adoptPtr(new AudioChannel(fftSize())); + std::unique_ptr<AudioChannel> channel = wrapUnique(new AudioChannel(fftSize())); FFTFrame fftFrame(*m_fftFrame); // Add leading delay back in. @@ -103,7 +105,7 @@ } // Interpolates two kernels with x: 0 -> 1 and returns the result. -PassOwnPtr<HRTFKernel> HRTFKernel::createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x) +std::unique_ptr<HRTFKernel> HRTFKernel::createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x) { ASSERT(kernel1 && kernel2); if (!kernel1 || !kernel2) @@ -120,7 +122,7 @@ float frameDelay = (1 - x) * kernel1->frameDelay() + x * kernel2->frameDelay(); - OwnPtr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kernel1->fftFrame(), *kernel2->fftFrame(), x); + std::unique_ptr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kernel1->fftFrame(), *kernel2->fftFrame(), x); return HRTFKernel::create(std::move(interpolatedFrame), frameDelay, sampleRate1); }
diff --git a/third_party/WebKit/Source/platform/audio/HRTFKernel.h b/third_party/WebKit/Source/platform/audio/HRTFKernel.h index 1de613d..d1e9f44 100644 --- a/third_party/WebKit/Source/platform/audio/HRTFKernel.h +++ b/third_party/WebKit/Source/platform/audio/HRTFKernel.h
@@ -32,9 +32,9 @@ #include "platform/audio/FFTFrame.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -52,18 +52,18 @@ public: // Note: this is destructive on the passed in AudioChannel. // The length of channel must be a power of two. - static PassOwnPtr<HRTFKernel> create(AudioChannel* channel, size_t fftSize, float sampleRate) + static std::unique_ptr<HRTFKernel> create(AudioChannel* channel, size_t fftSize, float sampleRate) { - return adoptPtr(new HRTFKernel(channel, fftSize, sampleRate)); + return wrapUnique(new HRTFKernel(channel, fftSize, sampleRate)); } - static PassOwnPtr<HRTFKernel> create(PassOwnPtr<FFTFrame> fftFrame, float frameDelay, float sampleRate) + static std::unique_ptr<HRTFKernel> create(std::unique_ptr<FFTFrame> fftFrame, float frameDelay, float sampleRate) { - return adoptPtr(new HRTFKernel(std::move(fftFrame), frameDelay, sampleRate)); + return wrapUnique(new HRTFKernel(std::move(fftFrame), frameDelay, sampleRate)); } // Given two HRTFKernels, and an interpolation factor x: 0 -> 1, returns an interpolated HRTFKernel. - static PassOwnPtr<HRTFKernel> createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x); + static std::unique_ptr<HRTFKernel> createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x); FFTFrame* fftFrame() { return m_fftFrame.get(); } @@ -74,25 +74,25 @@ double nyquist() const { return 0.5 * sampleRate(); } // Converts back into impulse-response form. - PassOwnPtr<AudioChannel> createImpulseResponse(); + std::unique_ptr<AudioChannel> createImpulseResponse(); private: // Note: this is destructive on the passed in AudioChannel. HRTFKernel(AudioChannel*, size_t fftSize, float sampleRate); - HRTFKernel(PassOwnPtr<FFTFrame> fftFrame, float frameDelay, float sampleRate) + HRTFKernel(std::unique_ptr<FFTFrame> fftFrame, float frameDelay, float sampleRate) : m_fftFrame(std::move(fftFrame)) , m_frameDelay(frameDelay) , m_sampleRate(sampleRate) { } - OwnPtr<FFTFrame> m_fftFrame; + std::unique_ptr<FFTFrame> m_fftFrame; float m_frameDelay; float m_sampleRate; }; -typedef Vector<OwnPtr<HRTFKernel>> HRTFKernelList; +typedef Vector<std::unique_ptr<HRTFKernel>> HRTFKernelList; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/audio/MultiChannelResampler.cpp b/third_party/WebKit/Source/platform/audio/MultiChannelResampler.cpp index e8b7168e..af2e8a24 100644 --- a/third_party/WebKit/Source/platform/audio/MultiChannelResampler.cpp +++ b/third_party/WebKit/Source/platform/audio/MultiChannelResampler.cpp
@@ -26,8 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/MultiChannelResampler.h" #include "platform/audio/AudioBus.h" +#include "platform/audio/MultiChannelResampler.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -92,7 +93,7 @@ { // Create each channel's resampler. for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) - m_kernels.append(adoptPtr(new SincResampler(scaleFactor))); + m_kernels.append(wrapUnique(new SincResampler(scaleFactor))); } void MultiChannelResampler::process(AudioSourceProvider* provider, AudioBus* destination, size_t framesToProcess)
diff --git a/third_party/WebKit/Source/platform/audio/MultiChannelResampler.h b/third_party/WebKit/Source/platform/audio/MultiChannelResampler.h index 2888e08..33f02b2 100644 --- a/third_party/WebKit/Source/platform/audio/MultiChannelResampler.h +++ b/third_party/WebKit/Source/platform/audio/MultiChannelResampler.h
@@ -32,7 +32,7 @@ #include "platform/audio/SincResampler.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -53,7 +53,7 @@ // https://bugs.webkit.org/show_bug.cgi?id=75118 // Each channel will be resampled using a high-quality SincResampler. - Vector<OwnPtr<SincResampler>> m_kernels; + Vector<std::unique_ptr<SincResampler>> m_kernels; unsigned m_numberOfChannels; };
diff --git a/third_party/WebKit/Source/platform/audio/Panner.cpp b/third_party/WebKit/Source/platform/audio/Panner.cpp index 363999dc..196e071 100644 --- a/third_party/WebKit/Source/platform/audio/Panner.cpp +++ b/third_party/WebKit/Source/platform/audio/Panner.cpp
@@ -26,20 +26,22 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/Panner.h" #include "platform/audio/EqualPowerPanner.h" #include "platform/audio/HRTFPanner.h" +#include "platform/audio/Panner.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<Panner> Panner::create(PanningModel model, float sampleRate, HRTFDatabaseLoader* databaseLoader) +std::unique_ptr<Panner> Panner::create(PanningModel model, float sampleRate, HRTFDatabaseLoader* databaseLoader) { switch (model) { case PanningModelEqualPower: - return adoptPtr(new EqualPowerPanner(sampleRate)); + return wrapUnique(new EqualPowerPanner(sampleRate)); case PanningModelHRTF: - return adoptPtr(new HRTFPanner(sampleRate, databaseLoader)); + return wrapUnique(new HRTFPanner(sampleRate, databaseLoader)); default: ASSERT_NOT_REACHED();
diff --git a/third_party/WebKit/Source/platform/audio/Panner.h b/third_party/WebKit/Source/platform/audio/Panner.h index 896863a..79109cb 100644 --- a/third_party/WebKit/Source/platform/audio/Panner.h +++ b/third_party/WebKit/Source/platform/audio/Panner.h
@@ -32,8 +32,8 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/build_config.h" +#include <memory> namespace blink { @@ -54,7 +54,7 @@ typedef unsigned PanningModel; - static PassOwnPtr<Panner> create(PanningModel, float sampleRate, HRTFDatabaseLoader*); + static std::unique_ptr<Panner> create(PanningModel, float sampleRate, HRTFDatabaseLoader*); virtual ~Panner() { };
diff --git a/third_party/WebKit/Source/platform/audio/Reverb.cpp b/third_party/WebKit/Source/platform/audio/Reverb.cpp index dc7e9ea..5f4babda 100644 --- a/third_party/WebKit/Source/platform/audio/Reverb.cpp +++ b/third_party/WebKit/Source/platform/audio/Reverb.cpp
@@ -26,13 +26,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/Reverb.h" -#include <math.h> #include "platform/audio/AudioBus.h" +#include "platform/audio/Reverb.h" #include "platform/audio/VectorMath.h" #include "wtf/MathExtras.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <math.h> +#include <memory> #if OS(MACOSX) using namespace std; @@ -116,7 +116,7 @@ for (size_t i = 0; i < numResponseChannels; ++i) { AudioChannel* channel = impulseResponseBuffer->channel(i); - OwnPtr<ReverbConvolver> convolver = adoptPtr(new ReverbConvolver(channel, renderSliceSize, maxFFTSize, convolverRenderPhase, useBackgroundThreads)); + std::unique_ptr<ReverbConvolver> convolver = wrapUnique(new ReverbConvolver(channel, renderSliceSize, maxFFTSize, convolverRenderPhase, useBackgroundThreads)); m_convolvers.append(std::move(convolver)); convolverRenderPhase += renderSliceSize;
diff --git a/third_party/WebKit/Source/platform/audio/Reverb.h b/third_party/WebKit/Source/platform/audio/Reverb.h index 1fb29a8..3320931 100644 --- a/third_party/WebKit/Source/platform/audio/Reverb.h +++ b/third_party/WebKit/Source/platform/audio/Reverb.h
@@ -33,6 +33,7 @@ #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -60,7 +61,7 @@ size_t m_impulseResponseLength; - Vector<OwnPtr<ReverbConvolver>> m_convolvers; + Vector<std::unique_ptr<ReverbConvolver>> m_convolvers; // For "True" stereo processing RefPtr<AudioBus> m_tempBuffer;
diff --git a/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp b/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp index 4a59630..dfa6ab7 100644 --- a/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp +++ b/third_party/WebKit/Source/platform/audio/ReverbConvolver.cpp
@@ -26,14 +26,16 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/ReverbConvolver.h" #include "platform/ThreadSafeFunctional.h" #include "platform/audio/AudioBus.h" +#include "platform/audio/ReverbConvolver.h" #include "platform/audio/VectorMath.h" #include "public/platform/Platform.h" #include "public/platform/WebTaskRunner.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -88,7 +90,7 @@ bool useDirectConvolver = !stageOffset; - OwnPtr<ReverbConvolverStage> stage = adoptPtr(new ReverbConvolverStage(response, totalResponseLength, reverbTotalLatency, stageOffset, stageSize, fftSize, renderPhase, renderSliceSize, &m_accumulationBuffer, useDirectConvolver)); + std::unique_ptr<ReverbConvolverStage> stage = wrapUnique(new ReverbConvolverStage(response, totalResponseLength, reverbTotalLatency, stageOffset, stageSize, fftSize, renderPhase, renderSliceSize, &m_accumulationBuffer, useDirectConvolver)); bool isBackgroundStage = false; @@ -116,7 +118,7 @@ // Start up background thread // FIXME: would be better to up the thread priority here. It doesn't need to be real-time, but higher than the default... if (useBackgroundThreads && m_backgroundStages.size() > 0) - m_backgroundThread = adoptPtr(Platform::current()->createThread("Reverb convolution background thread")); + m_backgroundThread = wrapUnique(Platform::current()->createThread("Reverb convolution background thread")); } ReverbConvolver::~ReverbConvolver()
diff --git a/third_party/WebKit/Source/platform/audio/ReverbConvolver.h b/third_party/WebKit/Source/platform/audio/ReverbConvolver.h index 07b981b..5e61ee77 100644 --- a/third_party/WebKit/Source/platform/audio/ReverbConvolver.h +++ b/third_party/WebKit/Source/platform/audio/ReverbConvolver.h
@@ -36,8 +36,8 @@ #include "platform/audio/ReverbConvolverStage.h" #include "platform/audio/ReverbInputBuffer.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -64,8 +64,8 @@ private: void processInBackground(); - Vector<OwnPtr<ReverbConvolverStage>> m_stages; - Vector<OwnPtr<ReverbConvolverStage>> m_backgroundStages; + Vector<std::unique_ptr<ReverbConvolverStage>> m_stages; + Vector<std::unique_ptr<ReverbConvolverStage>> m_backgroundStages; size_t m_impulseResponseLength; ReverbAccumulationBuffer m_accumulationBuffer; @@ -81,7 +81,7 @@ size_t m_maxRealtimeFFTSize; // Background thread and synchronization - OwnPtr<WebThread> m_backgroundThread; + std::unique_ptr<WebThread> m_backgroundThread; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.cpp b/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.cpp index 7bc04a3d..4b3d63e 100644 --- a/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.cpp +++ b/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.cpp
@@ -26,12 +26,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/audio/ReverbConvolverStage.h" #include "platform/audio/ReverbAccumulationBuffer.h" #include "platform/audio/ReverbConvolver.h" +#include "platform/audio/ReverbConvolverStage.h" #include "platform/audio/ReverbInputBuffer.h" #include "platform/audio/VectorMath.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -48,16 +48,16 @@ ASSERT(accumulationBuffer); if (!m_directMode) { - m_fftKernel = adoptPtr(new FFTFrame(fftSize)); + m_fftKernel = wrapUnique(new FFTFrame(fftSize)); m_fftKernel->doPaddedFFT(impulseResponse + stageOffset, stageLength); - m_fftConvolver = adoptPtr(new FFTConvolver(fftSize)); + m_fftConvolver = wrapUnique(new FFTConvolver(fftSize)); } else { ASSERT(!stageOffset); ASSERT(stageLength <= fftSize / 2); - m_directKernel = adoptPtr(new AudioFloatArray(fftSize / 2)); + m_directKernel = wrapUnique(new AudioFloatArray(fftSize / 2)); m_directKernel->copyToRange(impulseResponse, 0, stageLength); - m_directConvolver = adoptPtr(new DirectConvolver(renderSliceSize)); + m_directConvolver = wrapUnique(new DirectConvolver(renderSliceSize)); } m_temporaryBuffer.allocate(renderSliceSize);
diff --git a/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.h b/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.h index 8b4983a..e1b99d3e 100644 --- a/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.h +++ b/third_party/WebKit/Source/platform/audio/ReverbConvolverStage.h
@@ -33,7 +33,7 @@ #include "platform/audio/FFTFrame.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -63,8 +63,8 @@ int inputReadIndex() const { return m_inputReadIndex; } private: - OwnPtr<FFTFrame> m_fftKernel; - OwnPtr<FFTConvolver> m_fftConvolver; + std::unique_ptr<FFTFrame> m_fftKernel; + std::unique_ptr<FFTConvolver> m_fftConvolver; AudioFloatArray m_preDelayBuffer; @@ -80,8 +80,8 @@ AudioFloatArray m_temporaryBuffer; bool m_directMode; - OwnPtr<AudioFloatArray> m_directKernel; - OwnPtr<DirectConvolver> m_directConvolver; + std::unique_ptr<AudioFloatArray> m_directKernel; + std::unique_ptr<DirectConvolver> m_directConvolver; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/audio/Spatializer.cpp b/third_party/WebKit/Source/platform/audio/Spatializer.cpp index ba11fbc3..ff4896c 100644 --- a/third_party/WebKit/Source/platform/audio/Spatializer.cpp +++ b/third_party/WebKit/Source/platform/audio/Spatializer.cpp
@@ -4,14 +4,16 @@ #include "platform/audio/Spatializer.h" #include "platform/audio/StereoPanner.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<Spatializer> Spatializer::create(PanningModel model, float sampleRate) +std::unique_ptr<Spatializer> Spatializer::create(PanningModel model, float sampleRate) { switch (model) { case PanningModelEqualPower: - return adoptPtr(new StereoPanner(sampleRate)); + return wrapUnique(new StereoPanner(sampleRate)); default: ASSERT_NOT_REACHED(); return nullptr;
diff --git a/third_party/WebKit/Source/platform/audio/Spatializer.h b/third_party/WebKit/Source/platform/audio/Spatializer.h index 9da000b..a4629a5 100644 --- a/third_party/WebKit/Source/platform/audio/Spatializer.h +++ b/third_party/WebKit/Source/platform/audio/Spatializer.h
@@ -8,7 +8,7 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -28,7 +28,7 @@ typedef unsigned PanningModel; - static PassOwnPtr<Spatializer> create(PanningModel, float sampleRate); + static std::unique_ptr<Spatializer> create(PanningModel, float sampleRate); virtual ~Spatializer(); // Handle sample-accurate panning by AudioParam automation.
diff --git a/third_party/WebKit/Source/platform/blob/BlobData.cpp b/third_party/WebKit/Source/platform/blob/BlobData.cpp index 85c4f2e..4a82ea4 100644 --- a/third_party/WebKit/Source/platform/blob/BlobData.cpp +++ b/third_party/WebKit/Source/platform/blob/BlobData.cpp
@@ -33,12 +33,13 @@ #include "platform/UUID.h" #include "platform/blob/BlobRegistry.h" #include "platform/text/LineEnding.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/text/CString.h" #include "wtf/text/TextEncoding.h" +#include <memory> namespace blink { @@ -78,9 +79,9 @@ fileSystemURL = fileSystemURL.copy(); } -PassOwnPtr<BlobData> BlobData::create() +std::unique_ptr<BlobData> BlobData::create() { - return adoptPtr(new BlobData()); + return wrapUnique(new BlobData()); } void BlobData::detachFromCurrentThread() @@ -203,7 +204,7 @@ BlobRegistry::registerBlobData(m_uuid, BlobData::create()); } -BlobDataHandle::BlobDataHandle(PassOwnPtr<BlobData> data, long long size) +BlobDataHandle::BlobDataHandle(std::unique_ptr<BlobData> data, long long size) : m_uuid(createCanonicalUUIDString()) , m_type(data->contentType().isolatedCopy()) , m_size(size)
diff --git a/third_party/WebKit/Source/platform/blob/BlobData.h b/third_party/WebKit/Source/platform/blob/BlobData.h index d357358c..c132b95 100644 --- a/third_party/WebKit/Source/platform/blob/BlobData.h +++ b/third_party/WebKit/Source/platform/blob/BlobData.h
@@ -35,9 +35,9 @@ #include "platform/FileMetadata.h" #include "platform/weborigin/KURL.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -164,7 +164,7 @@ USING_FAST_MALLOC(BlobData); WTF_MAKE_NONCOPYABLE(BlobData); public: - static PassOwnPtr<BlobData> create(); + static std::unique_ptr<BlobData> create(); // Detaches from current thread so that it can be passed to another thread. void detachFromCurrentThread(); @@ -208,7 +208,7 @@ } // For initial creation. - static PassRefPtr<BlobDataHandle> create(PassOwnPtr<BlobData> data, long long size) + static PassRefPtr<BlobDataHandle> create(std::unique_ptr<BlobData> data, long long size) { return adoptRef(new BlobDataHandle(std::move(data), size)); } @@ -227,7 +227,7 @@ private: BlobDataHandle(); - BlobDataHandle(PassOwnPtr<BlobData>, long long size); + BlobDataHandle(std::unique_ptr<BlobData>, long long size); BlobDataHandle(const String& uuid, const String& type, long long size); const String m_uuid;
diff --git a/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp b/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp index e7bef25..8ac1d5ac 100644 --- a/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp +++ b/third_party/WebKit/Source/platform/blob/BlobDataTest.cpp
@@ -6,8 +6,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -28,7 +28,7 @@ EXPECT_EQ(0, memcmp(data.m_items[0].data->data(), "abcdefps1ps2", 12)); - OwnPtr<char[]> large_data = adoptArrayPtr(new char[kMaxConsolidatedItemSizeInBytes]); + std::unique_ptr<char[]> large_data = wrapArrayUnique(new char[kMaxConsolidatedItemSizeInBytes]); data.appendBytes(large_data.get(), kMaxConsolidatedItemSizeInBytes); EXPECT_EQ(2u, data.m_items.size());
diff --git a/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp b/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp index c0d11582..6458fd9 100644 --- a/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp +++ b/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp
@@ -48,6 +48,7 @@ #include "wtf/Threading.h" #include "wtf/text/StringHash.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -88,7 +89,7 @@ originMap()->remove(url.getString()); } -void BlobRegistry::registerBlobData(const String& uuid, PassOwnPtr<BlobData> data) +void BlobRegistry::registerBlobData(const String& uuid, std::unique_ptr<BlobData> data) { blobRegistry()->registerBlobData(uuid, WebBlobData(std::move(data))); }
diff --git a/third_party/WebKit/Source/platform/blob/BlobRegistry.h b/third_party/WebKit/Source/platform/blob/BlobRegistry.h index 603cd52..3631adc 100644 --- a/third_party/WebKit/Source/platform/blob/BlobRegistry.h +++ b/third_party/WebKit/Source/platform/blob/BlobRegistry.h
@@ -34,8 +34,8 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include <memory> namespace blink { @@ -50,7 +50,7 @@ STATIC_ONLY(BlobRegistry); public: // Methods for controlling Blobs. - static void registerBlobData(const String& uuid, PassOwnPtr<BlobData>); + static void registerBlobData(const String& uuid, std::unique_ptr<BlobData>); static void addBlobDataRef(const String& uuid); static void removeBlobDataRef(const String& uuid); static void registerPublicBlobURL(SecurityOrigin*, const KURL&, PassRefPtr<BlobDataHandle>);
diff --git a/third_party/WebKit/Source/platform/exported/Platform.cpp b/third_party/WebKit/Source/platform/exported/Platform.cpp index 1eaf688..c0f50a0 100644 --- a/third_party/WebKit/Source/platform/exported/Platform.cpp +++ b/third_party/WebKit/Source/platform/exported/Platform.cpp
@@ -40,7 +40,6 @@ #include "public/platform/ServiceRegistry.h" #include "public/platform/WebPrerenderingSupport.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.cpp b/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.cpp index 50453e7..a5dd44f 100644 --- a/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.cpp +++ b/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.cpp
@@ -27,24 +27,26 @@ #include "public/platform/WebGestureCurve.h" #include "public/platform/WebGestureCurveTarget.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<WebActiveGestureAnimation> WebActiveGestureAnimation::createAtAnimationStart(PassOwnPtr<WebGestureCurve> curve, WebGestureCurveTarget* target) +std::unique_ptr<WebActiveGestureAnimation> WebActiveGestureAnimation::createAtAnimationStart(std::unique_ptr<WebGestureCurve> curve, WebGestureCurveTarget* target) { - return adoptPtr(new WebActiveGestureAnimation(std::move(curve), target, 0, true)); + return wrapUnique(new WebActiveGestureAnimation(std::move(curve), target, 0, true)); } -PassOwnPtr<WebActiveGestureAnimation> WebActiveGestureAnimation::createWithTimeOffset(PassOwnPtr<WebGestureCurve> curve, WebGestureCurveTarget* target, double startTime) +std::unique_ptr<WebActiveGestureAnimation> WebActiveGestureAnimation::createWithTimeOffset(std::unique_ptr<WebGestureCurve> curve, WebGestureCurveTarget* target, double startTime) { - return adoptPtr(new WebActiveGestureAnimation(std::move(curve), target, startTime, false)); + return wrapUnique(new WebActiveGestureAnimation(std::move(curve), target, startTime, false)); } WebActiveGestureAnimation::~WebActiveGestureAnimation() { } -WebActiveGestureAnimation::WebActiveGestureAnimation(PassOwnPtr<WebGestureCurve> curve, WebGestureCurveTarget* target, double startTime, bool waitingForFirstTick) +WebActiveGestureAnimation::WebActiveGestureAnimation(std::unique_ptr<WebGestureCurve> curve, WebGestureCurveTarget* target, double startTime, bool waitingForFirstTick) : m_startTime(startTime) , m_waitingForFirstTick(waitingForFirstTick) , m_curve(std::move(curve))
diff --git a/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.h b/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.h index 4510ff8..9ca0bec 100644 --- a/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.h +++ b/third_party/WebKit/Source/platform/exported/WebActiveGestureAnimation.h
@@ -29,8 +29,7 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -45,19 +44,19 @@ USING_FAST_MALLOC(WebActiveGestureAnimation); WTF_MAKE_NONCOPYABLE(WebActiveGestureAnimation); public: - static PassOwnPtr<WebActiveGestureAnimation> createAtAnimationStart(PassOwnPtr<WebGestureCurve>, WebGestureCurveTarget*); - static PassOwnPtr<WebActiveGestureAnimation> createWithTimeOffset(PassOwnPtr<WebGestureCurve>, WebGestureCurveTarget*, double startTime); + static std::unique_ptr<WebActiveGestureAnimation> createAtAnimationStart(std::unique_ptr<WebGestureCurve>, WebGestureCurveTarget*); + static std::unique_ptr<WebActiveGestureAnimation> createWithTimeOffset(std::unique_ptr<WebGestureCurve>, WebGestureCurveTarget*, double startTime); ~WebActiveGestureAnimation(); bool animate(double time); private: // Assumes a valid WebGestureCurveTarget that outlives the animation. - WebActiveGestureAnimation(PassOwnPtr<WebGestureCurve>, WebGestureCurveTarget*, double startTime, bool waitingForFirstTick); + WebActiveGestureAnimation(std::unique_ptr<WebGestureCurve>, WebGestureCurveTarget*, double startTime, bool waitingForFirstTick); double m_startTime; bool m_waitingForFirstTick; - OwnPtr<WebGestureCurve> m_curve; + std::unique_ptr<WebGestureCurve> m_curve; WebGestureCurveTarget* m_target; };
diff --git a/third_party/WebKit/Source/platform/exported/WebBlobData.cpp b/third_party/WebKit/Source/platform/exported/WebBlobData.cpp index 6b67d588..942d2aec 100644 --- a/third_party/WebKit/Source/platform/exported/WebBlobData.cpp +++ b/third_party/WebKit/Source/platform/exported/WebBlobData.cpp
@@ -32,7 +32,7 @@ #include "public/platform/WebBlobData.h" #include "platform/blob/BlobData.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -94,18 +94,18 @@ return m_private->contentType(); } -WebBlobData::WebBlobData(PassOwnPtr<BlobData> data) +WebBlobData::WebBlobData(std::unique_ptr<BlobData> data) : m_private(std::move(data)) { } -WebBlobData& WebBlobData::operator=(PassOwnPtr<BlobData> data) +WebBlobData& WebBlobData::operator=(std::unique_ptr<BlobData> data) { m_private.reset(std::move(data)); return *this; } -WebBlobData::operator PassOwnPtr<BlobData>() +WebBlobData::operator std::unique_ptr<BlobData>() { return m_private.release(); }
diff --git a/third_party/WebKit/Source/platform/exported/WebContentSettingCallbacks.cpp b/third_party/WebKit/Source/platform/exported/WebContentSettingCallbacks.cpp index de907f6e..2524e147 100644 --- a/third_party/WebKit/Source/platform/exported/WebContentSettingCallbacks.cpp +++ b/third_party/WebKit/Source/platform/exported/WebContentSettingCallbacks.cpp
@@ -6,12 +6,13 @@ #include "platform/ContentSettingCallbacks.h" #include "wtf/RefCounted.h" +#include <memory> namespace blink { class WebContentSettingCallbacksPrivate : public RefCounted<WebContentSettingCallbacksPrivate> { public: - static PassRefPtr<WebContentSettingCallbacksPrivate> create(PassOwnPtr<ContentSettingCallbacks> callbacks) + static PassRefPtr<WebContentSettingCallbacksPrivate> create(std::unique_ptr<ContentSettingCallbacks> callbacks) { return adoptRef(new WebContentSettingCallbacksPrivate(std::move(callbacks))); } @@ -19,11 +20,11 @@ ContentSettingCallbacks* callbacks() { return m_callbacks.get(); } private: - WebContentSettingCallbacksPrivate(PassOwnPtr<ContentSettingCallbacks> callbacks) : m_callbacks(std::move(callbacks)) { } - OwnPtr<ContentSettingCallbacks> m_callbacks; + WebContentSettingCallbacksPrivate(std::unique_ptr<ContentSettingCallbacks> callbacks) : m_callbacks(std::move(callbacks)) { } + std::unique_ptr<ContentSettingCallbacks> m_callbacks; }; -WebContentSettingCallbacks::WebContentSettingCallbacks(PassOwnPtr<ContentSettingCallbacks>&& callbacks) +WebContentSettingCallbacks::WebContentSettingCallbacks(std::unique_ptr<ContentSettingCallbacks>&& callbacks) { m_private = WebContentSettingCallbacksPrivate::create(std::move(callbacks)); }
diff --git a/third_party/WebKit/Source/platform/exported/WebCryptoAlgorithm.cpp b/third_party/WebKit/Source/platform/exported/WebCryptoAlgorithm.cpp index eb1793b6..b174f45 100644 --- a/third_party/WebKit/Source/platform/exported/WebCryptoAlgorithm.cpp +++ b/third_party/WebKit/Source/platform/exported/WebCryptoAlgorithm.cpp
@@ -32,9 +32,10 @@ #include "public/platform/WebCryptoAlgorithmParams.h" #include "wtf/Assertions.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/ThreadSafeRefCounted.h" +#include <memory> namespace blink { @@ -295,17 +296,17 @@ class WebCryptoAlgorithmPrivate : public ThreadSafeRefCounted<WebCryptoAlgorithmPrivate> { public: - WebCryptoAlgorithmPrivate(WebCryptoAlgorithmId id, PassOwnPtr<WebCryptoAlgorithmParams> params) + WebCryptoAlgorithmPrivate(WebCryptoAlgorithmId id, std::unique_ptr<WebCryptoAlgorithmParams> params) : id(id) , params(std::move(params)) { } WebCryptoAlgorithmId id; - OwnPtr<WebCryptoAlgorithmParams> params; + std::unique_ptr<WebCryptoAlgorithmParams> params; }; -WebCryptoAlgorithm::WebCryptoAlgorithm(WebCryptoAlgorithmId id, PassOwnPtr<WebCryptoAlgorithmParams> params) +WebCryptoAlgorithm::WebCryptoAlgorithm(WebCryptoAlgorithmId id, std::unique_ptr<WebCryptoAlgorithmParams> params) : m_private(adoptRef(new WebCryptoAlgorithmPrivate(id, std::move(params)))) { } @@ -317,7 +318,7 @@ WebCryptoAlgorithm WebCryptoAlgorithm::adoptParamsAndCreate(WebCryptoAlgorithmId id, WebCryptoAlgorithmParams* params) { - return WebCryptoAlgorithm(id, adoptPtr(params)); + return WebCryptoAlgorithm(id, wrapUnique(params)); } const WebCryptoAlgorithmInfo* WebCryptoAlgorithm::lookupAlgorithmInfo(WebCryptoAlgorithmId id)
diff --git a/third_party/WebKit/Source/platform/exported/WebCryptoKey.cpp b/third_party/WebKit/Source/platform/exported/WebCryptoKey.cpp index 97660f7..07437ec 100644 --- a/third_party/WebKit/Source/platform/exported/WebCryptoKey.cpp +++ b/third_party/WebKit/Source/platform/exported/WebCryptoKey.cpp
@@ -33,14 +33,15 @@ #include "public/platform/WebCryptoAlgorithm.h" #include "public/platform/WebCryptoAlgorithmParams.h" #include "public/platform/WebCryptoKeyAlgorithm.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadSafeRefCounted.h" +#include <memory> namespace blink { class WebCryptoKeyPrivate : public ThreadSafeRefCounted<WebCryptoKeyPrivate> { public: - WebCryptoKeyPrivate(PassOwnPtr<WebCryptoKeyHandle> handle, WebCryptoKeyType type, bool extractable, const WebCryptoKeyAlgorithm& algorithm, WebCryptoKeyUsageMask usages) + WebCryptoKeyPrivate(std::unique_ptr<WebCryptoKeyHandle> handle, WebCryptoKeyType type, bool extractable, const WebCryptoKeyAlgorithm& algorithm, WebCryptoKeyUsageMask usages) : handle(std::move(handle)) , type(type) , extractable(extractable) @@ -50,7 +51,7 @@ ASSERT(!algorithm.isNull()); } - const OwnPtr<WebCryptoKeyHandle> handle; + const std::unique_ptr<WebCryptoKeyHandle> handle; const WebCryptoKeyType type; const bool extractable; const WebCryptoKeyAlgorithm algorithm; @@ -60,7 +61,7 @@ WebCryptoKey WebCryptoKey::create(WebCryptoKeyHandle* handle, WebCryptoKeyType type, bool extractable, const WebCryptoKeyAlgorithm& algorithm, WebCryptoKeyUsageMask usages) { WebCryptoKey key; - key.m_private = adoptRef(new WebCryptoKeyPrivate(adoptPtr(handle), type, extractable, algorithm, usages)); + key.m_private = adoptRef(new WebCryptoKeyPrivate(wrapUnique(handle), type, extractable, algorithm, usages)); return key; }
diff --git a/third_party/WebKit/Source/platform/exported/WebCryptoKeyAlgorithm.cpp b/third_party/WebKit/Source/platform/exported/WebCryptoKeyAlgorithm.cpp index 45e406a..771722e2 100644 --- a/third_party/WebKit/Source/platform/exported/WebCryptoKeyAlgorithm.cpp +++ b/third_party/WebKit/Source/platform/exported/WebCryptoKeyAlgorithm.cpp
@@ -30,8 +30,9 @@ #include "public/platform/WebCryptoKeyAlgorithm.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadSafeRefCounted.h" +#include <memory> namespace blink { @@ -43,24 +44,24 @@ class WebCryptoKeyAlgorithmPrivate : public ThreadSafeRefCounted<WebCryptoKeyAlgorithmPrivate> { public: - WebCryptoKeyAlgorithmPrivate(WebCryptoAlgorithmId id, PassOwnPtr<WebCryptoKeyAlgorithmParams> params) + WebCryptoKeyAlgorithmPrivate(WebCryptoAlgorithmId id, std::unique_ptr<WebCryptoKeyAlgorithmParams> params) : id(id) , params(std::move(params)) { } WebCryptoAlgorithmId id; - OwnPtr<WebCryptoKeyAlgorithmParams> params; + std::unique_ptr<WebCryptoKeyAlgorithmParams> params; }; -WebCryptoKeyAlgorithm::WebCryptoKeyAlgorithm(WebCryptoAlgorithmId id, PassOwnPtr<WebCryptoKeyAlgorithmParams> params) +WebCryptoKeyAlgorithm::WebCryptoKeyAlgorithm(WebCryptoAlgorithmId id, std::unique_ptr<WebCryptoKeyAlgorithmParams> params) : m_private(adoptRef(new WebCryptoKeyAlgorithmPrivate(id, std::move(params)))) { } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::adoptParamsAndCreate(WebCryptoAlgorithmId id, WebCryptoKeyAlgorithmParams* params) { - return WebCryptoKeyAlgorithm(id, adoptPtr(params)); + return WebCryptoKeyAlgorithm(id, wrapUnique(params)); } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createAes(WebCryptoAlgorithmId id, unsigned short keyLengthBits) @@ -69,14 +70,14 @@ // FIXME: Move this somewhere more general. if (keyLengthBits != 128 && keyLengthBits != 192 && keyLengthBits != 256) return WebCryptoKeyAlgorithm(); - return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoAesKeyAlgorithmParams(keyLengthBits))); + return WebCryptoKeyAlgorithm(id, wrapUnique(new WebCryptoAesKeyAlgorithmParams(keyLengthBits))); } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createHmac(WebCryptoAlgorithmId hash, unsigned keyLengthBits) { if (!WebCryptoAlgorithm::isHash(hash)) return WebCryptoKeyAlgorithm(); - return WebCryptoKeyAlgorithm(WebCryptoAlgorithmIdHmac, adoptPtr(new WebCryptoHmacKeyAlgorithmParams(createHash(hash), keyLengthBits))); + return WebCryptoKeyAlgorithm(WebCryptoAlgorithmIdHmac, wrapUnique(new WebCryptoHmacKeyAlgorithmParams(createHash(hash), keyLengthBits))); } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createRsaHashed(WebCryptoAlgorithmId id, unsigned modulusLengthBits, const unsigned char* publicExponent, unsigned publicExponentSize, WebCryptoAlgorithmId hash) @@ -84,12 +85,12 @@ // FIXME: Verify that id is an RSA algorithm which expects a hash if (!WebCryptoAlgorithm::isHash(hash)) return WebCryptoKeyAlgorithm(); - return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoRsaHashedKeyAlgorithmParams(modulusLengthBits, publicExponent, publicExponentSize, createHash(hash)))); + return WebCryptoKeyAlgorithm(id, wrapUnique(new WebCryptoRsaHashedKeyAlgorithmParams(modulusLengthBits, publicExponent, publicExponentSize, createHash(hash)))); } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createEc(WebCryptoAlgorithmId id, WebCryptoNamedCurve namedCurve) { - return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoEcKeyAlgorithmParams(namedCurve))); + return WebCryptoKeyAlgorithm(id, wrapUnique(new WebCryptoEcKeyAlgorithmParams(namedCurve))); } WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createWithoutParams(WebCryptoAlgorithmId id)
diff --git a/third_party/WebKit/Source/platform/exported/WebDataConsumerHandle.cpp b/third_party/WebKit/Source/platform/exported/WebDataConsumerHandle.cpp index 3e757f9e..5c87021 100644 --- a/third_party/WebKit/Source/platform/exported/WebDataConsumerHandle.cpp +++ b/third_party/WebKit/Source/platform/exported/WebDataConsumerHandle.cpp
@@ -5,8 +5,9 @@ #include "public/platform/WebDataConsumerHandle.h" #include "platform/heap/Handle.h" - +#include "wtf/PtrUtil.h" #include <algorithm> +#include <memory> #include <string.h> namespace blink { @@ -21,10 +22,10 @@ ASSERT(ThreadState::current()); } -PassOwnPtr<WebDataConsumerHandle::Reader> WebDataConsumerHandle::obtainReader(WebDataConsumerHandle::Client* client) +std::unique_ptr<WebDataConsumerHandle::Reader> WebDataConsumerHandle::obtainReader(WebDataConsumerHandle::Client* client) { ASSERT(ThreadState::current()); - return adoptPtr(obtainReaderInternal(client)); + return wrapUnique(obtainReaderInternal(client)); } WebDataConsumerHandle::Result WebDataConsumerHandle::Reader::read(void* data, size_t size, Flags flags, size_t* readSize)
diff --git a/third_party/WebKit/Source/platform/exported/WebFileSystemCallbacks.cpp b/third_party/WebKit/Source/platform/exported/WebFileSystemCallbacks.cpp index 410ccbc..92e8975 100644 --- a/third_party/WebKit/Source/platform/exported/WebFileSystemCallbacks.cpp +++ b/third_party/WebKit/Source/platform/exported/WebFileSystemCallbacks.cpp
@@ -37,15 +37,16 @@ #include "public/platform/WebFileSystemEntry.h" #include "public/platform/WebFileWriter.h" #include "public/platform/WebString.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" +#include <memory> namespace blink { class WebFileSystemCallbacksPrivate : public RefCounted<WebFileSystemCallbacksPrivate> { public: - static PassRefPtr<WebFileSystemCallbacksPrivate> create(PassOwnPtr<AsyncFileSystemCallbacks> callbacks) + static PassRefPtr<WebFileSystemCallbacksPrivate> create(std::unique_ptr<AsyncFileSystemCallbacks> callbacks) { return adoptRef(new WebFileSystemCallbacksPrivate(std::move(callbacks))); } @@ -53,11 +54,11 @@ AsyncFileSystemCallbacks* callbacks() { return m_callbacks.get(); } private: - WebFileSystemCallbacksPrivate(PassOwnPtr<AsyncFileSystemCallbacks> callbacks) : m_callbacks(std::move(callbacks)) { } - OwnPtr<AsyncFileSystemCallbacks> m_callbacks; + WebFileSystemCallbacksPrivate(std::unique_ptr<AsyncFileSystemCallbacks> callbacks) : m_callbacks(std::move(callbacks)) { } + std::unique_ptr<AsyncFileSystemCallbacks> m_callbacks; }; -WebFileSystemCallbacks::WebFileSystemCallbacks(PassOwnPtr<AsyncFileSystemCallbacks>&& callbacks) +WebFileSystemCallbacks::WebFileSystemCallbacks(std::unique_ptr<AsyncFileSystemCallbacks>&& callbacks) { m_private = WebFileSystemCallbacksPrivate::create(std::move(callbacks)); } @@ -96,7 +97,7 @@ ASSERT(!m_private.isNull()); // It's important to create a BlobDataHandle that refers to the platform file path prior // to return from this method so the underlying file will not be deleted. - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->appendFile(webFileInfo.platformPath, 0, webFileInfo.length, invalidFileTime()); RefPtr<BlobDataHandle> snapshotBlob = BlobDataHandle::create(std::move(blobData), webFileInfo.length); @@ -135,7 +136,7 @@ void WebFileSystemCallbacks::didCreateFileWriter(WebFileWriter* webFileWriter, long long length) { ASSERT(!m_private.isNull()); - m_private->callbacks()->didCreateFileWriter(adoptPtr(webFileWriter), length); + m_private->callbacks()->didCreateFileWriter(wrapUnique(webFileWriter), length); m_private.reset(); }
diff --git a/third_party/WebKit/Source/platform/exported/WebImage.cpp b/third_party/WebKit/Source/platform/exported/WebImage.cpp index bb14044..31dc8d7 100644 --- a/third_party/WebKit/Source/platform/exported/WebImage.cpp +++ b/third_party/WebKit/Source/platform/exported/WebImage.cpp
@@ -36,18 +36,17 @@ #include "public/platform/WebData.h" #include "public/platform/WebSize.h" #include "third_party/skia/include/core/SkImage.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include <algorithm> +#include <memory> namespace blink { WebImage WebImage::fromData(const WebData& data, const WebSize& desiredSize) { RefPtr<SharedBuffer> buffer = PassRefPtr<SharedBuffer>(data); - OwnPtr<ImageDecoder> decoder(ImageDecoder::create(*buffer.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored)); + std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(*buffer.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored)); if (!decoder) return WebImage(); @@ -91,7 +90,7 @@ const size_t maxFrameCount = 8; RefPtr<SharedBuffer> buffer = PassRefPtr<SharedBuffer>(data); - OwnPtr<ImageDecoder> decoder(ImageDecoder::create(*buffer.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored)); + std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(*buffer.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored)); if (!decoder) return WebVector<WebImage>();
diff --git a/third_party/WebKit/Source/platform/exported/WebMediaStream.cpp b/third_party/WebKit/Source/platform/exported/WebMediaStream.cpp index 468f919..9573897 100644 --- a/third_party/WebKit/Source/platform/exported/WebMediaStream.cpp +++ b/third_party/WebKit/Source/platform/exported/WebMediaStream.cpp
@@ -31,9 +31,9 @@ #include "public/platform/WebMediaStreamSource.h" #include "public/platform/WebMediaStreamTrack.h" #include "public/platform/WebString.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -41,12 +41,12 @@ class ExtraDataContainer : public MediaStreamDescriptor::ExtraData { public: - ExtraDataContainer(PassOwnPtr<WebMediaStream::ExtraData> extraData) : m_extraData(std::move(extraData)) { } + ExtraDataContainer(std::unique_ptr<WebMediaStream::ExtraData> extraData) : m_extraData(std::move(extraData)) { } WebMediaStream::ExtraData* getExtraData() { return m_extraData.get(); } private: - OwnPtr<WebMediaStream::ExtraData> m_extraData; + std::unique_ptr<WebMediaStream::ExtraData> m_extraData; }; } // namespace @@ -76,7 +76,7 @@ void WebMediaStream::setExtraData(ExtraData* extraData) { - m_private->setExtraData(adoptPtr(new ExtraDataContainer(adoptPtr(extraData)))); + m_private->setExtraData(wrapUnique(new ExtraDataContainer(wrapUnique(extraData)))); } void WebMediaStream::audioTracks(WebVector<WebMediaStreamTrack>& webTracks) const
diff --git a/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp b/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp index 59996c8..be39614 100644 --- a/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp +++ b/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp
@@ -35,8 +35,9 @@ #include "public/platform/WebAudioDestinationConsumer.h" #include "public/platform/WebMediaConstraints.h" #include "public/platform/WebString.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -44,12 +45,12 @@ class ExtraDataContainer : public MediaStreamSource::ExtraData { public: - ExtraDataContainer(PassOwnPtr<WebMediaStreamSource::ExtraData> extraData) : m_extraData(std::move(extraData)) { } + ExtraDataContainer(std::unique_ptr<WebMediaStreamSource::ExtraData> extraData) : m_extraData(std::move(extraData)) { } WebMediaStreamSource::ExtraData* getExtraData() { return m_extraData.get(); } private: - OwnPtr<WebMediaStreamSource::ExtraData> m_extraData; + std::unique_ptr<WebMediaStreamSource::ExtraData> m_extraData; }; } // namespace @@ -154,7 +155,7 @@ if (extraData) extraData->setOwner(m_private.get()); - m_private->setExtraData(adoptPtr(new ExtraDataContainer(adoptPtr(extraData)))); + m_private->setExtraData(wrapUnique(new ExtraDataContainer(wrapUnique(extraData)))); } WebMediaConstraints WebMediaStreamSource::constraints()
diff --git a/third_party/WebKit/Source/platform/exported/WebMediaStreamTrack.cpp b/third_party/WebKit/Source/platform/exported/WebMediaStreamTrack.cpp index 9111c56..7f3468f 100644 --- a/third_party/WebKit/Source/platform/exported/WebMediaStreamTrack.cpp +++ b/third_party/WebKit/Source/platform/exported/WebMediaStreamTrack.cpp
@@ -30,6 +30,8 @@ #include "public/platform/WebMediaStream.h" #include "public/platform/WebMediaStreamSource.h" #include "public/platform/WebString.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -37,7 +39,7 @@ class TrackDataContainer : public MediaStreamComponent::TrackData { public: - explicit TrackDataContainer(PassOwnPtr<WebMediaStreamTrack::TrackData> extraData) + explicit TrackDataContainer(std::unique_ptr<WebMediaStreamTrack::TrackData> extraData) : m_extraData(std::move(extraData)) { } @@ -49,7 +51,7 @@ } private: - OwnPtr<WebMediaStreamTrack::TrackData> m_extraData; + std::unique_ptr<WebMediaStreamTrack::TrackData> m_extraData; }; } // namespace @@ -121,7 +123,7 @@ { ASSERT(!m_private.isNull()); - m_private->setTrackData(adoptPtr(new TrackDataContainer(adoptPtr(extraData)))); + m_private->setTrackData(wrapUnique(new TrackDataContainer(wrapUnique(extraData)))); } void WebMediaStreamTrack::setSourceProvider(WebAudioSourceProvider* provider)
diff --git a/third_party/WebKit/Source/platform/exported/WebMediaStreamTrackSourcesRequest.cpp b/third_party/WebKit/Source/platform/exported/WebMediaStreamTrackSourcesRequest.cpp index 8e9b69b..700e14c7 100644 --- a/third_party/WebKit/Source/platform/exported/WebMediaStreamTrackSourcesRequest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebMediaStreamTrackSourcesRequest.cpp
@@ -28,7 +28,6 @@ #include "platform/mediastream/MediaStreamTrackSourcesRequest.h" #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/WebSourceInfo.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebPrerender.cpp b/third_party/WebKit/Source/platform/exported/WebPrerender.cpp index f7d33ee..5f23fca 100644 --- a/third_party/WebKit/Source/platform/exported/WebPrerender.cpp +++ b/third_party/WebKit/Source/platform/exported/WebPrerender.cpp
@@ -32,6 +32,8 @@ #include "platform/Prerender.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -47,11 +49,11 @@ private: explicit ExtraDataContainer(WebPrerender::ExtraData* extraData) - : m_extraData(adoptPtr(extraData)) + : m_extraData(wrapUnique(extraData)) { } - OwnPtr<WebPrerender::ExtraData> m_extraData; + std::unique_ptr<WebPrerender::ExtraData> m_extraData; }; } // namespace
diff --git a/third_party/WebKit/Source/platform/exported/WebRTCSessionDescriptionRequest.cpp b/third_party/WebKit/Source/platform/exported/WebRTCSessionDescriptionRequest.cpp index 119fff05..513c92d7 100644 --- a/third_party/WebKit/Source/platform/exported/WebRTCSessionDescriptionRequest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRTCSessionDescriptionRequest.cpp
@@ -32,7 +32,6 @@ #include "platform/mediastream/RTCSessionDescriptionRequest.h" #include "public/platform/WebRTCSessionDescription.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebRTCStatsRequest.cpp b/third_party/WebKit/Source/platform/exported/WebRTCStatsRequest.cpp index 10452de7..db537f4 100644 --- a/third_party/WebKit/Source/platform/exported/WebRTCStatsRequest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRTCStatsRequest.cpp
@@ -35,7 +35,6 @@ #include "public/platform/WebMediaStream.h" #include "public/platform/WebMediaStreamTrack.h" #include "public/platform/WebRTCStatsResponse.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebRTCStatsResponse.cpp b/third_party/WebKit/Source/platform/exported/WebRTCStatsResponse.cpp index e3ad7e38..dd47529 100644 --- a/third_party/WebKit/Source/platform/exported/WebRTCStatsResponse.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRTCStatsResponse.cpp
@@ -25,7 +25,6 @@ #include "public/platform/WebRTCStatsResponse.h" #include "platform/mediastream/RTCStatsResponseBase.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebRTCVoidRequest.cpp b/third_party/WebKit/Source/platform/exported/WebRTCVoidRequest.cpp index 1fdc7b4f..166c6cc 100644 --- a/third_party/WebKit/Source/platform/exported/WebRTCVoidRequest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRTCVoidRequest.cpp
@@ -31,7 +31,6 @@ #include "public/platform/WebRTCVoidRequest.h" #include "platform/mediastream/RTCVoidRequest.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.cpp b/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.cpp index 5f39f1b..1cc919f 100644 --- a/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.cpp +++ b/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.cpp
@@ -28,12 +28,14 @@ #include "platform/exported/WebScrollbarThemeClientImpl.h" #include "platform/scroll/ScrollbarTheme.h" #include "public/platform/WebScrollbar.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<WebScrollbarThemeGeometryNative> WebScrollbarThemeGeometryNative::create(ScrollbarTheme& theme) +std::unique_ptr<WebScrollbarThemeGeometryNative> WebScrollbarThemeGeometryNative::create(ScrollbarTheme& theme) { - return adoptPtr(new WebScrollbarThemeGeometryNative(theme)); + return wrapUnique(new WebScrollbarThemeGeometryNative(theme)); } WebScrollbarThemeGeometryNative::WebScrollbarThemeGeometryNative(ScrollbarTheme& theme)
diff --git a/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.h b/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.h index b280628..cb0ca43 100644 --- a/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.h +++ b/third_party/WebKit/Source/platform/exported/WebScrollbarThemeGeometryNative.h
@@ -31,7 +31,7 @@ #include "public/platform/WebScrollbarThemeGeometry.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -42,7 +42,7 @@ USING_FAST_MALLOC(WebScrollbarThemeGeometryNative); WTF_MAKE_NONCOPYABLE(WebScrollbarThemeGeometryNative); public: - static PassOwnPtr<WebScrollbarThemeGeometryNative> create(ScrollbarTheme&); + static std::unique_ptr<WebScrollbarThemeGeometryNative> create(ScrollbarTheme&); bool hasButtons(WebScrollbar*) override; bool hasThumb(WebScrollbar*) override;
diff --git a/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp b/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp index c2592d82..54776d2 100644 --- a/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp +++ b/third_party/WebKit/Source/platform/exported/WebURLRequest.cpp
@@ -39,6 +39,8 @@ #include "public/platform/WebURL.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -54,11 +56,11 @@ private: explicit ExtraDataContainer(WebURLRequest::ExtraData* extraData) - : m_extraData(adoptPtr(extraData)) + : m_extraData(wrapUnique(extraData)) { } - OwnPtr<WebURLRequest::ExtraData> m_extraData; + std::unique_ptr<WebURLRequest::ExtraData> m_extraData; }; } // namespace
diff --git a/third_party/WebKit/Source/platform/exported/WebURLResponse.cpp b/third_party/WebKit/Source/platform/exported/WebURLResponse.cpp index 1766df4..2dda37a 100644 --- a/third_party/WebKit/Source/platform/exported/WebURLResponse.cpp +++ b/third_party/WebKit/Source/platform/exported/WebURLResponse.cpp
@@ -39,7 +39,9 @@ #include "public/platform/WebURL.h" #include "public/platform/WebURLLoadTiming.h" #include "wtf/Allocator.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -55,11 +57,11 @@ private: explicit ExtraDataContainer(WebURLResponse::ExtraData* extraData) - : m_extraData(adoptPtr(extraData)) + : m_extraData(wrapUnique(extraData)) { } - OwnPtr<WebURLResponse::ExtraData> m_extraData; + std::unique_ptr<WebURLResponse::ExtraData> m_extraData; }; } // namespace
diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.cpp b/third_party/WebKit/Source/platform/fonts/FontCache.cpp index ac4a0eb3..3a7a8db2 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCache.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
@@ -50,10 +50,12 @@ #include "public/platform/Platform.h" #include "wtf/HashMap.h" #include "wtf/ListHashSet.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/Vector.h" #include "wtf/text/AtomicStringHash.h" #include "wtf/text/StringHash.h" +#include <memory> using namespace WTF; @@ -67,9 +69,9 @@ } #endif // !OS(WIN) && !OS(LINUX) -typedef HashMap<unsigned, OwnPtr<FontPlatformData>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> SizedFontPlatformDataSet; +typedef HashMap<unsigned, std::unique_ptr<FontPlatformData>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> SizedFontPlatformDataSet; typedef HashMap<FontCacheKey, SizedFontPlatformDataSet, FontCacheKeyHash, FontCacheKeyTraits> FontPlatformDataCache; -typedef HashMap<FallbackListCompositeKey, OwnPtr<ShapeCache>, FallbackListCompositeKeyHash, FallbackListCompositeKeyTraits> FallbackListShaperCache; +typedef HashMap<FallbackListCompositeKey, std::unique_ptr<ShapeCache>, FallbackListCompositeKeyHash, FallbackListCompositeKeyTraits> FallbackListShaperCache; static FontPlatformDataCache* gFontPlatformDataCache = nullptr; static FallbackListShaperCache* gFallbackListShaperCache = nullptr; @@ -118,7 +120,7 @@ // Take a different size instance of the same font before adding an entry to |sizedFont|. FontPlatformData* anotherSize = wasEmpty ? nullptr : sizedFonts->begin()->value.get(); auto addResult = sizedFonts->add(roundedSize, nullptr); - OwnPtr<FontPlatformData>* found = &addResult.storedValue->value; + std::unique_ptr<FontPlatformData>* found = &addResult.storedValue->value; if (addResult.isNewEntry) { if (wasEmpty) *found = createFontPlatformData(fontDescription, creationParams, size); @@ -141,19 +143,19 @@ if (result) { // Cache the result under the old name. auto adding = &gFontPlatformDataCache->add(key, SizedFontPlatformDataSet()).storedValue->value; - adding->set(roundedSize, adoptPtr(new FontPlatformData(*result))); + adding->set(roundedSize, wrapUnique(new FontPlatformData(*result))); } } return result; } -PassOwnPtr<FontPlatformData> FontCache::scaleFontPlatformData(const FontPlatformData& fontPlatformData, const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize) +std::unique_ptr<FontPlatformData> FontCache::scaleFontPlatformData(const FontPlatformData& fontPlatformData, const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize) { #if OS(MACOSX) return createFontPlatformData(fontDescription, creationParams, fontSize); #else - return adoptPtr(new FontPlatformData(fontPlatformData, fontSize)); + return wrapUnique(new FontPlatformData(fontPlatformData, fontSize)); #endif } @@ -166,7 +168,7 @@ ShapeCache* result = nullptr; if (it == gFallbackListShaperCache->end()) { result = new ShapeCache(); - gFallbackListShaperCache->set(key, adoptPtr(result)); + gFallbackListShaperCache->set(key, wrapUnique(result)); } else { result = it->value.get(); }
diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.h b/third_party/WebKit/Source/platform/fonts/FontCache.h index 52bb119..189d3e0 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCache.h +++ b/third_party/WebKit/Source/platform/fonts/FontCache.h
@@ -44,6 +44,7 @@ #include "wtf/text/Unicode.h" #include "wtf/text/WTFString.h" #include <limits.h> +#include <memory> #include "SkFontMgr.h" @@ -172,8 +173,8 @@ FontPlatformData* getFontPlatformData(const FontDescription&, const FontFaceCreationParams&, bool checkingAlternateName = false); // These methods are implemented by each platform. - PassOwnPtr<FontPlatformData> createFontPlatformData(const FontDescription&, const FontFaceCreationParams&, float fontSize); - PassOwnPtr<FontPlatformData> scaleFontPlatformData(const FontPlatformData&, const FontDescription&, const FontFaceCreationParams&, float fontSize); + std::unique_ptr<FontPlatformData> createFontPlatformData(const FontDescription&, const FontFaceCreationParams&, float fontSize); + std::unique_ptr<FontPlatformData> scaleFontPlatformData(const FontPlatformData&, const FontDescription&, const FontFaceCreationParams&, float fontSize); // Implemented on skia platforms. PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFaceCreationParams&, CString& name);
diff --git a/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp b/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp index 5b80c62..c38d495f 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp
@@ -39,7 +39,8 @@ #include "platform/fonts/WebFontDecoder.h" #include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkTypeface.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -56,7 +57,7 @@ return FontPlatformData(m_typeface.get(), "", size, bold && !m_typeface->isBold(), italic && !m_typeface->isItalic(), orientation); } -PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer* buffer, String& otsParseMessage) +std::unique_ptr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer* buffer, String& otsParseMessage) { DCHECK(buffer); WebFontDecoder decoder; @@ -65,7 +66,7 @@ otsParseMessage = decoder.getErrorString(); return nullptr; } - return adoptPtr(new FontCustomPlatformData(typeface.release())); + return wrapUnique(new FontCustomPlatformData(typeface.release())); } bool FontCustomPlatformData::supportsFormat(const String& format)
diff --git a/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.h b/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.h index dc11a4c..022879b 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.h +++ b/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.h
@@ -39,6 +39,7 @@ #include "wtf/Noncopyable.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" +#include <memory> class SkTypeface; @@ -51,7 +52,7 @@ USING_FAST_MALLOC(FontCustomPlatformData); WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); public: - static PassOwnPtr<FontCustomPlatformData> create(SharedBuffer*, String& otsParseMessage); + static std::unique_ptr<FontCustomPlatformData> create(SharedBuffer*, String& otsParseMessage); ~FontCustomPlatformData(); FontPlatformData fontPlatformData(float size, bool bold, bool italic, FontOrientation = FontOrientation::Horizontal);
diff --git a/third_party/WebKit/Source/platform/fonts/GlyphMetricsMap.h b/third_party/WebKit/Source/platform/fonts/GlyphMetricsMap.h index b5e412d..f4225f0 100644 --- a/third_party/WebKit/Source/platform/fonts/GlyphMetricsMap.h +++ b/third_party/WebKit/Source/platform/fonts/GlyphMetricsMap.h
@@ -34,9 +34,9 @@ #include "wtf/Allocator.h" #include "wtf/Assertions.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/Unicode.h" +#include <memory> namespace blink { @@ -93,7 +93,7 @@ bool m_filledPrimaryPage; GlyphMetricsPage m_primaryPage; // We optimize for the page that contains glyph indices 0-255. - OwnPtr<HashMap<int, OwnPtr<GlyphMetricsPage>>> m_pages; + std::unique_ptr<HashMap<int, std::unique_ptr<GlyphMetricsPage>>> m_pages; }; template<> inline float GlyphMetricsMap<float>::unknownMetrics() @@ -119,10 +119,10 @@ if (page) return page; } else { - m_pages = adoptPtr(new HashMap<int, OwnPtr<GlyphMetricsPage>>); + m_pages = wrapUnique(new HashMap<int, std::unique_ptr<GlyphMetricsPage>>); } page = new GlyphMetricsPage; - m_pages->set(pageNumber, adoptPtr(page)); + m_pages->set(pageNumber, wrapUnique(page)); } // Fill in the whole page with the unknown glyph information.
diff --git a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp index d0b99cf..46238b2 100644 --- a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp +++ b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp
@@ -31,9 +31,11 @@ #include "platform/fonts/SegmentedFontData.h" #include "platform/fonts/SimpleFontData.h" #include "platform/fonts/opentype/OpenTypeVerticalData.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/WTFString.h" +#include <memory> #include <stdio.h> namespace blink { @@ -355,7 +357,7 @@ #if ENABLE(ASSERT) child->m_pageNumber = m_pageNumber; #endif - m_children.set(fontData, adoptPtr(child)); + m_children.set(fontData, wrapUnique(child)); fontData->setMaxGlyphPageTreeLevel(max(fontData->maxGlyphPageTreeLevel(), child->m_level)); child->initializePage(fontData, pageNumber); return child; @@ -369,7 +371,7 @@ return m_systemFallbackChild.get(); SystemFallbackGlyphPageTreeNode* child = new SystemFallbackGlyphPageTreeNode(this); - m_systemFallbackChild = adoptPtr(child); + m_systemFallbackChild = wrapUnique(child); #if ENABLE(ASSERT) child->m_pageNumber = m_pageNumber; #endif @@ -382,7 +384,7 @@ return; // Prune any branch that contains this FontData. - if (OwnPtr<GlyphPageTreeNode> node = m_children.take(fontData)) { + if (std::unique_ptr<GlyphPageTreeNode> node = m_children.take(fontData)) { if (unsigned customFontCount = node->m_customFontCount + 1) { for (GlyphPageTreeNode* curr = this; curr; curr = curr->m_parent) curr->m_customFontCount -= customFontCount; @@ -411,7 +413,7 @@ m_page->removePerGlyphFontData(fontData); // Prune any branch that contains this FontData. - if (OwnPtr<GlyphPageTreeNode> node = m_children.take(fontData)) { + if (std::unique_ptr<GlyphPageTreeNode> node = m_children.take(fontData)) { if (unsigned customFontCount = node->m_customFontCount) { for (GlyphPageTreeNode* curr = this; curr; curr = curr->m_parent) curr->m_customFontCount -= customFontCount;
diff --git a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.h b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.h index 5926e2b..3954e36 100644 --- a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.h +++ b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.h
@@ -32,11 +32,10 @@ #include "platform/fonts/GlyphPage.h" #include "wtf/Allocator.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/Unicode.h" +#include <memory> #include <string.h> - #include <unicode/uscript.h> namespace blink { @@ -134,9 +133,9 @@ static GlyphPageTreeNode* pageZeroRoot; RefPtr<GlyphPage> m_page; - typedef HashMap<const FontData*, OwnPtr<GlyphPageTreeNode>> GlyphPageTreeNodeMap; + typedef HashMap<const FontData*, std::unique_ptr<GlyphPageTreeNode>> GlyphPageTreeNodeMap; GlyphPageTreeNodeMap m_children; - OwnPtr<SystemFallbackGlyphPageTreeNode> m_systemFallbackChild; + std::unique_ptr<SystemFallbackGlyphPageTreeNode> m_systemFallbackChild; }; class PLATFORM_EXPORT SystemFallbackGlyphPageTreeNode : public GlyphPageTreeNodeBase {
diff --git a/third_party/WebKit/Source/platform/fonts/OrientationIterator.cpp b/third_party/WebKit/Source/platform/fonts/OrientationIterator.cpp index fe03220..2f40b00 100644 --- a/third_party/WebKit/Source/platform/fonts/OrientationIterator.cpp +++ b/third_party/WebKit/Source/platform/fonts/OrientationIterator.cpp
@@ -4,10 +4,12 @@ #include "OrientationIterator.h" +#include "wtf/PtrUtil.h" + namespace blink { OrientationIterator::OrientationIterator(const UChar* buffer, unsigned bufferSize, FontOrientation runOrientation) - : m_utf16Iterator(adoptPtr(new UTF16TextIterator(buffer, bufferSize))) + : m_utf16Iterator(wrapUnique(new UTF16TextIterator(buffer, bufferSize))) , m_bufferSize(bufferSize) , m_atEnd(bufferSize == 0) {
diff --git a/third_party/WebKit/Source/platform/fonts/OrientationIterator.h b/third_party/WebKit/Source/platform/fonts/OrientationIterator.h index 30ec83b..a67650a 100644 --- a/third_party/WebKit/Source/platform/fonts/OrientationIterator.h +++ b/third_party/WebKit/Source/platform/fonts/OrientationIterator.h
@@ -10,6 +10,7 @@ #include "platform/fonts/UTF16TextIterator.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -27,7 +28,7 @@ bool consume(unsigned* orientationLimit, RenderOrientation*); private: - OwnPtr<UTF16TextIterator> m_utf16Iterator; + std::unique_ptr<UTF16TextIterator> m_utf16Iterator; unsigned m_bufferSize; bool m_atEnd; };
diff --git a/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp b/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp index e18b729..efed5b90 100644 --- a/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp +++ b/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
@@ -38,9 +38,11 @@ #include "platform/fonts/VDMXParser.h" #include "platform/geometry/FloatRect.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" #include "wtf/allocator/Partitions.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/Unicode.h" +#include <memory> #include <unicode/unorm.h> #include <unicode/utf16.h> @@ -343,9 +345,9 @@ || fontData->m_derivedFontData->verticalRightOrientation == this; } -PassOwnPtr<SimpleFontData::DerivedFontData> SimpleFontData::DerivedFontData::create(bool forCustomFont) +std::unique_ptr<SimpleFontData::DerivedFontData> SimpleFontData::DerivedFontData::create(bool forCustomFont) { - return adoptPtr(new DerivedFontData(forCustomFont)); + return wrapUnique(new DerivedFontData(forCustomFont)); } SimpleFontData::DerivedFontData::~DerivedFontData()
diff --git a/third_party/WebKit/Source/platform/fonts/SimpleFontData.h b/third_party/WebKit/Source/platform/fonts/SimpleFontData.h index 1403a8e..9cbeb8b 100644 --- a/third_party/WebKit/Source/platform/fonts/SimpleFontData.h +++ b/third_party/WebKit/Source/platform/fonts/SimpleFontData.h
@@ -35,9 +35,9 @@ #include "platform/fonts/TypesettingFeatures.h" #include "platform/fonts/opentype/OpenTypeVerticalData.h" #include "platform/geometry/FloatRect.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/StringHash.h" +#include <memory> namespace blink { @@ -144,7 +144,7 @@ FontPlatformData m_platformData; - mutable OwnPtr<GlyphMetricsMap<FloatRect>> m_glyphToBoundsMap; + mutable std::unique_ptr<GlyphMetricsMap<FloatRect>> m_glyphToBoundsMap; mutable GlyphMetricsMap<float> m_glyphToWidthMap; bool m_isTextOrientationFallback; @@ -161,7 +161,7 @@ USING_FAST_MALLOC(DerivedFontData); WTF_MAKE_NONCOPYABLE(DerivedFontData); public: - static PassOwnPtr<DerivedFontData> create(bool forCustomFont); + static std::unique_ptr<DerivedFontData> create(bool forCustomFont); ~DerivedFontData(); bool forCustomFont; @@ -177,7 +177,7 @@ } }; - mutable OwnPtr<DerivedFontData> m_derivedFontData; + mutable std::unique_ptr<DerivedFontData> m_derivedFontData; RefPtr<CustomFontData> m_customFontData; }; @@ -193,7 +193,7 @@ bounds = platformBoundsForGlyph(glyph); if (!m_glyphToBoundsMap) - m_glyphToBoundsMap = adoptPtr(new GlyphMetricsMap<FloatRect>); + m_glyphToBoundsMap = wrapUnique(new GlyphMetricsMap<FloatRect>); m_glyphToBoundsMap->setMetricsForGlyph(glyph, bounds); return bounds; }
diff --git a/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.cpp b/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.cpp index 2e13587..88fd1e5 100644 --- a/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.cpp +++ b/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.cpp
@@ -4,12 +4,13 @@ #include "SmallCapsIterator.h" +#include "wtf/PtrUtil.h" #include <unicode/utypes.h> namespace blink { SmallCapsIterator::SmallCapsIterator(const UChar* buffer, unsigned bufferSize) - : m_utf16Iterator(adoptPtr(new UTF16TextIterator(buffer, bufferSize))) + : m_utf16Iterator(wrapUnique(new UTF16TextIterator(buffer, bufferSize))) , m_bufferSize(bufferSize) , m_nextUChar32(0) , m_atEnd(bufferSize == 0)
diff --git a/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.h b/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.h index b689d3a..c262719 100644 --- a/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.h +++ b/third_party/WebKit/Source/platform/fonts/SmallCapsIterator.h
@@ -10,6 +10,7 @@ #include "platform/fonts/UTF16TextIterator.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -27,7 +28,7 @@ bool consume(unsigned* capsLimit, SmallCapsBehavior*); private: - OwnPtr<UTF16TextIterator> m_utf16Iterator; + std::unique_ptr<UTF16TextIterator> m_utf16Iterator; unsigned m_bufferSize; UChar32 m_nextUChar32; bool m_atEnd;
diff --git a/third_party/WebKit/Source/platform/fonts/SymbolsIterator.cpp b/third_party/WebKit/Source/platform/fonts/SymbolsIterator.cpp index 44dcceb..fa780125 100644 --- a/third_party/WebKit/Source/platform/fonts/SymbolsIterator.cpp +++ b/third_party/WebKit/Source/platform/fonts/SymbolsIterator.cpp
@@ -4,6 +4,7 @@ #include "SymbolsIterator.h" +#include "wtf/PtrUtil.h" #include <unicode/uchar.h> #include <unicode/uniset.h> @@ -12,7 +13,7 @@ using namespace WTF::Unicode; SymbolsIterator::SymbolsIterator(const UChar* buffer, unsigned bufferSize) - : m_utf16Iterator(adoptPtr(new UTF16TextIterator(buffer, bufferSize))) + : m_utf16Iterator(wrapUnique(new UTF16TextIterator(buffer, bufferSize))) , m_bufferSize(bufferSize) , m_nextChar(0) , m_atEnd(bufferSize == 0)
diff --git a/third_party/WebKit/Source/platform/fonts/SymbolsIterator.h b/third_party/WebKit/Source/platform/fonts/SymbolsIterator.h index db5ccc0..01dcdb5 100644 --- a/third_party/WebKit/Source/platform/fonts/SymbolsIterator.h +++ b/third_party/WebKit/Source/platform/fonts/SymbolsIterator.h
@@ -11,6 +11,7 @@ #include "platform/fonts/UTF16TextIterator.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" +#include <memory> namespace blink { @@ -25,7 +26,7 @@ private: FontFallbackPriority fontFallbackPriorityForCharacter(UChar32); - OwnPtr<UTF16TextIterator> m_utf16Iterator; + std::unique_ptr<UTF16TextIterator> m_utf16Iterator; unsigned m_bufferSize; UChar32 m_nextChar; bool m_atEnd;
diff --git a/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm b/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm index 26ff434..3f14d83 100644 --- a/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm +++ b/third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm
@@ -41,7 +41,9 @@ #include "public/platform/WebTaskRunner.h" #include "public/platform/WebTraceLocation.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" +#include <memory> // Forward declare Mac SPIs. // Request for public API: rdar://13803570 @@ -202,7 +204,7 @@ return getFontData(fontDescription, lucidaGrandeStr, false, shouldRetain); } -PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, +std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize) { NSFontTraitMask traits = fontDescription.style() ? NSFontItalicTrait : 0; @@ -232,7 +234,7 @@ // Out-of-process loading occurs for registered fonts stored in non-system locations. // When loading fails, we do not want to use the returned FontPlatformData since it will not have // a valid SkTypeface. - OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platformFont, size, syntheticBold, syntheticItalic, fontDescription.orientation())); + std::unique_ptr<FontPlatformData> platformData = wrapUnique(new FontPlatformData(platformFont, size, syntheticBold, syntheticItalic, fontDescription.orientation())); if (!platformData->typeface()) { return nullptr; }
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.h b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.h index dcab4f03..51d75cc 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.h +++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.h
@@ -30,7 +30,6 @@ #include "platform/geometry/FloatRect.h" #include "platform/text/TextRun.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp index de852dd..4475685 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp
@@ -10,6 +10,8 @@ #include "platform/fonts/shaping/CachingWordShapeIterator.h" #include "platform/fonts/shaping/ShapeResultTestInfo.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -26,13 +28,13 @@ font.update(nullptr); ASSERT_TRUE(font.canShapeWordByWord()); fallbackFonts = nullptr; - cache = adoptPtr(new ShapeCache()); + cache = wrapUnique(new ShapeCache()); } FontCachePurgePreventer fontCachePurgePreventer; FontDescription fontDescription; Font font; - OwnPtr<ShapeCache> cache; + std::unique_ptr<ShapeCache> cache; HashSet<const SimpleFontData*>* fallbackFonts; unsigned startIndex = 0; unsigned numGlyphs = 0; @@ -117,7 +119,7 @@ GlyphBuffer glyphBuffer; shaper.fillGlyphBuffer(&font, textRun, fallbackFonts, &glyphBuffer, 0, 3); - OwnPtr<ShapeCache> referenceCache = adoptPtr(new ShapeCache()); + std::unique_ptr<ShapeCache> referenceCache = wrapUnique(new ShapeCache()); CachingWordShaper referenceShaper(referenceCache.get()); GlyphBuffer referenceGlyphBuffer; font.setCanShapeWordByWordForTesting(false); @@ -142,7 +144,7 @@ GlyphBuffer glyphBuffer; shaper.fillGlyphBuffer(&font, textRun, fallbackFonts, &glyphBuffer, 1, 6); - OwnPtr<ShapeCache> referenceCache = adoptPtr(new ShapeCache()); + std::unique_ptr<ShapeCache> referenceCache = wrapUnique(new ShapeCache()); CachingWordShaper referenceShaper(referenceCache.get()); GlyphBuffer referenceGlyphBuffer; font.setCanShapeWordByWordForTesting(false);
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp index 1115eff..3dffa865 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -37,6 +37,8 @@ #include "platform/fonts/shaping/HarfBuzzShaper.h" #include "wtf/HashMap.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" +#include <memory> #include <hb-ot.h> #include <hb.h> @@ -112,11 +114,11 @@ private: explicit HbFontCacheEntry(hb_font_t* font) : m_hbFont(HbFontUniquePtr(font)) - , m_hbFontData(adoptPtr(new HarfBuzzFontData())) + , m_hbFontData(wrapUnique(new HarfBuzzFontData())) { }; HbFontUniquePtr m_hbFont; - OwnPtr<HarfBuzzFontData> m_hbFontData; + std::unique_ptr<HarfBuzzFontData> m_hbFontData; }; typedef HashMap<uint64_t, RefPtr<HbFontCacheEntry>, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> HarfBuzzFontCache;
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp index 0999e94..fe7bd7d 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
@@ -45,10 +45,11 @@ #include "platform/text/TextBreakIterator.h" #include "wtf/Compiler.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" #include "wtf/text/Unicode.h" - #include <algorithm> #include <hb.h> +#include <memory> #include <unicode/uchar.h> #include <unicode/uscript.h> @@ -114,7 +115,7 @@ : Shaper(font, run) , m_normalizedBufferLength(0) { - m_normalizedBuffer = adoptArrayPtr(new UChar[m_textRun.length() + 1]); + m_normalizedBuffer = wrapArrayUnique(new UChar[m_textRun.length() + 1]); normalizeCharacters(m_textRun, m_textRun.length(), m_normalizedBuffer.get(), &m_normalizedBufferLength); setFontFeatures(); } @@ -467,7 +468,7 @@ ShapeResult::RunInfo* run = new ShapeResult::RunInfo(currentFont, direction, ICUScriptToHBScript(currentRunScript), startIndex, numGlyphsToInsert, numCharacters); - shapeResult->insertRun(adoptPtr(run), lastChangePosition, + shapeResult->insertRun(wrapUnique(run), lastChangePosition, numGlyphsToInsert, harfBuzzBuffer); } @@ -681,7 +682,7 @@ const TextRun& textRun, float positionOffset, unsigned count) { const SimpleFontData* fontData = font->primaryFont(); - OwnPtr<ShapeResult::RunInfo> run = adoptPtr(new ShapeResult::RunInfo(fontData, + std::unique_ptr<ShapeResult::RunInfo> run = wrapUnique(new ShapeResult::RunInfo(fontData, // Tab characters are always LTR or RTL, not TTB, even when isVerticalAnyUpright(). textRun.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR, HB_SCRIPT_COMMON, 0, count, count));
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h index 2da39dc..40f2936 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h
@@ -41,12 +41,10 @@ #include "wtf/Allocator.h" #include "wtf/Deque.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/CharacterNames.h" - #include <hb.h> +#include <memory> #include <unicode/uscript.h> namespace blink { @@ -204,9 +202,9 @@ bool isLastResort); bool collectFallbackHintChars(Vector<UChar32>& hint, bool needsList); - void insertRunIntoShapeResult(ShapeResult*, PassOwnPtr<ShapeResult::RunInfo> runToInsert, unsigned startGlyph, unsigned numGlyphs, hb_buffer_t*); + void insertRunIntoShapeResult(ShapeResult*, std::unique_ptr<ShapeResult::RunInfo> runToInsert, unsigned startGlyph, unsigned numGlyphs, hb_buffer_t*); - OwnPtr<UChar[]> m_normalizedBuffer; + std::unique_ptr<UChar[]> m_normalizedBuffer; unsigned m_normalizedBufferLength; FeaturesVector m_features;
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.cpp b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.cpp index 08fd5c7d..fd63329 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.cpp
@@ -10,15 +10,16 @@ #include "platform/fonts/UTF16TextIterator.h" #include "platform/text/Character.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" namespace blink { RunSegmenter::RunSegmenter(const UChar* buffer, unsigned bufferSize, FontOrientation runOrientation) : m_bufferSize(bufferSize) , m_candidateRange({ 0, 0, USCRIPT_INVALID_CODE, OrientationIterator::OrientationKeep, FontFallbackPriority::Text }) - , m_scriptRunIterator(adoptPtr(new ScriptRunIterator(buffer, bufferSize))) - , m_orientationIterator(runOrientation == FontOrientation::VerticalMixed ? adoptPtr(new OrientationIterator(buffer, bufferSize, runOrientation)) : nullptr) - , m_symbolsIterator(adoptPtr(new SymbolsIterator(buffer, bufferSize))) + , m_scriptRunIterator(wrapUnique(new ScriptRunIterator(buffer, bufferSize))) + , m_orientationIterator(runOrientation == FontOrientation::VerticalMixed ? wrapUnique(new OrientationIterator(buffer, bufferSize, runOrientation)) : nullptr) + , m_symbolsIterator(wrapUnique(new SymbolsIterator(buffer, bufferSize))) , m_lastSplit(0) , m_scriptRunIteratorPosition(0) , m_orientationIteratorPosition(runOrientation == FontOrientation::VerticalMixed ? 0 : m_bufferSize)
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.h b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.h index 8a77f9f7..e347f295 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.h +++ b/third_party/WebKit/Source/platform/fonts/shaping/RunSegmenter.h
@@ -14,7 +14,7 @@ #include "platform/fonts/UTF16TextIterator.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" - +#include <memory> #include <unicode/uscript.h> namespace blink { @@ -49,9 +49,9 @@ unsigned m_bufferSize; RunSegmenterRange m_candidateRange; - OwnPtr<ScriptRunIterator> m_scriptRunIterator; - OwnPtr<OrientationIterator> m_orientationIterator; - OwnPtr<SymbolsIterator> m_symbolsIterator; + std::unique_ptr<ScriptRunIterator> m_scriptRunIterator; + std::unique_ptr<OrientationIterator> m_orientationIterator; + std::unique_ptr<SymbolsIterator> m_symbolsIterator; unsigned m_lastSplit; unsigned m_scriptRunIteratorPosition; unsigned m_orientationIteratorPosition;
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp index 9367176..e05e7b1 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp
@@ -34,7 +34,9 @@ #include "platform/fonts/Font.h" #include "platform/fonts/shaping/ShapeResultInlineHeaders.h" #include "platform/fonts/shaping/ShapeResultSpacing.h" +#include "wtf/PtrUtil.h" #include <hb.h> +#include <memory> namespace blink { @@ -154,7 +156,7 @@ { m_runs.reserveCapacity(other.m_runs.size()); for (const auto& run : other.m_runs) - m_runs.append(adoptPtr(new ShapeResult::RunInfo(*run))); + m_runs.append(wrapUnique(new ShapeResult::RunInfo(*run))); } ShapeResult::~ShapeResult() @@ -278,11 +280,11 @@ return static_cast<float>(value) / (1 << 16); } -void ShapeResult::insertRun(PassOwnPtr<ShapeResult::RunInfo> runToInsert, +void ShapeResult::insertRun(std::unique_ptr<ShapeResult::RunInfo> runToInsert, unsigned startGlyph, unsigned numGlyphs, hb_buffer_t* harfBuzzBuffer) { ASSERT(numGlyphs > 0); - OwnPtr<ShapeResult::RunInfo> run(std::move(runToInsert)); + std::unique_ptr<ShapeResult::RunInfo> run(std::move(runToInsert)); ASSERT(numGlyphs == run->m_glyphData.size()); const SimpleFontData* currentFontData = run->m_fontData.get();
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h index c83666d..ba2f52d8 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h +++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h
@@ -36,9 +36,9 @@ #include "platform/text/TextDirection.h" #include "wtf/HashSet.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" +#include <memory> struct hb_buffer_t; @@ -88,12 +88,12 @@ } void applySpacing(ShapeResultSpacing&, const TextRun&); - void insertRun(PassOwnPtr<ShapeResult::RunInfo>, unsigned startGlyph, + void insertRun(std::unique_ptr<ShapeResult::RunInfo>, unsigned startGlyph, unsigned numGlyphs, hb_buffer_t*); float m_width; FloatRect m_glyphBoundingBox; - Vector<OwnPtr<RunInfo>> m_runs; + Vector<std::unique_ptr<RunInfo>> m_runs; RefPtr<SimpleFontData> m_primaryFont; unsigned m_numCharacters;
diff --git a/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp b/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp index 9cd1424..0a60262 100644 --- a/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp +++ b/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp
@@ -42,8 +42,10 @@ #include "public/platform/Platform.h" #include "public/platform/linux/WebSandboxSupport.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" #include "wtf/text/AtomicString.h" #include "wtf/text/CString.h" +#include <memory> #include <unicode/locid.h> #if !OS(WIN) && !OS(ANDROID) @@ -201,7 +203,7 @@ } #if !OS(WIN) -PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, +std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize) { CString name; @@ -209,7 +211,7 @@ if (!tf) return nullptr; - return adoptPtr(new FontPlatformData(tf, + return wrapUnique(new FontPlatformData(tf, name.data(), fontSize, (fontDescription.weight() > 200 + tf->fontStyle().weight()) || fontDescription.isSyntheticBold(),
diff --git a/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp b/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp index d8a150d5..5d6a886 100644 --- a/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp +++ b/third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp
@@ -40,6 +40,8 @@ #include "platform/fonts/FontPlatformData.h" #include "platform/fonts/SimpleFontData.h" #include "platform/fonts/win/FontFallbackWin.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -355,7 +357,7 @@ return false; } -PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, +std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize) { ASSERT(creationParams.creationType() == CreateFontByFamily); @@ -393,7 +395,7 @@ } } - OwnPtr<FontPlatformData> result = adoptPtr(new FontPlatformData(tf, + std::unique_ptr<FontPlatformData> result = wrapUnique(new FontPlatformData(tf, name.data(), fontSize, (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDescription.isSyntheticBold(),
diff --git a/third_party/WebKit/Source/platform/geometry/FloatPolygon.cpp b/third_party/WebKit/Source/platform/geometry/FloatPolygon.cpp index 74cb1bf2..2ad06042 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatPolygon.cpp +++ b/third_party/WebKit/Source/platform/geometry/FloatPolygon.cpp
@@ -30,6 +30,7 @@ #include "platform/geometry/FloatPolygon.h" #include "wtf/MathExtras.h" +#include <memory> namespace blink { @@ -78,7 +79,7 @@ return vertexIndex2; } -FloatPolygon::FloatPolygon(PassOwnPtr<Vector<FloatPoint>> vertices, WindRule fillRule) +FloatPolygon::FloatPolygon(std::unique_ptr<Vector<FloatPoint>> vertices, WindRule fillRule) : m_vertices(std::move(vertices)) , m_fillRule(fillRule) {
diff --git a/third_party/WebKit/Source/platform/geometry/FloatPolygon.h b/third_party/WebKit/Source/platform/geometry/FloatPolygon.h index 0799fa6..26e891b5 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatPolygon.h +++ b/third_party/WebKit/Source/platform/geometry/FloatPolygon.h
@@ -35,9 +35,8 @@ #include "platform/geometry/FloatRect.h" #include "platform/graphics/GraphicsTypes.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -52,7 +51,7 @@ USING_FAST_MALLOC(FloatPolygon); WTF_MAKE_NONCOPYABLE(FloatPolygon); public: - FloatPolygon(PassOwnPtr<Vector<FloatPoint>> vertices, WindRule fillRule); + FloatPolygon(std::unique_ptr<Vector<FloatPoint>> vertices, WindRule fillRule); const FloatPoint& vertexAt(unsigned index) const { return (*m_vertices)[index]; } unsigned numberOfVertices() const { return m_vertices->size(); } @@ -74,7 +73,7 @@ bool containsNonZero(const FloatPoint&) const; bool containsEvenOdd(const FloatPoint&) const; - OwnPtr<Vector<FloatPoint>> m_vertices; + std::unique_ptr<Vector<FloatPoint>> m_vertices; WindRule m_fillRule; FloatRect m_boundingBox; bool m_empty;
diff --git a/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp b/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp index a8a1ff91..e5cf1e5d 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp +++ b/third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp
@@ -30,6 +30,8 @@ #include "platform/geometry/FloatPolygon.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -38,16 +40,16 @@ FloatPolygonTestValue(const float* coordinates, unsigned coordinatesLength, WindRule fillRule) { ASSERT(!(coordinatesLength % 2)); - OwnPtr<Vector<FloatPoint>> vertices = adoptPtr(new Vector<FloatPoint>(coordinatesLength / 2)); + std::unique_ptr<Vector<FloatPoint>> vertices = wrapUnique(new Vector<FloatPoint>(coordinatesLength / 2)); for (unsigned i = 0; i < coordinatesLength; i += 2) (*vertices)[i / 2] = FloatPoint(coordinates[i], coordinates[i + 1]); - m_polygon = adoptPtr(new FloatPolygon(std::move(vertices), fillRule)); + m_polygon = wrapUnique(new FloatPolygon(std::move(vertices), fillRule)); } const FloatPolygon& polygon() const { return *m_polygon; } private: - OwnPtr<FloatPolygon> m_polygon; + std::unique_ptr<FloatPolygon> m_polygon; }; namespace {
diff --git a/third_party/WebKit/Source/platform/geometry/TransformState.cpp b/third_party/WebKit/Source/platform/geometry/TransformState.cpp index cdfc0120..86ceb92 100644 --- a/third_party/WebKit/Source/platform/geometry/TransformState.cpp +++ b/third_party/WebKit/Source/platform/geometry/TransformState.cpp
@@ -25,7 +25,6 @@ #include "platform/geometry/TransformState.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/geometry/TransformState.h b/third_party/WebKit/Source/platform/geometry/TransformState.h index f3c4104..7ef3f6c 100644 --- a/third_party/WebKit/Source/platform/geometry/TransformState.h +++ b/third_party/WebKit/Source/platform/geometry/TransformState.h
@@ -33,7 +33,7 @@ #include "platform/transforms/AffineTransform.h" #include "platform/transforms/TransformationMatrix.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -133,7 +133,7 @@ FloatQuad m_lastPlanarQuad; // We only allocate the transform if we need to - OwnPtr<TransformationMatrix> m_accumulatedTransform; + std::unique_ptr<TransformationMatrix> m_accumulatedTransform; LayoutSize m_accumulatedOffset; bool m_accumulatingTransform; bool m_forceAccumulatingTransform;
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp index b950446..17d815c5 100644 --- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
@@ -37,6 +37,7 @@ #include "platform/graphics/skia/SkiaUtils.h" #include "third_party/skia/include/core/SkCanvas.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" namespace blink { @@ -479,7 +480,7 @@ if (catchUpIfNecessary == DoNotCatchUp || time < m_desiredFrameStartTime) { // Haven't yet reached time for next frame to start; delay until then. - m_frameTimer = adoptPtr(new Timer<BitmapImage>(this, &BitmapImage::advanceAnimation)); + m_frameTimer = wrapUnique(new Timer<BitmapImage>(this, &BitmapImage::advanceAnimation)); m_frameTimer->startOneShot(std::max(m_desiredFrameStartTime - time, 0.), BLINK_FROM_HERE); } else { // We've already reached or passed the time for the next frame to start. @@ -503,7 +504,7 @@ // may be in the past, meaning the next time through this function we'll // kick off the next advancement sooner than this frame's duration would // suggest. - m_frameTimer = adoptPtr(new Timer<BitmapImage>(this, &BitmapImage::advanceAnimationWithoutCatchUp)); + m_frameTimer = wrapUnique(new Timer<BitmapImage>(this, &BitmapImage::advanceAnimationWithoutCatchUp)); m_frameTimer->startOneShot(0, BLINK_FROM_HERE); } }
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.h b/third_party/WebKit/Source/platform/graphics/BitmapImage.h index a530097..98a16777 100644 --- a/third_party/WebKit/Source/platform/graphics/BitmapImage.h +++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.h
@@ -37,7 +37,7 @@ #include "platform/graphics/ImageSource.h" #include "platform/image-decoders/ImageAnimation.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -164,7 +164,7 @@ RefPtr<SkImage> m_cachedFrame; // A cached copy of the most recently-accessed frame. size_t m_cachedFrameIndex; // Index of the frame that is cached. - OwnPtr<Timer<BitmapImage>> m_frameTimer; + std::unique_ptr<Timer<BitmapImage>> m_frameTimer; int m_repetitionCount; // How many total animation loops we should do. This will be cAnimationNone if this image type is incapable of animation. RepetitionCountStatus m_repetitionCountStatus; int m_repetitionsComplete; // How many repetitions we've finished.
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp index c782456b..8a5ca10 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -45,6 +45,8 @@ #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/GrContext.h" #include "third_party/skia/include/gpu/gl/GrGLTypes.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace { enum { @@ -88,7 +90,7 @@ PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, AccelerationMode accelerationMode) { TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_SCOPE_GLOBAL); - OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!contextProvider) return nullptr; RefPtr<Canvas2DLayerBridge> layerBridge; @@ -96,9 +98,9 @@ return layerBridge.release(); } -Canvas2DLayerBridge::Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, AccelerationMode accelerationMode) +Canvas2DLayerBridge::Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, AccelerationMode accelerationMode) : m_contextProvider(std::move(contextProvider)) - , m_logger(adoptPtr(new Logger)) + , m_logger(wrapUnique(new Logger)) , m_weakPtrFactory(this) , m_imageBuffer(0) , m_msaaSampleCount(msaaSampleCount) @@ -137,7 +139,7 @@ void Canvas2DLayerBridge::startRecording() { DCHECK(m_isDeferralEnabled); - m_recorder = adoptPtr(new SkPictureRecorder); + m_recorder = wrapUnique(new SkPictureRecorder); m_recorder->beginRecording(m_size.width(), m_size.height(), nullptr); if (m_imageBuffer) { m_imageBuffer->resetCanvas(m_recorder->getRecordingCanvas()); @@ -145,7 +147,7 @@ m_recordingPixelCount = 0; } -void Canvas2DLayerBridge::setLoggerForTesting(PassOwnPtr<Logger> logger) +void Canvas2DLayerBridge::setLoggerForTesting(std::unique_ptr<Logger> logger) { m_logger = std::move(logger); } @@ -484,7 +486,7 @@ reportSurfaceCreationFailure(); if (m_surface && surfaceIsAccelerated && !m_layer) { - m_layer = adoptPtr(Platform::current()->compositorSupport()->createExternalTextureLayer(this)); + m_layer = wrapUnique(Platform::current()->compositorSupport()->createExternalTextureLayer(this)); m_layer->setOpaque(m_opacityMode == Opaque); m_layer->setBlendBackgroundColor(m_opacityMode != Opaque); GraphicsLayer::registerContentsLayer(m_layer->layer()); @@ -748,7 +750,7 @@ gpu::gles2::GLES2Interface* sharedGL = nullptr; m_layer->clearTexture(); - m_contextProvider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + m_contextProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (m_contextProvider) sharedGL = m_contextProvider->contextGL();
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h index 2ffda5a..7c8ce5b9 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h
@@ -37,11 +37,11 @@ #include "third_party/skia/include/core/SkSurface.h" #include "wtf/Allocator.h" #include "wtf/Deque.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" #include "wtf/Vector.h" #include "wtf/WeakPtr.h" +#include <memory> class SkImage; struct SkImageInfo; @@ -146,7 +146,7 @@ virtual ~Logger() { } }; - void setLoggerForTesting(PassOwnPtr<Logger>); + void setLoggerForTesting(std::unique_ptr<Logger>); private: #if USE_IOSURFACE_FOR_2D_CANVAS @@ -185,7 +185,7 @@ MailboxInfo() {} }; - Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider>, const IntSize&, int msaaSampleCount, OpacityMode, AccelerationMode); + Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, const IntSize&, int msaaSampleCount, OpacityMode, AccelerationMode); gpu::gles2::GLES2Interface* contextGL(); void startRecording(); void skipQueuedDrawCommands(); @@ -233,14 +233,14 @@ // changing texture bindings. void resetSkiaTextureBinding(); - OwnPtr<SkPictureRecorder> m_recorder; + std::unique_ptr<SkPictureRecorder> m_recorder; RefPtr<SkSurface> m_surface; RefPtr<SkImage> m_hibernationImage; int m_initialSurfaceSaveCount; - OwnPtr<WebExternalTextureLayer> m_layer; - OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; - OwnPtr<SharedContextRateLimiter> m_rateLimiter; - OwnPtr<Logger> m_logger; + std::unique_ptr<WebExternalTextureLayer> m_layer; + std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; + std::unique_ptr<SharedContextRateLimiter> m_rateLimiter; + std::unique_ptr<Logger> m_logger; WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory; ImageBuffer* m_imageBuffer; int m_msaaSampleCount;
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp index 350b948..9ced0261 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
@@ -47,8 +47,8 @@ #include "third_party/skia/include/gpu/GrContext.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h" #include "third_party/skia/include/gpu/gl/GrGLTypes.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" - #include <memory> using testing::AnyNumber; @@ -149,7 +149,7 @@ class Canvas2DLayerBridgeTest : public Test { public: - PassRefPtr<Canvas2DLayerBridge> makeBridge(PassOwnPtr<FakeWebGraphicsContext3DProvider> provider, const IntSize& size, Canvas2DLayerBridge::AccelerationMode accelerationMode) + PassRefPtr<Canvas2DLayerBridge> makeBridge(std::unique_ptr<FakeWebGraphicsContext3DProvider> provider, const IntSize& size, Canvas2DLayerBridge::AccelerationMode accelerationMode) { return adoptRef(new Canvas2DLayerBridge(std::move(provider), size, 0, NonOpaque, accelerationMode)); } @@ -158,7 +158,7 @@ void fullLifecycleTest() { FakeGLES2Interface gl; - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::DisableAcceleration))); @@ -170,7 +170,7 @@ void fallbackToSoftwareIfContextLost() { FakeGLES2Interface gl; - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); gl.setIsContextLost(true); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration))); @@ -183,7 +183,7 @@ { // No fallback case. FakeGLES2Interface gl; - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration))); EXPECT_TRUE(bridge->checkSurfaceValid()); EXPECT_TRUE(bridge->isAccelerated()); @@ -195,7 +195,7 @@ { // Fallback case. FakeGLES2Interface gl; - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); GrContext* gr = contextProvider->grContext(); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration))); EXPECT_TRUE(bridge->checkSurfaceValid()); @@ -212,7 +212,7 @@ void noDrawOnContextLostTest() { FakeGLES2Interface gl; - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::ForceAccelerationForTesting))); EXPECT_TRUE(bridge->checkSurfaceValid()); @@ -235,7 +235,7 @@ void prepareMailboxWithBitmapTest() { FakeGLES2Interface gl; - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::ForceAccelerationForTesting))); bridge->m_lastImageId = 1; @@ -252,7 +252,7 @@ // This test passes by not crashing and not triggering assertions. { FakeGLES2Interface gl; - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::ForceAccelerationForTesting))); WebExternalTextureMailbox mailbox; bridge->prepareMailbox(&mailbox, 0); @@ -262,7 +262,7 @@ // Retry with mailbox released while bridge destruction is in progress. { FakeGLES2Interface gl; - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); WebExternalTextureMailbox mailbox; Canvas2DLayerBridge* rawBridge; { @@ -280,7 +280,7 @@ { { FakeGLES2Interface gl; - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 300), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration))); SkPaint paint; bridge->canvas()->drawRect(SkRect::MakeXYWH(0, 0, 1, 1), paint); @@ -291,7 +291,7 @@ { FakeGLES2Interface gl; - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(&gl)); + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(&gl)); Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), IntSize(300, 300), 0, NonOpaque, Canvas2DLayerBridge::EnableAcceleration))); SkPaint paint; bridge->canvas()->drawRect(SkRect::MakeXYWH(0, 0, 1, 1), paint); @@ -346,7 +346,7 @@ void runCreateBridgeTask(Canvas2DLayerBridgePtr* bridgePtr, gpu::gles2::GLES2Interface* gl, Canvas2DLayerBridgeTest* testHost, WaitableEvent* doneEvent) { - OwnPtr<FakeWebGraphicsContext3DProvider> contextProvider = adoptPtr(new FakeWebGraphicsContext3DProvider(gl)); + std::unique_ptr<FakeWebGraphicsContext3DProvider> contextProvider = wrapUnique(new FakeWebGraphicsContext3DProvider(gl)); *bridgePtr = testHost->makeBridge(std::move(contextProvider), IntSize(300, 300), Canvas2DLayerBridge::EnableAcceleration); // draw+flush to trigger the creation of a GPU surface (*bridgePtr)->didDraw(FloatRect(0, 0, 1, 1)); @@ -357,7 +357,7 @@ void postAndWaitCreateBridgeTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridgePtr* bridgePtr, gpu::gles2::GLES2Interface* gl, Canvas2DLayerBridgeTest* testHost) { - OwnPtr<WaitableEvent> bridgeCreatedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> bridgeCreatedEvent = wrapUnique(new WaitableEvent()); testThread->getWebTaskRunner()->postTask( location, threadSafeBind(&runCreateBridgeTask, @@ -386,7 +386,7 @@ void postAndWaitDestroyBridgeTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridgePtr* bridgePtr) { - OwnPtr<WaitableEvent> bridgeDestroyedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> bridgeDestroyedEvent = wrapUnique(new WaitableEvent()); testThread->getWebTaskRunner()->postTask( location, threadSafeBind(&runDestroyBridgeTask, @@ -414,7 +414,7 @@ void postAndWaitSetIsHiddenTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridge* bridge, bool value) { - OwnPtr<WaitableEvent> doneEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent()); postSetIsHiddenTask(location, testThread, bridge, value, doneEvent.get()); doneEvent->wait(); } @@ -422,7 +422,7 @@ class MockImageBuffer : public ImageBuffer { public: MockImageBuffer() - : ImageBuffer(adoptPtr(new UnacceleratedImageBufferSurface(IntSize(1, 1)))) { } + : ImageBuffer(wrapUnique(new UnacceleratedImageBufferSurface(IntSize(1, 1)))) { } MOCK_CONST_METHOD1(resetCanvas, void(SkCanvas*)); @@ -436,7 +436,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -444,12 +444,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -480,7 +480,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -488,12 +488,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -529,7 +529,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -541,12 +541,12 @@ bridge->setImageBuffer(&mockImageBuffer); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -583,7 +583,7 @@ void postAndWaitRenderingTask(const WebTraceLocation& location, WebThread* testThread, Canvas2DLayerBridge* bridge) { - OwnPtr<WaitableEvent> doneEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent()); testThread->getWebTaskRunner()->postTask( location, threadSafeBind(&runRenderingTask, @@ -599,7 +599,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -607,12 +607,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -650,7 +650,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -662,12 +662,12 @@ bridge->disableDeferral(DisableDeferralReasonUnknown); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -711,7 +711,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -722,12 +722,12 @@ bridge->setImageBuffer(&mockImageBuffer); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -771,7 +771,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -779,12 +779,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -807,7 +807,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -815,12 +815,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -842,7 +842,7 @@ EXPECT_TRUE(bridge->checkSurfaceValid()); // End hibernation normally - OwnPtr<WaitableEvent> hibernationEndedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationEndedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationEndedNormally)) .WillOnce(testing::InvokeWithoutArgs(hibernationEndedEvent.get(), &WaitableEvent::signal)); postSetIsHiddenTask(BLINK_FROM_HERE, testThread.get(), bridge.get(), false); @@ -876,7 +876,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -884,12 +884,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationScheduledEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationScheduledEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); postSetIsHiddenTask(BLINK_FROM_HERE, testThread.get(), bridge.get(), true, hibernationScheduledEvent.get()); postDestroyBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge); @@ -904,7 +904,7 @@ // completion before the thread is destroyed. // This test passes by not crashing, which proves that the WeakPtr logic // is sound. - OwnPtr<WaitableEvent> fenceEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> fenceEvent = wrapUnique(new WaitableEvent()); testThread->scheduler()->postIdleTask(BLINK_FROM_HERE, new IdleFenceTask(fenceEvent.get())); fenceEvent->wait(); } @@ -916,7 +916,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -924,12 +924,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationAbortedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationAbortedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationAbortedDueToPendingDestruction)) .WillOnce(testing::InvokeWithoutArgs(hibernationAbortedEvent.get(), &WaitableEvent::signal)); @@ -950,7 +950,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -958,12 +958,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationAbortedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationAbortedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationAbortedDueToVisibilityChange)) .WillOnce(testing::InvokeWithoutArgs(hibernationAbortedEvent.get(), &WaitableEvent::signal)); @@ -987,7 +987,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -995,13 +995,13 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); gl.setIsContextLost(true); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationAbortedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationAbortedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationAbortedDueGpuContextLoss)) .WillOnce(testing::InvokeWithoutArgs(hibernationAbortedEvent.get(), &WaitableEvent::signal)); @@ -1022,7 +1022,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -1030,12 +1030,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal)); @@ -1061,7 +1061,7 @@ #endif { FakeGLES2Interface gl; - OwnPtr<WebThread> testThread = adoptPtr(Platform::current()->createThread("TestThread")); + std::unique_ptr<WebThread> testThread = wrapUnique(Platform::current()->createThread("TestThread")); // The Canvas2DLayerBridge has to be created on the thread that will use it // to avoid WeakPtr thread check issues. @@ -1069,12 +1069,12 @@ postAndWaitCreateBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge, &gl, this); // Register an alternate Logger for tracking hibernation events - OwnPtr<MockLogger> mockLogger = adoptPtr(new MockLogger); + std::unique_ptr<MockLogger> mockLogger = wrapUnique(new MockLogger); MockLogger* mockLoggerPtr = mockLogger.get(); bridge->setLoggerForTesting(std::move(mockLogger)); // Test entering hibernation - OwnPtr<WaitableEvent> hibernationStartedEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> hibernationStartedEvent = wrapUnique(new WaitableEvent()); EXPECT_CALL(*mockLoggerPtr, reportHibernationEvent(Canvas2DLayerBridge::HibernationScheduled)); EXPECT_CALL(*mockLoggerPtr, didStartHibernating()) .WillOnce(testing::Invoke(hibernationStartedEvent.get(), &WaitableEvent::signal));
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp index b13d9ad7..03926147 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
@@ -9,6 +9,7 @@ #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" #include "public/platform/WebLayer.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -16,7 +17,7 @@ { m_solidColorLayer = cc::SolidColorLayer::Create(); m_solidColorLayer->SetBackgroundColor(SK_ColorBLUE); - m_webLayer = adoptPtr(Platform::current()->compositorSupport()->createLayerFromCCLayer(m_solidColorLayer.get())); + m_webLayer = wrapUnique(Platform::current()->compositorSupport()->createLayerFromCCLayer(m_solidColorLayer.get())); GraphicsLayer::registerContentsLayer(m_webLayer.get()); }
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h index 3e9f320..5f9adc9 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h +++ b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h
@@ -7,7 +7,7 @@ #include "base/memory/ref_counted.h" #include "platform/PlatformExport.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace cc { // TODO(611796): replace SolidColorLayer with SurfaceLayer @@ -26,7 +26,7 @@ private: scoped_refptr<cc::SolidColorLayer> m_solidColorLayer; - OwnPtr<WebLayer> m_webLayer; + std::unique_ptr<WebLayer> m_webLayer; }; }
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorFilterOperations.h b/third_party/WebKit/Source/platform/graphics/CompositorFilterOperations.h index 0b3a941..beb590f9 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorFilterOperations.h +++ b/third_party/WebKit/Source/platform/graphics/CompositorFilterOperations.h
@@ -11,7 +11,8 @@ #include "platform/graphics/Color.h" #include "third_party/skia/include/core/SkScalar.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> class SkImageFilter; @@ -21,9 +22,9 @@ class PLATFORM_EXPORT CompositorFilterOperations { WTF_MAKE_NONCOPYABLE(CompositorFilterOperations); public: - static PassOwnPtr<CompositorFilterOperations> create() + static std::unique_ptr<CompositorFilterOperations> create() { - return adoptPtr(new CompositorFilterOperations()); + return wrapUnique(new CompositorFilterOperations()); } const cc::FilterOperations& asFilterOperations() const;
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp index 82886a1b..04f8c9c9 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp
@@ -8,8 +8,8 @@ #include "cc/trees/layer_tree_impl.h" #include "platform/graphics/CompositorMutableState.h" #include "platform/graphics/CompositorMutation.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -36,7 +36,7 @@ // Only if this is a new entry do we want to allocate a new mutation. if (result.isNewEntry) - result.storedValue->value = adoptPtr(new CompositorMutation); + result.storedValue->value = wrapUnique(new CompositorMutation); return wrapUnique(new CompositorMutableState(result.storedValue->value.get(), layers.main, layers.scroll)); }
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.h b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.h index 3f0bc4ea..91c6a531 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.h +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.h
@@ -6,7 +6,6 @@ #define CompositorMutableStateProvider_h #include "platform/PlatformExport.h" - #include <cstdint> #include <memory>
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp index 0d0cb78d..994e8cf 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp
@@ -16,7 +16,6 @@ #include "platform/graphics/CompositorMutableStateProvider.h" #include "platform/graphics/CompositorMutation.h" #include "testing/gtest/include/gtest/gtest.h" - #include <memory> namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutation.h b/third_party/WebKit/Source/platform/graphics/CompositorMutation.h index 971540af..b712cc8 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutation.h +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutation.h
@@ -8,6 +8,7 @@ #include "platform/graphics/CompositorMutableProperties.h" #include "third_party/skia/include/core/SkMatrix44.h" #include "wtf/HashMap.h" +#include <memory> namespace blink { @@ -53,7 +54,7 @@ }; struct CompositorMutations { - HashMap<uint64_t, OwnPtr<CompositorMutation>> map; + HashMap<uint64_t, std::unique_ptr<CompositorMutation>> map; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp index b3d04d8..8c47f77 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp
@@ -12,6 +12,8 @@ #include "platform/graphics/CompositorMutation.h" #include "platform/graphics/CompositorMutationsTarget.h" #include "platform/graphics/CompositorMutator.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -36,7 +38,7 @@ TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::Mutate"); double monotonicTimeNow = (monotonicTime - base::TimeTicks()).InSecondsF(); if (!m_mutations) - m_mutations = adoptPtr(new CompositorMutations); + m_mutations = wrapUnique(new CompositorMutations); CompositorMutableStateProvider compositorState(treeImpl, m_mutations.get()); bool shouldReinvoke = m_mutator->mutate(monotonicTimeNow, &compositorState); return shouldReinvoke; @@ -57,7 +59,7 @@ return base::Bind(&CompositorMutationsTarget::applyMutations, base::Unretained(m_mutationsTarget), - base::Owned(m_mutations.leakPtr())); + base::Owned(m_mutations.release())); } void CompositorMutatorClient::setNeedsMutate() @@ -66,7 +68,7 @@ m_client->SetNeedsMutate(); } -void CompositorMutatorClient::setMutationsForTesting(PassOwnPtr<CompositorMutations> mutations) +void CompositorMutatorClient::setMutationsForTesting(std::unique_ptr<CompositorMutations> mutations) { m_mutations = std::move(mutations); }
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.h b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.h index 6adfb58..6fb3299 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.h +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.h
@@ -8,8 +8,7 @@ #include "platform/PlatformExport.h" #include "platform/heap/Handle.h" #include "public/platform/WebCompositorMutatorClient.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -31,12 +30,12 @@ CompositorMutator* mutator() { return m_mutator.get(); } - void setMutationsForTesting(PassOwnPtr<CompositorMutations>); + void setMutationsForTesting(std::unique_ptr<CompositorMutations>); private: cc::LayerTreeMutatorClient* m_client; CompositorMutationsTarget* m_mutationsTarget; Persistent<CompositorMutator> m_mutator; - OwnPtr<CompositorMutations> m_mutations; + std::unique_ptr<CompositorMutations> m_mutations; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClientTest.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClientTest.cpp index 26fade6..58c8e61 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutatorClientTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutatorClientTest.cpp
@@ -10,7 +10,8 @@ #include "platform/graphics/CompositorMutator.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> using ::testing::_; @@ -38,7 +39,7 @@ MockCompositoMutationsTarget target; CompositorMutatorClient client(new StubCompositorMutator, &target); - OwnPtr<CompositorMutations> mutations = adoptPtr(new CompositorMutations()); + std::unique_ptr<CompositorMutations> mutations = wrapUnique(new CompositorMutations()); client.setMutationsForTesting(std::move(mutations)); EXPECT_CALL(target, applyMutations(_));
diff --git a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h index cfe4403..f84f27d 100644 --- a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h +++ b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.h
@@ -30,7 +30,6 @@ #include "public/platform/WebContentLayerClient.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" class SkCanvas;
diff --git a/third_party/WebKit/Source/platform/graphics/ContiguousContainer.cpp b/third_party/WebKit/Source/platform/graphics/ContiguousContainer.cpp index 7b8980d..cb42fef 100644 --- a/third_party/WebKit/Source/platform/graphics/ContiguousContainer.cpp +++ b/third_party/WebKit/Source/platform/graphics/ContiguousContainer.cpp
@@ -6,10 +6,11 @@ #include "wtf/Allocator.h" #include "wtf/ContainerAnnotations.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/allocator/PartitionAlloc.h" #include "wtf/allocator/Partitions.h" #include <algorithm> +#include <memory> namespace blink { @@ -174,7 +175,7 @@ ContiguousContainerBase::allocateNewBufferForNextAllocation(size_t bufferSize, const char* typeName) { ASSERT(m_buffers.isEmpty() || m_endIndex == m_buffers.size() - 1); - OwnPtr<Buffer> newBuffer = adoptPtr(new Buffer(bufferSize, typeName)); + std::unique_ptr<Buffer> newBuffer = wrapUnique(new Buffer(bufferSize, typeName)); Buffer* bufferToReturn = newBuffer.get(); m_buffers.append(std::move(newBuffer)); m_endIndex = m_buffers.size() - 1;
diff --git a/third_party/WebKit/Source/platform/graphics/ContiguousContainer.h b/third_party/WebKit/Source/platform/graphics/ContiguousContainer.h index a52ad85..a50431b 100644 --- a/third_party/WebKit/Source/platform/graphics/ContiguousContainer.h +++ b/third_party/WebKit/Source/platform/graphics/ContiguousContainer.h
@@ -10,11 +10,11 @@ #include "wtf/Allocator.h" #include "wtf/Compiler.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/TypeTraits.h" #include "wtf/Vector.h" #include <cstddef> #include <iterator> +#include <memory> #include <utility> namespace blink { @@ -67,7 +67,7 @@ Buffer* allocateNewBufferForNextAllocation(size_t, const char* typeName); - Vector<OwnPtr<Buffer>> m_buffers; + Vector<std::unique_ptr<Buffer>> m_buffers; unsigned m_endIndex; size_t m_maxObjectSize; };
diff --git a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp index b7f8c45..160ecd4 100644 --- a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp +++ b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
@@ -32,6 +32,7 @@ #include "platform/image-decoders/ImageDecoder.h" #include "platform/image-decoders/SegmentReader.h" #include "third_party/skia/include/core/SkData.h" +#include <memory> namespace blink { @@ -109,7 +110,7 @@ { // We just need the size of the image, so we have to temporarily create an ImageDecoder. Since // we only need the size, it doesn't really matter about premul or not, or gamma settings. - OwnPtr<ImageDecoder> decoder = ImageDecoder::create(static_cast<const char*>(data->data()), data->size(), + std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(static_cast<const char*>(data->data()), data->size(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); if (!decoder) return 0;
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp index 09fa440..60d6544 100644 --- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
@@ -33,7 +33,8 @@ #include "platform/graphics/skia/SkiaUtils.h" #include "platform/image-decoders/SegmentReader.h" #include "third_party/skia/include/core/SkImage.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -56,22 +57,22 @@ uint32_t m_uniqueID; }; -PassOwnPtr<DeferredImageDecoder> DeferredImageDecoder::create(const SharedBuffer& data, ImageDecoder::AlphaOption alphaOption, ImageDecoder::GammaAndColorProfileOption colorOptions) +std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::create(const SharedBuffer& data, ImageDecoder::AlphaOption alphaOption, ImageDecoder::GammaAndColorProfileOption colorOptions) { - OwnPtr<ImageDecoder> actualDecoder = ImageDecoder::create(data, alphaOption, colorOptions); + std::unique_ptr<ImageDecoder> actualDecoder = ImageDecoder::create(data, alphaOption, colorOptions); if (!actualDecoder) return nullptr; - return adoptPtr(new DeferredImageDecoder(std::move(actualDecoder))); + return wrapUnique(new DeferredImageDecoder(std::move(actualDecoder))); } -PassOwnPtr<DeferredImageDecoder> DeferredImageDecoder::createForTesting(PassOwnPtr<ImageDecoder> actualDecoder) +std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::createForTesting(std::unique_ptr<ImageDecoder> actualDecoder) { - return adoptPtr(new DeferredImageDecoder(std::move(actualDecoder))); + return wrapUnique(new DeferredImageDecoder(std::move(actualDecoder))); } -DeferredImageDecoder::DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder) +DeferredImageDecoder::DeferredImageDecoder(std::unique_ptr<ImageDecoder> actualDecoder) : m_allDataReceived(false) , m_actualDecoder(std::move(actualDecoder)) , m_repetitionCount(cAnimationNone) @@ -129,7 +130,7 @@ if (m_frameGenerator) { if (!m_rwBuffer) - m_rwBuffer = adoptPtr(new SkRWBuffer(data.size())); + m_rwBuffer = wrapUnique(new SkRWBuffer(data.size())); const char* segment = 0; for (size_t length = data.getSomeData(segment, m_rwBuffer->size());
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.h b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.h index 4838182..3db9411 100644 --- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.h +++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.h
@@ -32,8 +32,8 @@ #include "third_party/skia/include/core/SkRWBuffer.h" #include "wtf/Allocator.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" +#include <memory> class SkImage; @@ -47,9 +47,9 @@ WTF_MAKE_NONCOPYABLE(DeferredImageDecoder); USING_FAST_MALLOC(DeferredImageDecoder); public: - static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, ImageDecoder::AlphaOption, ImageDecoder::GammaAndColorProfileOption); + static std::unique_ptr<DeferredImageDecoder> create(const SharedBuffer& data, ImageDecoder::AlphaOption, ImageDecoder::GammaAndColorProfileOption); - static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDecoder>); + static std::unique_ptr<DeferredImageDecoder> createForTesting(std::unique_ptr<ImageDecoder>); ~DeferredImageDecoder(); @@ -74,7 +74,7 @@ bool hotSpot(IntPoint&) const; private: - explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); + explicit DeferredImageDecoder(std::unique_ptr<ImageDecoder> actualDecoder); friend class DeferredImageDecoderTest; ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } @@ -86,9 +86,9 @@ // Copy of the data that is passed in, used by deferred decoding. // Allows creating readonly snapshots that may be read in another thread. - OwnPtr<SkRWBuffer> m_rwBuffer; + std::unique_ptr<SkRWBuffer> m_rwBuffer; bool m_allDataReceived; - OwnPtr<ImageDecoder> m_actualDecoder; + std::unique_ptr<ImageDecoder> m_actualDecoder; String m_filenameExtension; IntSize m_size;
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp index 09d3da1..c0a04ccc 100644 --- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
@@ -42,7 +42,9 @@ #include "third_party/skia/include/core/SkPixmap.h" #include "third_party/skia/include/core/SkSurface.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -99,7 +101,7 @@ ImageDecodingStore::instance().setCacheLimitInBytes(1024 * 1024); m_data = SharedBuffer::create(whitePNG, sizeof(whitePNG)); m_frameCount = 1; - OwnPtr<MockImageDecoder> decoder = MockImageDecoder::create(this); + std::unique_ptr<MockImageDecoder> decoder = MockImageDecoder::create(this); m_actualDecoder = decoder.get(); m_actualDecoder->setSize(1, 1); m_lazyDecoder = DeferredImageDecoder::createForTesting(std::move(decoder)); @@ -160,7 +162,7 @@ // Don't own this but saves the pointer to query states. MockImageDecoder* m_actualDecoder; - OwnPtr<DeferredImageDecoder> m_lazyDecoder; + std::unique_ptr<DeferredImageDecoder> m_lazyDecoder; sk_sp<SkSurface> m_surface; int m_decodeRequestCount; RefPtr<SharedBuffer> m_data; @@ -243,7 +245,7 @@ EXPECT_EQ(0, m_decodeRequestCount); // Create a thread to rasterize SkPicture. - OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("RasterThread")); + std::unique_ptr<WebThread> thread = wrapUnique(Platform::current()->createThread("RasterThread")); thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&rasterizeMain, AllowCrossThreadAccess(m_surface->getCanvas()), AllowCrossThreadAccess(picture.get()))); thread.reset(); EXPECT_EQ(0, m_decodeRequestCount); @@ -358,9 +360,9 @@ TEST_F(DeferredImageDecoderTest, frameOpacity) { - OwnPtr<ImageDecoder> actualDecoder = ImageDecoder::create(*m_data, + std::unique_ptr<ImageDecoder> actualDecoder = ImageDecoder::create(*m_data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); - OwnPtr<DeferredImageDecoder> decoder = DeferredImageDecoder::createForTesting(std::move(actualDecoder)); + std::unique_ptr<DeferredImageDecoder> decoder = DeferredImageDecoder::createForTesting(std::move(actualDecoder)); decoder->setData(*m_data, true); SkImageInfo pixInfo = SkImageInfo::MakeN32Premul(1, 1);
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTestWoPlatform.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTestWoPlatform.cpp index f9677b3..80bf250 100644 --- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTestWoPlatform.cpp +++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTestWoPlatform.cpp
@@ -9,6 +9,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkImage.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -34,7 +35,7 @@ RefPtr<SharedBuffer> file = readFile(fileName); ASSERT_NE(file, nullptr); - OwnPtr<DeferredImageDecoder> decoder = DeferredImageDecoder::create(*file.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored); + std::unique_ptr<DeferredImageDecoder> decoder = DeferredImageDecoder::create(*file.get(), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored); ASSERT_TRUE(decoder.get()); RefPtr<SharedBuffer> partialFile = SharedBuffer::create(file->data(), bytesForFirstFrame);
diff --git a/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.cpp b/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.cpp index 7b3e224..018d193 100644 --- a/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.cpp +++ b/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.cpp
@@ -39,7 +39,9 @@ #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkXfermode.h" #include "third_party/skia/include/effects/SkBlurMaskFilter.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -47,9 +49,9 @@ DrawLooperBuilder::~DrawLooperBuilder() { } -PassOwnPtr<DrawLooperBuilder> DrawLooperBuilder::create() +std::unique_ptr<DrawLooperBuilder> DrawLooperBuilder::create() { - return adoptPtr(new DrawLooperBuilder); + return wrapUnique(new DrawLooperBuilder); } PassRefPtr<SkDrawLooper> DrawLooperBuilder::detachDrawLooper()
diff --git a/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.h b/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.h index b94f5a7f..eeb03dfd 100644 --- a/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.h +++ b/third_party/WebKit/Source/platform/graphics/DrawLooperBuilder.h
@@ -35,8 +35,8 @@ #include "third_party/skia/include/effects/SkLayerDrawLooper.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include <memory> class SkDrawLooper; @@ -64,7 +64,7 @@ DrawLooperBuilder(); ~DrawLooperBuilder(); - static PassOwnPtr<DrawLooperBuilder> create(); + static std::unique_ptr<DrawLooperBuilder> create(); // Creates the SkDrawLooper and passes ownership to the caller. The builder // should not be used any more after calling this method.
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp index 0244a5ad..d0fbe4e 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp
@@ -49,6 +49,7 @@ #include "third_party/skia/include/utils/SkNullCanvas.h" #include "wtf/Assertions.h" #include "wtf/MathExtras.h" +#include <memory> namespace blink { @@ -175,7 +176,7 @@ if (contextDisabled()) return; - OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); if (!color.alpha()) { // When shadow-only but there is no shadow, we use an empty draw looper // to disable rendering of the source primitive. When not shadow-only, we @@ -194,7 +195,7 @@ setDrawLooper(std::move(drawLooperBuilder)); } -void GraphicsContext::setDrawLooper(PassOwnPtr<DrawLooperBuilder> drawLooperBuilder) +void GraphicsContext::setDrawLooper(std::unique_ptr<DrawLooperBuilder> drawLooperBuilder) { if (contextDisabled()) return; @@ -433,7 +434,7 @@ clip(rect.rect()); } - OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); + std::unique_ptr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); drawLooperBuilder->addShadow(FloatSize(shadowOffset), shadowBlur, shadowColor, DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder::ShadowIgnoresAlpha); setDrawLooper(std::move(drawLooperBuilder));
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContext.h b/third_party/WebKit/Source/platform/graphics/GraphicsContext.h index ff0ba7a..71fde7ed 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContext.h +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContext.h
@@ -41,7 +41,7 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include <memory> class SkBitmap; class SkImage; @@ -215,7 +215,7 @@ // It is assumed that this draw looper is used only for shadows // (i.e. a draw looper is set if and only if there is a shadow). // The builder passed into this method will be destroyed. - void setDrawLooper(PassOwnPtr<DrawLooperBuilder>); + void setDrawLooper(std::unique_ptr<DrawLooperBuilder>); void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&); void drawFocusRing(const Path&, int width, int offset, const Color&); @@ -343,7 +343,7 @@ // Paint states stack. Enables local drawing state change with save()/restore() calls. // This state controls the appearance of drawn content. // We do not delete from this stack to avoid memory churn. - Vector<OwnPtr<GraphicsContextState>> m_paintStateStack; + Vector<std::unique_ptr<GraphicsContextState>> m_paintStateStack; // Current index on the stack. May not be the last thing on the stack. unsigned m_paintStateIndex; // Raw pointer to the current state.
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContextState.h b/third_party/WebKit/Source/platform/graphics/GraphicsContextState.h index df82cfe..b8605c5b 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContextState.h +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContextState.h
@@ -36,8 +36,9 @@ #include "third_party/skia/include/core/SkPaint.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -46,14 +47,14 @@ class PLATFORM_EXPORT GraphicsContextState final { USING_FAST_MALLOC(GraphicsContextState); public: - static PassOwnPtr<GraphicsContextState> create() + static std::unique_ptr<GraphicsContextState> create() { - return adoptPtr(new GraphicsContextState()); + return wrapUnique(new GraphicsContextState()); } - static PassOwnPtr<GraphicsContextState> createAndCopy(const GraphicsContextState& other) + static std::unique_ptr<GraphicsContextState> createAndCopy(const GraphicsContextState& other) { - return adoptPtr(new GraphicsContextState(other)); + return wrapUnique(new GraphicsContextState(other)); } void copy(const GraphicsContextState&);
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp index 46da10f..5b5886e5 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContextTest.cpp
@@ -32,6 +32,7 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkShader.h" +#include <memory> namespace blink { @@ -69,7 +70,7 @@ bitmap.eraseColor(0); SkCanvas canvas(bitmap); - OwnPtr<PaintController> paintController = PaintController::create(); + std::unique_ptr<PaintController> paintController = PaintController::create(); GraphicsContext context(*paintController); Color opaque(1.0f, 0.0f, 0.0f, 1.0f); @@ -102,7 +103,7 @@ Color alpha(0.0f, 0.0f, 0.0f, 0.0f); FloatRect bounds(0, 0, 100, 100); - OwnPtr<PaintController> paintController = PaintController::create(); + std::unique_ptr<PaintController> paintController = PaintController::create(); GraphicsContext context(*paintController); context.beginRecording(bounds);
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp index 7572bd3b..7a3cfb4 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -57,10 +57,12 @@ #include "wtf/HashMap.h" #include "wtf/HashSet.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" #include "wtf/text/StringUTF8Adaptor.h" #include "wtf/text/WTFString.h" #include <algorithm> #include <cmath> +#include <memory> #include <utility> #ifndef NDEBUG @@ -107,9 +109,9 @@ return map; } -PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client) +std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client) { - return adoptPtr(new GraphicsLayer(client)); + return wrapUnique(new GraphicsLayer(client)); } GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) @@ -148,8 +150,8 @@ m_client->verifyNotPainting(); #endif - m_contentLayerDelegate = adoptPtr(new ContentLayerDelegate(this)); - m_layer = adoptPtr(Platform::current()->compositorSupport()->createContentLayer(m_contentLayerDelegate.get())); + m_contentLayerDelegate = wrapUnique(new ContentLayerDelegate(this)); + m_layer = wrapUnique(Platform::current()->compositorSupport()->createContentLayer(m_contentLayerDelegate.get())); m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible); m_layer->layer()->setLayerClient(this); } @@ -1155,7 +1157,7 @@ if (image && skImage) { if (!m_imageLayer) { - m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->createImageLayer()); + m_imageLayer = wrapUnique(Platform::current()->compositorSupport()->createImageLayer()); registerContentsLayer(m_imageLayer->layer()); } m_imageLayer->setImage(skImage.get()); @@ -1178,14 +1180,14 @@ void GraphicsLayer::setFilters(const FilterOperations& filters) { - OwnPtr<CompositorFilterOperations> compositorFilters = CompositorFilterOperations::create(); + std::unique_ptr<CompositorFilterOperations> compositorFilters = CompositorFilterOperations::create(); SkiaImageFilterBuilder::buildFilterOperations(filters, compositorFilters.get()); m_layer->layer()->setFilters(compositorFilters->asFilterOperations()); } void GraphicsLayer::setBackdropFilters(const FilterOperations& filters) { - OwnPtr<CompositorFilterOperations> compositorFilters = CompositorFilterOperations::create(); + std::unique_ptr<CompositorFilterOperations> compositorFilters = CompositorFilterOperations::create(); SkiaImageFilterBuilder::buildFilterOperations(filters, compositorFilters.get()); m_layer->layer()->setBackgroundFilters(compositorFilters->asFilterOperations()); }
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h index b6f7032..0b117dc 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h
@@ -50,9 +50,8 @@ #include "public/platform/WebImageLayer.h" #include "public/platform/WebLayerScrollClient.h" #include "third_party/skia/include/core/SkFilterQuality.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -72,7 +71,7 @@ class PLATFORM_EXPORT GraphicsLayer : public WebLayerScrollClient, public cc::LayerClient, public DisplayItemClient { WTF_MAKE_NONCOPYABLE(GraphicsLayer); USING_FAST_MALLOC(GraphicsLayer); public: - static PassOwnPtr<GraphicsLayer> create(GraphicsLayerClient*); + static std::unique_ptr<GraphicsLayer> create(GraphicsLayerClient*); ~GraphicsLayer() override; @@ -357,8 +356,8 @@ int m_paintCount; - OwnPtr<WebContentLayer> m_layer; - OwnPtr<WebImageLayer> m_imageLayer; + std::unique_ptr<WebContentLayer> m_layer; + std::unique_ptr<WebImageLayer> m_imageLayer; WebLayer* m_contentsLayer; // We don't have ownership of m_contentsLayer, but we do want to know if a given layer is the // same as our current layer in setContentsTo(). Since m_contentsLayer may be deleted at this point, @@ -368,13 +367,13 @@ Vector<LinkHighlight*> m_linkHighlights; - OwnPtr<ContentLayerDelegate> m_contentLayerDelegate; + std::unique_ptr<ContentLayerDelegate> m_contentLayerDelegate; WeakPersistent<ScrollableArea> m_scrollableArea; GraphicsLayerDebugInfo m_debugInfo; int m_3dRenderingContext; - OwnPtr<PaintController> m_paintController; + std::unique_ptr<PaintController> m_paintController; IntRect m_previousInterestRect;
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp index 1b2c3738..6464d428 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
@@ -43,7 +43,8 @@ #include "public/platform/WebLayer.h" #include "public/platform/WebLayerTreeView.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -51,15 +52,15 @@ public: GraphicsLayerTest() { - m_clipLayer = adoptPtr(new FakeGraphicsLayer(&m_client)); - m_scrollElasticityLayer = adoptPtr(new FakeGraphicsLayer(&m_client)); - m_graphicsLayer = adoptPtr(new FakeGraphicsLayer(&m_client)); + m_clipLayer = wrapUnique(new FakeGraphicsLayer(&m_client)); + m_scrollElasticityLayer = wrapUnique(new FakeGraphicsLayer(&m_client)); + m_graphicsLayer = wrapUnique(new FakeGraphicsLayer(&m_client)); m_clipLayer->addChild(m_scrollElasticityLayer.get()); m_scrollElasticityLayer->addChild(m_graphicsLayer.get()); m_graphicsLayer->platformLayer()->setScrollClipLayer( m_clipLayer->platformLayer()); m_platformLayer = m_graphicsLayer->platformLayer(); - m_layerTreeView = adoptPtr(new WebLayerTreeViewImplForTesting); + m_layerTreeView = wrapUnique(new WebLayerTreeViewImplForTesting); ASSERT(m_layerTreeView); m_layerTreeView->setRootLayer(*m_clipLayer->platformLayer()); m_layerTreeView->registerViewportLayers( @@ -77,12 +78,12 @@ protected: WebLayer* m_platformLayer; - OwnPtr<FakeGraphicsLayer> m_graphicsLayer; - OwnPtr<FakeGraphicsLayer> m_scrollElasticityLayer; - OwnPtr<FakeGraphicsLayer> m_clipLayer; + std::unique_ptr<FakeGraphicsLayer> m_graphicsLayer; + std::unique_ptr<FakeGraphicsLayer> m_scrollElasticityLayer; + std::unique_ptr<FakeGraphicsLayer> m_clipLayer; private: - OwnPtr<WebLayerTreeView> m_layerTreeView; + std::unique_ptr<WebLayerTreeView> m_layerTreeView; FakeGraphicsLayerClient m_client; }; @@ -98,19 +99,19 @@ return m_compositorPlayer.get(); } - OwnPtr<CompositorAnimationPlayer> m_compositorPlayer; + std::unique_ptr<CompositorAnimationPlayer> m_compositorPlayer; }; TEST_F(GraphicsLayerTest, updateLayerShouldFlattenTransformWithAnimations) { ASSERT_FALSE(m_platformLayer->hasActiveAnimationForTesting()); - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0.0, 0.0), CubicBezierTimingFunction::EaseType::EASE); - OwnPtr<CompositorAnimation> floatAnimation(CompositorAnimation::create(*curve, CompositorTargetProperty::OPACITY, 0, 0)); + std::unique_ptr<CompositorAnimation> floatAnimation(CompositorAnimation::create(*curve, CompositorTargetProperty::OPACITY, 0, 0)); int animationId = floatAnimation->id(); - OwnPtr<CompositorAnimationTimeline> compositorTimeline = CompositorAnimationTimeline::create(); + std::unique_ptr<CompositorAnimationTimeline> compositorTimeline = CompositorAnimationTimeline::create(); AnimationPlayerForTesting player; layerTreeView()->attachCompositorAnimationTimeline(compositorTimeline->animationTimeline()); @@ -119,7 +120,7 @@ player.compositorPlayer()->attachLayer(m_platformLayer); ASSERT_TRUE(player.compositorPlayer()->isLayerAttached()); - player.compositorPlayer()->addAnimation(floatAnimation.leakPtr()); + player.compositorPlayer()->addAnimation(floatAnimation.release()); ASSERT_TRUE(m_platformLayer->hasActiveAnimationForTesting());
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp index e545ca2..828ade9 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
@@ -54,29 +54,31 @@ #include "third_party/skia/include/gpu/gl/GrGLTypes.h" #include "wtf/CheckedNumeric.h" #include "wtf/MathExtras.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/Base64.h" #include "wtf/text/WTFString.h" #include "wtf/typed_arrays/ArrayBufferContents.h" +#include <memory> namespace blink { -PassOwnPtr<ImageBuffer> ImageBuffer::create(PassOwnPtr<ImageBufferSurface> surface) +std::unique_ptr<ImageBuffer> ImageBuffer::create(std::unique_ptr<ImageBufferSurface> surface) { if (!surface->isValid()) return nullptr; - return adoptPtr(new ImageBuffer(std::move(surface))); + return wrapUnique(new ImageBuffer(std::move(surface))); } -PassOwnPtr<ImageBuffer> ImageBuffer::create(const IntSize& size, OpacityMode opacityMode, ImageInitializationMode initializationMode) +std::unique_ptr<ImageBuffer> ImageBuffer::create(const IntSize& size, OpacityMode opacityMode, ImageInitializationMode initializationMode) { - OwnPtr<ImageBufferSurface> surface(adoptPtr(new UnacceleratedImageBufferSurface(size, opacityMode, initializationMode))); + std::unique_ptr<ImageBufferSurface> surface(wrapUnique(new UnacceleratedImageBufferSurface(size, opacityMode, initializationMode))); if (!surface->isValid()) return nullptr; - return adoptPtr(new ImageBuffer(std::move(surface))); + return wrapUnique(new ImageBuffer(std::move(surface))); } -ImageBuffer::ImageBuffer(PassOwnPtr<ImageBufferSurface> surface) +ImageBuffer::ImageBuffer(std::unique_ptr<ImageBufferSurface> surface) : m_snapshotState(InitialSnapshotState) , m_surface(std::move(surface)) , m_client(0) @@ -204,12 +206,12 @@ if (!textureInfo || !textureInfo->fID) return false; - OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + std::unique_ptr<WebGraphicsContext3DProvider> provider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!provider) return false; gpu::gles2::GLES2Interface* sharedGL = provider->contextGL(); - OwnPtr<WebExternalTextureMailbox> mailbox = adoptPtr(new WebExternalTextureMailbox); + std::unique_ptr<WebExternalTextureMailbox> mailbox = wrapUnique(new WebExternalTextureMailbox); mailbox->textureSize = WebSize(textureImage->width(), textureImage->height()); // Contexts may be in a different share group. We must transfer the texture through a mailbox first @@ -248,7 +250,7 @@ { if (!drawingBuffer || !m_surface->isAccelerated()) return false; - OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + std::unique_ptr<WebGraphicsContext3DProvider> provider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!provider) return false; gpu::gles2::GLES2Interface* gl = provider->contextGL();
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.h b/third_party/WebKit/Source/platform/graphics/ImageBuffer.h index 20bcd76..56b9fd9 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.h +++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.h
@@ -39,12 +39,11 @@ #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPicture.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" #include "wtf/typed_arrays/Uint8ClampedArray.h" +#include <memory> namespace gpu { namespace gles2 { @@ -76,8 +75,8 @@ WTF_MAKE_NONCOPYABLE(ImageBuffer); USING_FAST_MALLOC(ImageBuffer); public: - static PassOwnPtr<ImageBuffer> create(const IntSize&, OpacityMode = NonOpaque, ImageInitializationMode = InitializeImagePixels); - static PassOwnPtr<ImageBuffer> create(PassOwnPtr<ImageBufferSurface>); + static std::unique_ptr<ImageBuffer> create(const IntSize&, OpacityMode = NonOpaque, ImageInitializationMode = InitializeImagePixels); + static std::unique_ptr<ImageBuffer> create(std::unique_ptr<ImageBufferSurface>); virtual ~ImageBuffer(); @@ -147,7 +146,7 @@ intptr_t getGPUMemoryUsage() { return m_gpuMemoryUsage; } protected: - ImageBuffer(PassOwnPtr<ImageBufferSurface>); + ImageBuffer(std::unique_ptr<ImageBufferSurface>); private: enum SnapshotState { @@ -156,7 +155,7 @@ DrawnToAfterSnapshot, }; mutable SnapshotState m_snapshotState; - OwnPtr<ImageBufferSurface> m_surface; + std::unique_ptr<ImageBufferSurface> m_surface; ImageBufferClient* m_client; mutable intptr_t m_gpuMemoryUsage;
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp index 54ab435..a181e9e 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
@@ -28,6 +28,7 @@ #include "platform/TraceEvent.h" #include "platform/graphics/ImageFrameGenerator.h" #include "wtf/Threading.h" +#include <memory> namespace blink { @@ -55,7 +56,7 @@ ImageDecodingStore& ImageDecodingStore::instance() { - DEFINE_THREAD_SAFE_STATIC_LOCAL(ImageDecodingStore, store, ImageDecodingStore::create().leakPtr()); + DEFINE_THREAD_SAFE_STATIC_LOCAL(ImageDecodingStore, store, ImageDecodingStore::create().release()); return store; } @@ -91,12 +92,12 @@ m_orderedCacheList.append(cacheEntry); } -void ImageDecodingStore::insertDecoder(const ImageFrameGenerator* generator, PassOwnPtr<ImageDecoder> decoder) +void ImageDecodingStore::insertDecoder(const ImageFrameGenerator* generator, std::unique_ptr<ImageDecoder> decoder) { // Prune old cache entries to give space for the new one. prune(); - OwnPtr<DecoderCacheEntry> newCacheEntry = DecoderCacheEntry::create(generator, std::move(decoder)); + std::unique_ptr<DecoderCacheEntry> newCacheEntry = DecoderCacheEntry::create(generator, std::move(decoder)); MutexLocker lock(m_mutex); ASSERT(!m_decoderCacheMap.contains(newCacheEntry->cacheKey())); @@ -105,7 +106,7 @@ void ImageDecodingStore::removeDecoder(const ImageFrameGenerator* generator, const ImageDecoder* decoder) { - Vector<OwnPtr<CacheEntry>> cacheEntriesToDelete; + Vector<std::unique_ptr<CacheEntry>> cacheEntriesToDelete; { MutexLocker lock(m_mutex); DecoderCacheMap::iterator iter = m_decoderCacheMap.find(DecoderCacheEntry::makeCacheKey(generator, decoder)); @@ -127,7 +128,7 @@ void ImageDecodingStore::removeCacheIndexedByGenerator(const ImageFrameGenerator* generator) { - Vector<OwnPtr<CacheEntry>> cacheEntriesToDelete; + Vector<std::unique_ptr<CacheEntry>> cacheEntriesToDelete; { MutexLocker lock(m_mutex); @@ -182,7 +183,7 @@ { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("blink.image_decoding"), "ImageDecodingStore::prune"); - Vector<OwnPtr<CacheEntry>> cacheEntriesToDelete; + Vector<std::unique_ptr<CacheEntry>> cacheEntriesToDelete; { MutexLocker lock(m_mutex); @@ -208,7 +209,7 @@ } template<class T, class U, class V> -void ImageDecodingStore::insertCacheInternal(PassOwnPtr<T> cacheEntry, U* cacheMap, V* identifierMap) +void ImageDecodingStore::insertCacheInternal(std::unique_ptr<T> cacheEntry, U* cacheMap, V* identifierMap) { const size_t cacheEntryBytes = cacheEntry->memoryUsageInBytes(); m_heapMemoryUsageInBytes += cacheEntryBytes; @@ -227,7 +228,7 @@ } template<class T, class U, class V> -void ImageDecodingStore::removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<OwnPtr<CacheEntry>>* deletionList) +void ImageDecodingStore::removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<std::unique_ptr<CacheEntry>>* deletionList) { const size_t cacheEntryBytes = cacheEntry->memoryUsageInBytes(); ASSERT(m_heapMemoryUsageInBytes >= cacheEntryBytes); @@ -247,7 +248,7 @@ TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.image_decoding"), "ImageDecodingStoreNumOfDecoders", m_decoderCacheMap.size()); } -void ImageDecodingStore::removeFromCacheInternal(const CacheEntry* cacheEntry, Vector<OwnPtr<CacheEntry>>* deletionList) +void ImageDecodingStore::removeFromCacheInternal(const CacheEntry* cacheEntry, Vector<std::unique_ptr<CacheEntry>>* deletionList) { if (cacheEntry->type() == CacheEntry::TypeDecoder) { removeFromCacheInternal(static_cast<const DecoderCacheEntry*>(cacheEntry), &m_decoderCacheMap, &m_decoderCacheKeyMap, deletionList); @@ -257,7 +258,7 @@ } template<class U, class V> -void ImageDecodingStore::removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator* generator, Vector<OwnPtr<CacheEntry>>* deletionList) +void ImageDecodingStore::removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator* generator, Vector<std::unique_ptr<CacheEntry>>* deletionList) { typename V::iterator iter = identifierMap->find(generator); if (iter == identifierMap->end()) @@ -270,13 +271,13 @@ // For each cache identifier find the corresponding CacheEntry and remove it. for (size_t i = 0; i < cacheIdentifierList.size(); ++i) { ASSERT(cacheMap->contains(cacheIdentifierList[i])); - const typename U::MappedType::PtrType cacheEntry = cacheMap->get(cacheIdentifierList[i]); + const auto& cacheEntry = cacheMap->get(cacheIdentifierList[i]); ASSERT(!cacheEntry->useCount()); removeFromCacheInternal(cacheEntry, cacheMap, identifierMap, deletionList); } } -void ImageDecodingStore::removeFromCacheListInternal(const Vector<OwnPtr<CacheEntry>>& deletionList) +void ImageDecodingStore::removeFromCacheListInternal(const Vector<std::unique_ptr<CacheEntry>>& deletionList) { for (size_t i = 0; i < deletionList.size(); ++i) m_orderedCacheList.remove(deletionList[i].get());
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h index 7117456..465963a 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h +++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h
@@ -31,13 +31,12 @@ #include "platform/PlatformExport.h" #include "platform/graphics/skia/SkSizeHash.h" #include "platform/image-decoders/ImageDecoder.h" - #include "wtf/DoublyLinkedList.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -65,7 +64,7 @@ USING_FAST_MALLOC(ImageDecodingStore); WTF_MAKE_NONCOPYABLE(ImageDecodingStore); public: - static PassOwnPtr<ImageDecodingStore> create() { return adoptPtr(new ImageDecodingStore); } + static std::unique_ptr<ImageDecodingStore> create() { return wrapUnique(new ImageDecodingStore); } ~ImageDecodingStore(); static ImageDecodingStore& instance(); @@ -74,7 +73,7 @@ // and scaled size. Return true if the cached object is found. bool lockDecoder(const ImageFrameGenerator*, const SkISize& scaledSize, ImageDecoder**); void unlockDecoder(const ImageFrameGenerator*, const ImageDecoder*); - void insertDecoder(const ImageFrameGenerator*, PassOwnPtr<ImageDecoder>); + void insertDecoder(const ImageFrameGenerator*, std::unique_ptr<ImageDecoder>); void removeDecoder(const ImageFrameGenerator*, const ImageDecoder*); // Remove all cache entries indexed by ImageFrameGenerator. @@ -136,12 +135,12 @@ class DecoderCacheEntry final : public CacheEntry { public: - static PassOwnPtr<DecoderCacheEntry> create(const ImageFrameGenerator* generator, PassOwnPtr<ImageDecoder> decoder) + static std::unique_ptr<DecoderCacheEntry> create(const ImageFrameGenerator* generator, std::unique_ptr<ImageDecoder> decoder) { - return adoptPtr(new DecoderCacheEntry(generator, 0, std::move(decoder))); + return wrapUnique(new DecoderCacheEntry(generator, 0, std::move(decoder))); } - DecoderCacheEntry(const ImageFrameGenerator* generator, int count, PassOwnPtr<ImageDecoder> decoder) + DecoderCacheEntry(const ImageFrameGenerator* generator, int count, std::unique_ptr<ImageDecoder> decoder) : CacheEntry(generator, count) , m_cachedDecoder(std::move(decoder)) , m_size(SkISize::Make(m_cachedDecoder->decodedSize().width(), m_cachedDecoder->decodedSize().height())) @@ -163,7 +162,7 @@ ImageDecoder* cachedDecoder() const { return m_cachedDecoder.get(); } private: - OwnPtr<ImageDecoder> m_cachedDecoder; + std::unique_ptr<ImageDecoder> m_cachedDecoder; SkISize m_size; }; @@ -172,22 +171,22 @@ void prune(); // These helper methods are called while m_mutex is locked. - template<class T, class U, class V> void insertCacheInternal(PassOwnPtr<T> cacheEntry, U* cacheMap, V* identifierMap); + template<class T, class U, class V> void insertCacheInternal(std::unique_ptr<T> cacheEntry, U* cacheMap, V* identifierMap); // Helper method to remove a cache entry. Ownership is transferred to // deletionList. Use of Vector<> is handy when removing multiple entries. - template<class T, class U, class V> void removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<OwnPtr<CacheEntry>>* deletionList); + template<class T, class U, class V> void removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<std::unique_ptr<CacheEntry>>* deletionList); // Helper method to remove a cache entry. Uses the templated version base on // the type of cache entry. - void removeFromCacheInternal(const CacheEntry*, Vector<OwnPtr<CacheEntry>>* deletionList); + void removeFromCacheInternal(const CacheEntry*, Vector<std::unique_ptr<CacheEntry>>* deletionList); // Helper method to remove all cache entries associated with a ImageFraneGenerator. // Ownership of cache entries is transferred to deletionList. - template<class U, class V> void removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator*, Vector<OwnPtr<CacheEntry>>* deletionList); + template<class U, class V> void removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator*, Vector<std::unique_ptr<CacheEntry>>* deletionList); // Helper method to remove cache entry pointers from the LRU list. - void removeFromCacheListInternal(const Vector<OwnPtr<CacheEntry>>& deletionList); + void removeFromCacheListInternal(const Vector<std::unique_ptr<CacheEntry>>& deletionList); // A doubly linked list that maintains usage history of cache entries. // This is used for eviction of old entries. @@ -196,7 +195,7 @@ DoublyLinkedList<CacheEntry> m_orderedCacheList; // A lookup table for all decoder cache objects. Owns all decoder cache objects. - typedef HashMap<DecoderCacheKey, OwnPtr<DecoderCacheEntry>> DecoderCacheMap; + typedef HashMap<DecoderCacheKey, std::unique_ptr<DecoderCacheEntry>> DecoderCacheMap; DecoderCacheMap m_decoderCacheMap; // A lookup table to map ImageFrameGenerator to all associated
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp index 809174a..bbd4fbe 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStoreTest.cpp
@@ -28,6 +28,7 @@ #include "platform/graphics/ImageFrameGenerator.h" #include "platform/graphics/test/MockImageDecoder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -82,7 +83,7 @@ TEST_F(ImageDecodingStoreTest, insertDecoder) { const SkISize size = SkISize::Make(1, 1); - OwnPtr<ImageDecoder> decoder = MockImageDecoder::create(this); + std::unique_ptr<ImageDecoder> decoder = MockImageDecoder::create(this); decoder->setSize(1, 1); const ImageDecoder* refDecoder = decoder.get(); ImageDecodingStore::instance().insertDecoder(m_generator.get(), std::move(decoder)); @@ -99,9 +100,9 @@ TEST_F(ImageDecodingStoreTest, evictDecoder) { - OwnPtr<ImageDecoder> decoder1 = MockImageDecoder::create(this); - OwnPtr<ImageDecoder> decoder2 = MockImageDecoder::create(this); - OwnPtr<ImageDecoder> decoder3 = MockImageDecoder::create(this); + std::unique_ptr<ImageDecoder> decoder1 = MockImageDecoder::create(this); + std::unique_ptr<ImageDecoder> decoder2 = MockImageDecoder::create(this); + std::unique_ptr<ImageDecoder> decoder3 = MockImageDecoder::create(this); decoder1->setSize(1, 1); decoder2->setSize(2, 2); decoder3->setSize(3, 3); @@ -126,9 +127,9 @@ TEST_F(ImageDecodingStoreTest, decoderInUseNotEvicted) { - OwnPtr<ImageDecoder> decoder1 = MockImageDecoder::create(this); - OwnPtr<ImageDecoder> decoder2 = MockImageDecoder::create(this); - OwnPtr<ImageDecoder> decoder3 = MockImageDecoder::create(this); + std::unique_ptr<ImageDecoder> decoder1 = MockImageDecoder::create(this); + std::unique_ptr<ImageDecoder> decoder2 = MockImageDecoder::create(this); + std::unique_ptr<ImageDecoder> decoder3 = MockImageDecoder::create(this); decoder1->setSize(1, 1); decoder2->setSize(2, 2); decoder3->setSize(3, 3); @@ -155,7 +156,7 @@ TEST_F(ImageDecodingStoreTest, removeDecoder) { const SkISize size = SkISize::Make(1, 1); - OwnPtr<ImageDecoder> decoder = MockImageDecoder::create(this); + std::unique_ptr<ImageDecoder> decoder = MockImageDecoder::create(this); decoder->setSize(1, 1); const ImageDecoder* refDecoder = decoder.get(); ImageDecodingStore::instance().insertDecoder(m_generator.get(), std::move(decoder));
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp index faf1444..cebc233 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
@@ -30,6 +30,8 @@ #include "platform/graphics/ImageDecodingStore.h" #include "platform/image-decoders/ImageDecoder.h" #include "third_party/skia/include/core/SkYUVSizeInfo.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -158,13 +160,13 @@ return false; } - OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); + std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); // getYUVComponentSizes was already called and was successful, so ImageDecoder::create must succeed. ASSERT(decoder); decoder->setData(data, true); - OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes(planes, rowBytes)); + std::unique_ptr<ImagePlanes> imagePlanes = wrapUnique(new ImagePlanes(planes, rowBytes)); decoder->setImagePlanes(std::move(imagePlanes)); ASSERT(decoder->canDecodeToYUV()); @@ -199,9 +201,9 @@ // If we are not resuming decoding that means the decoder is freshly // created and we have ownership. If we are resuming decoding then // the decoder is owned by ImageDecodingStore. - OwnPtr<ImageDecoder> decoderContainer; + std::unique_ptr<ImageDecoder> decoderContainer; if (!resumeDecoding) - decoderContainer = adoptPtr(decoder); + decoderContainer = wrapUnique(decoder); if (fullSizeImage.isNull()) { // If decoding has failed, we can save work in the future by @@ -262,10 +264,10 @@ if (!*decoder) { newDecoder = true; if (m_imageDecoderFactory) - *decoder = m_imageDecoderFactory->create().leakPtr(); + *decoder = m_imageDecoderFactory->create().release(); if (!*decoder) - *decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied).leakPtr(); + *decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied).release(); if (!*decoder) return false; @@ -325,13 +327,13 @@ if (m_yuvDecodingFailed) return false; - OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); + std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied); if (!decoder) return false; // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding. decoder->setData(data, true); - OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); + std::unique_ptr<ImagePlanes> dummyImagePlanes = wrapUnique(new ImagePlanes); decoder->setImagePlanes(std::move(dummyImagePlanes)); return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fWidthBytes);
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h index b8053b9..37685411 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h +++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h
@@ -33,13 +33,13 @@ #include "third_party/skia/include/core/SkTypes.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" +#include <memory> class SkData; struct SkYUVSizeInfo; @@ -54,7 +54,7 @@ public: ImageDecoderFactory() {} virtual ~ImageDecoderFactory() { } - virtual PassOwnPtr<ImageDecoder> create() = 0; + virtual std::unique_ptr<ImageDecoder> create() = 0; }; class PLATFORM_EXPORT ImageFrameGenerator final : public ThreadSafeRefCounted<ImageFrameGenerator> { @@ -95,7 +95,7 @@ friend class ImageFrameGeneratorTest; friend class DeferredImageDecoderTest; // For testing. |factory| will overwrite the default ImageDecoder creation logic if |factory->create()| returns non-zero. - void setImageDecoderFactory(PassOwnPtr<ImageDecoderFactory> factory) { m_imageDecoderFactory = std::move(factory); } + void setImageDecoderFactory(std::unique_ptr<ImageDecoderFactory> factory) { m_imageDecoderFactory = std::move(factory); } void setHasAlpha(size_t index, bool hasAlpha); @@ -111,7 +111,7 @@ size_t m_frameCount; Vector<bool> m_hasAlpha; - OwnPtr<ImageDecoderFactory> m_imageDecoderFactory; + std::unique_ptr<ImageDecoderFactory> m_imageDecoderFactory; // Prevents multiple decode operations on the same data. Mutex m_decodeMutex;
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp index 74e5a2b..63f41a4 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGeneratorTest.cpp
@@ -35,6 +35,8 @@ #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -184,7 +186,7 @@ // LocalFrame can now be decoded completely. setFrameStatus(ImageFrame::FrameComplete); addNewData(); - OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("DecodeThread")); + std::unique_ptr<WebThread> thread = wrapUnique(Platform::current()->createThread("DecodeThread")); thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&decodeThreadMain, m_generator, m_segmentReader)); thread.reset(); EXPECT_EQ(2, m_decodeRequestCount);
diff --git a/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp index ada2c2d..ac6c74b 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp
@@ -30,7 +30,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -95,7 +96,7 @@ TEST(ImageLayerChromiumTest, imageLayerContentReset) { FakeGraphicsLayerClient client; - OwnPtr<FakeGraphicsLayer> graphicsLayer = adoptPtr(new FakeGraphicsLayer(&client)); + std::unique_ptr<FakeGraphicsLayer> graphicsLayer = wrapUnique(new FakeGraphicsLayer(&client)); ASSERT_TRUE(graphicsLayer.get()); ASSERT_FALSE(graphicsLayer->hasContentsLayer()); @@ -117,7 +118,7 @@ TEST(ImageLayerChromiumTest, opaqueImages) { FakeGraphicsLayerClient client; - OwnPtr<FakeGraphicsLayer> graphicsLayer = adoptPtr(new FakeGraphicsLayer(&client)); + std::unique_ptr<FakeGraphicsLayer> graphicsLayer = wrapUnique(new FakeGraphicsLayer(&client)); ASSERT_TRUE(graphicsLayer.get()); bool opaque = true;
diff --git a/third_party/WebKit/Source/platform/graphics/ImageSource.h b/third_party/WebKit/Source/platform/graphics/ImageSource.h index 3e5d183..5e8ded4 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageSource.h +++ b/third_party/WebKit/Source/platform/graphics/ImageSource.h
@@ -30,7 +30,7 @@ #include "platform/graphics/ImageOrientation.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" +#include <memory> class SkImage; @@ -95,7 +95,7 @@ size_t frameBytesAtIndex(size_t) const; private: - OwnPtr<DeferredImageDecoder> m_decoder; + std::unique_ptr<DeferredImageDecoder> m_decoder; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h b/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h index d78262ba..58f55fd 100644 --- a/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h +++ b/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h
@@ -7,7 +7,6 @@ #include "platform/geometry/IntSize.h" #include "platform/graphics/GeneratedImage.h" -#include "wtf/OwnPtr.h" class SkPicture;
diff --git a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp index 5bc8eb1c..8cc9f53 100644 --- a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp +++ b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
@@ -46,8 +46,10 @@ #include "third_party/skia/include/core/SkStream.h" #include "wtf/CurrentTime.h" #include "wtf/HexNumber.h" +#include "wtf/PtrUtil.h" #include "wtf/text/Base64.h" #include "wtf/text/TextEncoding.h" +#include <memory> namespace blink { @@ -58,7 +60,7 @@ static bool decodeBitmap(const void* data, size_t length, SkBitmap* result) { - OwnPtr<ImageDecoder> imageDecoder = ImageDecoder::create(static_cast<const char*>(data), length, + std::unique_ptr<ImageDecoder> imageDecoder = ImageDecoder::create(static_cast<const char*>(data), length, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored); if (!imageDecoder) return false; @@ -107,7 +109,7 @@ return m_picture->cullRect().isEmpty(); } -PassOwnPtr<Vector<char>> PictureSnapshot::replay(unsigned fromStep, unsigned toStep, double scale) const +std::unique_ptr<Vector<char>> PictureSnapshot::replay(unsigned fromStep, unsigned toStep, double scale) const { const SkIRect bounds = m_picture->cullRect().roundOut(); @@ -127,7 +129,7 @@ canvas.resetStepCount(); m_picture->playback(&canvas, &canvas); } - OwnPtr<Vector<char>> base64Data = adoptPtr(new Vector<char>()); + std::unique_ptr<Vector<char>> base64Data = wrapUnique(new Vector<char>()); Vector<char> encodedImage; RefPtr<SkImage> image = fromSkSp(SkImage::MakeFromBitmap(bitmap)); @@ -144,9 +146,9 @@ return base64Data; } -PassOwnPtr<PictureSnapshot::Timings> PictureSnapshot::profile(unsigned minRepeatCount, double minDuration, const FloatRect* clipRect) const +std::unique_ptr<PictureSnapshot::Timings> PictureSnapshot::profile(unsigned minRepeatCount, double minDuration, const FloatRect* clipRect) const { - OwnPtr<PictureSnapshot::Timings> timings = adoptPtr(new PictureSnapshot::Timings()); + std::unique_ptr<PictureSnapshot::Timings> timings = wrapUnique(new PictureSnapshot::Timings()); timings->reserveCapacity(minRepeatCount); const SkIRect bounds = m_picture->cullRect().roundOut(); SkBitmap bitmap;
diff --git a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.h b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.h index 34bac46..ffe561f 100644 --- a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.h +++ b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.h
@@ -37,6 +37,7 @@ #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkPictureRecorder.h" #include "wtf/RefCounted.h" +#include <memory> namespace blink { @@ -56,13 +57,13 @@ PictureSnapshot(PassRefPtr<const SkPicture>); - PassOwnPtr<Vector<char>> replay(unsigned fromStep = 0, unsigned toStep = 0, double scale = 1.0) const; - PassOwnPtr<Timings> profile(unsigned minIterations, double minDuration, const FloatRect* clipRect) const; + std::unique_ptr<Vector<char>> replay(unsigned fromStep = 0, unsigned toStep = 0, double scale = 1.0) const; + std::unique_ptr<Timings> profile(unsigned minIterations, double minDuration, const FloatRect* clipRect) const; PassRefPtr<JSONArray> snapshotCommandLog() const; bool isEmpty() const; private: - PassOwnPtr<SkBitmap> createBitmap() const; + std::unique_ptr<SkBitmap> createBitmap() const; RefPtr<const SkPicture> m_picture; };
diff --git a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp index c19292b..6784aee 100644 --- a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp +++ b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp
@@ -11,12 +11,13 @@ #include "platform/graphics/ImageBuffer.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPictureRecorder.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -RecordingImageBufferSurface::RecordingImageBufferSurface(const IntSize& size, PassOwnPtr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory, OpacityMode opacityMode) +RecordingImageBufferSurface::RecordingImageBufferSurface(const IntSize& size, std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory, OpacityMode opacityMode) : ImageBufferSurface(size, opacityMode) , m_imageBuffer(0) , m_currentFramePixelCount(0) @@ -36,7 +37,7 @@ void RecordingImageBufferSurface::initializeCurrentFrame() { static SkRTreeFactory rTreeFactory; - m_currentFrame = adoptPtr(new SkPictureRecorder); + m_currentFrame = wrapUnique(new SkPictureRecorder); m_currentFrame->beginRecording(size().width(), size().height(), &rTreeFactory); if (m_imageBuffer) { m_imageBuffer->resetCanvas(m_currentFrame->getRecordingCanvas());
diff --git a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.h b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.h index 011073e..257a9316 100644 --- a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.h +++ b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.h
@@ -10,8 +10,8 @@ #include "public/platform/WebThread.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> class SkCanvas; class SkPicture; @@ -26,7 +26,7 @@ USING_FAST_MALLOC(RecordingImageBufferFallbackSurfaceFactory); WTF_MAKE_NONCOPYABLE(RecordingImageBufferFallbackSurfaceFactory); public: - virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize&, OpacityMode) = 0; + virtual std::unique_ptr<ImageBufferSurface> createSurface(const IntSize&, OpacityMode) = 0; virtual ~RecordingImageBufferFallbackSurfaceFactory() { } protected: RecordingImageBufferFallbackSurfaceFactory() { } @@ -39,7 +39,7 @@ // for one frame and should not be used for any operations which need a // raster surface, (i.e. writePixels). // Only #getPicture should be used to access the resulting frame. - RecordingImageBufferSurface(const IntSize&, PassOwnPtr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory = nullptr, OpacityMode = NonOpaque); + RecordingImageBufferSurface(const IntSize&, std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory = nullptr, OpacityMode = NonOpaque); ~RecordingImageBufferSurface() override; // Implementation of ImageBufferSurface interfaces @@ -94,9 +94,9 @@ bool finalizeFrameInternal(FallbackReason*); int approximateOpCount(); - OwnPtr<SkPictureRecorder> m_currentFrame; + std::unique_ptr<SkPictureRecorder> m_currentFrame; RefPtr<SkPicture> m_previousFrame; - OwnPtr<ImageBufferSurface> m_fallbackSurface; + std::unique_ptr<ImageBufferSurface> m_fallbackSurface; ImageBuffer* m_imageBuffer; int m_initialSaveCount; int m_currentFramePixelCount; @@ -105,7 +105,7 @@ bool m_didRecordDrawCommandsInCurrentFrame; bool m_currentFrameHasExpensiveOp; bool m_previousFrameHasExpensiveOp; - OwnPtr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; + std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp index 7e9b5702..c5641e84 100644 --- a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp
@@ -17,9 +17,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPictureRecorder.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> using testing::Test; @@ -78,10 +78,10 @@ public: MockSurfaceFactory() : m_createSurfaceCount(0) { } - virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode opacityMode) + virtual std::unique_ptr<ImageBufferSurface> createSurface(const IntSize& size, OpacityMode opacityMode) { m_createSurfaceCount++; - return adoptPtr(new UnacceleratedImageBufferSurface(size, opacityMode)); + return wrapUnique(new UnacceleratedImageBufferSurface(size, opacityMode)); } virtual ~MockSurfaceFactory() { } @@ -96,15 +96,15 @@ protected: RecordingImageBufferSurfaceTest() { - OwnPtr<MockSurfaceFactory> surfaceFactory = adoptPtr(new MockSurfaceFactory()); + std::unique_ptr<MockSurfaceFactory> surfaceFactory = wrapUnique(new MockSurfaceFactory()); m_surfaceFactory = surfaceFactory.get(); - OwnPtr<RecordingImageBufferSurface> testSurface = adoptPtr(new RecordingImageBufferSurface(IntSize(10, 10), std::move(surfaceFactory))); + std::unique_ptr<RecordingImageBufferSurface> testSurface = wrapUnique(new RecordingImageBufferSurface(IntSize(10, 10), std::move(surfaceFactory))); m_testSurface = testSurface.get(); // We create an ImageBuffer in order for the testSurface to be // properly initialized with a GraphicsContext m_imageBuffer = ImageBuffer::create(std::move(testSurface)); EXPECT_FALSE(!m_imageBuffer); - m_fakeImageBufferClient = adoptPtr(new FakeImageBufferClient(m_imageBuffer.get())); + m_fakeImageBufferClient = wrapUnique(new FakeImageBufferClient(m_imageBuffer.get())); m_imageBuffer->setClient(m_fakeImageBufferClient.get()); } @@ -226,8 +226,8 @@ private: MockSurfaceFactory* m_surfaceFactory; RecordingImageBufferSurface* m_testSurface; - OwnPtr<FakeImageBufferClient> m_fakeImageBufferClient; - OwnPtr<ImageBuffer> m_imageBuffer; + std::unique_ptr<FakeImageBufferClient> m_fakeImageBufferClient; + std::unique_ptr<ImageBuffer> m_imageBuffer; }; namespace {
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp index ac88b3d3..aa45be3a 100644 --- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
@@ -14,6 +14,8 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkShader.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -74,7 +76,7 @@ // In the place when we consume an ImageBitmap that is gpu texture backed, // create a new SkImage from that texture. // TODO(xidachen): make this work on a worker thread. - OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + std::unique_ptr<WebGraphicsContext3DProvider> provider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!provider) return nullptr; GrContext* grContext = provider->grContext();
diff --git a/third_party/WebKit/Source/platform/graphics/StrokeData.cpp b/third_party/WebKit/Source/platform/graphics/StrokeData.cpp index d7b3b56..a82fe7e 100644 --- a/third_party/WebKit/Source/platform/graphics/StrokeData.cpp +++ b/third_party/WebKit/Source/platform/graphics/StrokeData.cpp
@@ -28,8 +28,8 @@ #include "platform/graphics/StrokeData.h" #include "third_party/skia/include/effects/SkDashPathEffect.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -49,7 +49,7 @@ } size_t count = !(dashLength % 2) ? dashLength : dashLength * 2; - OwnPtr<SkScalar[]> intervals = adoptArrayPtr(new SkScalar[count]); + std::unique_ptr<SkScalar[]> intervals = wrapArrayUnique(new SkScalar[count]); for (unsigned i = 0; i < count; i++) intervals[i] = dashes[i % dashLength];
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp index c88437b..090e79bfb 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
@@ -32,8 +32,9 @@ #include "ui/gfx/skia_util.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include <algorithm> +#include <memory> #include <utility> namespace blink { @@ -68,7 +69,7 @@ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) return; m_rootLayer = cc::Layer::Create(); - m_webLayer = adoptPtr(Platform::current()->compositorSupport()->createLayerFromCCLayer(m_rootLayer.get())); + m_webLayer = wrapUnique(Platform::current()->compositorSupport()->createLayerFromCCLayer(m_rootLayer.get())); } PaintArtifactCompositor::~PaintArtifactCompositor() @@ -373,7 +374,7 @@ // The common case: create a layer for painted content. gfx::Rect combinedBounds = enclosingIntRect(paintChunk.bounds); scoped_refptr<cc::DisplayItemList> displayList = recordPaintChunk(paintArtifact, paintChunk, combinedBounds); - OwnPtr<ContentLayerClientImpl> contentLayerClient = adoptPtr( + std::unique_ptr<ContentLayerClientImpl> contentLayerClient = wrapUnique( new ContentLayerClientImpl(std::move(displayList), gfx::Rect(combinedBounds.size()))); layerOffset = combinedBounds.OffsetFromOrigin();
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h index 1c2f526..ad732528d 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h
@@ -8,8 +8,8 @@ #include "base/memory/ref_counted.h" #include "platform/PlatformExport.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace cc { class Layer; @@ -62,8 +62,8 @@ scoped_refptr<cc::Layer> layerForPaintChunk(const PaintArtifact&, const PaintChunk&, gfx::Vector2dF& layerOffset); scoped_refptr<cc::Layer> m_rootLayer; - OwnPtr<WebLayer> m_webLayer; - Vector<OwnPtr<ContentLayerClientImpl>> m_contentLayerClients; + std::unique_ptr<WebLayer> m_webLayer; + Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp index f21059a1..ef9edb4 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp
@@ -17,6 +17,8 @@ #include "platform/testing/WebLayerTreeViewImplForTesting.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { namespace { @@ -37,7 +39,7 @@ RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); // Delay constructing the compositor until after the feature is set. - m_paintArtifactCompositor = adoptPtr(new PaintArtifactCompositor); + m_paintArtifactCompositor = wrapUnique(new PaintArtifactCompositor); } void TearDown() override @@ -51,7 +53,7 @@ private: RuntimeEnabledFeatures::Backup m_featuresBackup; - OwnPtr<PaintArtifactCompositor> m_paintArtifactCompositor; + std::unique_ptr<PaintArtifactCompositor> m_paintArtifactCompositor; }; TEST_F(PaintArtifactCompositorTest, EmptyPaintArtifact) @@ -385,7 +387,7 @@ cc::LayerTreeSettings settings = WebLayerTreeViewImplForTesting::defaultLayerTreeSettings(); settings.single_thread_proxy_scheduler = false; settings.use_layer_lists = true; - m_webLayerTreeView = adoptPtr(new WebLayerTreeViewWithOutputSurface(settings)); + m_webLayerTreeView = wrapUnique(new WebLayerTreeViewWithOutputSurface(settings)); m_webLayerTreeView->setRootLayer(*getPaintArtifactCompositor().getWebLayer()); } @@ -403,7 +405,7 @@ private: scoped_refptr<base::TestSimpleTaskRunner> m_taskRunner; base::ThreadTaskRunnerHandle m_taskRunnerHandle; - OwnPtr<WebLayerTreeViewWithOutputSurface> m_webLayerTreeView; + std::unique_ptr<WebLayerTreeViewWithOutputSurface> m_webLayerTreeView; }; TEST_F(PaintArtifactCompositorTestWithPropertyTrees, EmptyPaintArtifact)
diff --git a/third_party/WebKit/Source/platform/graphics/filters/FEConvolveMatrix.cpp b/third_party/WebKit/Source/platform/graphics/filters/FEConvolveMatrix.cpp index 0101f44..ece3a8d 100644 --- a/third_party/WebKit/Source/platform/graphics/filters/FEConvolveMatrix.cpp +++ b/third_party/WebKit/Source/platform/graphics/filters/FEConvolveMatrix.cpp
@@ -28,7 +28,8 @@ #include "platform/graphics/filters/SkiaImageFilterBuilder.h" #include "platform/text/TextStream.h" #include "wtf/CheckedNumeric.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -150,7 +151,7 @@ SkIPoint target = SkIPoint::Make(m_targetOffset.x(), m_targetOffset.y()); SkMatrixConvolutionImageFilter::TileMode tileMode = toSkiaTileMode(m_edgeMode); bool convolveAlpha = !m_preserveAlpha; - OwnPtr<SkScalar[]> kernel = adoptArrayPtr(new SkScalar[numElements]); + std::unique_ptr<SkScalar[]> kernel = wrapArrayUnique(new SkScalar[numElements]); for (int i = 0; i < numElements; ++i) kernel[i] = SkFloatToScalar(m_kernelMatrix[numElements - 1 - i]); SkImageFilter::CropRect cropRect = getCropRect();
diff --git a/third_party/WebKit/Source/platform/graphics/filters/FEMerge.cpp b/third_party/WebKit/Source/platform/graphics/filters/FEMerge.cpp index 3b1cccd..8c55d52 100644 --- a/third_party/WebKit/Source/platform/graphics/filters/FEMerge.cpp +++ b/third_party/WebKit/Source/platform/graphics/filters/FEMerge.cpp
@@ -25,7 +25,8 @@ #include "SkMergeImageFilter.h" #include "platform/graphics/filters/SkiaImageFilterBuilder.h" #include "platform/text/TextStream.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -43,7 +44,7 @@ { unsigned size = numberOfEffectInputs(); - OwnPtr<sk_sp<SkImageFilter>[]> inputRefs = adoptArrayPtr(new sk_sp<SkImageFilter>[size]); + std::unique_ptr<sk_sp<SkImageFilter>[]> inputRefs = wrapArrayUnique(new sk_sp<SkImageFilter>[size]); for (unsigned i = 0; i < size; ++i) inputRefs[i] = SkiaImageFilterBuilder::build(inputEffect(i), operatingColorSpace()); SkImageFilter::CropRect rect = getCropRect();
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp index 21edb3e..cc07c2345 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp
@@ -35,7 +35,7 @@ #include "public/platform/WebGraphicsContext3DProvider.h" #include "skia/ext/texture_handle.h" #include "third_party/skia/include/gpu/GrContext.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" namespace blink { @@ -43,7 +43,7 @@ AcceleratedImageBufferSurface::AcceleratedImageBufferSurface(const IntSize& size, OpacityMode opacityMode) : ImageBufferSurface(size, opacityMode) { - m_contextProvider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + m_contextProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!m_contextProvider) return; GrContext* grContext = m_contextProvider->grContext();
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h index 5a2da49..021cb84 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h
@@ -34,7 +34,7 @@ #include "platform/graphics/ImageBufferSurface.h" #include "public/platform/WebGraphicsContext3DProvider.h" #include "third_party/skia/include/core/SkSurface.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -51,7 +51,7 @@ GLuint getBackingTextureHandleForOverwrite() override; private: - OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; + std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; sk_sp<SkSurface> m_surface; // Uses m_contextProvider. };
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp index 3b72a2e..601e4dac 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -43,8 +43,10 @@ #include "public/platform/WebExternalTextureLayer.h" #include "public/platform/WebGraphicsContext3DProvider.h" #include "wtf/CheckedNumeric.h" +#include "wtf/PtrUtil.h" #include "wtf/typed_arrays/ArrayBufferContents.h" #include <algorithm> +#include <memory> namespace blink { @@ -79,7 +81,7 @@ } // namespace -PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, bool premultipliedAlpha, bool wantAlphaChannel, bool wantDepthBuffer, bool wantStencilBuffer, bool wantAntialiasing, PreserveDrawingBuffer preserve) +PassRefPtr<DrawingBuffer> DrawingBuffer::create(std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, bool premultipliedAlpha, bool wantAlphaChannel, bool wantDepthBuffer, bool wantStencilBuffer, bool wantAntialiasing, PreserveDrawingBuffer preserve) { ASSERT(contextProvider); @@ -88,7 +90,7 @@ return nullptr; } - OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(contextProvider->contextGL()); + std::unique_ptr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(contextProvider->contextGL()); if (!extensionsUtil->isValid()) { // This might be the first time we notice that the GL context is lost. return nullptr; @@ -124,8 +126,8 @@ } DrawingBuffer::DrawingBuffer( - PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, - PassOwnPtr<Extensions3DUtil> extensionsUtil, + std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, + std::unique_ptr<Extensions3DUtil> extensionsUtil, bool discardFramebufferSupported, bool wantAlphaChannel, bool premultipliedAlpha, @@ -558,7 +560,7 @@ WebLayer* DrawingBuffer::platformLayer() { if (!m_layer) { - m_layer = adoptPtr(Platform::current()->compositorSupport()->createExternalTextureLayer(this)); + m_layer = wrapUnique(Platform::current()->compositorSupport()->createExternalTextureLayer(this)); m_layer->setOpaque(!m_wantAlphaChannel); m_layer->setBlendBackgroundColor(m_wantAlphaChannel);
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h index b0a31df..da880647 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
@@ -41,9 +41,8 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "wtf/Deque.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" +#include <memory> namespace gpu { namespace gles2 { @@ -75,7 +74,7 @@ }; static PassRefPtr<DrawingBuffer> create( - PassOwnPtr<WebGraphicsContext3DProvider>, + std::unique_ptr<WebGraphicsContext3DProvider>, const IntSize&, bool premultipliedAlpha, bool wantAlphaChannel, @@ -222,8 +221,8 @@ protected: // For unittests DrawingBuffer( - PassOwnPtr<WebGraphicsContext3DProvider>, - PassOwnPtr<Extensions3DUtil>, + std::unique_ptr<WebGraphicsContext3DProvider>, + std::unique_ptr<Extensions3DUtil>, bool discardFramebufferSupported, bool wantAlphaChannel, bool premultipliedAlpha, @@ -368,10 +367,10 @@ GLfloat m_clearColor[4]; GLboolean m_colorMask[4]; - OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; + std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; // Lifetime is tied to the m_contextProvider. gpu::gles2::GLES2Interface* m_gl; - OwnPtr<Extensions3DUtil> m_extensionsUtil; + std::unique_ptr<Extensions3DUtil> m_extensionsUtil; IntSize m_size = { -1, -1 }; const bool m_discardFramebufferSupported; const bool m_wantAlphaChannel; @@ -431,7 +430,7 @@ bool m_isHidden = false; SkFilterQuality m_filterQuality = kLow_SkFilterQuality; - OwnPtr<WebExternalTextureLayer> m_layer; + std::unique_ptr<WebExternalTextureLayer> m_layer; // All of the mailboxes that this DrawingBuffer has ever created. Vector<RefPtr<MailboxInfo>> m_textureMailboxes;
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp index 7e161b6f..e8ac977 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -42,7 +42,9 @@ #include "public/platform/functional/WebFunction.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" +#include <memory> using testing::Test; using testing::_; @@ -215,9 +217,9 @@ class DrawingBufferForTests : public DrawingBuffer { public: - static PassRefPtr<DrawingBufferForTests> create(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, PreserveDrawingBuffer preserve) + static PassRefPtr<DrawingBufferForTests> create(std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, PreserveDrawingBuffer preserve) { - OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(contextProvider->contextGL()); + std::unique_ptr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(contextProvider->contextGL()); RefPtr<DrawingBufferForTests> drawingBuffer = adoptRef(new DrawingBufferForTests(std::move(contextProvider), std::move(extensionsUtil), preserve)); bool multisampleExtensionSupported = false; if (!drawingBuffer->initialize(size, multisampleExtensionSupported)) { @@ -227,7 +229,7 @@ return drawingBuffer.release(); } - DrawingBufferForTests(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, PassOwnPtr<Extensions3DUtil> extensionsUtil, PreserveDrawingBuffer preserve) + DrawingBufferForTests(std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, std::unique_ptr<Extensions3DUtil> extensionsUtil, PreserveDrawingBuffer preserve) : DrawingBuffer(std::move(contextProvider), std::move(extensionsUtil), false /* discardFramebufferSupported */, true /* wantAlphaChannel */, false /* premultipliedAlpha */, preserve, false /* wantDepth */, false /* wantStencil */) , m_live(0) { } @@ -243,7 +245,7 @@ class WebGraphicsContext3DProviderForTests : public WebGraphicsContext3DProvider { public: - WebGraphicsContext3DProviderForTests(PassOwnPtr<gpu::gles2::GLES2Interface> gl) + WebGraphicsContext3DProviderForTests(std::unique_ptr<gpu::gles2::GLES2Interface> gl) : m_gl(std::move(gl)) { } @@ -260,16 +262,16 @@ void setErrorMessageCallback(WebFunction<void(const char*, int32_t id)>) {} private: - OwnPtr<gpu::gles2::GLES2Interface> m_gl; + std::unique_ptr<gpu::gles2::GLES2Interface> m_gl; }; class DrawingBufferTest : public Test { protected: void SetUp() override { - OwnPtr<GLES2InterfaceForTests> gl = adoptPtr(new GLES2InterfaceForTests); + std::unique_ptr<GLES2InterfaceForTests> gl = wrapUnique(new GLES2InterfaceForTests); m_gl = gl.get(); - OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new WebGraphicsContext3DProviderForTests(std::move(gl))); + std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = wrapUnique(new WebGraphicsContext3DProviderForTests(std::move(gl))); m_drawingBuffer = DrawingBufferForTests::create(std::move(provider), IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve); CHECK(m_drawingBuffer); } @@ -489,9 +491,9 @@ protected: void SetUp() override { - OwnPtr<GLES2InterfaceForTests> gl = adoptPtr(new GLES2InterfaceForTests); + std::unique_ptr<GLES2InterfaceForTests> gl = wrapUnique(new GLES2InterfaceForTests); m_gl = gl.get(); - OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new WebGraphicsContext3DProviderForTests(std::move(gl))); + std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = wrapUnique(new WebGraphicsContext3DProviderForTests(std::move(gl))); RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true); m_imageId0 = m_gl->nextImageIdToBeCreated(); EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId0)).Times(1); @@ -707,9 +709,9 @@ for (size_t i = 0; i < WTF_ARRAY_LENGTH(cases); i++) { SCOPED_TRACE(cases[i].testCaseName); - OwnPtr<DepthStencilTrackingGLES2Interface> gl = adoptPtr(new DepthStencilTrackingGLES2Interface); + std::unique_ptr<DepthStencilTrackingGLES2Interface> gl = wrapUnique(new DepthStencilTrackingGLES2Interface); DepthStencilTrackingGLES2Interface* trackingGL = gl.get(); - OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new WebGraphicsContext3DProviderForTests(std::move(gl))); + std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = wrapUnique(new WebGraphicsContext3DProviderForTests(std::move(gl))); DrawingBuffer::PreserveDrawingBuffer preserve = DrawingBuffer::Preserve; bool premultipliedAlpha = false;
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp b/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp index 58cd5d2..0f00d826 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp
@@ -5,10 +5,10 @@ #include "platform/graphics/gpu/Extensions3DUtil.h" #include "gpu/command_buffer/client/gles2_interface.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/StringHash.h" +#include <memory> namespace blink { @@ -24,9 +24,9 @@ } // anonymous namespace -PassOwnPtr<Extensions3DUtil> Extensions3DUtil::create(gpu::gles2::GLES2Interface* gl) +std::unique_ptr<Extensions3DUtil> Extensions3DUtil::create(gpu::gles2::GLES2Interface* gl) { - OwnPtr<Extensions3DUtil> out = adoptPtr(new Extensions3DUtil(gl)); + std::unique_ptr<Extensions3DUtil> out = wrapUnique(new Extensions3DUtil(gl)); out->initializeExtensions(); return out; }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.h b/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.h index 418daf3..155d21fd 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.h
@@ -12,6 +12,7 @@ #include "wtf/Noncopyable.h" #include "wtf/text/StringHash.h" #include "wtf/text/WTFString.h" +#include <memory> namespace gpu { namespace gles2 { @@ -26,7 +27,7 @@ WTF_MAKE_NONCOPYABLE(Extensions3DUtil); public: // Creates a new Extensions3DUtil. If the passed GLES2Interface has been spontaneously lost, returns null. - static PassOwnPtr<Extensions3DUtil> create(gpu::gles2::GLES2Interface*); + static std::unique_ptr<Extensions3DUtil> create(gpu::gles2::GLES2Interface*); ~Extensions3DUtil(); bool isValid() { return m_isValid; }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp index c351f16..54152e96 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp
@@ -9,25 +9,27 @@ #include "public/platform/Platform.h" #include "public/platform/WebGraphicsContext3DProvider.h" #include "third_party/khronos/GLES2/gl2.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<SharedContextRateLimiter> SharedContextRateLimiter::create(unsigned maxPendingTicks) +std::unique_ptr<SharedContextRateLimiter> SharedContextRateLimiter::create(unsigned maxPendingTicks) { - return adoptPtr(new SharedContextRateLimiter(maxPendingTicks)); + return wrapUnique(new SharedContextRateLimiter(maxPendingTicks)); } SharedContextRateLimiter::SharedContextRateLimiter(unsigned maxPendingTicks) : m_maxPendingTicks(maxPendingTicks) , m_canUseSyncQueries(false) { - m_contextProvider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); + m_contextProvider = wrapUnique(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!m_contextProvider) return; gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); if (gl && gl->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { - OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); + std::unique_ptr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); // TODO(junov): when the GLES 3.0 command buffer is ready, we could use fenceSync instead m_canUseSyncQueries = extensionsUtil->supportsExtension("GL_CHROMIUM_sync_query"); }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.h b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.h index 96805c1..4a276b7f 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.h
@@ -9,8 +9,7 @@ #include "wtf/Allocator.h" #include "wtf/Deque.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -40,13 +39,13 @@ USING_FAST_MALLOC(SharedContextRateLimiter); WTF_MAKE_NONCOPYABLE(SharedContextRateLimiter); public: - static PassOwnPtr<SharedContextRateLimiter> create(unsigned maxPendingTicks); + static std::unique_ptr<SharedContextRateLimiter> create(unsigned maxPendingTicks); void tick(); void reset(); private: SharedContextRateLimiter(unsigned maxPendingTicks); - OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; + std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; Deque<GLuint> m_queries; unsigned m_maxPendingTicks; bool m_canUseSyncQueries;
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp index 5e264f9..ea70f07 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
@@ -11,8 +11,8 @@ #include "platform/graphics/skia/SkiaUtils.h" #include "platform/image-decoders/ImageDecoder.h" #include "third_party/skia/include/core/SkImage.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -1715,7 +1715,7 @@ { const unsigned MaxNumberOfComponents = 4; const unsigned MaxBytesPerComponent = 4; - m_unpackedIntermediateSrcData = adoptArrayPtr(new uint8_t[m_width * MaxNumberOfComponents *MaxBytesPerComponent]); + m_unpackedIntermediateSrcData = wrapArrayUnique(new uint8_t[m_width * MaxNumberOfComponents *MaxBytesPerComponent]); ASSERT(m_unpackedIntermediateSrcData.get()); } @@ -1737,7 +1737,7 @@ void* const m_dstStart; const int m_srcStride, m_dstStride; bool m_success; - OwnPtr<uint8_t[]> m_unpackedIntermediateSrcData; + std::unique_ptr<uint8_t[]> m_unpackedIntermediateSrcData; }; void FormatConverter::convert(WebGLImageConversion::DataFormat srcFormat, WebGLImageConversion::DataFormat dstFormat, WebGLImageConversion::AlphaOp alphaOp) @@ -2141,7 +2141,7 @@ if ((!skiaImage || ignoreGammaAndColorProfile || (hasAlpha && !premultiplyAlpha)) && m_image->data()) { // Attempt to get raw unpremultiplied image data. - OwnPtr<ImageDecoder> decoder(ImageDecoder::create( + std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create( *(m_image->data()), ImageDecoder::AlphaNotPremultiplied, ignoreGammaAndColorProfile ? ImageDecoder::GammaAndColorProfileIgnored : ImageDecoder::GammaAndColorProfileApplied)); if (!decoder)
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h index eede2c21..de020e2 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ClipDisplayItem.h
@@ -10,7 +10,6 @@ #include "platform/geometry/FloatRoundedRect.h" #include "platform/geometry/IntRect.h" #include "platform/graphics/paint/DisplayItem.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h index 47cbddff..721b1ee 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.h
@@ -9,7 +9,6 @@ #include "platform/graphics/Path.h" #include "platform/graphics/paint/DisplayItem.h" #include "third_party/skia/include/core/SkPath.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h index 1e444fc..10dd663 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/CompositingDisplayItem.h
@@ -9,7 +9,6 @@ #include "platform/graphics/GraphicsTypes.h" #include "platform/graphics/paint/DisplayItem.h" #include "public/platform/WebBlendMode.h" -#include "wtf/PassOwnPtr.h" #ifndef NDEBUG #include "wtf/text/WTFString.h" #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h index 78a2c09..94f60a1 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
@@ -11,7 +11,6 @@ #include "wtf/Allocator.h" #include "wtf/Assertions.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #ifndef NDEBUG #include "wtf/text/StringBuilder.h"
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.cpp b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.cpp index 7745871..1e196f2 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.cpp
@@ -39,6 +39,8 @@ } } liveDisplayItemClients->remove(this); + // In case this object is a subsequence owner. + endShouldKeepAliveAllClients(this); } bool DisplayItemClient::isAlive() const @@ -46,20 +48,20 @@ return liveDisplayItemClients && liveDisplayItemClients->contains(this); } -void DisplayItemClient::beginShouldKeepAlive(const void* paintController) const +void DisplayItemClient::beginShouldKeepAlive(const void* owner) const { CHECK(isAlive()); if (!displayItemClientsShouldKeepAlive) displayItemClientsShouldKeepAlive = new HashMap<const void*, HashMap<const DisplayItemClient*, String>>(); - auto addResult = displayItemClientsShouldKeepAlive->add(paintController, HashMap<const DisplayItemClient*, String>()).storedValue->value.add(this, ""); + auto addResult = displayItemClientsShouldKeepAlive->add(owner, HashMap<const DisplayItemClient*, String>()).storedValue->value.add(this, ""); if (addResult.isNewEntry) addResult.storedValue->value = debugName(); } -void DisplayItemClient::endShouldKeepAliveAllClients(const void* paintController) +void DisplayItemClient::endShouldKeepAliveAllClients(const void* owner) { if (displayItemClientsShouldKeepAlive) - displayItemClientsShouldKeepAlive->remove(paintController); + displayItemClientsShouldKeepAlive->remove(owner); } void DisplayItemClient::endShouldKeepAliveAllClients()
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h index 4a6bdbbb..383c57c 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h
@@ -64,14 +64,19 @@ // Tests if this DisplayItemClient object has been created and has not been deleted yet. bool isAlive() const; // Called when any DisplayItem of this DisplayItemClient is added into PaintController - // using PaintController::createAndAppend(). - void beginShouldKeepAlive(const void* paintController) const; + // using PaintController::createAndAppend() or into a cached subsequence. + void beginShouldKeepAlive(const void* owner) const; // Clears all should-keep-alive DisplayItemClients of a PaintController. Called after - // PaintController commits new display items. - static void endShouldKeepAliveAllClients(const void* paintController); + // PaintController commits new display items or the subsequence owner is invalidated. + static void endShouldKeepAliveAllClients(const void* owner); static void endShouldKeepAliveAllClients(); + + // Called to clear should-keep-alive of DisplayItemClients in a subsequence if this + // object is a subsequence. +#define ON_DISPLAY_ITEM_CLIENT_INVALIDATION() endShouldKeepAliveAllClients(this) #else virtual ~DisplayItemClient() { } +#define ON_DISPLAY_ITEM_CLIENT_INVALIDATION() #endif virtual String debugName() const = 0; @@ -88,7 +93,11 @@ #define DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION \ bool displayItemsAreCached(DisplayItemCacheGeneration cacheGeneration) const final { return m_cacheGeneration.matches(cacheGeneration); } \ void setDisplayItemsCached(DisplayItemCacheGeneration cacheGeneration) const final { m_cacheGeneration = cacheGeneration; } \ - void setDisplayItemsUncached() const final { m_cacheGeneration.invalidate(); } \ + void setDisplayItemsUncached() const final \ + { \ + m_cacheGeneration.invalidate(); \ + ON_DISPLAY_ITEM_CLIENT_INVALIDATION(); \ + } \ mutable DisplayItemCacheGeneration m_cacheGeneration; #define DISPLAY_ITEM_CACHE_STATUS_UNCACHEABLE_IMPLEMENTATION \
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h index 1892622e..b2aed26 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h
@@ -10,7 +10,6 @@ #include "platform/geometry/FloatPoint.h" #include "platform/graphics/paint/DisplayItem.h" #include "third_party/skia/include/core/SkPicture.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h index 0c67a4a..8eee7b6 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/FilterDisplayItem.h
@@ -8,17 +8,17 @@ #include "platform/geometry/FloatRect.h" #include "platform/graphics/CompositorFilterOperations.h" #include "platform/graphics/paint/DisplayItem.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #ifndef NDEBUG #include "wtf/text/WTFString.h" #endif +#include <memory> namespace blink { class PLATFORM_EXPORT BeginFilterDisplayItem final : public PairedBeginDisplayItem { public: - BeginFilterDisplayItem(const DisplayItemClient& client, sk_sp<SkImageFilter> imageFilter, const FloatRect& bounds, PassOwnPtr<CompositorFilterOperations> filterOperations = nullptr) + BeginFilterDisplayItem(const DisplayItemClient& client, sk_sp<SkImageFilter> imageFilter, const FloatRect& bounds, std::unique_ptr<CompositorFilterOperations> filterOperations = nullptr) : PairedBeginDisplayItem(client, BeginFilter, sizeof(*this)) , m_imageFilter(std::move(imageFilter)) , m_webFilterOperations(std::move(filterOperations)) @@ -43,7 +43,7 @@ // FIXME: m_imageFilter should be replaced with m_webFilterOperations when copying data to the compositor. sk_sp<SkImageFilter> m_imageFilter; - OwnPtr<CompositorFilterOperations> m_webFilterOperations; + std::unique_ptr<CompositorFilterOperations> m_webFilterOperations; const FloatRect m_bounds; };
diff --git a/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h index e9cac36..b6275a1 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/FloatClipDisplayItem.h
@@ -8,7 +8,6 @@ #include "platform/PlatformExport.h" #include "platform/geometry/FloatRect.h" #include "platform/graphics/paint/DisplayItem.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp index ba87f02..d22dc42 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
@@ -66,8 +66,26 @@ DCHECK(!skippingCache() || !displayItem.isCached()); #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS - if (!skippingCache() && (displayItem.isCacheable() || displayItem.isCached())) - displayItem.client().beginShouldKeepAlive(this); + if (!skippingCache()) { + if (displayItem.isCacheable() || displayItem.isCached()) { + // Mark the client shouldKeepAlive under this PaintController. + // The status will end after the new display items are committed. + displayItem.client().beginShouldKeepAlive(this); + + if (!m_currentSubsequenceClients.isEmpty()) { + // Mark the client shouldKeepAlive under the current subsequence. + // The status will end when the subsequence owner is invalidated or deleted. + displayItem.client().beginShouldKeepAlive(m_currentSubsequenceClients.last()); + } + } + + if (displayItem.getType() == DisplayItem::Subsequence) { + m_currentSubsequenceClients.append(&displayItem.client()); + } else if (displayItem.getType() == DisplayItem::EndSubsequence) { + CHECK(m_currentSubsequenceClients.last() == &displayItem.client()); + m_currentSubsequenceClients.removeLast(); + } + } #endif if (displayItem.isCached()) @@ -201,7 +219,7 @@ DCHECK(currentIt != m_currentPaintArtifact.getDisplayItemList().end()); DCHECK(currentIt->hasValidClient()); #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS - CHECK(currentIt->client().isAlive()); + CHECK(clientCacheIsValid(currentIt->client()) || !currentIt->isCacheable()); #endif updatedList.appendByMoving(*currentIt, currentList.visualRect(currentIt - m_currentPaintArtifact.getDisplayItemList().begin()), gpuAnalyzer); ++currentIt; @@ -280,7 +298,9 @@ if (newDisplayItemHasCachedType) { DCHECK(newDisplayItem.isCached()); - DCHECK(clientCacheIsValid(newDisplayItem.client())); +#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS + CHECK(clientCacheIsValid(newDisplayItem.client())); +#endif if (!isSynchronized) { currentIt = findOutOfOrderCachedItem(newDisplayItemId, outOfOrderIndexContext); @@ -368,6 +388,7 @@ displayItem.client().setDisplayItemsCached(m_currentCacheGeneration); } #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS + CHECK(m_currentSubsequenceClients.isEmpty()); DisplayItemClient::endShouldKeepAliveAllClients(this); #endif }
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h index 52d574e..279e94f 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.h +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.h
@@ -20,8 +20,9 @@ #include "wtf/Assertions.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> #include <utility> class SkPicture; @@ -39,9 +40,9 @@ WTF_MAKE_NONCOPYABLE(PaintController); USING_FAST_MALLOC(PaintController); public: - static PassOwnPtr<PaintController> create() + static std::unique_ptr<PaintController> create() { - return adoptPtr(new PaintController()); + return wrapUnique(new PaintController()); } ~PaintController() @@ -216,6 +217,11 @@ #endif DisplayItemCacheGeneration m_currentCacheGeneration; + +#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS + // A stack recording subsequence clients that are currently painting. + Vector<const DisplayItemClient*> m_currentSubsequenceClients; +#endif }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp index ed4d6a18..826c05d 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp
@@ -15,6 +15,7 @@ #include "platform/graphics/paint/SubsequenceRecorder.h" #include "platform/testing/FakeDisplayItemClient.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -38,7 +39,7 @@ RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPaintV2Enabled); } - OwnPtr<PaintController> m_paintController; + std::unique_ptr<PaintController> m_paintController; bool m_originalSlimmingPaintV2Enabled; }; @@ -502,6 +503,10 @@ TestDisplayItem(content1, foregroundDrawingType), TestDisplayItem(container1, foregroundDrawingType), TestDisplayItem(container1, DisplayItem::EndSubsequence)); + +#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS + DisplayItemClient::endShouldKeepAliveAllClients(); +#endif } TEST_F(PaintControllerTest, OutOfOrderNoCrash) @@ -620,6 +625,10 @@ TestDisplayItem(content1, DisplayItem::EndSubsequence), TestDisplayItem(container1, foregroundDrawingType), TestDisplayItem(container1, DisplayItem::EndSubsequence)); + +#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS + DisplayItemClient::endShouldKeepAliveAllClients(); +#endif } TEST_F(PaintControllerTest, SkipCache) @@ -893,6 +902,10 @@ EXPECT_TRUE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, container)); getPaintController().commitNewDisplayItems(LayoutSize()); EXPECT_FALSE(getPaintController().paintArtifact().isSuitableForGpuRasterization()); + +#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS + DisplayItemClient::endShouldKeepAliveAllClients(); +#endif } // Temporarily disabled (pref regressions due to GPU veto stickiness: http://crbug.com/603969).
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h index 73ca8c1..f8b0e54 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/ScrollDisplayItem.h
@@ -8,7 +8,6 @@ #include "platform/geometry/IntSize.h" #include "platform/graphics/paint/DisplayItem.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.cpp b/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.cpp index 6c5a50d4..2d8215d5 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.cpp
@@ -7,6 +7,7 @@ #include "platform/geometry/FloatRect.h" #include "platform/graphics/GraphicsContext.h" #include "platform/graphics/paint/PaintController.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -19,7 +20,7 @@ m_paintController = PaintController::create(); m_paintController->beginSkippingCache(); - m_context = adoptPtr(new GraphicsContext(*m_paintController, disabledMode, metaData)); + m_context = wrapUnique(new GraphicsContext(*m_paintController, disabledMode, metaData)); if (containingContext) { m_context->setDeviceScaleFactor(containingContext->deviceScaleFactor());
diff --git a/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.h b/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.h index 1bb4839..edf2b25c8 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.h +++ b/third_party/WebKit/Source/platform/graphics/paint/SkPictureBuilder.h
@@ -9,8 +9,8 @@ #include "platform/geometry/FloatRect.h" #include "platform/graphics/paint/DisplayItemClient.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" +#include <memory> class SkMetaData; class SkPicture; @@ -45,8 +45,8 @@ private: DISPLAY_ITEM_CACHE_STATUS_UNCACHEABLE_IMPLEMENTATION - OwnPtr<PaintController> m_paintController; - OwnPtr<GraphicsContext> m_context; + std::unique_ptr<PaintController> m_paintController; + std::unique_ptr<GraphicsContext> m_context; FloatRect m_bounds; };
diff --git a/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h index cb028bcb..b25dcd5 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/Transform3DDisplayItem.h
@@ -9,7 +9,6 @@ #include "platform/graphics/paint/DisplayItem.h" #include "platform/transforms/TransformationMatrix.h" #include "wtf/Assertions.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h index e05a1b8..1852458 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h +++ b/third_party/WebKit/Source/platform/graphics/paint/TransformDisplayItem.h
@@ -7,7 +7,6 @@ #include "platform/graphics/paint/DisplayItem.h" #include "platform/transforms/AffineTransform.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/graphics/test/MockImageDecoder.h b/third_party/WebKit/Source/platform/graphics/test/MockImageDecoder.h index a109d96..f40291e9 100644 --- a/third_party/WebKit/Source/platform/graphics/test/MockImageDecoder.h +++ b/third_party/WebKit/Source/platform/graphics/test/MockImageDecoder.h
@@ -26,7 +26,8 @@ #ifndef MockImageDecoder_h #include "platform/image-decoders/ImageDecoder.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -65,7 +66,7 @@ class MockImageDecoder : public ImageDecoder { public: - static PassOwnPtr<MockImageDecoder> create(MockImageDecoderClient* client) { return adoptPtr(new MockImageDecoder(client)); } + static std::unique_ptr<MockImageDecoder> create(MockImageDecoderClient* client) { return wrapUnique(new MockImageDecoder(client)); } MockImageDecoder(MockImageDecoderClient* client) : ImageDecoder(AlphaPremultiplied, GammaAndColorProfileApplied, noDecodedImageByteLimit) @@ -137,19 +138,19 @@ class MockImageDecoderFactory : public ImageDecoderFactory { public: - static PassOwnPtr<MockImageDecoderFactory> create(MockImageDecoderClient* client, const SkISize& decodedSize) + static std::unique_ptr<MockImageDecoderFactory> create(MockImageDecoderClient* client, const SkISize& decodedSize) { - return adoptPtr(new MockImageDecoderFactory(client, IntSize(decodedSize.width(), decodedSize.height()))); + return wrapUnique(new MockImageDecoderFactory(client, IntSize(decodedSize.width(), decodedSize.height()))); } - static PassOwnPtr<MockImageDecoderFactory> create(MockImageDecoderClient* client, const IntSize& decodedSize) + static std::unique_ptr<MockImageDecoderFactory> create(MockImageDecoderClient* client, const IntSize& decodedSize) { - return adoptPtr(new MockImageDecoderFactory(client, decodedSize)); + return wrapUnique(new MockImageDecoderFactory(client, decodedSize)); } - PassOwnPtr<ImageDecoder> create() override + std::unique_ptr<ImageDecoder> create() override { - OwnPtr<MockImageDecoder> decoder = MockImageDecoder::create(m_client); + std::unique_ptr<MockImageDecoder> decoder = MockImageDecoder::create(m_client); decoder->setSize(m_decodedSize.width(), m_decodedSize.height()); return std::move(decoder); }
diff --git a/third_party/WebKit/Source/platform/heap/GCTaskRunner.h b/third_party/WebKit/Source/platform/heap/GCTaskRunner.h index d2a37098..8ef05d6 100644 --- a/third_party/WebKit/Source/platform/heap/GCTaskRunner.h +++ b/third_party/WebKit/Source/platform/heap/GCTaskRunner.h
@@ -36,6 +36,8 @@ #include "public/platform/WebTaskRunner.h" #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -100,11 +102,11 @@ USING_FAST_MALLOC(GCTaskRunner); public: explicit GCTaskRunner(WebThread* thread) - : m_gcTaskObserver(adoptPtr(new GCTaskObserver)) + : m_gcTaskObserver(wrapUnique(new GCTaskObserver)) , m_thread(thread) { m_thread->addTaskObserver(m_gcTaskObserver.get()); - ThreadState::current()->addInterruptor(adoptPtr(new MessageLoopInterruptor(thread->getWebTaskRunner()))); + ThreadState::current()->addInterruptor(wrapUnique(new MessageLoopInterruptor(thread->getWebTaskRunner()))); } ~GCTaskRunner() @@ -113,7 +115,7 @@ } private: - OwnPtr<GCTaskObserver> m_gcTaskObserver; + std::unique_ptr<GCTaskObserver> m_gcTaskObserver; WebThread* m_thread; };
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp index 527b04a1..6156652 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.cpp +++ b/third_party/WebKit/Source/platform/heap/Heap.cpp
@@ -48,7 +48,9 @@ #include "wtf/CurrentTime.h" #include "wtf/DataLog.h" #include "wtf/LeakAnnotations.h" +#include "wtf/PtrUtil.h" #include "wtf/allocator/Partitions.h" +#include <memory> namespace blink { @@ -217,15 +219,15 @@ } ThreadHeap::ThreadHeap() - : m_regionTree(adoptPtr(new RegionTree())) - , m_heapDoesNotContainCache(adoptPtr(new HeapDoesNotContainCache)) - , m_safePointBarrier(adoptPtr(new SafePointBarrier())) - , m_freePagePool(adoptPtr(new FreePagePool)) - , m_orphanedPagePool(adoptPtr(new OrphanedPagePool)) - , m_markingStack(adoptPtr(new CallbackStack())) - , m_postMarkingCallbackStack(adoptPtr(new CallbackStack())) - , m_globalWeakCallbackStack(adoptPtr(new CallbackStack())) - , m_ephemeronStack(adoptPtr(new CallbackStack(CallbackStack::kMinimalBlockSize))) + : m_regionTree(wrapUnique(new RegionTree())) + , m_heapDoesNotContainCache(wrapUnique(new HeapDoesNotContainCache)) + , m_safePointBarrier(wrapUnique(new SafePointBarrier())) + , m_freePagePool(wrapUnique(new FreePagePool)) + , m_orphanedPagePool(wrapUnique(new OrphanedPagePool)) + , m_markingStack(wrapUnique(new CallbackStack())) + , m_postMarkingCallbackStack(wrapUnique(new CallbackStack())) + , m_globalWeakCallbackStack(wrapUnique(new CallbackStack())) + , m_ephemeronStack(wrapUnique(new CallbackStack(CallbackStack::kMinimalBlockSize))) { if (ThreadState::current()->isMainThread()) s_mainThreadHeap = this; @@ -486,7 +488,7 @@ RELEASE_ASSERT(!state->isGCForbidden()); state->completeSweep(); - OwnPtr<Visitor> visitor = Visitor::create(state, gcType); + std::unique_ptr<Visitor> visitor = Visitor::create(state, gcType); SafePointScope safePointScope(stackState, state); @@ -579,7 +581,7 @@ // ahead while it is running, hence the termination GC does not enter a // safepoint. VisitorScope will not enter also a safepoint scope for // ThreadTerminationGC. - OwnPtr<Visitor> visitor = Visitor::create(state, BlinkGC::ThreadTerminationGC); + std::unique_ptr<Visitor> visitor = Visitor::create(state, BlinkGC::ThreadTerminationGC); ThreadState::NoAllocationScope noAllocationScope(state);
diff --git a/third_party/WebKit/Source/platform/heap/Heap.h b/third_party/WebKit/Source/platform/heap/Heap.h index e6dd3ffd..9330378 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.h +++ b/third_party/WebKit/Source/platform/heap/Heap.h
@@ -42,6 +42,7 @@ #include "wtf/Assertions.h" #include "wtf/Atomics.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -403,15 +404,15 @@ RecursiveMutex m_threadAttachMutex; ThreadStateSet m_threads; ThreadHeapStats m_stats; - OwnPtr<RegionTree> m_regionTree; - OwnPtr<HeapDoesNotContainCache> m_heapDoesNotContainCache; - OwnPtr<SafePointBarrier> m_safePointBarrier; - OwnPtr<FreePagePool> m_freePagePool; - OwnPtr<OrphanedPagePool> m_orphanedPagePool; - OwnPtr<CallbackStack> m_markingStack; - OwnPtr<CallbackStack> m_postMarkingCallbackStack; - OwnPtr<CallbackStack> m_globalWeakCallbackStack; - OwnPtr<CallbackStack> m_ephemeronStack; + std::unique_ptr<RegionTree> m_regionTree; + std::unique_ptr<HeapDoesNotContainCache> m_heapDoesNotContainCache; + std::unique_ptr<SafePointBarrier> m_safePointBarrier; + std::unique_ptr<FreePagePool> m_freePagePool; + std::unique_ptr<OrphanedPagePool> m_orphanedPagePool; + std::unique_ptr<CallbackStack> m_markingStack; + std::unique_ptr<CallbackStack> m_postMarkingCallbackStack; + std::unique_ptr<CallbackStack> m_globalWeakCallbackStack; + std::unique_ptr<CallbackStack> m_ephemeronStack; BlinkGC::GCReason m_lastGCReason; static ThreadHeap* s_mainThreadHeap;
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.cpp b/third_party/WebKit/Source/platform/heap/HeapPage.cpp index d9b9c60..b7da90a 100644 --- a/third_party/WebKit/Source/platform/heap/HeapPage.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
@@ -48,7 +48,6 @@ #include "wtf/ContainerAnnotations.h" #include "wtf/CurrentTime.h" #include "wtf/LeakAnnotations.h" -#include "wtf/PassOwnPtr.h" #include "wtf/TemporaryChange.h" #include "wtf/allocator/PageAllocator.h" #include "wtf/allocator/Partitions.h"
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp index 2c2dcf1..5f7d8fd1 100644 --- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -44,6 +44,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/HashTraits.h" #include "wtf/LinkedHashSet.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -465,9 +467,9 @@ protected: static void test(ThreadedTesterBase* tester) { - Vector<OwnPtr<WebThread>, numberOfThreads> m_threads; + Vector<std::unique_ptr<WebThread>, numberOfThreads> m_threads; for (int i = 0; i < numberOfThreads; i++) { - m_threads.append(adoptPtr(Platform::current()->createThread("blink gc testing thread"))); + m_threads.append(wrapUnique(Platform::current()->createThread("blink gc testing thread"))); m_threads.last()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(threadFunc, AllowCrossThreadAccess(tester))); } while (tester->m_threadsToFinish) { @@ -529,11 +531,11 @@ using GlobalIntWrapperPersistent = CrossThreadPersistent<IntWrapper>; Mutex m_mutex; - Vector<OwnPtr<GlobalIntWrapperPersistent>> m_crossPersistents; + Vector<std::unique_ptr<GlobalIntWrapperPersistent>> m_crossPersistents; - PassOwnPtr<GlobalIntWrapperPersistent> createGlobalPersistent(int value) + std::unique_ptr<GlobalIntWrapperPersistent> createGlobalPersistent(int value) { - return adoptPtr(new GlobalIntWrapperPersistent(IntWrapper::create(value))); + return wrapUnique(new GlobalIntWrapperPersistent(IntWrapper::create(value))); } void addGlobalPersistent() @@ -557,7 +559,7 @@ { Persistent<IntWrapper> wrapper; - OwnPtr<GlobalIntWrapperPersistent> globalPersistent = createGlobalPersistent(0x0ed0cabb); + std::unique_ptr<GlobalIntWrapperPersistent> globalPersistent = createGlobalPersistent(0x0ed0cabb); for (int i = 0; i < numberOfAllocations; i++) { wrapper = IntWrapper::create(0x0bbac0de); @@ -1388,7 +1390,7 @@ class FinalizationObserverWithHashMap { public: - typedef HeapHashMap<WeakMember<Observable>, OwnPtr<FinalizationObserverWithHashMap>> ObserverMap; + typedef HeapHashMap<WeakMember<Observable>, std::unique_ptr<FinalizationObserverWithHashMap>> ObserverMap; explicit FinalizationObserverWithHashMap(Observable& target) : m_target(target) { } ~FinalizationObserverWithHashMap() @@ -1402,7 +1404,7 @@ ObserverMap& map = observers(); ObserverMap::AddResult result = map.add(&target, nullptr); if (result.isNewEntry) - result.storedValue->value = adoptPtr(new FinalizationObserverWithHashMap(target)); + result.storedValue->value = wrapUnique(new FinalizationObserverWithHashMap(target)); else ASSERT(result.storedValue->value); return map; @@ -4794,9 +4796,9 @@ TEST(HeapTest, DestructorsCalled) { - HeapHashMap<Member<IntWrapper>, OwnPtr<SimpleClassWithDestructor>> map; + HeapHashMap<Member<IntWrapper>, std::unique_ptr<SimpleClassWithDestructor>> map; SimpleClassWithDestructor* hasDestructor = new SimpleClassWithDestructor(); - map.add(IntWrapper::create(1), adoptPtr(hasDestructor)); + map.add(IntWrapper::create(1), wrapUnique(hasDestructor)); SimpleClassWithDestructor::s_wasDestructed = false; map.clear(); EXPECT_TRUE(SimpleClassWithDestructor::s_wasDestructed); @@ -4941,7 +4943,7 @@ public: static void test() { - OwnPtr<WebThread> sleepingThread = adoptPtr(Platform::current()->createThread("SleepingThread")); + std::unique_ptr<WebThread> sleepingThread = wrapUnique(Platform::current()->createThread("SleepingThread")); sleepingThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(sleeperMainFunc)); // Wait for the sleeper to run. @@ -5606,7 +5608,7 @@ IntWrapper::s_destructorCalls = 0; MutexLocker locker(mainThreadMutex()); - OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread")); + std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread")); workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMain)); // Wait for the worker thread to have done its initialization, @@ -5709,7 +5711,7 @@ IntWrapper::s_destructorCalls = 0; MutexLocker locker(mainThreadMutex()); - OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread")); + std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread")); workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMain)); // Wait for the worker thread initialization. The worker @@ -5912,7 +5914,7 @@ DestructorLockingObject::s_destructorCalls = 0; MutexLocker locker(mainThreadMutex()); - OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread")); + std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread")); workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMain)); // Park the main thread until the worker thread has initialized. @@ -6617,7 +6619,7 @@ TEST(HeapTest, WeakPersistent) { Persistent<IntWrapper> object = new IntWrapper(20); - OwnPtr<WeakPersistentHolder> holder = adoptPtr(new WeakPersistentHolder(object)); + std::unique_ptr<WeakPersistentHolder> holder = wrapUnique(new WeakPersistentHolder(object)); preciselyCollectGarbage(); EXPECT_TRUE(holder->object()); object = nullptr; @@ -6658,7 +6660,7 @@ // Step 1: Initiate a worker thread, and wait for |object| to get allocated on the worker thread. MutexLocker mainThreadMutexLocker(mainThreadMutex()); - OwnPtr<WebThread> workerThread = adoptPtr(Platform::current()->createThread("Test Worker Thread")); + std::unique_ptr<WebThread> workerThread = wrapUnique(Platform::current()->createThread("Test Worker Thread")); DestructorLockingObject* object = nullptr; workerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(workerThreadMainForCrossThreadWeakPersistentTest, AllowCrossThreadAccess(&object))); parkMainThread();
diff --git a/third_party/WebKit/Source/platform/heap/PersistentNode.h b/third_party/WebKit/Source/platform/heap/PersistentNode.h index a685840..c9bebe3 100644 --- a/third_party/WebKit/Source/platform/heap/PersistentNode.h +++ b/third_party/WebKit/Source/platform/heap/PersistentNode.h
@@ -9,7 +9,9 @@ #include "platform/heap/ThreadState.h" #include "wtf/Allocator.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> namespace blink { @@ -172,7 +174,7 @@ class CrossThreadPersistentRegion final { USING_FAST_MALLOC(CrossThreadPersistentRegion); public: - CrossThreadPersistentRegion() : m_persistentRegion(adoptPtr(new PersistentRegion)) { } + CrossThreadPersistentRegion() : m_persistentRegion(wrapUnique(new PersistentRegion)) { } void allocatePersistentNode(PersistentNode*& persistentNode, void* self, TraceCallback trace) { @@ -242,7 +244,7 @@ // We don't make CrossThreadPersistentRegion inherit from PersistentRegion // because we don't want to virtualize performance-sensitive methods // such as PersistentRegion::allocate/freePersistentNode. - OwnPtr<PersistentRegion> m_persistentRegion; + std::unique_ptr<PersistentRegion> m_persistentRegion; // Recursive as prepareForThreadStateTermination() clears a PersistentNode's // associated Persistent<> -- it in turn freeing the PersistentNode. And both
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp index 8d0320d..63e607a7 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -49,8 +49,11 @@ #include "public/platform/WebTraceLocation.h" #include "wtf/CurrentTime.h" #include "wtf/DataLog.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/allocator/Partitions.h" +#include <memory> +#include <v8.h> #if OS(WIN) #include <stddef.h> @@ -66,8 +69,6 @@ #include <pthread_np.h> #endif -#include <v8.h> - namespace blink { WTF::ThreadSpecific<ThreadState*>* ThreadState::s_threadSpecific = nullptr; @@ -77,7 +78,7 @@ ThreadState::ThreadState(bool perThreadHeapEnabled) : m_thread(currentThread()) - , m_persistentRegion(adoptPtr(new PersistentRegion())) + , m_persistentRegion(wrapUnique(new PersistentRegion())) #if OS(WIN) && COMPILER(MSVC) , m_threadStackSize(0) #endif @@ -132,7 +133,7 @@ m_arenas[arenaIndex] = new NormalPageArena(this, arenaIndex); m_arenas[BlinkGC::LargeObjectArenaIndex] = new LargeObjectArena(this, BlinkGC::LargeObjectArenaIndex); - m_likelyToBePromptlyFreed = adoptArrayPtr(new int[likelyToBePromptlyFreedArraySize]); + m_likelyToBePromptlyFreed = wrapArrayUnique(new int[likelyToBePromptlyFreedArraySize]); clearArenaAges(); // There is little use of weak references and collections off the main thread; @@ -447,7 +448,7 @@ // Due to the complexity, we just forbid allocations. NoAllocationScope noAllocationScope(this); - OwnPtr<Visitor> visitor = Visitor::create(this, BlinkGC::ThreadLocalWeakProcessing); + std::unique_ptr<Visitor> visitor = Visitor::create(this, BlinkGC::ThreadLocalWeakProcessing); // Perform thread-specific weak processing. while (popAndInvokeThreadLocalWeakCallback(visitor.get())) { } @@ -1320,7 +1321,7 @@ } } -void ThreadState::addInterruptor(PassOwnPtr<BlinkGCInterruptor> interruptor) +void ThreadState::addInterruptor(std::unique_ptr<BlinkGCInterruptor> interruptor) { ASSERT(checkThread()); SafePointScope scope(BlinkGC::HeapPointersOnStack);
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.h b/third_party/WebKit/Source/platform/heap/ThreadState.h index 234e07f..16825dc 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.h +++ b/third_party/WebKit/Source/platform/heap/ThreadState.h
@@ -45,6 +45,7 @@ #include "wtf/ThreadSpecific.h" #include "wtf/Threading.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> namespace v8 { class Isolate; @@ -78,12 +79,12 @@ // Since a pre-finalizer adds pressure on GC performance, you should use it // only if necessary. // -// A pre-finalizer is similar to the HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> +// A pre-finalizer is similar to the HeapHashMap<WeakMember<Foo>, std::unique_ptr<Disposer>> // idiom. The difference between this and the idiom is that pre-finalizer // function is called whenever an object is destructed with this feature. The -// HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> idiom requires an assumption +// HeapHashMap<WeakMember<Foo>, std::unique_ptr<Disposer>> idiom requires an assumption // that the HeapHashMap outlives objects pointed by WeakMembers. -// FIXME: Replace all of the HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> +// FIXME: Replace all of the HeapHashMap<WeakMember<Foo>, std::unique_ptr<Disposer>> // idiom usages with the pre-finalizer if the replacement won't cause // performance regressions. // @@ -334,7 +335,7 @@ void leaveSafePoint(SafePointAwareMutexLocker* = nullptr); bool isAtSafePoint() const { return m_atSafePoint; } - void addInterruptor(PassOwnPtr<BlinkGCInterruptor>); + void addInterruptor(std::unique_ptr<BlinkGCInterruptor>); void recordStackEnd(intptr_t* endOfStack) { @@ -600,7 +601,7 @@ void reportMemoryToV8(); // Should only be called under protection of threadAttachMutex(). - const Vector<OwnPtr<BlinkGCInterruptor>>& interruptors() const { return m_interruptors; } + const Vector<std::unique_ptr<BlinkGCInterruptor>>& interruptors() const { return m_interruptors; } friend class SafePointAwareMutexLocker; friend class SafePointBarrier; @@ -621,7 +622,7 @@ ThreadHeap* m_heap; ThreadIdentifier m_thread; - OwnPtr<PersistentRegion> m_persistentRegion; + std::unique_ptr<PersistentRegion> m_persistentRegion; BlinkGC::StackState m_stackState; #if OS(WIN) && COMPILER(MSVC) size_t m_threadStackSize; @@ -632,7 +633,7 @@ void* m_safePointScopeMarker; Vector<Address> m_safePointStackCopy; bool m_atSafePoint; - Vector<OwnPtr<BlinkGCInterruptor>> m_interruptors; + Vector<std::unique_ptr<BlinkGCInterruptor>> m_interruptors; bool m_sweepForbidden; size_t m_noAllocationCount; size_t m_gcForbiddenCount; @@ -682,7 +683,7 @@ // since there will be less than 2^8 types of objects in common cases. static const int likelyToBePromptlyFreedArraySize = (1 << 8); static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedArraySize - 1; - OwnPtr<int[]> m_likelyToBePromptlyFreed; + std::unique_ptr<int[]> m_likelyToBePromptlyFreed; // Stats for heap memory of this thread. size_t m_allocatedObjectSize;
diff --git a/third_party/WebKit/Source/platform/heap/Visitor.cpp b/third_party/WebKit/Source/platform/heap/Visitor.cpp index 3649860..e69f336b 100644 --- a/third_party/WebKit/Source/platform/heap/Visitor.cpp +++ b/third_party/WebKit/Source/platform/heap/Visitor.cpp
@@ -7,21 +7,23 @@ #include "platform/heap/BlinkGC.h" #include "platform/heap/MarkingVisitor.h" #include "platform/heap/ThreadState.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<Visitor> Visitor::create(ThreadState* state, BlinkGC::GCType gcType) +std::unique_ptr<Visitor> Visitor::create(ThreadState* state, BlinkGC::GCType gcType) { switch (gcType) { case BlinkGC::GCWithSweep: case BlinkGC::GCWithoutSweep: - return adoptPtr(new MarkingVisitor<Visitor::GlobalMarking>(state)); + return wrapUnique(new MarkingVisitor<Visitor::GlobalMarking>(state)); case BlinkGC::TakeSnapshot: - return adoptPtr(new MarkingVisitor<Visitor::SnapshotMarking>(state)); + return wrapUnique(new MarkingVisitor<Visitor::SnapshotMarking>(state)); case BlinkGC::ThreadTerminationGC: - return adoptPtr(new MarkingVisitor<Visitor::ThreadLocalMarking>(state)); + return wrapUnique(new MarkingVisitor<Visitor::ThreadLocalMarking>(state)); case BlinkGC::ThreadLocalWeakProcessing: - return adoptPtr(new MarkingVisitor<Visitor::WeakProcessing>(state)); + return wrapUnique(new MarkingVisitor<Visitor::WeakProcessing>(state)); default: ASSERT_NOT_REACHED(); }
diff --git a/third_party/WebKit/Source/platform/heap/Visitor.h b/third_party/WebKit/Source/platform/heap/Visitor.h index 9ddefb9..97a660d3b 100644 --- a/third_party/WebKit/Source/platform/heap/Visitor.h +++ b/third_party/WebKit/Source/platform/heap/Visitor.h
@@ -38,6 +38,7 @@ #include "wtf/Forward.h" #include "wtf/HashTraits.h" #include "wtf/TypeTraits.h" +#include <memory> namespace blink { @@ -261,7 +262,7 @@ WeakProcessing, }; - static PassOwnPtr<Visitor> create(ThreadState*, BlinkGC::GCType); + static std::unique_ptr<Visitor> create(ThreadState*, BlinkGC::GCType); virtual ~Visitor();
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp index 6a887969..8a09dec8 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
@@ -27,7 +27,8 @@ #include "platform/image-decoders/jpeg/JPEGImageDecoder.h" #include "platform/image-decoders/png/PNGImageDecoder.h" #include "platform/image-decoders/webp/WEBPImageDecoder.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -79,7 +80,7 @@ return !memcmp(contents, "BM", 2); } -PassOwnPtr<ImageDecoder> ImageDecoder::create(const char* contents, size_t length, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) +std::unique_ptr<ImageDecoder> ImageDecoder::create(const char* contents, size_t length, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) { const size_t longestSignatureLength = sizeof("RIFF????WEBPVP") - 1; ASSERT(longestSignatureLength == 14); @@ -90,34 +91,34 @@ size_t maxDecodedBytes = Platform::current() ? Platform::current()->maxDecodedImageBytes() : noDecodedImageByteLimit; if (matchesJPEGSignature(contents)) - return adoptPtr(new JPEGImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return wrapUnique(new JPEGImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); if (matchesPNGSignature(contents)) - return adoptPtr(new PNGImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return wrapUnique(new PNGImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); if (matchesGIFSignature(contents)) - return adoptPtr(new GIFImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return wrapUnique(new GIFImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); if (matchesWebPSignature(contents)) - return adoptPtr(new WEBPImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return wrapUnique(new WEBPImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); if (matchesICOSignature(contents) || matchesCURSignature(contents)) - return adoptPtr(new ICOImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return wrapUnique(new ICOImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); if (matchesBMPSignature(contents)) - return adoptPtr(new BMPImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); + return wrapUnique(new BMPImageDecoder(alphaOption, colorOptions, maxDecodedBytes)); return nullptr; } -PassOwnPtr<ImageDecoder> ImageDecoder::create(const SharedBuffer& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) +std::unique_ptr<ImageDecoder> ImageDecoder::create(const SharedBuffer& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) { const char* contents; const size_t length = data.getSomeData<size_t>(contents); return create(contents, length, alphaOption, colorOptions); } -PassOwnPtr<ImageDecoder> ImageDecoder::create(const SegmentReader& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) +std::unique_ptr<ImageDecoder> ImageDecoder::create(const SegmentReader& data, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions) { const char* contents; const size_t length = data.getSomeData(contents, 0);
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h index 70198f1f..c444907 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -36,7 +36,6 @@ #include "platform/image-decoders/SegmentReader.h" #include "public/platform/Platform.h" #include "wtf/Assertions.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/Threading.h" #include "wtf/Vector.h" @@ -109,9 +108,9 @@ // we can't sniff a supported type from the provided data (possibly // because there isn't enough data yet). // Sets m_maxDecodedBytes to Platform::maxImageDecodedBytes(). - static PassOwnPtr<ImageDecoder> create(const char* data, size_t length, AlphaOption, GammaAndColorProfileOption); - static PassOwnPtr<ImageDecoder> create(const SharedBuffer&, AlphaOption, GammaAndColorProfileOption); - static PassOwnPtr<ImageDecoder> create(const SegmentReader&, AlphaOption, GammaAndColorProfileOption); + static std::unique_ptr<ImageDecoder> create(const char* data, size_t length, AlphaOption, GammaAndColorProfileOption); + static std::unique_ptr<ImageDecoder> create(const SharedBuffer&, AlphaOption, GammaAndColorProfileOption); + static std::unique_ptr<ImageDecoder> create(const SegmentReader&, AlphaOption, GammaAndColorProfileOption); virtual String filenameExtension() const = 0; @@ -264,7 +263,7 @@ virtual bool canDecodeToYUV() { return false; } virtual bool decodeToYUV() { return false; } - virtual void setImagePlanes(PassOwnPtr<ImagePlanes>) { } + virtual void setImagePlanes(std::unique_ptr<ImagePlanes>) { } protected: // Calculates the most recent frame whose image data may be needed in
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp index c21e161..e66fc61 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTest.cpp
@@ -32,9 +32,9 @@ #include "platform/image-decoders/ImageFrame.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -73,7 +73,7 @@ TEST(ImageDecoderTest, sizeCalculationMayOverflow) { - OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); + std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); EXPECT_FALSE(decoder->setSize(1 << 29, 1)); EXPECT_FALSE(decoder->setSize(1, 1 << 29)); EXPECT_FALSE(decoder->setSize(1 << 15, 1 << 15)); @@ -84,7 +84,7 @@ TEST(ImageDecoderTest, requiredPreviousFrameIndex) { - OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); + std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); decoder->initFrames(6); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); @@ -109,7 +109,7 @@ TEST(ImageDecoderTest, requiredPreviousFrameIndexDisposeOverwriteBgcolor) { - OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); + std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); decoder->initFrames(3); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); @@ -126,7 +126,7 @@ TEST(ImageDecoderTest, requiredPreviousFrameIndexForFrame1) { - OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); + std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); decoder->initFrames(2); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); @@ -155,7 +155,7 @@ TEST(ImageDecoderTest, requiredPreviousFrameIndexBlendAtopBgcolor) { - OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); + std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); decoder->initFrames(3); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); @@ -180,7 +180,7 @@ TEST(ImageDecoderTest, requiredPreviousFrameIndexKnownOpaque) { - OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); + std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); decoder->initFrames(3); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); @@ -204,7 +204,7 @@ TEST(ImageDecoderTest, clearCacheExceptFrameDoNothing) { - OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); + std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); decoder->clearCacheExceptFrame(0); // This should not crash. @@ -215,7 +215,7 @@ TEST(ImageDecoderTest, clearCacheExceptFrameAll) { const size_t numFrames = 10; - OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); + std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); decoder->initFrames(numFrames); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); for (size_t i = 0; i < numFrames; ++i) @@ -232,7 +232,7 @@ TEST(ImageDecoderTest, clearCacheExceptFramePreverveClearExceptFrame) { const size_t numFrames = 10; - OwnPtr<TestImageDecoder> decoder(adoptPtr(new TestImageDecoder())); + std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder())); decoder->initFrames(numFrames); Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache(); for (size_t i = 0; i < numFrames; ++i)
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp index 574ea355..6e11a895 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp
@@ -9,8 +9,8 @@ #include "platform/image-decoders/ImageFrame.h" #include "platform/testing/UnitTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" #include "wtf/StringHasher.h" +#include <memory> namespace blink { @@ -39,7 +39,7 @@ static unsigned createDecodingBaseline(DecoderCreator createDecoder, SharedBuffer* data) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); decoder->setData(data, true); ImageFrame* frame = decoder->frameBufferAtIndex(0); return hashBitmap(frame->bitmap()); @@ -47,7 +47,7 @@ void createDecodingBaseline(DecoderCreator createDecoder, SharedBuffer* data, Vector<unsigned>* baselineHashes) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); decoder->setData(data, true); size_t frameCount = decoder->frameCount(); for (size_t i = 0; i < frameCount; ++i) { @@ -65,7 +65,7 @@ Vector<unsigned> baselineHashes; createDecodingBaseline(createDecoder, data.get(), &baselineHashes); - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); size_t frameCount = 0; size_t framesDecoded = 0; @@ -129,7 +129,7 @@ RefPtr<SharedBuffer> segmentedData = SharedBuffer::create(); segmentedData->append(data->data(), data->size()); - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); decoder->setData(segmentedData.get(), true); ASSERT_TRUE(decoder->isSizeAvailable());
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.h b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.h index 88683855b..837b5306 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.h +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" +#include <memory> class SkBitmap; @@ -11,7 +11,7 @@ class ImageDecoder; class SharedBuffer; -using DecoderCreator = PassOwnPtr<ImageDecoder>(*)(); +using DecoderCreator = std::unique_ptr<ImageDecoder>(*)(); PassRefPtr<SharedBuffer> readFile(const char* fileName); PassRefPtr<SharedBuffer> readFile(const char* dir, const char* fileName); unsigned hashBitmap(const SkBitmap&);
diff --git a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.cpp index 87a80281..0cf541a 100644 --- a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.cpp
@@ -31,7 +31,7 @@ #include "platform/image-decoders/bmp/BMPImageDecoder.h" #include "platform/image-decoders/FastSharedBufferReader.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -80,7 +80,7 @@ return false; if (!m_reader) { - m_reader = adoptPtr(new BMPImageReader(this, m_decodedOffset, imgDataOffset, false)); + m_reader = wrapUnique(new BMPImageReader(this, m_decodedOffset, imgDataOffset, false)); m_reader->setData(m_data.get()); }
diff --git a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.h index e4a6bd1..a912246d 100644 --- a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoder.h
@@ -32,7 +32,7 @@ #define BMPImageDecoder_h #include "platform/image-decoders/bmp/BMPImageReader.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -74,7 +74,7 @@ size_t m_decodedOffset; // The reader used to do most of the BMP decoding. - OwnPtr<BMPImageReader> m_reader; + std::unique_ptr<BMPImageReader> m_reader; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp index 1e2bc10..14b399a 100644 --- a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp
@@ -7,14 +7,16 @@ #include "platform/SharedBuffer.h" #include "platform/image-decoders/ImageDecoderTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { namespace { -PassOwnPtr<ImageDecoder> createDecoder() +std::unique_ptr<ImageDecoder> createDecoder() { - return adoptPtr(new BMPImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); + return wrapUnique(new BMPImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); } } // anonymous namespace @@ -25,7 +27,7 @@ RefPtr<SharedBuffer> data = readFile(bmpFile); ASSERT_TRUE(data.get()); - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); decoder->setData(data.get(), true); EXPECT_TRUE(decoder->isSizeAvailable()); EXPECT_EQ(256, decoder->size().width()); @@ -38,7 +40,7 @@ RefPtr<SharedBuffer> data = readFile(bmpFile); ASSERT_TRUE(data.get()); - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); decoder->setData(data.get(), true); ImageFrame* frame = decoder->frameBufferAtIndex(0); @@ -56,7 +58,7 @@ RefPtr<SharedBuffer> data = readFile(bmpFile); ASSERT_TRUE(data.get()); - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); decoder->setData(data.get(), true); ImageFrame* frame = decoder->frameBufferAtIndex(0);
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp index 2cae67e0a..68e9334 100644 --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp
@@ -25,10 +25,10 @@ #include "platform/image-decoders/gif/GIFImageDecoder.h" -#include <limits> #include "platform/image-decoders/gif/GIFImageReader.h" #include "wtf/NotFound.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <limits> namespace blink { @@ -331,7 +331,7 @@ return; if (!m_reader) { - m_reader = adoptPtr(new GIFImageReader(this)); + m_reader = wrapUnique(new GIFImageReader(this)); m_reader->setData(m_data); }
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.h index 98941e68..a2c6ce1 100644 --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.h
@@ -28,7 +28,7 @@ #include "platform/image-decoders/ImageDecoder.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" +#include <memory> class GIFImageReader; @@ -86,7 +86,7 @@ bool m_currentBufferSawAlpha; mutable int m_repetitionCount; - OwnPtr<GIFImageReader> m_reader; + std::unique_ptr<GIFImageReader> m_reader; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp index 756eb33..25f7ad5 100644 --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
@@ -35,9 +35,9 @@ #include "public/platform/WebData.h" #include "public/platform/WebSize.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -46,9 +46,9 @@ const char decodersTestingDir[] = "Source/platform/image-decoders/testing"; const char layoutTestResourcesDir[] = "LayoutTests/fast/images/resources"; -PassOwnPtr<ImageDecoder> createDecoder() +std::unique_ptr<ImageDecoder> createDecoder() { - return adoptPtr(new GIFImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); + return wrapUnique(new GIFImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); } void testRandomFrameDecode(const char* dir, const char* gifFile) @@ -62,7 +62,7 @@ size_t frameCount = baselineHashes.size(); // Random decoding should get the same results as sequential decoding. - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); decoder->setData(fullData.get(), true); const size_t skippingStep = 5; for (size_t i = 0; i < skippingStep; ++i) { @@ -93,7 +93,7 @@ createDecodingBaseline(&createDecoder, data.get(), &baselineHashes); size_t frameCount = baselineHashes.size(); - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); decoder->setData(data.get(), true); for (size_t clearExceptFrame = 0; clearExceptFrame < frameCount; ++clearExceptFrame) { decoder->clearCacheExceptFrame(clearExceptFrame); @@ -112,7 +112,7 @@ TEST(GIFImageDecoderTest, decodeTwoFrames) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -138,7 +138,7 @@ TEST(GIFImageDecoderTest, parseAndDecode) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -162,7 +162,7 @@ TEST(GIFImageDecoderTest, parseByteByByte) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -187,7 +187,7 @@ TEST(GIFImageDecoderTest, parseAndDecodeByteByByte) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated-gif-with-offsets.gif"); ASSERT_TRUE(data.get()); @@ -215,7 +215,7 @@ TEST(GIFImageDecoderTest, brokenSecondFrame) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(decodersTestingDir, "broken.gif"); ASSERT_TRUE(data.get()); @@ -233,7 +233,7 @@ ASSERT_TRUE(fullData.get()); const size_t fullLength = fullData->size(); - OwnPtr<ImageDecoder> decoder; + std::unique_ptr<ImageDecoder> decoder; ImageFrame* frame; Vector<unsigned> truncatedHashes; @@ -280,7 +280,7 @@ TEST(GIFImageDecoderTest, allDataReceivedTruncation) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -300,7 +300,7 @@ TEST(GIFImageDecoderTest, frameIsComplete) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -315,7 +315,7 @@ TEST(GIFImageDecoderTest, frameIsCompleteLoading) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "animated.gif"); ASSERT_TRUE(data.get()); @@ -342,13 +342,13 @@ ASSERT_TRUE(referenceData.get()); ASSERT_TRUE(testData.get()); - OwnPtr<ImageDecoder> referenceDecoder = createDecoder(); + std::unique_ptr<ImageDecoder> referenceDecoder = createDecoder(); referenceDecoder->setData(referenceData.get(), true); EXPECT_EQ(1u, referenceDecoder->frameCount()); ImageFrame* referenceFrame = referenceDecoder->frameBufferAtIndex(0); ASSERT(referenceFrame); - OwnPtr<ImageDecoder> testDecoder = createDecoder(); + std::unique_ptr<ImageDecoder> testDecoder = createDecoder(); testDecoder->setData(testData.get(), true); EXPECT_EQ(1u, testDecoder->frameCount()); ImageFrame* testFrame = testDecoder->frameBufferAtIndex(0); @@ -359,7 +359,7 @@ TEST(GIFImageDecoderTest, updateRequiredPreviousFrameAfterFirstDecode) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> fullData = readFile(layoutTestResourcesDir, "animated-10color.gif"); ASSERT_TRUE(fullData.get()); @@ -409,7 +409,7 @@ createDecodingBaseline(&createDecoder, fullData.get(), &baselineHashes); size_t frameCount = baselineHashes.size(); - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); // Let frame 0 be partially decoded. size_t partialSize = 1; @@ -439,7 +439,7 @@ RefPtr<SharedBuffer> testData = readFile(decodersTestingDir, "bad-initial-code.gif"); ASSERT_TRUE(testData.get()); - OwnPtr<ImageDecoder> testDecoder = createDecoder(); + std::unique_ptr<ImageDecoder> testDecoder = createDecoder(); testDecoder->setData(testData.get(), true); EXPECT_EQ(1u, testDecoder->frameCount()); ASSERT_TRUE(testDecoder->frameBufferAtIndex(0)); @@ -452,7 +452,7 @@ RefPtr<SharedBuffer> testData = readFile(decodersTestingDir, "bad-code.gif"); ASSERT_TRUE(testData.get()); - OwnPtr<ImageDecoder> testDecoder = createDecoder(); + std::unique_ptr<ImageDecoder> testDecoder = createDecoder(); testDecoder->setData(testData.get(), true); EXPECT_EQ(1u, testDecoder->frameCount()); ASSERT_TRUE(testDecoder->frameBufferAtIndex(0)); @@ -461,7 +461,7 @@ TEST(GIFImageDecoderTest, invalidDisposalMethod) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); // The image has 2 frames, with disposal method 4 and 5, respectively. RefPtr<SharedBuffer> data = readFile(decodersTestingDir, "invalid-disposal-method.gif"); @@ -480,7 +480,7 @@ RefPtr<SharedBuffer> fullData = readFile(decodersTestingDir, "first-frame-has-greater-size-than-screen-size.gif"); ASSERT_TRUE(fullData.get()); - OwnPtr<ImageDecoder> decoder; + std::unique_ptr<ImageDecoder> decoder; IntSize frameSize; // Compute hashes when the file is truncated. @@ -502,7 +502,7 @@ TEST(GIFImageDecoderTest, verifyRepetitionCount) { const int expectedRepetitionCount = 2; - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "full2loop.gif"); ASSERT_TRUE(data.get()); decoder->setData(data.get(), true); @@ -528,11 +528,11 @@ ASSERT_TRUE(kTruncateSize < fullData->size()); RefPtr<SharedBuffer> partialData = SharedBuffer::create(fullData->data(), kTruncateSize); - OwnPtr<ImageDecoder> premulDecoder = adoptPtr(new GIFImageDecoder( + std::unique_ptr<ImageDecoder> premulDecoder = wrapUnique(new GIFImageDecoder( ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); - OwnPtr<ImageDecoder> unpremulDecoder = adoptPtr(new GIFImageDecoder( + std::unique_ptr<ImageDecoder> unpremulDecoder = wrapUnique(new GIFImageDecoder( ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit));
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp index 34679f5..3ed6e66 100644 --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp
@@ -75,8 +75,8 @@ #include "platform/image-decoders/gif/GIFImageReader.h" #include "platform/Histogram.h" +#include "wtf/PtrUtil.h" #include "wtf/Threading.h" - #include <string.h> using blink::GIFImageDecoder; @@ -336,7 +336,7 @@ if (!isDataSizeDefined() || !isHeaderDefined()) return true; - m_lzwContext = adoptPtr(new GIFLZWContext(client, this)); + m_lzwContext = wrapUnique(new GIFLZWContext(client, this)); if (!m_lzwContext->prepareToDecode()) { m_lzwContext.reset(); return false; @@ -827,7 +827,7 @@ void GIFImageReader::addFrameIfNecessary() { if (m_frames.isEmpty() || m_frames.last()->isComplete()) - m_frames.append(adoptPtr(new GIFFrameContext(m_frames.size()))); + m_frames.append(wrapUnique(new GIFFrameContext(m_frames.size()))); } // FIXME: Move this method to close to doLZW().
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.h b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.h index 1ec9d384..068b921 100644 --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.h +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.h
@@ -44,9 +44,8 @@ #include "platform/image-decoders/gif/GIFImageDecoder.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" +#include <memory> #define MAX_DICTIONARY_ENTRY_BITS 12 #define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS @@ -267,7 +266,7 @@ unsigned m_delayTime; // Display time, in milliseconds, for this image in a multi-image GIF. - OwnPtr<GIFLZWContext> m_lzwContext; + std::unique_ptr<GIFLZWContext> m_lzwContext; Vector<GIFLZWBlock> m_lzwBlocks; // LZW blocks for this frame. GIFColorMap m_localColorMap; @@ -353,7 +352,7 @@ GIFColorMap m_globalColorMap; int m_loopCount; // Netscape specific extension block to control the number of animation loops a GIF renders. - Vector<OwnPtr<GIFFrameContext>> m_frames; + Vector<std::unique_ptr<GIFFrameContext>> m_frames; RefPtr<blink::SegmentReader> m_data; bool m_parseCompleted;
diff --git a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.cpp index 00d19d7e..f8d39b9 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.cpp
@@ -32,9 +32,8 @@ #include "platform/Histogram.h" #include "platform/image-decoders/png/PNGImageDecoder.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Threading.h" - #include <algorithm> namespace blink { @@ -196,7 +195,7 @@ if (imageType == BMP) { if (!m_bmpReaders[index]) { - m_bmpReaders[index] = adoptPtr(new BMPImageReader(this, dirEntry.m_imageOffset, 0, true)); + m_bmpReaders[index] = wrapUnique(new BMPImageReader(this, dirEntry.m_imageOffset, 0, true)); m_bmpReaders[index]->setData(m_data.get()); } // Update the pointer to the buffer as it could change after @@ -211,7 +210,7 @@ if (!m_pngDecoders[index]) { AlphaOption alphaOption = m_premultiplyAlpha ? AlphaPremultiplied : AlphaNotPremultiplied; GammaAndColorProfileOption colorOptions = m_ignoreGammaAndColorProfile ? GammaAndColorProfileIgnored : GammaAndColorProfileApplied; - m_pngDecoders[index] = adoptPtr(new PNGImageDecoder(alphaOption, colorOptions, m_maxDecodedBytes, dirEntry.m_imageOffset)); + m_pngDecoders[index] = wrapUnique(new PNGImageDecoder(alphaOption, colorOptions, m_maxDecodedBytes, dirEntry.m_imageOffset)); setDataForPNGDecoderAtIndex(index); } // Fail if the size the PNGImageDecoder calculated does not match the size
diff --git a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.h index 7bfe240a..0f875ffe 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.h
@@ -33,6 +33,7 @@ #include "platform/image-decoders/FastSharedBufferReader.h" #include "platform/image-decoders/bmp/BMPImageReader.h" +#include <memory> namespace blink { @@ -159,9 +160,9 @@ IconDirectoryEntries m_dirEntries; // The image decoders for the various frames. - typedef Vector<OwnPtr<BMPImageReader>> BMPReaders; + typedef Vector<std::unique_ptr<BMPImageReader>> BMPReaders; BMPReaders m_bmpReaders; - typedef Vector<OwnPtr<PNGImageDecoder>> PNGDecoders; + typedef Vector<std::unique_ptr<PNGImageDecoder>> PNGDecoders; PNGDecoders m_pngDecoders; // Valid only while a BMPImageReader is decoding, this holds the size
diff --git a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp index 9e061ec..31b0a3f 100644 --- a/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoderTest.cpp
@@ -6,14 +6,16 @@ #include "platform/image-decoders/ImageDecoderTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { namespace { -PassOwnPtr<ImageDecoder> createDecoder() +std::unique_ptr<ImageDecoder> createDecoder() { - return adoptPtr(new ICOImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); + return wrapUnique(new ICOImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); } }
diff --git a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp index 95bb9acd..63827d4 100644 --- a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -39,7 +39,9 @@ #include "platform/Histogram.h" #include "platform/PlatformInstrumentation.h" +#include "wtf/PtrUtil.h" #include "wtf/Threading.h" +#include <memory> extern "C" { #include <stdio.h> // jpeglib.h needs stdio FILE. @@ -793,7 +795,7 @@ return !failed(); } -void JPEGImageDecoder::setImagePlanes(PassOwnPtr<ImagePlanes> imagePlanes) +void JPEGImageDecoder::setImagePlanes(std::unique_ptr<ImagePlanes> imagePlanes) { m_imagePlanes = std::move(imagePlanes); } @@ -988,7 +990,7 @@ return; if (!m_reader) { - m_reader = adoptPtr(new JPEGImageReader(this)); + m_reader = wrapUnique(new JPEGImageReader(this)); m_reader->setData(m_data.get()); }
diff --git a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.h index 0dc93f1..845bfcb 100644 --- a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.h
@@ -27,6 +27,7 @@ #define JPEGImageDecoder_h #include "platform/image-decoders/ImageDecoder.h" +#include <memory> namespace blink { @@ -47,7 +48,7 @@ size_t decodedYUVWidthBytes(int component) const override; bool canDecodeToYUV() override; bool decodeToYUV() override; - void setImagePlanes(PassOwnPtr<ImagePlanes>) override; + void setImagePlanes(std::unique_ptr<ImagePlanes>) override; bool hasImagePlanes() const { return m_imagePlanes.get(); } bool outputScanlines(); @@ -67,8 +68,8 @@ // data coming, sets the "decode failure" flag. void decode(bool onlySize); - OwnPtr<JPEGImageReader> m_reader; - OwnPtr<ImagePlanes> m_imagePlanes; + std::unique_ptr<JPEGImageReader> m_reader; + std::unique_ptr<ImagePlanes> m_imagePlanes; IntSize m_decodedSize; };
diff --git a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp index 4de383f..6295e54 100644 --- a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
@@ -36,9 +36,9 @@ #include "public/platform/WebData.h" #include "public/platform/WebSize.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/typed_arrays/ArrayBuffer.h" +#include <memory> namespace blink { @@ -46,12 +46,12 @@ namespace { -PassOwnPtr<ImageDecoder> createDecoder(size_t maxDecodedBytes) +std::unique_ptr<ImageDecoder> createDecoder(size_t maxDecodedBytes) { - return adoptPtr(new JPEGImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, maxDecodedBytes)); + return wrapUnique(new JPEGImageDecoder(ImageDecoder::AlphaNotPremultiplied, ImageDecoder::GammaAndColorProfileApplied, maxDecodedBytes)); } -PassOwnPtr<ImageDecoder> createDecoder() +std::unique_ptr<ImageDecoder> createDecoder() { return createDecoder(ImageDecoder::noDecodedImageByteLimit); } @@ -63,7 +63,7 @@ RefPtr<SharedBuffer> data = readFile(imageFilePath); ASSERT_TRUE(data); - OwnPtr<ImageDecoder> decoder = createDecoder(maxDecodedBytes); + std::unique_ptr<ImageDecoder> decoder = createDecoder(maxDecodedBytes); decoder->setData(data.get(), true); ImageFrame* frame = decoder->frameBufferAtIndex(0); @@ -78,11 +78,11 @@ RefPtr<SharedBuffer> data = readFile(imageFilePath); ASSERT_TRUE(data); - OwnPtr<ImageDecoder> decoder = createDecoder(maxDecodedBytes); + std::unique_ptr<ImageDecoder> decoder = createDecoder(maxDecodedBytes); decoder->setData(data.get(), true); // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding. - OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes()); + std::unique_ptr<ImagePlanes> dummyImagePlanes = wrapUnique(new ImagePlanes()); decoder->setImagePlanes(std::move(dummyImagePlanes)); bool sizeIsAvailable = decoder->isSizeAvailable(); @@ -114,7 +114,7 @@ planes[1] = ((char*) planes[0]) + rowBytes[0] * ySize.height(); planes[2] = ((char*) planes[1]) + rowBytes[1] * uSize.height(); - OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes(planes, rowBytes)); + std::unique_ptr<ImagePlanes> imagePlanes = wrapUnique(new ImagePlanes(planes, rowBytes)); decoder->setImagePlanes(std::move(imagePlanes)); ASSERT_TRUE(decoder->decodeToYUV()); @@ -123,7 +123,7 @@ // Tests failure on a too big image. TEST(JPEGImageDecoderTest, tooBig) { - OwnPtr<ImageDecoder> decoder = createDecoder(100); + std::unique_ptr<ImageDecoder> decoder = createDecoder(100); EXPECT_FALSE(decoder->setSize(10000, 10000)); EXPECT_TRUE(decoder->failed()); } @@ -247,10 +247,10 @@ RefPtr<SharedBuffer> data = readFile(jpegFile); ASSERT_TRUE(data); - OwnPtr<ImageDecoder> decoder = createDecoder(230 * 230 * 4); + std::unique_ptr<ImageDecoder> decoder = createDecoder(230 * 230 * 4); decoder->setData(data.get(), true); - OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes()); + std::unique_ptr<ImagePlanes> imagePlanes = wrapUnique(new ImagePlanes()); decoder->setImagePlanes(std::move(imagePlanes)); ASSERT_TRUE(decoder->isSizeAvailable()); ASSERT_FALSE(decoder->canDecodeToYUV());
diff --git a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp index 23715e3..c0b8473a 100644 --- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -39,6 +39,8 @@ #include "platform/image-decoders/png/PNGImageDecoder.h" #include "png.h" +#include "wtf/PtrUtil.h" +#include <memory> #if !defined(PNG_LIBPNG_VER_MAJOR) || !defined(PNG_LIBPNG_VER_MINOR) #error version error: compile against a versioned libpng. @@ -142,10 +144,10 @@ bool hasAlpha() const { return m_hasAlpha; } png_bytep interlaceBuffer() const { return m_interlaceBuffer.get(); } - void createInterlaceBuffer(int size) { m_interlaceBuffer = adoptArrayPtr(new png_byte[size]); } + void createInterlaceBuffer(int size) { m_interlaceBuffer = wrapArrayUnique(new png_byte[size]); } #if USE(QCMSLIB) png_bytep rowBuffer() const { return m_rowBuffer.get(); } - void createRowBuffer(int size) { m_rowBuffer = adoptArrayPtr(new png_byte[size]); } + void createRowBuffer(int size) { m_rowBuffer = wrapArrayUnique(new png_byte[size]); } #endif private: @@ -156,9 +158,9 @@ size_t m_currentBufferSize; bool m_decodingSizeOnly; bool m_hasAlpha; - OwnPtr<png_byte[]> m_interlaceBuffer; + std::unique_ptr<png_byte[]> m_interlaceBuffer; #if USE(QCMSLIB) - OwnPtr<png_byte[]> m_rowBuffer; + std::unique_ptr<png_byte[]> m_rowBuffer; #endif }; @@ -428,7 +430,7 @@ return; if (!m_reader) - m_reader = adoptPtr(new PNGImageReader(this, m_offset)); + m_reader = wrapUnique(new PNGImageReader(this, m_offset)); // If we couldn't decode the image but have received all the data, decoding // has failed.
diff --git a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h index f41b543..c0c9ca8 100644 --- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h +++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h
@@ -27,6 +27,7 @@ #define PNGImageDecoder_h #include "platform/image-decoders/ImageDecoder.h" +#include <memory> namespace blink { @@ -56,7 +57,7 @@ // data coming, sets the "decode failure" flag. void decode(bool onlySize); - OwnPtr<PNGImageReader> m_reader; + std::unique_ptr<PNGImageReader> m_reader; const unsigned m_offset; };
diff --git a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp index b3474e3..a941551 100644 --- a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp +++ b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp
@@ -36,21 +36,21 @@ #include "public/platform/WebData.h" #include "public/platform/WebSize.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/dtoa/utils.h" +#include <memory> namespace blink { namespace { -PassOwnPtr<ImageDecoder> createDecoder(ImageDecoder::AlphaOption alphaOption) +std::unique_ptr<ImageDecoder> createDecoder(ImageDecoder::AlphaOption alphaOption) { - return adoptPtr(new WEBPImageDecoder(alphaOption, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); + return wrapUnique(new WEBPImageDecoder(alphaOption, ImageDecoder::GammaAndColorProfileApplied, ImageDecoder::noDecodedImageByteLimit)); } -PassOwnPtr<ImageDecoder> createDecoder() +std::unique_ptr<ImageDecoder> createDecoder() { return createDecoder(ImageDecoder::AlphaNotPremultiplied); } @@ -66,7 +66,7 @@ size_t frameCount = baselineHashes.size(); // Random decoding should get the same results as sequential decoding. - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); decoder->setData(fullData.get(), true); const size_t skippingStep = 5; for (size_t i = 0; i < skippingStep; ++i) { @@ -97,7 +97,7 @@ createDecodingBaseline(&createDecoder, data.get(), &baselineHashes); size_t frameCount = baselineHashes.size(); - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); decoder->setData(data.get(), true); for (size_t clearExceptFrame = 0; clearExceptFrame < frameCount; ++clearExceptFrame) { decoder->clearCacheExceptFrame(clearExceptFrame); @@ -114,7 +114,7 @@ void testDecodeAfterReallocatingData(const char* webpFile) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(webpFile); ASSERT_TRUE(data.get()); @@ -136,7 +136,7 @@ void testByteByByteSizeAvailable(const char* webpFile, size_t frameOffset, bool hasColorProfile, int expectedRepetitionCount) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(webpFile); ASSERT_TRUE(data.get()); EXPECT_LT(frameOffset, data->size()); @@ -181,7 +181,7 @@ // call); else error is expected during decode (frameBufferAtIndex() call). void testInvalidImage(const char* webpFile, bool parseErrorExpected) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile(webpFile); ASSERT_TRUE(data.get()); @@ -242,10 +242,10 @@ RefPtr<SharedBuffer> data = readFile(webpFile); ASSERT_TRUE(data.get()); - OwnPtr<ImageDecoder> decoderA = createDecoder(ImageDecoder::AlphaPremultiplied); + std::unique_ptr<ImageDecoder> decoderA = createDecoder(ImageDecoder::AlphaPremultiplied); decoderA->setData(data.get(), true); - OwnPtr<ImageDecoder> decoderB = createDecoder(ImageDecoder::AlphaNotPremultiplied); + std::unique_ptr<ImageDecoder> decoderB = createDecoder(ImageDecoder::AlphaNotPremultiplied); decoderB->setData(data.get(), true); size_t frameCount = decoderA->frameCount(); @@ -259,7 +259,7 @@ TEST(AnimatedWebPTests, uniqueGenerationIDs) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated.webp"); ASSERT_TRUE(data.get()); @@ -275,7 +275,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersTransparentImage) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount()); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated.webp"); @@ -317,7 +317,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersOpaqueFramesTransparentBackground) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount()); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated-opaque.webp"); @@ -360,7 +360,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersBlendOverwrite) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount()); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated-no-blend.webp"); @@ -417,7 +417,7 @@ TEST(AnimatedWebPTests, truncatedLastFrame) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/invalid-animated-webp2.webp"); ASSERT_TRUE(data.get()); @@ -440,7 +440,7 @@ TEST(AnimatedWebPTests, truncatedInBetweenFrame) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/invalid-animated-webp4.webp"); ASSERT_TRUE(fullData.get()); @@ -459,7 +459,7 @@ // Reproduce a crash that used to happen for a specific file with specific sequence of method calls. TEST(AnimatedWebPTests, reproCrash) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/invalid_vp8_vp8x.webp"); ASSERT_TRUE(fullData.get()); @@ -491,7 +491,7 @@ ASSERT_TRUE(fullData.get()); const size_t fullLength = fullData->size(); - OwnPtr<ImageDecoder> decoder; + std::unique_ptr<ImageDecoder> decoder; ImageFrame* frame; Vector<unsigned> truncatedHashes; @@ -536,7 +536,7 @@ TEST(AnimatedWebPTests, frameIsCompleteAndDuration) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-animated.webp"); ASSERT_TRUE(data.get()); @@ -564,7 +564,7 @@ TEST(AnimatedWebPTests, updateRequiredPreviousFrameAfterFirstDecode) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/webp-animated.webp"); ASSERT_TRUE(fullData.get()); @@ -612,7 +612,7 @@ createDecodingBaseline(&createDecoder, fullData.get(), &baselineHashes); size_t frameCount = baselineHashes.size(); - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); // Let frame 0 be partially decoded. size_t partialSize = 1; @@ -679,7 +679,7 @@ TEST(StaticWebPTests, notAnimated) { - OwnPtr<ImageDecoder> decoder = createDecoder(); + std::unique_ptr<ImageDecoder> decoder = createDecoder(); RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/webp-color-profile-lossy.webp"); ASSERT_TRUE(data.get()); decoder->setData(data.get(), true);
diff --git a/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.cpp b/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.cpp index 93353ff..c4c2b09 100644 --- a/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.cpp +++ b/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.cpp
@@ -34,6 +34,8 @@ #include "platform/geometry/IntSize.h" #include "platform/graphics/ImageBuffer.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" +#include <memory> extern "C" { #include <setjmp.h> @@ -134,12 +136,12 @@ return what_to_return; \ } -PassOwnPtr<JPEGImageEncoderState> JPEGImageEncoderState::create(const IntSize& imageSize, const double& quality, Vector<unsigned char>* output) +std::unique_ptr<JPEGImageEncoderState> JPEGImageEncoderState::create(const IntSize& imageSize, const double& quality, Vector<unsigned char>* output) { if (imageSize.width() <= 0 || imageSize.height() <= 0) return nullptr; - OwnPtr<JPEGImageEncoderStateImpl> encoderState = adoptPtr(new JPEGImageEncoderStateImpl()); + std::unique_ptr<JPEGImageEncoderStateImpl> encoderState = wrapUnique(new JPEGImageEncoderStateImpl()); jpeg_compress_struct* cinfo = encoderState->cinfo(); jpeg_error_mgr* error = encoderState->error(); @@ -205,7 +207,7 @@ return currentRowsCompleted; } -bool JPEGImageEncoder::encodeWithPreInitializedState(PassOwnPtr<JPEGImageEncoderState> encoderState, const unsigned char* inputPixels, int numRowsCompleted) +bool JPEGImageEncoder::encodeWithPreInitializedState(std::unique_ptr<JPEGImageEncoderState> encoderState, const unsigned char* inputPixels, int numRowsCompleted) { JPEGImageEncoderStateImpl* encoderStateImpl = static_cast<JPEGImageEncoderStateImpl*>(encoderState.get()); @@ -232,7 +234,7 @@ if (!imageData.pixels()) return false; - OwnPtr<JPEGImageEncoderState> encoderState = JPEGImageEncoderState::create(imageData.size(), quality, output); + std::unique_ptr<JPEGImageEncoderState> encoderState = JPEGImageEncoderState::create(imageData.size(), quality, output); if (!encoderState) return false;
diff --git a/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.h b/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.h index 7ed6d30..afc0c9f 100644 --- a/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.h +++ b/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.h
@@ -33,8 +33,8 @@ #include "platform/geometry/IntSize.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -44,7 +44,7 @@ USING_FAST_MALLOC(JPEGImageEncoderState); WTF_MAKE_NONCOPYABLE(JPEGImageEncoderState); public: - static PassOwnPtr<JPEGImageEncoderState> create(const IntSize& imageSize, const double& quality, Vector<unsigned char>* output); + static std::unique_ptr<JPEGImageEncoderState> create(const IntSize& imageSize, const double& quality, Vector<unsigned char>* output); JPEGImageEncoderState() {} virtual ~JPEGImageEncoderState() {} }; @@ -63,7 +63,7 @@ // be safer. static bool encode(const ImageDataBuffer&, const double& quality, Vector<unsigned char>*); - static bool encodeWithPreInitializedState(PassOwnPtr<JPEGImageEncoderState>, const unsigned char*, int numRowsCompleted = 0); + static bool encodeWithPreInitializedState(std::unique_ptr<JPEGImageEncoderState>, const unsigned char*, int numRowsCompleted = 0); static int progressiveEncodeRowsJpegHelper(JPEGImageEncoderState*, unsigned char*, int, const double, double); static int computeCompressionQuality(const double& quality);
diff --git a/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.cpp b/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.cpp index cfaae3f1..77ccf5e 100644 --- a/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.cpp +++ b/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.cpp
@@ -31,7 +31,8 @@ #include "platform/image-encoders/PNGImageEncoder.h" #include "platform/graphics/ImageBuffer.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -45,7 +46,7 @@ static_cast<Vector<unsigned char>*>(png_get_io_ptr(png))->append(data, size); } -PassOwnPtr<PNGImageEncoderState> PNGImageEncoderState::create(const IntSize& imageSize, Vector<unsigned char>* output) +std::unique_ptr<PNGImageEncoderState> PNGImageEncoderState::create(const IntSize& imageSize, Vector<unsigned char>* output) { if (imageSize.width() <= 0 || imageSize.height() <= 0) return nullptr; @@ -73,7 +74,7 @@ png_set_IHDR(png, info, imageSize.width(), imageSize.height(), 8, PNG_COLOR_TYPE_RGB_ALPHA, 0, 0, 0); png_write_info(png, info); - return adoptPtr(new PNGImageEncoderState(png, info)); + return wrapUnique(new PNGImageEncoderState(png, info)); } void PNGImageEncoder::writeOneRowToPng(unsigned char* pixels, PNGImageEncoderState* encoderState) @@ -88,7 +89,7 @@ static bool encodePixels(const IntSize& imageSize, const unsigned char* inputPixels, Vector<unsigned char>* output) { - OwnPtr<PNGImageEncoderState> encoderState = PNGImageEncoderState::create(imageSize, output); + std::unique_ptr<PNGImageEncoderState> encoderState = PNGImageEncoderState::create(imageSize, output); if (!encoderState.get()) return false;
diff --git a/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.h b/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.h index 79f7960..a825c66 100644 --- a/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.h +++ b/third_party/WebKit/Source/platform/image-encoders/PNGImageEncoder.h
@@ -36,8 +36,8 @@ #include "png.h" } #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -47,7 +47,7 @@ USING_FAST_MALLOC(PNGImageEncoderState); WTF_MAKE_NONCOPYABLE(PNGImageEncoderState); public: - static PassOwnPtr<PNGImageEncoderState> create(const IntSize& imageSize, Vector<unsigned char>* output); + static std::unique_ptr<PNGImageEncoderState> create(const IntSize& imageSize, Vector<unsigned char>* output); ~PNGImageEncoderState(); png_struct* png() { ASSERT(m_png); return m_png; } png_info* info() { ASSERT(m_info); return m_info; }
diff --git a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.h b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.h index cdc362b6..d07fd37 100644 --- a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.h +++ b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.h
@@ -35,6 +35,7 @@ #include "platform/scroll/ScrollAnimatorBase.h" #include "public/platform/WebTaskRunner.h" #include "wtf/RetainPtr.h" +#include <memory> OBJC_CLASS BlinkScrollAnimationHelperDelegate; OBJC_CLASS BlinkScrollbarPainterControllerDelegate; @@ -82,11 +83,11 @@ RetainPtr<BlinkScrollbarPainterDelegate> m_verticalScrollbarPainterDelegate; void initialScrollbarPaintTask(); - OwnPtr<CancellableTaskFactory> m_initialScrollbarPaintTaskFactory; + std::unique_ptr<CancellableTaskFactory> m_initialScrollbarPaintTaskFactory; void sendContentAreaScrolledTask(); - OwnPtr<CancellableTaskFactory> m_sendContentAreaScrolledTaskFactory; - OwnPtr<WebTaskRunner> m_taskRunner; + std::unique_ptr<CancellableTaskFactory> m_sendContentAreaScrolledTaskFactory; + std::unique_ptr<WebTaskRunner> m_taskRunner; FloatSize m_contentAreaScrolledTimerScrollDelta; ScrollResult userScroll(ScrollGranularity, const FloatSize& delta) override;
diff --git a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm index 85c5c6d..e148eca 100644 --- a/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm +++ b/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm
@@ -39,7 +39,8 @@ #include "public/platform/Platform.h" #include "public/platform/WebScheduler.h" #include "wtf/MathExtras.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> using namespace blink; @@ -354,7 +355,7 @@ @interface BlinkScrollbarPartAnimation : NSObject { Scrollbar* _scrollbar; - OwnPtr<BlinkScrollbarPartAnimationTimer> _timer; + std::unique_ptr<BlinkScrollbarPartAnimationTimer> _timer; RetainPtr<ScrollbarPainter> _scrollbarPainter; FeatureToAnimate _featureToAnimate; CGFloat _startValue; @@ -371,7 +372,7 @@ if (!self) return nil; - _timer = adoptPtr(new BlinkScrollbarPartAnimationTimer(self, duration)); + _timer = wrapUnique(new BlinkScrollbarPartAnimationTimer(self, duration)); _scrollbar = scrollbar; _featureToAnimate = featureToAnimate; _startValue = startValue; @@ -682,7 +683,7 @@ : ScrollAnimatorBase(scrollableArea) , m_initialScrollbarPaintTaskFactory(CancellableTaskFactory::create(this, &ScrollAnimatorMac::initialScrollbarPaintTask)) , m_sendContentAreaScrolledTaskFactory(CancellableTaskFactory::create(this, &ScrollAnimatorMac::sendContentAreaScrolledTask)) - , m_taskRunner(adoptPtr(Platform::current()->currentThread()->scheduler()->timerTaskRunner()->clone())) + , m_taskRunner(wrapUnique(Platform::current()->currentThread()->scheduler()->timerTaskRunner()->clone())) , m_haveScrolledSincePageLoad(false) , m_needsScrollerStyleUpdate(false) {
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.cpp b/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.cpp index 32943ee..f883c81 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.cpp +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.cpp
@@ -40,7 +40,8 @@ #include "public/platform/WebMediaStreamCenter.h" #include "public/platform/WebMediaStreamTrack.h" #include "wtf/Assertions.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -52,7 +53,7 @@ } MediaStreamCenter::MediaStreamCenter() - : m_private(adoptPtr(Platform::current()->createMediaStreamCenter(this))) + : m_private(wrapUnique(Platform::current()->createMediaStreamCenter(this))) { } @@ -121,11 +122,11 @@ m_private->didCreateMediaStreamTrack(track); } -PassOwnPtr<AudioSourceProvider> MediaStreamCenter::createWebAudioSourceFromMediaStreamTrack(MediaStreamComponent* track) +std::unique_ptr<AudioSourceProvider> MediaStreamCenter::createWebAudioSourceFromMediaStreamTrack(MediaStreamComponent* track) { ASSERT_UNUSED(track, track); if (m_private) - return MediaStreamWebAudioSource::create(adoptPtr(m_private->createWebAudioSourceFromMediaStreamTrack(track))); + return MediaStreamWebAudioSource::create(wrapUnique(m_private->createWebAudioSourceFromMediaStreamTrack(track))); return nullptr; }
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.h b/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.h index c666955..a3b047e 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.h +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.h
@@ -35,9 +35,9 @@ #include "platform/heap/Handle.h" #include "public/platform/WebMediaStreamCenterClient.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -59,7 +59,7 @@ void didCreateMediaStreamTrack(MediaStreamComponent*); void didSetMediaStreamTrackEnabled(MediaStreamComponent*); bool didStopMediaStreamTrack(MediaStreamComponent*); - PassOwnPtr<AudioSourceProvider> createWebAudioSourceFromMediaStreamTrack(MediaStreamComponent*); + std::unique_ptr<AudioSourceProvider> createWebAudioSourceFromMediaStreamTrack(MediaStreamComponent*); void didCreateMediaStream(MediaStreamDescriptor*); void didCreateMediaStreamAndTracks(MediaStreamDescriptor*); @@ -73,7 +73,7 @@ private: MediaStreamCenter(); - OwnPtr<WebMediaStreamCenter> m_private; + std::unique_ptr<WebMediaStreamCenter> m_private; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamComponent.h b/third_party/WebKit/Source/platform/mediastream/MediaStreamComponent.h index 7c5f406..87d2167 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamComponent.h +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamComponent.h
@@ -38,6 +38,7 @@ #include "wtf/Forward.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -78,7 +79,7 @@ void setSourceProvider(WebAudioSourceProvider* provider) { m_sourceProvider.wrap(provider); } TrackData* getTrackData() const { return m_trackData.get(); } - void setTrackData(PassOwnPtr<TrackData> trackData) { m_trackData = std::move(trackData); } + void setTrackData(std::unique_ptr<TrackData> trackData) { m_trackData = std::move(trackData); } void getSettings(WebMediaStreamTrack::Settings&); DECLARE_TRACE(); @@ -114,7 +115,7 @@ String m_id; bool m_enabled; bool m_muted; - OwnPtr<TrackData> m_trackData; + std::unique_ptr<TrackData> m_trackData; }; typedef HeapVector<Member<MediaStreamComponent>> MediaStreamComponentVector;
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamDescriptor.h b/third_party/WebKit/Source/platform/mediastream/MediaStreamDescriptor.h index db4dd8d..fbbc846 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamDescriptor.h +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamDescriptor.h
@@ -37,6 +37,7 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -89,7 +90,7 @@ void setEnded() { m_ended = true; } ExtraData* getExtraData() const { return m_extraData.get(); } - void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = std::move(extraData); } + void setExtraData(std::unique_ptr<ExtraData> extraData) { m_extraData = std::move(extraData); } // |m_extraData| may hold pointers to GC objects, and it may touch them in destruction. // So this class is eagerly finalized to finalize |m_extraData| promptly. @@ -107,7 +108,7 @@ bool m_active; bool m_ended; - OwnPtr<ExtraData> m_extraData; + std::unique_ptr<ExtraData> m_extraData; }; typedef HeapVector<Member<MediaStreamDescriptor>> MediaStreamDescriptorVector;
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h b/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h index ebc1852c..38d68f668 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h
@@ -36,11 +36,10 @@ #include "platform/audio/AudioDestinationConsumer.h" #include "public/platform/WebMediaConstraints.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -82,7 +81,7 @@ void addObserver(Observer*); ExtraData* getExtraData() const { return m_extraData.get(); } - void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = std::move(extraData); } + void setExtraData(std::unique_ptr<ExtraData> extraData) { m_extraData = std::move(extraData); } void setConstraints(WebMediaConstraints constraints) { m_constraints = constraints; } WebMediaConstraints constraints() { return m_constraints; } @@ -112,7 +111,7 @@ HeapHashSet<WeakMember<Observer>> m_observers; Mutex m_audioConsumersLock; HeapHashSet<Member<AudioDestinationConsumer>> m_audioConsumers; - OwnPtr<ExtraData> m_extraData; + std::unique_ptr<ExtraData> m_extraData; WebMediaConstraints m_constraints; };
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.cpp b/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.cpp index 47bd137..870d030 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.cpp +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.cpp
@@ -28,13 +28,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "platform/mediastream/MediaStreamWebAudioSource.h" #include "platform/audio/AudioBus.h" +#include "platform/mediastream/MediaStreamWebAudioSource.h" #include "public/platform/WebAudioSourceProvider.h" +#include <memory> namespace blink { -MediaStreamWebAudioSource::MediaStreamWebAudioSource(PassOwnPtr<WebAudioSourceProvider> provider) +MediaStreamWebAudioSource::MediaStreamWebAudioSource(std::unique_ptr<WebAudioSourceProvider> provider) : m_webAudioSourceProvider(std::move(provider)) { }
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.h b/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.h index a2d42605..2fca5f3 100644 --- a/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.h +++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamWebAudioSource.h
@@ -33,10 +33,10 @@ #include "platform/audio/AudioSourceProvider.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/build_config.h" +#include <memory> namespace blink { @@ -45,17 +45,17 @@ class MediaStreamWebAudioSource : public AudioSourceProvider { WTF_MAKE_NONCOPYABLE(MediaStreamWebAudioSource); public: - static PassOwnPtr<MediaStreamWebAudioSource> create(PassOwnPtr<WebAudioSourceProvider> provider) { return adoptPtr(new MediaStreamWebAudioSource(std::move(provider))); } + static std::unique_ptr<MediaStreamWebAudioSource> create(std::unique_ptr<WebAudioSourceProvider> provider) { return wrapUnique(new MediaStreamWebAudioSource(std::move(provider))); } ~MediaStreamWebAudioSource() override; private: - explicit MediaStreamWebAudioSource(PassOwnPtr<WebAudioSourceProvider>); + explicit MediaStreamWebAudioSource(std::unique_ptr<WebAudioSourceProvider>); // blink::AudioSourceProvider implementation. void provideInput(AudioBus*, size_t framesToProcess) override; - OwnPtr<WebAudioSourceProvider> m_webAudioSourceProvider; + std::unique_ptr<WebAudioSourceProvider> m_webAudioSourceProvider; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/mediastream/RTCConfiguration.h b/third_party/WebKit/Source/platform/mediastream/RTCConfiguration.h index 8e83245..3b036ca 100644 --- a/third_party/WebKit/Source/platform/mediastream/RTCConfiguration.h +++ b/third_party/WebKit/Source/platform/mediastream/RTCConfiguration.h
@@ -35,8 +35,10 @@ #include "platform/weborigin/KURL.h" #include "public/platform/WebRTCCertificate.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -97,7 +99,7 @@ void setRtcpMuxPolicy(RTCRtcpMuxPolicy rtcpMuxPolicy) { m_rtcpMuxPolicy = rtcpMuxPolicy; } RTCRtcpMuxPolicy rtcpMuxPolicy() { return m_rtcpMuxPolicy; } - void appendCertificate(std::unique_ptr<WebRTCCertificate> certificate) { m_certificates.append(adoptPtr(certificate.release())); } + void appendCertificate(std::unique_ptr<WebRTCCertificate> certificate) { m_certificates.append(wrapUnique(certificate.release())); } size_t numberOfCertificates() const { return m_certificates.size(); } WebRTCCertificate* certificate(size_t index) const { return m_certificates[index].get(); } @@ -113,7 +115,7 @@ RTCIceTransports m_iceTransports; RTCBundlePolicy m_bundlePolicy; RTCRtcpMuxPolicy m_rtcpMuxPolicy; - Vector<OwnPtr<WebRTCCertificate>> m_certificates; + Vector<std::unique_ptr<WebRTCCertificate>> m_certificates; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/mojo/MojoHelper.h b/third_party/WebKit/Source/platform/mojo/MojoHelper.h index be49353..b43f902 100644 --- a/third_party/WebKit/Source/platform/mojo/MojoHelper.h +++ b/third_party/WebKit/Source/platform/mojo/MojoHelper.h
@@ -24,12 +24,6 @@ } template <typename R, typename... Args> -base::Callback<R(Args...)> createBaseCallback(PassOwnPtr<Function<R(Args...)>> functor) -{ - return base::Bind(&internal::CallWTFFunction<R, Args...>, base::Owned(functor.leakPtr())); -} - -template <typename R, typename... Args> base::Callback<R(Args...)> createBaseCallback(std::unique_ptr<Function<R(Args...)>> functor) { return base::Bind(&internal::CallWTFFunction<R, Args...>, base::Owned(functor.release()));
diff --git a/third_party/WebKit/Source/platform/network/HTTPHeaderMap.cpp b/third_party/WebKit/Source/platform/network/HTTPHeaderMap.cpp index c1c37dc..2581d2f 100644 --- a/third_party/WebKit/Source/platform/network/HTTPHeaderMap.cpp +++ b/third_party/WebKit/Source/platform/network/HTTPHeaderMap.cpp
@@ -30,6 +30,9 @@ #include "platform/network/HTTPHeaderMap.h" +#include "wtf/PtrUtil.h" +#include <memory> + namespace blink { HTTPHeaderMap::HTTPHeaderMap() @@ -40,9 +43,9 @@ { } -PassOwnPtr<CrossThreadHTTPHeaderMapData> HTTPHeaderMap::copyData() const +std::unique_ptr<CrossThreadHTTPHeaderMapData> HTTPHeaderMap::copyData() const { - OwnPtr<CrossThreadHTTPHeaderMapData> data = adoptPtr(new CrossThreadHTTPHeaderMapData()); + std::unique_ptr<CrossThreadHTTPHeaderMapData> data = wrapUnique(new CrossThreadHTTPHeaderMapData()); data->reserveInitialCapacity(size()); HTTPHeaderMap::const_iterator endIt = end(); @@ -52,7 +55,7 @@ return data; } -void HTTPHeaderMap::adopt(PassOwnPtr<CrossThreadHTTPHeaderMapData> data) +void HTTPHeaderMap::adopt(std::unique_ptr<CrossThreadHTTPHeaderMapData> data) { clear(); size_t dataSize = data->size();
diff --git a/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h b/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h index 3207583..f87f2554 100644 --- a/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h +++ b/third_party/WebKit/Source/platform/network/HTTPHeaderMap.h
@@ -30,11 +30,11 @@ #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/HashMap.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/AtomicStringHash.h" #include "wtf/text/StringHash.h" +#include <memory> #include <utility> namespace blink { @@ -49,9 +49,9 @@ ~HTTPHeaderMap(); // Gets a copy of the data suitable for passing to another thread. - PassOwnPtr<CrossThreadHTTPHeaderMapData> copyData() const; + std::unique_ptr<CrossThreadHTTPHeaderMapData> copyData() const; - void adopt(PassOwnPtr<CrossThreadHTTPHeaderMapData>); + void adopt(std::unique_ptr<CrossThreadHTTPHeaderMapData>); typedef HashMap<AtomicString, AtomicString, CaseFoldingHash> MapType; typedef MapType::AddResult AddResult;
diff --git a/third_party/WebKit/Source/platform/network/ResourceRequest.cpp b/third_party/WebKit/Source/platform/network/ResourceRequest.cpp index f24a2b5..e9f1960 100644 --- a/third_party/WebKit/Source/platform/network/ResourceRequest.cpp +++ b/third_party/WebKit/Source/platform/network/ResourceRequest.cpp
@@ -33,6 +33,8 @@ #include "public/platform/WebAddressSpace.h" #include "public/platform/WebCachePolicy.h" #include "public/platform/WebURLRequest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -78,9 +80,9 @@ m_redirectStatus = data->m_redirectStatus; } -PassOwnPtr<CrossThreadResourceRequestData> ResourceRequest::copyData() const +std::unique_ptr<CrossThreadResourceRequestData> ResourceRequest::copyData() const { - OwnPtr<CrossThreadResourceRequestData> data = adoptPtr(new CrossThreadResourceRequestData()); + std::unique_ptr<CrossThreadResourceRequestData> data = wrapUnique(new CrossThreadResourceRequestData()); data->m_url = url().copy(); data->m_cachePolicy = getCachePolicy(); data->m_timeoutInterval = timeoutInterval();
diff --git a/third_party/WebKit/Source/platform/network/ResourceRequest.h b/third_party/WebKit/Source/platform/network/ResourceRequest.h index b8a9508eb..2a6feae6 100644 --- a/third_party/WebKit/Source/platform/network/ResourceRequest.h +++ b/third_party/WebKit/Source/platform/network/ResourceRequest.h
@@ -38,8 +38,8 @@ #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/WebAddressSpace.h" #include "public/platform/WebURLRequest.h" -#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" +#include <memory> namespace blink { @@ -91,7 +91,7 @@ explicit ResourceRequest(CrossThreadResourceRequestData*); // Gets a copy of the data suitable for passing to another thread. - PassOwnPtr<CrossThreadResourceRequestData> copyData() const; + std::unique_ptr<CrossThreadResourceRequestData> copyData() const; bool isNull() const; bool isEmpty() const; @@ -307,7 +307,7 @@ RefPtr<SecurityOrigin> m_requestorOrigin; String m_httpMethod; - OwnPtr<CrossThreadHTTPHeaderMapData> m_httpHeaders; + std::unique_ptr<CrossThreadHTTPHeaderMapData> m_httpHeaders; RefPtr<EncodedFormData> m_httpBody; RefPtr<EncodedFormData> m_attachedCredential; bool m_allowStoredCredentials;
diff --git a/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp b/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp index 0979dff..94ba87f7 100644 --- a/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp +++ b/third_party/WebKit/Source/platform/network/ResourceRequestTest.cpp
@@ -11,6 +11,7 @@ #include "public/platform/WebURLRequest.h" #include "testing/gtest/include/gtest/gtest.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -75,7 +76,7 @@ EXPECT_STREQ("http://www.example.com/referrer.htm", original.httpReferrer().utf8().data()); EXPECT_EQ(ReferrerPolicyDefault, original.getReferrerPolicy()); - OwnPtr<CrossThreadResourceRequestData> data1(original.copyData()); + std::unique_ptr<CrossThreadResourceRequestData> data1(original.copyData()); ResourceRequest copy1(data1.get()); EXPECT_STREQ("http://www.example.com/test.htm", copy1.url().getString().utf8().data()); @@ -110,7 +111,7 @@ copy1.setFetchRequestMode(WebURLRequest::FetchRequestModeNoCORS); copy1.setFetchCredentialsMode(WebURLRequest::FetchCredentialsModeInclude); - OwnPtr<CrossThreadResourceRequestData> data2(copy1.copyData()); + std::unique_ptr<CrossThreadResourceRequestData> data2(copy1.copyData()); ResourceRequest copy2(data2.get()); EXPECT_TRUE(copy2.allowStoredCredentials()); EXPECT_TRUE(copy2.reportUploadProgress());
diff --git a/third_party/WebKit/Source/platform/network/ResourceResponse.cpp b/third_party/WebKit/Source/platform/network/ResourceResponse.cpp index 06fa838..d513f5b 100644 --- a/third_party/WebKit/Source/platform/network/ResourceResponse.cpp +++ b/third_party/WebKit/Source/platform/network/ResourceResponse.cpp
@@ -27,7 +27,9 @@ #include "platform/network/ResourceResponse.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" +#include <memory> namespace blink { @@ -148,9 +150,9 @@ // whatever values may be present in the opaque m_extraData structure. } -PassOwnPtr<CrossThreadResourceResponseData> ResourceResponse::copyData() const +std::unique_ptr<CrossThreadResourceResponseData> ResourceResponse::copyData() const { - OwnPtr<CrossThreadResourceResponseData> data = adoptPtr(new CrossThreadResourceResponseData); + std::unique_ptr<CrossThreadResourceResponseData> data = wrapUnique(new CrossThreadResourceResponseData); data->m_url = url().copy(); data->m_mimeType = mimeType().getString().isolatedCopy(); data->m_expectedContentLength = expectedContentLength(); @@ -542,7 +544,7 @@ m_downloadedFileHandle.clear(); return; } - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->appendFile(m_downloadedFilePath); blobData->detachFromCurrentThread(); m_downloadedFileHandle = BlobDataHandle::create(std::move(blobData), -1);
diff --git a/third_party/WebKit/Source/platform/network/ResourceResponse.h b/third_party/WebKit/Source/platform/network/ResourceResponse.h index 89d64806..d19e852 100644 --- a/third_party/WebKit/Source/platform/network/ResourceResponse.h +++ b/third_party/WebKit/Source/platform/network/ResourceResponse.h
@@ -35,10 +35,10 @@ #include "platform/network/ResourceLoadTiming.h" #include "platform/weborigin/KURL.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponseType.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" #include "wtf/text/CString.h" +#include <memory> namespace blink { @@ -90,7 +90,7 @@ explicit ResourceResponse(CrossThreadResourceResponseData*); // Gets a copy of the data suitable for passing to another thread. - PassOwnPtr<CrossThreadResourceResponseData> copyData() const; + std::unique_ptr<CrossThreadResourceResponseData> copyData() const; ResourceResponse(); ResourceResponse(const KURL&, const AtomicString& mimeType, long long expectedLength, const AtomicString& textEncodingName, const String& filename); @@ -391,7 +391,7 @@ String m_suggestedFilename; int m_httpStatusCode; String m_httpStatusText; - OwnPtr<CrossThreadHTTPHeaderMapData> m_httpHeaders; + std::unique_ptr<CrossThreadHTTPHeaderMapData> m_httpHeaders; time_t m_lastModifiedDate; RefPtr<ResourceLoadTiming> m_resourceLoadTiming; CString m_securityInfo;
diff --git a/third_party/WebKit/Source/platform/network/ResourceTimingInfo.cpp b/third_party/WebKit/Source/platform/network/ResourceTimingInfo.cpp index 03d0297..064cc45 100644 --- a/third_party/WebKit/Source/platform/network/ResourceTimingInfo.cpp +++ b/third_party/WebKit/Source/platform/network/ResourceTimingInfo.cpp
@@ -5,12 +5,14 @@ #include "platform/network/ResourceTimingInfo.h" #include "platform/CrossThreadCopier.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<ResourceTimingInfo> ResourceTimingInfo::adopt(PassOwnPtr<CrossThreadResourceTimingInfoData> data) +std::unique_ptr<ResourceTimingInfo> ResourceTimingInfo::adopt(std::unique_ptr<CrossThreadResourceTimingInfoData> data) { - OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(AtomicString(data->m_type), data->m_initialTime, data->m_isMainResource); + std::unique_ptr<ResourceTimingInfo> info = ResourceTimingInfo::create(AtomicString(data->m_type), data->m_initialTime, data->m_isMainResource); info->m_originalTimingAllowOrigin = AtomicString(data->m_originalTimingAllowOrigin); info->m_loadFinishTime = data->m_loadFinishTime; info->m_initialRequest = ResourceRequest(data->m_initialRequest.get()); @@ -20,9 +22,9 @@ return info; } -PassOwnPtr<CrossThreadResourceTimingInfoData> ResourceTimingInfo::copyData() const +std::unique_ptr<CrossThreadResourceTimingInfoData> ResourceTimingInfo::copyData() const { - OwnPtr<CrossThreadResourceTimingInfoData> data = adoptPtr(new CrossThreadResourceTimingInfoData); + std::unique_ptr<CrossThreadResourceTimingInfoData> data = wrapUnique(new CrossThreadResourceTimingInfoData); data->m_type = m_type.getString().isolatedCopy(); data->m_originalTimingAllowOrigin = m_originalTimingAllowOrigin.getString().isolatedCopy(); data->m_initialTime = m_initialTime;
diff --git a/third_party/WebKit/Source/platform/network/ResourceTimingInfo.h b/third_party/WebKit/Source/platform/network/ResourceTimingInfo.h index da3c5b51..f7ff7c1 100644 --- a/third_party/WebKit/Source/platform/network/ResourceTimingInfo.h +++ b/third_party/WebKit/Source/platform/network/ResourceTimingInfo.h
@@ -37,7 +37,9 @@ #include "wtf/Allocator.h" #include "wtf/Functional.h" #include "wtf/Noncopyable.h" +#include "wtf/PtrUtil.h" #include "wtf/text/AtomicString.h" +#include <memory> namespace blink { @@ -47,14 +49,14 @@ USING_FAST_MALLOC(ResourceTimingInfo); WTF_MAKE_NONCOPYABLE(ResourceTimingInfo); public: - static PassOwnPtr<ResourceTimingInfo> create(const AtomicString& type, const double time, bool isMainResource) + static std::unique_ptr<ResourceTimingInfo> create(const AtomicString& type, const double time, bool isMainResource) { - return adoptPtr(new ResourceTimingInfo(type, time, isMainResource)); + return wrapUnique(new ResourceTimingInfo(type, time, isMainResource)); } - static PassOwnPtr<ResourceTimingInfo> adopt(PassOwnPtr<CrossThreadResourceTimingInfoData>); + static std::unique_ptr<ResourceTimingInfo> adopt(std::unique_ptr<CrossThreadResourceTimingInfoData>); // Gets a copy of the data suitable for passing to another thread. - PassOwnPtr<CrossThreadResourceTimingInfoData> copyData() const; + std::unique_ptr<CrossThreadResourceTimingInfoData> copyData() const; double initialTime() const { return m_initialTime; } bool isMainResource() const { return m_isMainResource; } @@ -112,15 +114,15 @@ String m_originalTimingAllowOrigin; double m_initialTime; double m_loadFinishTime; - OwnPtr<CrossThreadResourceRequestData> m_initialRequest; - OwnPtr<CrossThreadResourceResponseData> m_finalResponse; - Vector<OwnPtr<CrossThreadResourceResponseData>> m_redirectChain; + std::unique_ptr<CrossThreadResourceRequestData> m_initialRequest; + std::unique_ptr<CrossThreadResourceResponseData> m_finalResponse; + Vector<std::unique_ptr<CrossThreadResourceResponseData>> m_redirectChain; bool m_isMainResource; }; template <> struct CrossThreadCopier<ResourceTimingInfo> { - typedef WTF::PassedWrapper<PassOwnPtr<CrossThreadResourceTimingInfoData>> Type; + typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceTimingInfoData>> Type; static Type copy(const ResourceTimingInfo& info) { return passed(info.copyData()); } };
diff --git a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h index 18741b1f..c6684da 100644 --- a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h +++ b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h
@@ -11,9 +11,9 @@ #include "wtf/Allocator.h" #include "wtf/Functional.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/WeakPtr.h" +#include <memory> #include <type_traits> namespace blink { @@ -37,15 +37,15 @@ // variety, which will refer back to the owner heap object safely (but weakly.) // template<typename T> - static PassOwnPtr<CancellableTaskFactory> create(T* thisObject, void (T::*method)(), typename std::enable_if<IsGarbageCollectedType<T>::value>::type* = nullptr) + static std::unique_ptr<CancellableTaskFactory> create(T* thisObject, void (T::*method)(), typename std::enable_if<IsGarbageCollectedType<T>::value>::type* = nullptr) { - return adoptPtr(new CancellableTaskFactory(WTF::bind(method, CrossThreadWeakPersistentThisPointer<T>(thisObject)))); + return wrapUnique(new CancellableTaskFactory(WTF::bind(method, CrossThreadWeakPersistentThisPointer<T>(thisObject)))); } template<typename T> - static PassOwnPtr<CancellableTaskFactory> create(T* thisObject, void (T::*method)(), typename std::enable_if<!IsGarbageCollectedType<T>::value>::type* = nullptr) + static std::unique_ptr<CancellableTaskFactory> create(T* thisObject, void (T::*method)(), typename std::enable_if<!IsGarbageCollectedType<T>::value>::type* = nullptr) { - return adoptPtr(new CancellableTaskFactory(WTF::bind(method, thisObject))); + return wrapUnique(new CancellableTaskFactory(WTF::bind(method, thisObject))); } bool isPending() const
diff --git a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp index 579f4e1..fcb6d78c 100644 --- a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp +++ b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp
@@ -6,6 +6,8 @@ #include "platform/heap/Handle.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -33,7 +35,7 @@ TEST_F(CancellableTaskFactoryTest, IsPending_TaskCreated) { TestCancellableTaskFactory factory(nullptr); - OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); EXPECT_TRUE(factory.isPending()); } @@ -46,7 +48,7 @@ { TestCancellableTaskFactory factory(WTF::bind(&EmptyFn)); { - OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); task->run(); } @@ -64,7 +66,7 @@ TEST_F(CancellableTaskFactoryTest, IsPending_TaskCreatedAndCancelled) { TestCancellableTaskFactory factory(nullptr); - OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); factory.cancel(); EXPECT_FALSE(factory.isPending()); @@ -72,7 +74,7 @@ class TestClass { public: - OwnPtr<CancellableTaskFactory> m_factory; + std::unique_ptr<CancellableTaskFactory> m_factory; TestClass() : m_factory(CancellableTaskFactory::create(this, &TestClass::TestFn)) @@ -88,7 +90,7 @@ TEST_F(CancellableTaskFactoryTest, IsPending_InCallback) { TestClass testClass; - OwnPtr<WebTaskRunner::Task> task = adoptPtr(testClass.m_factory->cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(testClass.m_factory->cancelAndCreate()); task->run(); } @@ -101,7 +103,7 @@ { int executionCount = 0; TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); task->run(); EXPECT_EQ(1, executionCount); @@ -111,7 +113,7 @@ { int executionCount = 0; TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); task->run(); task->run(); task->run(); @@ -123,10 +125,10 @@ TEST_F(CancellableTaskFactoryTest, Run_FactoryDestructionPreventsExecution) { int executionCount = 0; - OwnPtr<WebTaskRunner::Task> task; + std::unique_ptr<WebTaskRunner::Task> task; { TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - task = adoptPtr(factory.cancelAndCreate()); + task = wrapUnique(factory.cancelAndCreate()); } task->run(); @@ -138,15 +140,15 @@ int executionCount = 0; TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - OwnPtr<WebTaskRunner::Task> taskA = adoptPtr(factory.cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> taskA = wrapUnique(factory.cancelAndCreate()); taskA->run(); EXPECT_EQ(1, executionCount); - OwnPtr<WebTaskRunner::Task> taskB = adoptPtr(factory.cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> taskB = wrapUnique(factory.cancelAndCreate()); taskB->run(); EXPECT_EQ(2, executionCount); - OwnPtr<WebTaskRunner::Task> taskC = adoptPtr(factory.cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> taskC = wrapUnique(factory.cancelAndCreate()); taskC->run(); EXPECT_EQ(3, executionCount); } @@ -155,7 +157,7 @@ { int executionCount = 0; TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - OwnPtr<WebTaskRunner::Task> task = adoptPtr(factory.cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate()); factory.cancel(); task->run(); @@ -167,8 +169,8 @@ int executionCount = 0; TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount)); - OwnPtr<WebTaskRunner::Task> taskA = adoptPtr(factory.cancelAndCreate()); - OwnPtr<WebTaskRunner::Task> taskB = adoptPtr(factory.cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> taskA = wrapUnique(factory.cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> taskB = wrapUnique(factory.cancelAndCreate()); taskA->run(); EXPECT_EQ(0, executionCount); @@ -201,7 +203,7 @@ static int s_destructed; static int s_invoked; - OwnPtr<CancellableTaskFactory> m_factory; + std::unique_ptr<CancellableTaskFactory> m_factory; }; int GCObject::s_destructed = 0; @@ -212,7 +214,7 @@ TEST(CancellableTaskFactoryTest, GarbageCollectedWeak) { GCObject* object = new GCObject(); - OwnPtr<WebTaskRunner::Task> task = adoptPtr(object->m_factory->cancelAndCreate()); + std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(object->m_factory->cancelAndCreate()); object = nullptr; ThreadHeap::collectAllGarbage(); task->run();
diff --git a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp index 582d7a9..b53fdae 100644 --- a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp +++ b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
@@ -11,6 +11,8 @@ #include "platform/scroll/ScrollableArea.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -120,7 +122,7 @@ bool sentToCompositor = false; if (!m_scrollableArea->shouldScrollOnMainThread()) { - OwnPtr<CompositorAnimation> animation = CompositorAnimation::create(*m_animationCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0); + std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create(*m_animationCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0); int animationId = animation->id(); int animationGroupId = animation->group();
diff --git a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.h b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.h index 2aa64ef..f0bd65a 100644 --- a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.h +++ b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.h
@@ -10,8 +10,7 @@ #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -53,7 +52,7 @@ void notifyPositionChanged(const DoublePoint&); Member<ScrollableArea> m_scrollableArea; - OwnPtr<CompositorScrollOffsetAnimationCurve> m_animationCurve; + std::unique_ptr<CompositorScrollOffsetAnimationCurve> m_animationCurve; FloatPoint m_targetOffset; double m_startTime; };
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp index 6fce2694..6b219ce45 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
@@ -40,6 +40,8 @@ #include "public/platform/WebCompositorSupport.h" #include "wtf/CurrentTime.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -267,7 +269,7 @@ if (m_scrollableArea->shouldScrollOnMainThread()) return false; - OwnPtr<CompositorAnimation> animation = CompositorAnimation::create(*m_animationCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0); + std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create(*m_animationCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0); // Being here means that either there is an animation that needs // to be sent to the compositor, or an animation that needs to // be updated (a new scroll event before the previous animation
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h index da76f2f..bf9f80f1 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h
@@ -37,6 +37,7 @@ #include "platform/animation/CompositorScrollOffsetAnimationCurve.h" #include "platform/geometry/FloatPoint.h" #include "platform/scroll/ScrollAnimatorBase.h" +#include <memory> namespace blink { @@ -77,7 +78,7 @@ double animationStartTime, std::unique_ptr<cc::AnimationCurve>) override; - OwnPtr<CompositorScrollOffsetAnimationCurve> m_animationCurve; + std::unique_ptr<CompositorScrollOffsetAnimationCurve> m_animationCurve; double m_startTime; WTF::TimeFunction m_timeFunction;
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp index 6e3757e..1ed8f2c 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
@@ -34,7 +34,6 @@ #include "platform/geometry/FloatPoint.h" #include "platform/scroll/ScrollableArea.h" #include "wtf/MathExtras.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp index 7ebd18c1..85623d4 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.cpp
@@ -14,6 +14,8 @@ #include "platform/scroll/ScrollableArea.h" #include "public/platform/Platform.h" #include "public/platform/WebCompositorSupport.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -76,10 +78,10 @@ } bool ScrollAnimatorCompositorCoordinator::addAnimation( - PassOwnPtr<CompositorAnimation> animation) + std::unique_ptr<CompositorAnimation> animation) { if (m_compositorPlayer->isLayerAttached()) { - m_compositorPlayer->addAnimation(animation.leakPtr()); + m_compositorPlayer->addAnimation(animation.release()); return true; } return false;
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h index bf111dd..d0cecc2 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorCompositorCoordinator.h
@@ -16,7 +16,7 @@ #include "platform/scroll/ScrollTypes.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -63,7 +63,7 @@ IntSize implOnlyAnimationAdjustmentForTesting() { return m_implOnlyAnimationAdjustment; } void resetAnimationIds(); - bool addAnimation(PassOwnPtr<CompositorAnimation>); + bool addAnimation(std::unique_ptr<CompositorAnimation>); void removeAnimation(); virtual void abortAnimation(); @@ -139,7 +139,7 @@ RunningOnCompositorButNeedsAdjustment, }; - OwnPtr<CompositorAnimationPlayer> m_compositorPlayer; + std::unique_ptr<CompositorAnimationPlayer> m_compositorPlayer; int m_compositorAnimationAttachedToLayerId; RunState m_runState; int m_compositorAnimationId;
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h b/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h index a0551da..0bd8755 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarTestSuite.h
@@ -11,6 +11,8 @@ #include "platform/scroll/ScrollbarThemeMock.h" #include "platform/testing/TestingPlatformSupport.h" #include "testing/gmock/include/gmock/gmock.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -89,7 +91,7 @@ { TestingPlatformSupport::Config config; config.compositorSupport = Platform::current()->compositorSupport(); - m_fakePlatform = adoptPtr(new TestingPlatformSupportWithMockScheduler(config)); + m_fakePlatform = wrapUnique(new TestingPlatformSupportWithMockScheduler(config)); } void TearDown() override @@ -98,7 +100,7 @@ } private: - OwnPtr<TestingPlatformSupportWithMockScheduler> m_fakePlatform; + std::unique_ptr<TestingPlatformSupportWithMockScheduler> m_fakePlatform; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeClient.h b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeClient.h index e0325fd..006c26f 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeClient.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeClient.h
@@ -31,7 +31,6 @@ #include "platform/geometry/IntRect.h" #include "platform/geometry/IntSize.h" #include "platform/scroll/ScrollTypes.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.cpp b/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.cpp index 9cc5c8f..ac10dfd 100644 --- a/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.cpp +++ b/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.cpp
@@ -31,6 +31,7 @@ #include "public/platform/WebSpeechSynthesisUtterance.h" #include "public/platform/WebSpeechSynthesizer.h" #include "public/platform/WebSpeechSynthesizerClient.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -45,7 +46,7 @@ : m_speechSynthesizerClient(client) { m_webSpeechSynthesizerClient = new WebSpeechSynthesizerClientImpl(this, client); - m_webSpeechSynthesizer = adoptPtr(Platform::current()->createSpeechSynthesizer(m_webSpeechSynthesizerClient)); + m_webSpeechSynthesizer = wrapUnique(Platform::current()->createSpeechSynthesizer(m_webSpeechSynthesizerClient)); } PlatformSpeechSynthesizer::~PlatformSpeechSynthesizer()
diff --git a/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.h b/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.h index 3fd6ff12..70237e0 100644 --- a/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.h +++ b/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesizer.h
@@ -30,6 +30,7 @@ #include "platform/heap/Handle.h" #include "platform/speech/PlatformSpeechSynthesisVoice.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -94,7 +95,7 @@ private: Member<PlatformSpeechSynthesizerClient> m_speechSynthesizerClient; - OwnPtr<WebSpeechSynthesizer> m_webSpeechSynthesizer; + std::unique_ptr<WebSpeechSynthesizer> m_webSpeechSynthesizer; Member<WebSpeechSynthesizerClientImpl> m_webSpeechSynthesizerClient; };
diff --git a/third_party/WebKit/Source/platform/testing/FontTestHelpers.cpp b/third_party/WebKit/Source/platform/testing/FontTestHelpers.cpp index 8b94a36..91be6dd 100644 --- a/third_party/WebKit/Source/platform/testing/FontTestHelpers.cpp +++ b/third_party/WebKit/Source/platform/testing/FontTestHelpers.cpp
@@ -9,9 +9,9 @@ #include "platform/fonts/FontDescription.h" #include "platform/fonts/FontSelector.h" #include "platform/testing/UnitTestHelpers.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { namespace testing { @@ -50,12 +50,12 @@ void fontCacheInvalidated() override { } private: - TestFontSelector(PassOwnPtr<FontCustomPlatformData> customPlatformData) + TestFontSelector(std::unique_ptr<FontCustomPlatformData> customPlatformData) : m_customPlatformData(std::move(customPlatformData)) { } - OwnPtr<FontCustomPlatformData> m_customPlatformData; + std::unique_ptr<FontCustomPlatformData> m_customPlatformData; }; } // namespace
diff --git a/third_party/WebKit/Source/platform/testing/HistogramTester.cpp b/third_party/WebKit/Source/platform/testing/HistogramTester.cpp index 0e0fbb6..043ca952 100644 --- a/third_party/WebKit/Source/platform/testing/HistogramTester.cpp +++ b/third_party/WebKit/Source/platform/testing/HistogramTester.cpp
@@ -5,11 +5,11 @@ #include "platform/testing/HistogramTester.h" #include "base/test/histogram_tester.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" namespace blink { -HistogramTester::HistogramTester() : m_histogramTester(adoptPtr(new base::HistogramTester)) { } +HistogramTester::HistogramTester() : m_histogramTester(wrapUnique(new base::HistogramTester)) { } HistogramTester::~HistogramTester() { }
diff --git a/third_party/WebKit/Source/platform/testing/HistogramTester.h b/third_party/WebKit/Source/platform/testing/HistogramTester.h index 5d2a54a..16ccc152 100644 --- a/third_party/WebKit/Source/platform/testing/HistogramTester.h +++ b/third_party/WebKit/Source/platform/testing/HistogramTester.h
@@ -6,7 +6,7 @@ #define HistogramTester_h #include "platform/Histogram.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace base { class HistogramTester; @@ -24,7 +24,7 @@ void expectTotalCount(const std::string& name, base::HistogramBase::Count) const; private: - OwnPtr<base::HistogramTester> m_histogramTester; + std::unique_ptr<base::HistogramTester> m_histogramTester; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp b/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp index a14525d..83259b1 100644 --- a/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp +++ b/third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp
@@ -21,8 +21,9 @@ #include "platform/SharedBuffer.h" #include "platform/image-decoders/ImageDecoder.h" #include "public/platform/Platform.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> #if defined(_WIN32) #include <mmsystem.h> @@ -246,7 +247,7 @@ if (s.st_size <= 0) return SharedBuffer::create(); - OwnPtr<unsigned char[]> buffer = adoptArrayPtr(new unsigned char[fileSize]); + std::unique_ptr<unsigned char[]> buffer = wrapArrayUnique(new unsigned char[fileSize]); if (fileSize != fread(buffer.get(), 1, fileSize, fp)) { fprintf(stderr, "Error reading file %s\n", fileName); exit(2); @@ -258,7 +259,7 @@ bool decodeImageData(SharedBuffer* data, bool colorCorrection, size_t packetSize) { - OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, + std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::AlphaPremultiplied, colorCorrection ? ImageDecoder::GammaAndColorProfileApplied : ImageDecoder::GammaAndColorProfileIgnored);
diff --git a/third_party/WebKit/Source/platform/testing/RunAllTests.cpp b/third_party/WebKit/Source/platform/testing/RunAllTests.cpp index 2cd4f24..b84caf21 100644 --- a/third_party/WebKit/Source/platform/testing/RunAllTests.cpp +++ b/third_party/WebKit/Source/platform/testing/RunAllTests.cpp
@@ -40,6 +40,7 @@ #include "public/platform/Platform.h" #include "wtf/CryptographicallyRandomNumber.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" #include "wtf/WTF.h" #include "wtf/allocator/Partitions.h" #include <base/bind.h> @@ -49,6 +50,7 @@ #include <base/test/launcher/unit_test_launcher.h> #include <base/test/test_suite.h> #include <cc/blink/web_compositor_support_impl.h> +#include <memory> namespace { @@ -80,7 +82,7 @@ base::StatisticsRecorder::Initialize(); - OwnPtr<DummyPlatform> platform = adoptPtr(new DummyPlatform); + std::unique_ptr<DummyPlatform> platform = wrapUnique(new DummyPlatform); blink::Platform::setCurrentPlatformForTesting(platform.get()); WTF::Partitions::initialize(nullptr); @@ -103,7 +105,7 @@ mojo::edk::Init(); base::TestIOThread testIoThread(base::TestIOThread::kAutoStart); - WTF::OwnPtr<mojo::edk::test::ScopedIPCSupport> ipcSupport(adoptPtr(new mojo::edk::test::ScopedIPCSupport(testIoThread.task_runner()))); + std::unique_ptr<mojo::edk::test::ScopedIPCSupport> ipcSupport(wrapUnique(new mojo::edk::test::ScopedIPCSupport(testIoThread.task_runner()))); result = base::LaunchUnitTests(argc, argv, base::Bind(runTestSuite, base::Unretained(&testSuite))); blink::ThreadState::detachMainThread();
diff --git a/third_party/WebKit/Source/platform/testing/TestPaintArtifact.cpp b/third_party/WebKit/Source/platform/testing/TestPaintArtifact.cpp index a805e019..07878a9 100644 --- a/third_party/WebKit/Source/platform/testing/TestPaintArtifact.cpp +++ b/third_party/WebKit/Source/platform/testing/TestPaintArtifact.cpp
@@ -14,6 +14,8 @@ #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkPictureRecorder.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -74,7 +76,7 @@ TestPaintArtifact& TestPaintArtifact::rectDrawing(const FloatRect& bounds, Color color) { - OwnPtr<DummyRectClient> client = adoptPtr(new DummyRectClient(bounds, color)); + std::unique_ptr<DummyRectClient> client = wrapUnique(new DummyRectClient(bounds, color)); m_displayItemList.allocateAndConstruct<DrawingDisplayItem>( *client, DisplayItem::DrawingFirst, client->makePicture()); m_dummyClients.append(std::move(client)); @@ -84,7 +86,7 @@ TestPaintArtifact& TestPaintArtifact::foreignLayer(const FloatPoint& location, const IntSize& size, scoped_refptr<cc::Layer> layer) { FloatRect floatBounds(location, FloatSize(size)); - OwnPtr<DummyRectClient> client = adoptPtr(new DummyRectClient(floatBounds, Color::transparent)); + std::unique_ptr<DummyRectClient> client = wrapUnique(new DummyRectClient(floatBounds, Color::transparent)); m_displayItemList.allocateAndConstruct<ForeignLayerDisplayItem>( *client, DisplayItem::ForeignLayerFirst, std::move(layer), location, size); m_dummyClients.append(std::move(client));
diff --git a/third_party/WebKit/Source/platform/testing/TestPaintArtifact.h b/third_party/WebKit/Source/platform/testing/TestPaintArtifact.h index c8ff8a3..5392ee2 100644 --- a/third_party/WebKit/Source/platform/testing/TestPaintArtifact.h +++ b/third_party/WebKit/Source/platform/testing/TestPaintArtifact.h
@@ -10,9 +10,9 @@ #include "platform/graphics/paint/DisplayItemList.h" #include "platform/graphics/paint/PaintArtifact.h" #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" +#include <memory> namespace cc { class Layer; @@ -55,7 +55,7 @@ private: class DummyRectClient; - Vector<OwnPtr<DummyRectClient>> m_dummyClients; + Vector<std::unique_ptr<DummyRectClient>> m_dummyClients; // Exists if m_built is false. DisplayItemList m_displayItemList;
diff --git a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp index e8c7fbcf8..971224d 100644 --- a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp +++ b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp
@@ -30,6 +30,9 @@ #include "platform/testing/TestingPlatformSupport.h" +#include "wtf/PtrUtil.h" +#include <memory> + namespace blink { TestingPlatformSupport::TestingPlatformSupport() @@ -68,12 +71,12 @@ class TestingPlatformMockWebTaskRunner : public WebTaskRunner { WTF_MAKE_NONCOPYABLE(TestingPlatformMockWebTaskRunner); public: - explicit TestingPlatformMockWebTaskRunner(Deque<OwnPtr<WebTaskRunner::Task>>* tasks) : m_tasks(tasks) { } + explicit TestingPlatformMockWebTaskRunner(Deque<std::unique_ptr<WebTaskRunner::Task>>* tasks) : m_tasks(tasks) { } ~TestingPlatformMockWebTaskRunner() override { } void postTask(const WebTraceLocation&, Task* task) override { - m_tasks->append(adoptPtr(task)); + m_tasks->append(wrapUnique(task)); } void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) override @@ -99,13 +102,13 @@ } private: - Deque<OwnPtr<WebTaskRunner::Task>>* m_tasks; // NOT OWNED + Deque<std::unique_ptr<WebTaskRunner::Task>>* m_tasks; // NOT OWNED }; // TestingPlatformMockScheduler definition: TestingPlatformMockScheduler::TestingPlatformMockScheduler() - : m_mockWebTaskRunner(adoptPtr(new TestingPlatformMockWebTaskRunner(&m_tasks))) { } + : m_mockWebTaskRunner(wrapUnique(new TestingPlatformMockWebTaskRunner(&m_tasks))) { } TestingPlatformMockScheduler::~TestingPlatformMockScheduler() { } @@ -135,7 +138,7 @@ class TestingPlatformMockWebThread : public WebThread { WTF_MAKE_NONCOPYABLE(TestingPlatformMockWebThread); public: - TestingPlatformMockWebThread() : m_mockWebScheduler(adoptPtr(new TestingPlatformMockScheduler)) { } + TestingPlatformMockWebThread() : m_mockWebScheduler(wrapUnique(new TestingPlatformMockScheduler)) { } ~TestingPlatformMockWebThread() override { } WebTaskRunner* getWebTaskRunner() override @@ -160,17 +163,17 @@ } private: - OwnPtr<TestingPlatformMockScheduler> m_mockWebScheduler; + std::unique_ptr<TestingPlatformMockScheduler> m_mockWebScheduler; }; // TestingPlatformSupportWithMockScheduler definition: TestingPlatformSupportWithMockScheduler::TestingPlatformSupportWithMockScheduler() - : m_mockWebThread(adoptPtr(new TestingPlatformMockWebThread())) { } + : m_mockWebThread(wrapUnique(new TestingPlatformMockWebThread())) { } TestingPlatformSupportWithMockScheduler::TestingPlatformSupportWithMockScheduler(const Config& config) : TestingPlatformSupport(config) - , m_mockWebThread(adoptPtr(new TestingPlatformMockWebThread())) { } + , m_mockWebThread(wrapUnique(new TestingPlatformMockWebThread())) { } TestingPlatformSupportWithMockScheduler::~TestingPlatformSupportWithMockScheduler() { }
diff --git a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h index 9cc309c..bc5b15b 100644 --- a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h +++ b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h
@@ -37,6 +37,7 @@ #include "public/platform/WebScheduler.h" #include "public/platform/WebThread.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -74,8 +75,8 @@ void onNavigationStarted() override { } private: - WTF::Deque<OwnPtr<WebTaskRunner::Task>> m_tasks; - OwnPtr<TestingPlatformMockWebTaskRunner> m_mockWebTaskRunner; + WTF::Deque<std::unique_ptr<WebTaskRunner::Task>> m_tasks; + std::unique_ptr<TestingPlatformMockWebTaskRunner> m_mockWebTaskRunner; }; class TestingPlatformSupport : public Platform { @@ -112,7 +113,7 @@ TestingPlatformMockScheduler* mockWebScheduler(); protected: - OwnPtr<TestingPlatformMockWebThread> m_mockWebThread; + std::unique_ptr<TestingPlatformMockWebThread> m_mockWebThread; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h b/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h index 39f943af..5cd041c 100644 --- a/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h +++ b/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h
@@ -9,8 +9,6 @@ #include "cc/trees/layer_tree_host_client.h" #include "cc/trees/layer_tree_host_single_thread_client.h" #include "public/platform/WebLayerTreeView.h" -#include "wtf/PassOwnPtr.h" - #include <memory> namespace cc {
diff --git a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc index 35ff1445..3984742 100644 --- a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc +++ b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc
@@ -9,14 +9,13 @@ #include "public/platform/WebData.h" #include "public/platform/WebURLError.h" #include "public/platform/WebURLLoaderClient.h" -#include "wtf/PassOwnPtr.h" namespace blink { WebURLLoaderMock::WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory, WebURLLoader* default_loader) : factory_(factory), - default_loader_(adoptPtr(default_loader)), + default_loader_(wrapUnique(default_loader)), weak_factory_(this) { } @@ -35,9 +34,9 @@ // If no delegate is provided then create an empty one. The default behavior // will just proxy to the client. - OwnPtr<WebURLLoaderTestDelegate> default_delegate; + std::unique_ptr<WebURLLoaderTestDelegate> default_delegate; if (!delegate) { - default_delegate = adoptPtr(new WebURLLoaderTestDelegate()); + default_delegate = wrapUnique(new WebURLLoaderTestDelegate()); delegate = default_delegate.get(); }
diff --git a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.h b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.h index b796266..8978b77 100644 --- a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.h +++ b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.h
@@ -7,8 +7,8 @@ #include "base/macros.h" #include "public/platform/WebURLLoader.h" -#include "wtf/OwnPtr.h" #include "wtf/WeakPtr.h" +#include <memory> namespace blink { @@ -61,7 +61,7 @@ private: WebURLLoaderMockFactoryImpl* factory_ = nullptr; WebURLLoaderClient* client_ = nullptr; - OwnPtr<WebURLLoader> default_loader_; + std::unique_ptr<WebURLLoader> default_loader_; bool using_default_loader_ = false; bool is_deferred_ = false;
diff --git a/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp b/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp index e531959..993ad67 100644 --- a/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp +++ b/third_party/WebKit/Source/platform/text/BidiResolverTest.cpp
@@ -33,7 +33,6 @@ #include "platform/text/BidiTestHarness.h" #include "platform/text/TextRunIterator.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" #include <fstream> namespace blink {
diff --git a/third_party/WebKit/Source/platform/text/LocaleICU.cpp b/third_party/WebKit/Source/platform/text/LocaleICU.cpp index 7bed850a..300416e 100644 --- a/third_party/WebKit/Source/platform/text/LocaleICU.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleICU.cpp
@@ -30,20 +30,21 @@ #include "platform/text/LocaleICU.h" +#include "wtf/DateMath.h" +#include "wtf/PtrUtil.h" +#include "wtf/text/StringBuffer.h" +#include "wtf/text/StringBuilder.h" +#include <limits> +#include <memory> #include <unicode/udatpg.h> #include <unicode/udisplaycontext.h> #include <unicode/uloc.h> -#include <limits> -#include "wtf/DateMath.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/text/StringBuffer.h" -#include "wtf/text/StringBuilder.h" using namespace icu; namespace blink { -PassOwnPtr<Locale> Locale::create(const String& locale) +std::unique_ptr<Locale> Locale::create(const String& locale) { return LocaleICU::create(locale.utf8().data()); } @@ -69,9 +70,9 @@ udat_close(m_shortTimeFormat); } -PassOwnPtr<LocaleICU> LocaleICU::create(const char* localeString) +std::unique_ptr<LocaleICU> LocaleICU::create(const char* localeString) { - return adoptPtr(new LocaleICU(localeString)); + return wrapUnique(new LocaleICU(localeString)); } String LocaleICU::decimalSymbol(UNumberFormatSymbol symbol) @@ -180,14 +181,14 @@ return String::adopt(buffer); } -PassOwnPtr<Vector<String>> LocaleICU::createLabelVector(const UDateFormat* dateFormat, UDateFormatSymbolType type, int32_t startIndex, int32_t size) +std::unique_ptr<Vector<String>> LocaleICU::createLabelVector(const UDateFormat* dateFormat, UDateFormatSymbolType type, int32_t startIndex, int32_t size) { if (!dateFormat) - return PassOwnPtr<Vector<String>>(); + return std::unique_ptr<Vector<String>>(); if (udat_countSymbols(dateFormat, type) != startIndex + size) - return PassOwnPtr<Vector<String>>(); + return std::unique_ptr<Vector<String>>(); - OwnPtr<Vector<String>> labels = adoptPtr(new Vector<String>()); + std::unique_ptr<Vector<String>> labels = wrapUnique(new Vector<String>()); labels->reserveCapacity(size); bool isStandAloneMonth = (type == UDAT_STANDALONE_MONTHS) || (type == UDAT_STANDALONE_SHORT_MONTHS); for (int32_t i = 0; i < size; ++i) { @@ -201,7 +202,7 @@ length = udat_getSymbols(dateFormat, type, startIndex + i, 0, 0, &status); } if (status != U_BUFFER_OVERFLOW_ERROR) - return PassOwnPtr<Vector<String>>(); + return std::unique_ptr<Vector<String>>(); StringBuffer<UChar> buffer(length); status = U_ZERO_ERROR; if (isStandAloneMonth) { @@ -210,15 +211,15 @@ udat_getSymbols(dateFormat, type, startIndex + i, buffer.characters(), length, &status); } if (U_FAILURE(status)) - return PassOwnPtr<Vector<String>>(); + return std::unique_ptr<Vector<String>>(); labels->append(String::adopt(buffer)); } return labels; } -static PassOwnPtr<Vector<String>> createFallbackWeekDayShortLabels() +static std::unique_ptr<Vector<String>> createFallbackWeekDayShortLabels() { - OwnPtr<Vector<String>> labels = adoptPtr(new Vector<String>()); + std::unique_ptr<Vector<String>> labels = wrapUnique(new Vector<String>()); labels->reserveCapacity(7); labels->append("Sun"); labels->append("Mon"); @@ -247,9 +248,9 @@ m_weekDayShortLabels = createFallbackWeekDayShortLabels(); } -static PassOwnPtr<Vector<String>> createFallbackMonthLabels() +static std::unique_ptr<Vector<String>> createFallbackMonthLabels() { - OwnPtr<Vector<String>> labels = adoptPtr(new Vector<String>()); + std::unique_ptr<Vector<String>> labels = wrapUnique(new Vector<String>()); labels->reserveCapacity(WTF_ARRAY_LENGTH(WTF::monthFullName)); for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthFullName); ++i) labels->append(WTF::monthFullName[i]); @@ -287,9 +288,9 @@ return uloc_getCharacterOrientation(m_locale.data(), &status) == ULOC_LAYOUT_RTL; } -static PassOwnPtr<Vector<String>> createFallbackAMPMLabels() +static std::unique_ptr<Vector<String>> createFallbackAMPMLabels() { - OwnPtr<Vector<String>> labels = adoptPtr(new Vector<String>()); + std::unique_ptr<Vector<String>> labels = wrapUnique(new Vector<String>()); labels->reserveCapacity(2); labels->append("AM"); labels->append("PM"); @@ -318,7 +319,7 @@ m_dateTimeFormatWithoutSeconds = getDateFormatPattern(dateTimeFormatWithoutSeconds); udat_close(dateTimeFormatWithoutSeconds); - OwnPtr<Vector<String>> timeAMPMLabels = createLabelVector(m_mediumTimeFormat, UDAT_AM_PMS, UCAL_AM, 2); + std::unique_ptr<Vector<String>> timeAMPMLabels = createLabelVector(m_mediumTimeFormat, UDAT_AM_PMS, UCAL_AM, 2); if (!timeAMPMLabels) timeAMPMLabels = createFallbackAMPMLabels(); m_timeAMPMLabels = *timeAMPMLabels; @@ -405,7 +406,7 @@ if (!m_shortMonthLabels.isEmpty()) return m_shortMonthLabels; if (initializeShortDateFormat()) { - if (OwnPtr<Vector<String>> labels = createLabelVector(m_shortDateFormat, UDAT_SHORT_MONTHS, UCAL_JANUARY, 12)) { + if (std::unique_ptr<Vector<String>> labels = createLabelVector(m_shortDateFormat, UDAT_SHORT_MONTHS, UCAL_JANUARY, 12)) { m_shortMonthLabels = *labels; return m_shortMonthLabels; } @@ -422,7 +423,7 @@ return m_standAloneMonthLabels; UDateFormat* monthFormatter = openDateFormatForStandAloneMonthLabels(false); if (monthFormatter) { - if (OwnPtr<Vector<String>> labels = createLabelVector(monthFormatter, UDAT_STANDALONE_MONTHS, UCAL_JANUARY, 12)) { + if (std::unique_ptr<Vector<String>> labels = createLabelVector(monthFormatter, UDAT_STANDALONE_MONTHS, UCAL_JANUARY, 12)) { m_standAloneMonthLabels = *labels; udat_close(monthFormatter); return m_standAloneMonthLabels; @@ -439,7 +440,7 @@ return m_shortStandAloneMonthLabels; UDateFormat* monthFormatter = openDateFormatForStandAloneMonthLabels(true); if (monthFormatter) { - if (OwnPtr<Vector<String>> labels = createLabelVector(monthFormatter, UDAT_STANDALONE_SHORT_MONTHS, UCAL_JANUARY, 12)) { + if (std::unique_ptr<Vector<String>> labels = createLabelVector(monthFormatter, UDAT_STANDALONE_SHORT_MONTHS, UCAL_JANUARY, 12)) { m_shortStandAloneMonthLabels = *labels; udat_close(monthFormatter); return m_shortStandAloneMonthLabels;
diff --git a/third_party/WebKit/Source/platform/text/LocaleICU.h b/third_party/WebKit/Source/platform/text/LocaleICU.h index 9cc7574..5c7c2c6 100644 --- a/third_party/WebKit/Source/platform/text/LocaleICU.h +++ b/third_party/WebKit/Source/platform/text/LocaleICU.h
@@ -31,14 +31,14 @@ #ifndef LocaleICU_h #define LocaleICU_h -#include <unicode/udat.h> -#include <unicode/unum.h> #include "platform/DateComponents.h" #include "platform/text/PlatformLocale.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" +#include <memory> +#include <unicode/udat.h> +#include <unicode/unum.h> namespace blink { @@ -46,7 +46,7 @@ // and LocalizedNumberICUTest.cpp. class PLATFORM_EXPORT LocaleICU : public Locale { public: - static PassOwnPtr<LocaleICU> create(const char* localeString); + static std::unique_ptr<LocaleICU> create(const char* localeString); ~LocaleICU() override; const Vector<String>& weekDayShortLabels() override; @@ -80,7 +80,7 @@ void initializeCalendar(); - PassOwnPtr<Vector<String>> createLabelVector(const UDateFormat*, UDateFormatSymbolType, int32_t startIndex, int32_t size); + std::unique_ptr<Vector<String>> createLabelVector(const UDateFormat*, UDateFormatSymbolType, int32_t startIndex, int32_t size); void initializeDateTimeFormat(); CString m_locale; @@ -89,9 +89,9 @@ bool m_didCreateDecimalFormat; bool m_didCreateShortDateFormat; - OwnPtr<Vector<String>> m_weekDayShortLabels; + std::unique_ptr<Vector<String>> m_weekDayShortLabels; unsigned m_firstDayOfWeek; - OwnPtr<Vector<String>> m_monthLabels; + std::unique_ptr<Vector<String>> m_monthLabels; String m_dateFormat; String m_monthFormat; String m_shortMonthFormat;
diff --git a/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp b/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp index 256467bc..ff5e2b5 100644 --- a/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleICUTest.cpp
@@ -31,8 +31,8 @@ #include "platform/text/LocaleICU.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/StringBuilder.h" +#include <memory> #include <unicode/uvernum.h> namespace blink { @@ -89,49 +89,49 @@ String monthFormat(const char* localeString) { - OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); + std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); return locale->monthFormat(); } String localizedDateFormatText(const char* localeString) { - OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); + std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); return locale->timeFormat(); } String localizedShortDateFormatText(const char* localeString) { - OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); + std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); return locale->shortTimeFormat(); } String shortMonthLabel(const char* localeString, unsigned index) { - OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); + std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); return locale->shortMonthLabels()[index]; } String shortStandAloneMonthLabel(const char* localeString, unsigned index) { - OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); + std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); return locale->shortStandAloneMonthLabels()[index]; } String standAloneMonthLabel(const char* localeString, unsigned index) { - OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); + std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); return locale->standAloneMonthLabels()[index]; } Labels timeAMPMLabels(const char* localeString) { - OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); + std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); return Labels(locale->timeAMPMLabels()); } bool isRTL(const char* localeString) { - OwnPtr<LocaleICU> locale = LocaleICU::create(localeString); + std::unique_ptr<LocaleICU> locale = LocaleICU::create(localeString); return locale->isRTL(); } }; @@ -237,7 +237,7 @@ static String testDecimalSeparator(const AtomicString& localeIdentifier) { - OwnPtr<Locale> locale = Locale::create(localeIdentifier); + std::unique_ptr<Locale> locale = Locale::create(localeIdentifier); return locale->localizedDecimalSeparator(); } @@ -249,7 +249,7 @@ void testNumberIsReversible(const AtomicString& localeIdentifier, const char* original, const char* shouldHave = 0) { - OwnPtr<Locale> locale = Locale::create(localeIdentifier); + std::unique_ptr<Locale> locale = Locale::create(localeIdentifier); String localized = locale->convertToLocalizedNumber(original); if (shouldHave) EXPECT_TRUE(localized.contains(shouldHave));
diff --git a/third_party/WebKit/Source/platform/text/LocaleMac.h b/third_party/WebKit/Source/platform/text/LocaleMac.h index 8a8a563..ec3a367 100644 --- a/third_party/WebKit/Source/platform/text/LocaleMac.h +++ b/third_party/WebKit/Source/platform/text/LocaleMac.h
@@ -36,6 +36,7 @@ #include "wtf/RetainPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> OBJC_CLASS NSCalendar; OBJC_CLASS NSDateFormatter; @@ -45,8 +46,8 @@ class PLATFORM_EXPORT LocaleMac : public Locale { public: - static PassOwnPtr<LocaleMac> create(const String&); - static PassOwnPtr<LocaleMac> create(NSLocale*); + static std::unique_ptr<LocaleMac> create(const String&); + static std::unique_ptr<LocaleMac> create(NSLocale*); ~LocaleMac(); const Vector<String>& weekDayShortLabels() override;
diff --git a/third_party/WebKit/Source/platform/text/LocaleMac.mm b/third_party/WebKit/Source/platform/text/LocaleMac.mm index 39c762f..9a225b91 100644 --- a/third_party/WebKit/Source/platform/text/LocaleMac.mm +++ b/third_party/WebKit/Source/platform/text/LocaleMac.mm
@@ -35,9 +35,10 @@ #include "platform/Language.h" #include "platform/LayoutTestSupport.h" #include "wtf/DateMath.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RetainPtr.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -64,7 +65,7 @@ return RetainPtr<NSLocale>(AdoptNS, [[NSLocale alloc] initWithLocaleIdentifier:locale]); } -PassOwnPtr<Locale> Locale::create(const String& locale) +std::unique_ptr<Locale> Locale::create(const String& locale) { return LocaleMac::create(determineLocale(locale).get()); } @@ -97,15 +98,15 @@ { } -PassOwnPtr<LocaleMac> LocaleMac::create(const String& localeIdentifier) +std::unique_ptr<LocaleMac> LocaleMac::create(const String& localeIdentifier) { RetainPtr<NSLocale> locale = [[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier]; - return adoptPtr(new LocaleMac(locale.get())); + return wrapUnique(new LocaleMac(locale.get())); } -PassOwnPtr<LocaleMac> LocaleMac::create(NSLocale* locale) +std::unique_ptr<LocaleMac> LocaleMac::create(NSLocale* locale) { - return adoptPtr(new LocaleMac(locale)); + return wrapUnique(new LocaleMac(locale)); } RetainPtr<NSDateFormatter> LocaleMac::shortDateFormatter()
diff --git a/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp b/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp index 06fc799d..60c9f7e 100644 --- a/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleMacTest.cpp
@@ -31,8 +31,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/DateMath.h" #include "wtf/MathExtras.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/CString.h" +#include <memory> namespace blink { @@ -80,7 +80,7 @@ String formatWeek(const String& localeString, const String& isoString) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); DateComponents date; unsigned end; date.parseWeek(isoString, 0, end); @@ -89,7 +89,7 @@ String formatMonth(const String& localeString, const String& isoString, bool useShortFormat) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); DateComponents date; unsigned end; date.parseMonth(isoString, 0, end); @@ -98,85 +98,85 @@ String formatDate(const String& localeString, int year, int month, int day) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->formatDateTime(getDateComponents(year, month, day)); } String formatTime(const String& localeString, int hour, int minute, int second, int millisecond, bool useShortFormat) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->formatDateTime(getTimeComponents(hour, minute, second, millisecond), (useShortFormat ? Locale::FormatTypeShort : Locale::FormatTypeMedium)); } unsigned firstDayOfWeek(const String& localeString) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->firstDayOfWeek(); } String monthLabel(const String& localeString, unsigned index) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->monthLabels()[index]; } String weekDayShortLabel(const String& localeString, unsigned index) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->weekDayShortLabels()[index]; } bool isRTL(const String& localeString) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->isRTL(); } String monthFormat(const String& localeString) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->monthFormat(); } String timeFormat(const String& localeString) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->timeFormat(); } String shortTimeFormat(const String& localeString) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->shortTimeFormat(); } String shortMonthLabel(const String& localeString, unsigned index) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->shortMonthLabels()[index]; } String standAloneMonthLabel(const String& localeString, unsigned index) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->standAloneMonthLabels()[index]; } String shortStandAloneMonthLabel(const String& localeString, unsigned index) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->shortStandAloneMonthLabels()[index]; } String timeAMPMLabel(const String& localeString, unsigned index) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->timeAMPMLabels()[index]; } String decimalSeparator(const String& localeString) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); return locale->localizedDecimalSeparator(); } }; @@ -361,7 +361,7 @@ static void testNumberIsReversible(const AtomicString& localeString, const char* original, const char* shouldHave = 0) { - OwnPtr<LocaleMac> locale = LocaleMac::create(localeString); + std::unique_ptr<LocaleMac> locale = LocaleMac::create(localeString); String localized = locale->convertToLocalizedNumber(original); if (shouldHave) EXPECT_TRUE(localized.contains(shouldHave));
diff --git a/third_party/WebKit/Source/platform/text/LocaleWin.cpp b/third_party/WebKit/Source/platform/text/LocaleWin.cpp index 35a6ec7e..cdbd1b7 100644 --- a/third_party/WebKit/Source/platform/text/LocaleWin.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleWin.cpp
@@ -30,7 +30,6 @@ #include "platform/text/LocaleWin.h" -#include <limits> #include "platform/DateComponents.h" #include "platform/Language.h" #include "platform/LayoutTestSupport.h" @@ -38,11 +37,12 @@ #include "wtf/CurrentTime.h" #include "wtf/DateMath.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/StringHash.h" +#include <limits> +#include <memory> namespace blink { @@ -76,7 +76,7 @@ return lcid; } -PassOwnPtr<Locale> Locale::create(const String& locale) +std::unique_ptr<Locale> Locale::create(const String& locale) { // Whether the default settings for the locale should be used, ignoring user overrides. bool defaultsForLocale = LayoutTestSupport::isRunningLayoutTest(); @@ -95,9 +95,9 @@ m_firstDayOfWeek = (value + 1) % 7; } -PassOwnPtr<LocaleWin> LocaleWin::create(LCID lcid, bool defaultsForLocale) +std::unique_ptr<LocaleWin> LocaleWin::create(LCID lcid, bool defaultsForLocale) { - return adoptPtr(new LocaleWin(lcid, defaultsForLocale)); + return wrapUnique(new LocaleWin(lcid, defaultsForLocale)); } LocaleWin::~LocaleWin()
diff --git a/third_party/WebKit/Source/platform/text/LocaleWin.h b/third_party/WebKit/Source/platform/text/LocaleWin.h index 373a1fb..485e34bf 100644 --- a/third_party/WebKit/Source/platform/text/LocaleWin.h +++ b/third_party/WebKit/Source/platform/text/LocaleWin.h
@@ -31,17 +31,18 @@ #ifndef LocaleWin_h #define LocaleWin_h -#include <windows.h> #include "platform/text/PlatformLocale.h" #include "wtf/Forward.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> +#include <windows.h> namespace blink { class PLATFORM_EXPORT LocaleWin : public Locale { public: - static PassOwnPtr<LocaleWin> create(LCID, bool defaultsForLocale); + static std::unique_ptr<LocaleWin> create(LCID, bool defaultsForLocale); ~LocaleWin(); const Vector<String>& weekDayShortLabels() override; unsigned firstDayOfWeek() override;
diff --git a/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp b/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp index 898fe5b..70930c0 100644 --- a/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleWinTest.cpp
@@ -34,8 +34,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/DateMath.h" #include "wtf/MathExtras.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/CString.h" +#include <memory> namespace blink { @@ -84,67 +84,67 @@ String formatDate(LCID lcid, int year, int month, int day) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->formatDateTime(getDateComponents(year, month, day)); } unsigned firstDayOfWeek(LCID lcid) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->firstDayOfWeek(); } String monthLabel(LCID lcid, unsigned index) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->monthLabels()[index]; } String weekDayShortLabel(LCID lcid, unsigned index) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->weekDayShortLabels()[index]; } bool isRTL(LCID lcid) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->isRTL(); } String monthFormat(LCID lcid) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->monthFormat(); } String timeFormat(LCID lcid) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->timeFormat(); } String shortTimeFormat(LCID lcid) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->shortTimeFormat(); } String shortMonthLabel(LCID lcid, unsigned index) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->shortMonthLabels()[index]; } String timeAMPMLabel(LCID lcid, unsigned index) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->timeAMPMLabels()[index]; } String decimalSeparator(LCID lcid) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); return locale->localizedDecimalSeparator(); } }; @@ -261,7 +261,7 @@ static void testNumberIsReversible(LCID lcid, const char* original, const char* shouldHave = 0) { - OwnPtr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); + std::unique_ptr<LocaleWin> locale = LocaleWin::create(lcid, true /* defaultsForLocale */); String localized = locale->convertToLocalizedNumber(original); if (shouldHave) EXPECT_TRUE(localized.contains(shouldHave));
diff --git a/third_party/WebKit/Source/platform/text/PlatformLocale.cpp b/third_party/WebKit/Source/platform/text/PlatformLocale.cpp index 3641a7c7..d4a0f56 100644 --- a/third_party/WebKit/Source/platform/text/PlatformLocale.cpp +++ b/third_party/WebKit/Source/platform/text/PlatformLocale.cpp
@@ -33,6 +33,7 @@ #include "platform/text/DateTimeFormat.h" #include "public/platform/Platform.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -176,7 +177,7 @@ Locale& Locale::defaultLocale() { - static Locale* locale = Locale::create(defaultLanguage()).leakPtr(); + static Locale* locale = Locale::create(defaultLanguage()).release(); ASSERT(isMainThread()); return *locale; }
diff --git a/third_party/WebKit/Source/platform/text/PlatformLocale.h b/third_party/WebKit/Source/platform/text/PlatformLocale.h index d9189bb8f..ed248b3 100644 --- a/third_party/WebKit/Source/platform/text/PlatformLocale.h +++ b/third_party/WebKit/Source/platform/text/PlatformLocale.h
@@ -30,8 +30,8 @@ #include "platform/Language.h" #include "public/platform/WebLocalizedString.h" #include "wtf/Allocator.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -39,7 +39,7 @@ WTF_MAKE_NONCOPYABLE(Locale); USING_FAST_MALLOC(Locale); public: - static PassOwnPtr<Locale> create(const String& localeIdentifier); + static std::unique_ptr<Locale> create(const String& localeIdentifier); static Locale& defaultLocale(); String queryString(WebLocalizedString::Name);
diff --git a/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp b/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp index 9691763..eae10b8 100644 --- a/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp +++ b/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp
@@ -24,10 +24,11 @@ #include "platform/text/TextBreakIteratorInternalICU.h" #include "wtf/Assertions.h" #include "wtf/HashMap.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadSpecific.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/text/WTFString.h" +#include <memory> #include <unicode/rbbi.h> #include <unicode/ubrk.h> @@ -45,7 +46,7 @@ return **pool; } - static PassOwnPtr<LineBreakIteratorPool> create() { return adoptPtr(new LineBreakIteratorPool); } + static std::unique_ptr<LineBreakIteratorPool> create() { return wrapUnique(new LineBreakIteratorPool); } icu::BreakIterator* take(const AtomicString& locale) {
diff --git a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunner.h b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunner.h index f403459..63dc410 100644 --- a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunner.h +++ b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunner.h
@@ -7,7 +7,6 @@ #include "platform/PlatformExport.h" #include "wtf/Functional.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp index ec1e624..25f85362 100644 --- a/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp +++ b/third_party/WebKit/Source/platform/threading/BackgroundTaskRunnerTest.cpp
@@ -8,6 +8,8 @@ #include "platform/WaitableEvent.h" #include "public/platform/WebTraceLocation.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace { @@ -24,7 +26,7 @@ TEST_F(BackgroundTaskRunnerTest, RunShortTaskOnBackgroundThread) { - OwnPtr<WaitableEvent> doneEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent()); BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&PingPongTask, AllowCrossThreadAccess(doneEvent.get())), BackgroundTaskRunner::TaskSizeShortRunningTask); // Test passes by not hanging on the following wait(). doneEvent->wait(); @@ -32,7 +34,7 @@ TEST_F(BackgroundTaskRunnerTest, RunLongTaskOnBackgroundThread) { - OwnPtr<WaitableEvent> doneEvent = adoptPtr(new WaitableEvent()); + std::unique_ptr<WaitableEvent> doneEvent = wrapUnique(new WaitableEvent()); BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&PingPongTask, AllowCrossThreadAccess(doneEvent.get())), BackgroundTaskRunner::TaskSizeLongRunningTask); // Test passes by not hanging on the following wait(). doneEvent->wait();
diff --git a/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h b/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h index 64f47ad..14fdd36 100644 --- a/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h +++ b/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h
@@ -32,7 +32,8 @@ #include "wtf/Alignment.h" #include "wtf/Allocator.h" #include "wtf/CPU.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> #include <string.h> // for memcpy namespace blink { @@ -61,24 +62,24 @@ typedef double Matrix4[4][4]; #endif - static PassOwnPtr<TransformationMatrix> create() + static std::unique_ptr<TransformationMatrix> create() { - return adoptPtr(new TransformationMatrix()); + return wrapUnique(new TransformationMatrix()); } - static PassOwnPtr<TransformationMatrix> create(const TransformationMatrix& t) + static std::unique_ptr<TransformationMatrix> create(const TransformationMatrix& t) { - return adoptPtr(new TransformationMatrix(t)); + return wrapUnique(new TransformationMatrix(t)); } - static PassOwnPtr<TransformationMatrix> create(double a, double b, double c, double d, double e, double f) + static std::unique_ptr<TransformationMatrix> create(double a, double b, double c, double d, double e, double f) { - return adoptPtr(new TransformationMatrix(a, b, c, d, e, f)); + return wrapUnique(new TransformationMatrix(a, b, c, d, e, f)); } - static PassOwnPtr<TransformationMatrix> create(double m11, double m12, double m13, double m14, + static std::unique_ptr<TransformationMatrix> create(double m11, double m12, double m13, double m14, double m21, double m22, double m23, double m24, double m31, double m32, double m33, double m34, double m41, double m42, double m43, double m44) { - return adoptPtr(new TransformationMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)); + return wrapUnique(new TransformationMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)); } TransformationMatrix()
diff --git a/third_party/WebKit/Source/platform/web_process_memory_dump.cc b/third_party/WebKit/Source/platform/web_process_memory_dump.cc index 46f768a..5da3aef 100644 --- a/third_party/WebKit/Source/platform/web_process_memory_dump.cc +++ b/third_party/WebKit/Source/platform/web_process_memory_dump.cc
@@ -74,7 +74,7 @@ // memory_allocator_dumps_ will take ownership of // |web_memory_allocator_dump|. memory_allocator_dumps_.set( - memory_allocator_dump, adoptPtr(web_memory_allocator_dump)); + memory_allocator_dump, wrapUnique(web_memory_allocator_dump)); return web_memory_allocator_dump; }
diff --git a/third_party/WebKit/Source/platform/web_process_memory_dump.h b/third_party/WebKit/Source/platform/web_process_memory_dump.h index 5fb92cda..ed7310f 100644 --- a/third_party/WebKit/Source/platform/web_process_memory_dump.h +++ b/third_party/WebKit/Source/platform/web_process_memory_dump.h
@@ -12,9 +12,7 @@ #include "platform/PlatformExport.h" #include "platform/web_memory_allocator_dump.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" - #include <map> #include <memory> #include <vector> @@ -158,7 +156,7 @@ // Those pointers are valid only within the scope of the call and can be // safely torn down once the WebProcessMemoryDump itself is destroyed. HashMap<base::trace_event::MemoryAllocatorDump*, - OwnPtr<WebMemoryAllocatorDump>> memory_allocator_dumps_; + std::unique_ptr<WebMemoryAllocatorDump>> memory_allocator_dumps_; // Stores SkTraceMemoryDump for the current ProcessMemoryDump. std::vector<std::unique_ptr<skia::SkiaTraceMemoryDumpImpl>> sk_trace_dump_list_;
diff --git a/third_party/WebKit/Source/platform/web_process_memory_dump_test.cc b/third_party/WebKit/Source/platform/web_process_memory_dump_test.cc index aafa2d6..09875fb 100644 --- a/third_party/WebKit/Source/platform/web_process_memory_dump_test.cc +++ b/third_party/WebKit/Source/platform/web_process_memory_dump_test.cc
@@ -12,7 +12,6 @@ #include "base/values.h" #include "platform/web_memory_allocator_dump.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/platform/weborigin/KURL.cpp b/third_party/WebKit/Source/platform/weborigin/KURL.cpp index d8b32348..b191958 100644 --- a/third_party/WebKit/Source/platform/weborigin/KURL.cpp +++ b/third_party/WebKit/Source/platform/weborigin/KURL.cpp
@@ -29,6 +29,7 @@ #include "platform/weborigin/KnownPorts.h" #include "url/url_util.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/text/CString.h" #include "wtf/text/StringHash.h" @@ -274,7 +275,7 @@ , m_string(other.m_string) { if (other.m_innerURL.get()) - m_innerURL = adoptPtr(new KURL(other.m_innerURL->copy())); + m_innerURL = wrapUnique(new KURL(other.m_innerURL->copy())); } KURL::~KURL() @@ -288,7 +289,7 @@ m_parsed = other.m_parsed; m_string = other.m_string; if (other.m_innerURL) - m_innerURL = adoptPtr(new KURL(other.m_innerURL->copy())); + m_innerURL = wrapUnique(new KURL(other.m_innerURL->copy())); else m_innerURL.reset(); return *this; @@ -302,7 +303,7 @@ result.m_parsed = m_parsed; result.m_string = m_string.isolatedCopy(); if (m_innerURL) - result.m_innerURL = adoptPtr(new KURL(m_innerURL->copy())); + result.m_innerURL = wrapUnique(new KURL(m_innerURL->copy())); return result; } @@ -818,7 +819,7 @@ return; } if (url::Parsed* innerParsed = m_parsed.inner_parsed()) - m_innerURL = adoptPtr(new KURL(ParsedURLString, m_string.substring(innerParsed->scheme.begin, innerParsed->Length() - innerParsed->scheme.begin))); + m_innerURL = wrapUnique(new KURL(ParsedURLString, m_string.substring(innerParsed->scheme.begin, innerParsed->Length() - innerParsed->scheme.begin))); else m_innerURL.reset(); }
diff --git a/third_party/WebKit/Source/platform/weborigin/KURL.h b/third_party/WebKit/Source/platform/weborigin/KURL.h index ce7c730..abb207f 100644 --- a/third_party/WebKit/Source/platform/weborigin/KURL.h +++ b/third_party/WebKit/Source/platform/weborigin/KURL.h
@@ -32,8 +32,8 @@ #include "wtf/Allocator.h" #include "wtf/Forward.h" #include "wtf/HashTableDeletedValueType.h" -#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { class TextEncoding; @@ -202,7 +202,7 @@ bool m_protocolIsInHTTPFamily; url::Parsed m_parsed; String m_string; - OwnPtr<KURL> m_innerURL; + std::unique_ptr<KURL> m_innerURL; }; PLATFORM_EXPORT bool operator==(const KURL&, const KURL&);
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp index 395869e..4560bab 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
@@ -37,10 +37,10 @@ #include "url/url_canon_ip.h" #include "wtf/HexNumber.h" #include "wtf/NotFound.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/text/StringBuilder.h" +#include <memory> namespace blink { @@ -565,16 +565,16 @@ return uniqueSecurityOriginURL; } -PassOwnPtr<SecurityOrigin::PrivilegeData> SecurityOrigin::createPrivilegeData() const +std::unique_ptr<SecurityOrigin::PrivilegeData> SecurityOrigin::createPrivilegeData() const { - OwnPtr<PrivilegeData> privilegeData = adoptPtr(new PrivilegeData); + std::unique_ptr<PrivilegeData> privilegeData = wrapUnique(new PrivilegeData); privilegeData->m_universalAccess = m_universalAccess; privilegeData->m_canLoadLocalResources = m_canLoadLocalResources; privilegeData->m_blockLocalAccessFromLocalOrigin = m_blockLocalAccessFromLocalOrigin; return privilegeData; } -void SecurityOrigin::transferPrivilegesFrom(PassOwnPtr<PrivilegeData> privilegeData) +void SecurityOrigin::transferPrivilegesFrom(std::unique_ptr<PrivilegeData> privilegeData) { m_universalAccess = privilegeData->m_universalAccess; m_canLoadLocalResources = privilegeData->m_canLoadLocalResources;
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h index 6b06883..bfc37ff 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h
@@ -35,6 +35,7 @@ #include "wtf/Noncopyable.h" #include "wtf/ThreadSafeRefCounted.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -251,8 +252,8 @@ bool m_canLoadLocalResources; bool m_blockLocalAccessFromLocalOrigin; }; - PassOwnPtr<PrivilegeData> createPrivilegeData() const; - void transferPrivilegesFrom(PassOwnPtr<PrivilegeData>); + std::unique_ptr<PrivilegeData> createPrivilegeData() const; + void transferPrivilegesFrom(std::unique_ptr<PrivilegeData>); void setUniqueOriginIsPotentiallyTrustworthy(bool isUniqueOriginPotentiallyTrustworthy);
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp index 14cde14..e915a51 100644 --- a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp +++ b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp
@@ -35,15 +35,15 @@ #include "platform/weborigin/SecurityOrigin.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Threading.h" #include "wtf/text/StringHash.h" +#include <memory> namespace blink { using OriginAccessWhiteList = Vector<OriginAccessEntry>; -using OriginAccessMap = HashMap<String, OwnPtr<OriginAccessWhiteList>>; +using OriginAccessMap = HashMap<String, std::unique_ptr<OriginAccessWhiteList>>; using OriginSet = HashSet<String>; static OriginAccessMap& originAccessMap() @@ -186,7 +186,7 @@ String sourceString = sourceOrigin.toString(); OriginAccessMap::AddResult result = originAccessMap().add(sourceString, nullptr); if (result.isNewEntry) - result.storedValue->value = adoptPtr(new OriginAccessWhiteList); + result.storedValue->value = wrapUnique(new OriginAccessWhiteList); OriginAccessWhiteList* list = result.storedValue->value.get(); list->append(OriginAccessEntry(destinationProtocol, destinationDomain, allowDestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry::DisallowSubdomains));
diff --git a/third_party/WebKit/Source/web/AssociatedURLLoader.cpp b/third_party/WebKit/Source/web/AssociatedURLLoader.cpp index 008e332..a740f02 100644 --- a/third_party/WebKit/Source/web/AssociatedURLLoader.cpp +++ b/third_party/WebKit/Source/web/AssociatedURLLoader.cpp
@@ -48,8 +48,10 @@ #include "public/web/WebDataSource.h" #include "web/WebLocalFrameImpl.h" #include "wtf/HashSet.h" +#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" #include <limits.h> +#include <memory> namespace blink { @@ -79,11 +81,11 @@ class AssociatedURLLoader::ClientAdapter final : public DocumentThreadableLoaderClient { WTF_MAKE_NONCOPYABLE(ClientAdapter); public: - static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderClient*, const WebURLLoaderOptions&); + static std::unique_ptr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderClient*, const WebURLLoaderOptions&); // ThreadableLoaderClient void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) override; - void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) override; + void didReceiveResponse(unsigned long, const ResourceResponse&, std::unique_ptr<WebDataConsumerHandle>) override; void didDownloadData(int /*dataLength*/) override; void didReceiveData(const char*, unsigned /*dataLength*/) override; void didReceiveCachedMetadata(const char*, int /*dataLength*/) override; @@ -123,9 +125,9 @@ bool m_didFail; }; -PassOwnPtr<AssociatedURLLoader::ClientAdapter> AssociatedURLLoader::ClientAdapter::create(AssociatedURLLoader* loader, WebURLLoaderClient* client, const WebURLLoaderOptions& options) +std::unique_ptr<AssociatedURLLoader::ClientAdapter> AssociatedURLLoader::ClientAdapter::create(AssociatedURLLoader* loader, WebURLLoaderClient* client, const WebURLLoaderOptions& options) { - return adoptPtr(new ClientAdapter(loader, client, options)); + return wrapUnique(new ClientAdapter(loader, client, options)); } AssociatedURLLoader::ClientAdapter::ClientAdapter(AssociatedURLLoader* loader, WebURLLoaderClient* client, const WebURLLoaderOptions& options) @@ -158,7 +160,7 @@ m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent); } -void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) +void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response, std::unique_ptr<WebDataConsumerHandle> handle) { ASSERT_UNUSED(handle, !handle); if (!m_client)
diff --git a/third_party/WebKit/Source/web/AssociatedURLLoader.h b/third_party/WebKit/Source/web/AssociatedURLLoader.h index 234b8b6..990d43c 100644 --- a/third_party/WebKit/Source/web/AssociatedURLLoader.h +++ b/third_party/WebKit/Source/web/AssociatedURLLoader.h
@@ -35,8 +35,8 @@ #include "public/platform/WebURLLoader.h" #include "public/web/WebURLLoaderOptions.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -83,8 +83,8 @@ // An adapter which converts the DocumentThreadableLoaderClient method // calls into the WebURLLoaderClient method calls. - OwnPtr<ClientAdapter> m_clientAdapter; - OwnPtr<DocumentThreadableLoader> m_loader; + std::unique_ptr<ClientAdapter> m_clientAdapter; + std::unique_ptr<DocumentThreadableLoader> m_loader; // A ContextLifecycleObserver for cancelling |m_loader| when the Document // is detached.
diff --git a/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp b/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp index ff6deb36..e29d874 100644 --- a/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp +++ b/third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp
@@ -45,8 +45,10 @@ #include "public/web/WebView.h" #include "testing/gtest/include/gtest/gtest.h" #include "web/tests/FrameTestHelpers.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" +#include <memory> using blink::URLTestHelpers::toKURL; using blink::testing::runPendingTasks; @@ -115,16 +117,16 @@ Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); } - PassOwnPtr<WebURLLoader> createAssociatedURLLoader(const WebURLLoaderOptions options = WebURLLoaderOptions()) + std::unique_ptr<WebURLLoader> createAssociatedURLLoader(const WebURLLoaderOptions options = WebURLLoaderOptions()) { - return adoptPtr(mainFrame()->createAssociatedURLLoader(options)); + return wrapUnique(mainFrame()->createAssociatedURLLoader(options)); } // WebURLLoaderClient implementation. void willFollowRedirect(WebURLLoader* loader, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) override { m_willFollowRedirect = true; - EXPECT_EQ(m_expectedLoader, loader); + EXPECT_EQ(m_expectedLoader.get(), loader); EXPECT_EQ(m_expectedNewRequest.url(), newRequest.url()); // Check that CORS simple headers are transferred to the new request. EXPECT_EQ(m_expectedNewRequest.httpHeaderField("accept"), newRequest.httpHeaderField("accept")); @@ -136,14 +138,14 @@ void didSendData(WebURLLoader* loader, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override { m_didSendData = true; - EXPECT_EQ(m_expectedLoader, loader); + EXPECT_EQ(m_expectedLoader.get(), loader); } void didReceiveResponse(WebURLLoader* loader, const WebURLResponse& response) override { m_didReceiveResponse = true; m_actualResponse = WebURLResponse(response); - EXPECT_EQ(m_expectedLoader, loader); + EXPECT_EQ(m_expectedLoader.get(), loader); EXPECT_EQ(m_expectedResponse.url(), response.url()); EXPECT_EQ(m_expectedResponse.httpStatusCode(), response.httpStatusCode()); } @@ -151,13 +153,13 @@ void didDownloadData(WebURLLoader* loader, int dataLength, int encodedDataLength) override { m_didDownloadData = true; - EXPECT_EQ(m_expectedLoader, loader); + EXPECT_EQ(m_expectedLoader.get(), loader); } void didReceiveData(WebURLLoader* loader, const char* data, int dataLength, int encodedDataLength) override { m_didReceiveData = true; - EXPECT_EQ(m_expectedLoader, loader); + EXPECT_EQ(m_expectedLoader.get(), loader); EXPECT_TRUE(data); EXPECT_GT(dataLength, 0); } @@ -165,19 +167,19 @@ void didReceiveCachedMetadata(WebURLLoader* loader, const char* data, int dataLength) override { m_didReceiveCachedMetadata = true; - EXPECT_EQ(m_expectedLoader, loader); + EXPECT_EQ(m_expectedLoader.get(), loader); } void didFinishLoading(WebURLLoader* loader, double finishTime, int64_t encodedDataLength) override { m_didFinishLoading = true; - EXPECT_EQ(m_expectedLoader, loader); + EXPECT_EQ(m_expectedLoader.get(), loader); } void didFail(WebURLLoader* loader, const WebURLError& error) override { m_didFail = true; - EXPECT_EQ(m_expectedLoader, loader); + EXPECT_EQ(m_expectedLoader.get(), loader); } void CheckMethodFails(const char* unsafeMethod) @@ -268,7 +270,7 @@ String m_frameFilePath; FrameTestHelpers::WebViewHelper m_helper; - OwnPtr<WebURLLoader> m_expectedLoader; + std::unique_ptr<WebURLLoader> m_expectedLoader; WebURLResponse m_actualResponse; WebURLResponse m_expectedResponse; WebURLRequest m_expectedNewRequest;
diff --git a/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.cpp b/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.cpp index 4607fba..f1d32424 100644 --- a/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.cpp +++ b/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.cpp
@@ -8,6 +8,7 @@ #include "core/dom/ExecutionContext.h" #include "public/web/WebFrameClient.h" #include "web/WebLocalFrameImpl.h" +#include <memory> namespace blink { @@ -24,13 +25,13 @@ { } -void AudioOutputDeviceClientImpl::checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext* context, const WebString& sinkId, PassOwnPtr<WebSetSinkIdCallbacks> callbacks) +void AudioOutputDeviceClientImpl::checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext* context, const WebString& sinkId, std::unique_ptr<WebSetSinkIdCallbacks> callbacks) { DCHECK(context); DCHECK(context->isDocument()); Document* document = toDocument(context); WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame()); - webFrame->client()->checkIfAudioSinkExistsAndIsAuthorized(sinkId, WebSecurityOrigin(context->getSecurityOrigin()), callbacks.leakPtr()); + webFrame->client()->checkIfAudioSinkExistsAndIsAuthorized(sinkId, WebSecurityOrigin(context->getSecurityOrigin()), callbacks.release()); } } // namespace blink
diff --git a/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.h b/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.h index 62e6da5..b8bd34c 100644 --- a/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.h +++ b/third_party/WebKit/Source/web/AudioOutputDeviceClientImpl.h
@@ -7,6 +7,7 @@ #include "modules/audio_output_devices/AudioOutputDeviceClient.h" #include "platform/heap/Handle.h" +#include <memory> namespace blink { @@ -19,7 +20,7 @@ ~AudioOutputDeviceClientImpl() override; // AudioOutputDeviceClient implementation. - void checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext*, const WebString& sinkId, PassOwnPtr<WebSetSinkIdCallbacks>) override; + void checkIfAudioSinkExistsAndIsAuthorized(ExecutionContext*, const WebString& sinkId, std::unique_ptr<WebSetSinkIdCallbacks>) override; // GarbageCollectedFinalized implementation. DEFINE_INLINE_VIRTUAL_TRACE() { AudioOutputDeviceClient::trace(visitor); }
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp index f3d796c7..6b3b603 100644 --- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp +++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -103,10 +103,12 @@ #include "web/WebPluginContainerImpl.h" #include "web/WebSettingsImpl.h" #include "web/WebViewImpl.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/StringConcatenate.h" +#include <memory> namespace blink { @@ -1113,9 +1115,9 @@ m_webView->pageImportanceSignals()->setIssuedNonGetFetchFromScript(); } -PassOwnPtr<WebFrameScheduler> ChromeClientImpl::createFrameScheduler(BlameContext* blameContext) +std::unique_ptr<WebFrameScheduler> ChromeClientImpl::createFrameScheduler(BlameContext* blameContext) { - return adoptPtr(m_webView->scheduler()->createFrameScheduler(blameContext).release()); + return wrapUnique(m_webView->scheduler()->createFrameScheduler(blameContext).release()); } double ChromeClientImpl::lastFrameTimeMonotonic() const
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.h b/third_party/WebKit/Source/web/ChromeClientImpl.h index 183ca260..72f56e20 100644 --- a/third_party/WebKit/Source/web/ChromeClientImpl.h +++ b/third_party/WebKit/Source/web/ChromeClientImpl.h
@@ -36,7 +36,7 @@ #include "core/page/WindowFeatures.h" #include "public/web/WebNavigationPolicy.h" #include "web/WebExport.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -184,7 +184,7 @@ void didObserveNonGetFetchFromScript() const override; - PassOwnPtr<WebFrameScheduler> createFrameScheduler(BlameContext*) override; + std::unique_ptr<WebFrameScheduler> createFrameScheduler(BlameContext*) override; double lastFrameTimeMonotonic() const override;
diff --git a/third_party/WebKit/Source/web/ColorChooserPopupUIController.h b/third_party/WebKit/Source/web/ColorChooserPopupUIController.h index 933ab26c..a0d7aa8 100644 --- a/third_party/WebKit/Source/web/ColorChooserPopupUIController.h +++ b/third_party/WebKit/Source/web/ColorChooserPopupUIController.h
@@ -28,7 +28,6 @@ #include "core/page/PagePopupClient.h" #include "web/ColorChooserUIController.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/ColorChooserUIController.cpp b/third_party/WebKit/Source/web/ColorChooserUIController.cpp index 93ebd3c..8e5dccd 100644 --- a/third_party/WebKit/Source/web/ColorChooserUIController.cpp +++ b/third_party/WebKit/Source/web/ColorChooserUIController.cpp
@@ -32,6 +32,7 @@ #include "public/web/WebColorSuggestion.h" #include "public/web/WebFrameClient.h" #include "web/WebLocalFrameImpl.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -98,7 +99,7 @@ WebFrameClient* webFrameClient = frame->client(); if (!webFrameClient) return; - m_chooser = adoptPtr(webFrameClient->createColorChooser( + m_chooser = wrapUnique(webFrameClient->createColorChooser( this, static_cast<WebColor>(m_client->currentColor().rgb()), m_client->suggestions())); }
diff --git a/third_party/WebKit/Source/web/ColorChooserUIController.h b/third_party/WebKit/Source/web/ColorChooserUIController.h index 123b86d3..e83acd7e 100644 --- a/third_party/WebKit/Source/web/ColorChooserUIController.h +++ b/third_party/WebKit/Source/web/ColorChooserUIController.h
@@ -30,7 +30,7 @@ #include "platform/heap/Handle.h" #include "platform/text/PlatformLocale.h" #include "public/web/WebColorChooserClient.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -64,7 +64,7 @@ ColorChooserUIController(LocalFrame*, ColorChooserClient*); void openColorChooser(); - OwnPtr<WebColorChooser> m_chooser; + std::unique_ptr<WebColorChooser> m_chooser; Member<ColorChooserClient> m_client; Member<LocalFrame> m_frame;
diff --git a/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp b/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp index 211ea54..79709e1 100644 --- a/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp +++ b/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp
@@ -14,6 +14,7 @@ #include "platform/heap/Handle.h" #include "public/platform/Platform.h" #include "web/CompositorProxyClientImpl.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -30,7 +31,7 @@ } // namespace CompositorMutatorImpl::CompositorMutatorImpl() - : m_animationManager(adoptPtr(new CustomCompositorAnimationManager)) + : m_animationManager(wrapUnique(new CustomCompositorAnimationManager)) , m_client(nullptr) { }
diff --git a/third_party/WebKit/Source/web/CompositorMutatorImpl.h b/third_party/WebKit/Source/web/CompositorMutatorImpl.h index 7fa50747..a5281b6 100644 --- a/third_party/WebKit/Source/web/CompositorMutatorImpl.h +++ b/third_party/WebKit/Source/web/CompositorMutatorImpl.h
@@ -10,8 +10,7 @@ #include "platform/heap/Handle.h" #include "platform/heap/HeapAllocator.h" #include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -54,7 +53,7 @@ using ProxyClients = HeapHashSet<WeakMember<CompositorProxyClientImpl>>; ProxyClients m_proxyClients; - OwnPtr<CustomCompositorAnimationManager> m_animationManager; + std::unique_ptr<CustomCompositorAnimationManager> m_animationManager; CompositorMutatorClient* m_client; };
diff --git a/third_party/WebKit/Source/web/ContextFeaturesClientImpl.h b/third_party/WebKit/Source/web/ContextFeaturesClientImpl.h index 64b5b07..3e1b9e3 100644 --- a/third_party/WebKit/Source/web/ContextFeaturesClientImpl.h +++ b/third_party/WebKit/Source/web/ContextFeaturesClientImpl.h
@@ -32,14 +32,16 @@ #define ContextFeaturesClientImpl_h #include "core/dom/ContextFeatures.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { class ContextFeaturesClientImpl final : public ContextFeaturesClient { public: - static PassOwnPtr<ContextFeaturesClientImpl> create() + static std::unique_ptr<ContextFeaturesClientImpl> create() { - return adoptPtr(new ContextFeaturesClientImpl()); + return wrapUnique(new ContextFeaturesClientImpl()); } bool isEnabled(Document*, ContextFeatures::FeatureType, bool defaultValue) override;
diff --git a/third_party/WebKit/Source/web/DateTimeChooserImpl.h b/third_party/WebKit/Source/web/DateTimeChooserImpl.h index 1949bf2..419cbd7 100644 --- a/third_party/WebKit/Source/web/DateTimeChooserImpl.h +++ b/third_party/WebKit/Source/web/DateTimeChooserImpl.h
@@ -33,6 +33,7 @@ #include "core/html/forms/DateTimeChooser.h" #include "core/page/PagePopupClient.h" +#include <memory> namespace blink { @@ -67,7 +68,7 @@ Member<DateTimeChooserClient> m_client; PagePopup* m_popup; DateTimeChooserParameters m_parameters; - OwnPtr<Locale> m_locale; + std::unique_ptr<Locale> m_locale; }; } // namespace blink
diff --git a/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.cpp b/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.cpp index c9a6881..bb651146 100644 --- a/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.cpp +++ b/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.cpp
@@ -43,6 +43,7 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" #include "web/WorkerContentSettingsClient.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -54,7 +55,7 @@ WorkerClients* workerClients = WorkerClients::create(); provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create()); provideLocalFileSystemToWorker(workerClients, LocalFileSystemClient::create()); - provideContentSettingsClientToWorker(workerClients, adoptPtr(webFrame->client()->createWorkerContentSettingsClientProxy())); + provideContentSettingsClientToWorker(workerClients, wrapUnique(webFrame->client()->createWorkerContentSettingsClientProxy())); // FIXME: call provideServiceWorkerContainerClientToWorker here when we // support ServiceWorker in dedicated workers (http://crbug.com/371690) return new DedicatedWorkerMessagingProxy(worker, workerClients);
diff --git a/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.h b/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.h index 8ed01a7..1f99166e 100644 --- a/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.h +++ b/third_party/WebKit/Source/web/DedicatedWorkerGlobalScopeProxyProviderImpl.h
@@ -33,7 +33,6 @@ #include "core/workers/DedicatedWorkerGlobalScopeProxyProvider.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/DevToolsEmulator.cpp b/third_party/WebKit/Source/web/DevToolsEmulator.cpp index 3b8be5b..848f4e1 100644 --- a/third_party/WebKit/Source/web/DevToolsEmulator.cpp +++ b/third_party/WebKit/Source/web/DevToolsEmulator.cpp
@@ -16,6 +16,7 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebSettingsImpl.h" #include "web/WebViewImpl.h" +#include "wtf/PtrUtil.h" namespace { @@ -366,8 +367,8 @@ PlatformGestureEventBuilder gestureEvent(frameView, static_cast<const WebGestureEvent&>(inputEvent)); float pageScaleFactor = page->pageScaleFactor(); if (gestureEvent.type() == PlatformEvent::GesturePinchBegin) { - m_lastPinchAnchorCss = adoptPtr(new IntPoint(frameView->scrollPosition() + gestureEvent.position())); - m_lastPinchAnchorDip = adoptPtr(new IntPoint(gestureEvent.position())); + m_lastPinchAnchorCss = wrapUnique(new IntPoint(frameView->scrollPosition() + gestureEvent.position())); + m_lastPinchAnchorDip = wrapUnique(new IntPoint(gestureEvent.position())); m_lastPinchAnchorDip->scale(pageScaleFactor, pageScaleFactor); } if (gestureEvent.type() == PlatformEvent::GesturePinchUpdate && m_lastPinchAnchorCss) {
diff --git a/third_party/WebKit/Source/web/DevToolsEmulator.h b/third_party/WebKit/Source/web/DevToolsEmulator.h index 73c35b4..07836526 100644 --- a/third_party/WebKit/Source/web/DevToolsEmulator.h +++ b/third_party/WebKit/Source/web/DevToolsEmulator.h
@@ -10,7 +10,7 @@ #include "public/platform/WebViewportStyle.h" #include "public/web/WebDeviceEmulationParams.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -83,8 +83,8 @@ bool m_originalDeviceSupportsMouse; bool m_originalDeviceSupportsTouch; int m_originalMaxTouchPoints; - OwnPtr<IntPoint> m_lastPinchAnchorCss; - OwnPtr<IntPoint> m_lastPinchAnchorDip; + std::unique_ptr<IntPoint> m_lastPinchAnchorCss; + std::unique_ptr<IntPoint> m_lastPinchAnchorDip; bool m_embedderScriptEnabled; bool m_scriptExecutionDisabled;
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp index b9c93176a..b3e73d3 100644 --- a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp +++ b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
@@ -50,6 +50,7 @@ #include "public/web/WebPopupMenuInfo.h" #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -111,7 +112,7 @@ #if OS(MACOSX) const WebInputEvent* currentEvent = WebViewImpl::currentInputEvent(); if (currentEvent && currentEvent->type == WebInputEvent::MouseDown) { - m_syntheticEvent = adoptPtr(new WebMouseEvent); + m_syntheticEvent = wrapUnique(new WebMouseEvent); *m_syntheticEvent = *static_cast<const WebMouseEvent*>(currentEvent); m_syntheticEvent->type = WebInputEvent::MouseUp; m_dispatchEventTimer.startOneShot(0, BLINK_FROM_HERE);
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenu.h b/third_party/WebKit/Source/web/ExternalPopupMenu.h index e11ef4b..497343c2 100644 --- a/third_party/WebKit/Source/web/ExternalPopupMenu.h +++ b/third_party/WebKit/Source/web/ExternalPopupMenu.h
@@ -38,6 +38,7 @@ #include "public/web/WebExternalPopupMenuClient.h" #include "web/WebExport.h" #include "wtf/Compiler.h" +#include <memory> namespace blink { @@ -85,7 +86,7 @@ Member<HTMLSelectElement> m_ownerElement; Member<LocalFrame> m_localFrame; WebViewImpl& m_webView; - OwnPtr<WebMouseEvent> m_syntheticEvent; + std::unique_ptr<WebMouseEvent> m_syntheticEvent; Timer<ExternalPopupMenu> m_dispatchEventTimer; // The actual implementor of the show menu. WebExternalPopupMenu* m_webExternalPopupMenu;
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp b/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp index b4bd8b0..a48b89b2 100644 --- a/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp +++ b/third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp
@@ -23,6 +23,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" +#include <memory> namespace blink { @@ -42,7 +43,7 @@ m_dummyPageHolder->document().updateStyleAndLayoutIgnorePendingStylesheets(); } - OwnPtr<DummyPageHolder> m_dummyPageHolder; + std::unique_ptr<DummyPageHolder> m_dummyPageHolder; Persistent<HTMLSelectElement> m_ownerElement; };
diff --git a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp index 108b2af..0f4a87b 100644 --- a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp +++ b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
@@ -103,9 +103,11 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebPluginContainerImpl.h" #include "web/WebViewImpl.h" +#include "wtf/PtrUtil.h" #include "wtf/StringExtras.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" +#include <memory> #include <v8.h> namespace blink { @@ -803,7 +805,7 @@ return container; } -PassOwnPtr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer( +std::unique_ptr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer( HTMLMediaElement& htmlMediaElement, const WebMediaPlayerSource& source, WebMediaPlayerClient* client) @@ -820,17 +822,17 @@ HTMLMediaElementEncryptedMedia& encryptedMedia = HTMLMediaElementEncryptedMedia::from(htmlMediaElement); WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement)); - return adoptPtr(webFrame->client()->createMediaPlayer(source, + return wrapUnique(webFrame->client()->createMediaPlayer(source, client, &encryptedMedia, encryptedMedia.contentDecryptionModule(), sinkId, webMediaSession)); } -PassOwnPtr<WebMediaSession> FrameLoaderClientImpl::createWebMediaSession() +std::unique_ptr<WebMediaSession> FrameLoaderClientImpl::createWebMediaSession() { if (!m_webFrame->client()) return nullptr; - return adoptPtr(m_webFrame->client()->createMediaSession()); + return wrapUnique(m_webFrame->client()->createMediaSession()); } ObjectContentType FrameLoaderClientImpl::getObjectContentType( @@ -963,11 +965,11 @@ m_webFrame->client()->willInsertBody(m_webFrame); } -PassOwnPtr<WebServiceWorkerProvider> FrameLoaderClientImpl::createServiceWorkerProvider() +std::unique_ptr<WebServiceWorkerProvider> FrameLoaderClientImpl::createServiceWorkerProvider() { if (!m_webFrame->client()) return nullptr; - return adoptPtr(m_webFrame->client()->createServiceWorkerProvider()); + return wrapUnique(m_webFrame->client()->createServiceWorkerProvider()); } bool FrameLoaderClientImpl::isControlledByServiceWorker(DocumentLoader& loader) @@ -987,11 +989,11 @@ return m_webFrame->sharedWorkerRepositoryClient(); } -PassOwnPtr<WebApplicationCacheHost> FrameLoaderClientImpl::createApplicationCacheHost(WebApplicationCacheHostClient* client) +std::unique_ptr<WebApplicationCacheHost> FrameLoaderClientImpl::createApplicationCacheHost(WebApplicationCacheHostClient* client) { if (!m_webFrame->client()) return nullptr; - return adoptPtr(m_webFrame->client()->createApplicationCacheHost(client)); + return wrapUnique(m_webFrame->client()->createApplicationCacheHost(client)); } void FrameLoaderClientImpl::dispatchDidChangeManifest()
diff --git a/third_party/WebKit/Source/web/FrameLoaderClientImpl.h b/third_party/WebKit/Source/web/FrameLoaderClientImpl.h index 46f1519..a8035c5 100644 --- a/third_party/WebKit/Source/web/FrameLoaderClientImpl.h +++ b/third_party/WebKit/Source/web/FrameLoaderClientImpl.h
@@ -36,8 +36,8 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" #include "public/platform/WebInsecureRequestPolicy.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -131,8 +131,8 @@ HTMLPlugInElement*, const KURL&, const Vector<WTF::String>&, const Vector<WTF::String>&, const WTF::String&, bool loadManually, DetachedPluginPolicy) override; - PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override; - PassOwnPtr<WebMediaSession> createWebMediaSession() override; + std::unique_ptr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, const WebMediaPlayerSource&, WebMediaPlayerClient*) override; + std::unique_ptr<WebMediaSession> createWebMediaSession() override; ObjectContentType getObjectContentType( const KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages) override; void didChangeScrollOffset() override; @@ -165,12 +165,12 @@ void dispatchWillInsertBody() override; - PassOwnPtr<WebServiceWorkerProvider> createServiceWorkerProvider() override; + std::unique_ptr<WebServiceWorkerProvider> createServiceWorkerProvider() override; bool isControlledByServiceWorker(DocumentLoader&) override; int64_t serviceWorkerID(DocumentLoader&) override; SharedWorkerRepositoryClient* sharedWorkerRepositoryClient() override; - PassOwnPtr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) override; + std::unique_ptr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) override; void dispatchDidChangeManifest() override;
diff --git a/third_party/WebKit/Source/web/FullscreenController.h b/third_party/WebKit/Source/web/FullscreenController.h index 2655d15d..039535c 100644 --- a/third_party/WebKit/Source/web/FullscreenController.h +++ b/third_party/WebKit/Source/web/FullscreenController.h
@@ -34,7 +34,6 @@ #include "platform/geometry/FloatPoint.h" #include "platform/geometry/IntSize.h" #include "platform/heap/Handle.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/InspectorOverlay.cpp b/third_party/WebKit/Source/web/InspectorOverlay.cpp index f88ab50d..80d894cc 100644 --- a/third_party/WebKit/Source/web/InspectorOverlay.cpp +++ b/third_party/WebKit/Source/web/InspectorOverlay.cpp
@@ -58,6 +58,7 @@ #include "web/WebInputEventConversion.h" #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" +#include <memory> #include <v8.h> namespace blink { @@ -320,7 +321,7 @@ scheduleUpdate(); } -void InspectorOverlay::setInspectMode(InspectorDOMAgent::SearchMode searchMode, PassOwnPtr<InspectorHighlightConfig> highlightConfig) +void InspectorOverlay::setInspectMode(InspectorDOMAgent::SearchMode searchMode, std::unique_ptr<InspectorHighlightConfig> highlightConfig) { if (m_layoutEditor) overlayClearSelection(true); @@ -348,7 +349,7 @@ initializeLayoutEditorIfNeeded(node); } -void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const InspectorHighlightConfig& highlightConfig) +void InspectorOverlay::highlightQuad(std::unique_ptr<FloatQuad> quad, const InspectorHighlightConfig& highlightConfig) { m_quadHighlightConfig = highlightConfig; m_highlightQuad = std::move(quad);
diff --git a/third_party/WebKit/Source/web/InspectorOverlay.h b/third_party/WebKit/Source/web/InspectorOverlay.h index 3975ed1..c9daa2b 100644 --- a/third_party/WebKit/Source/web/InspectorOverlay.h +++ b/third_party/WebKit/Source/web/InspectorOverlay.h
@@ -38,10 +38,9 @@ #include "platform/heap/Handle.h" #include "platform/inspector_protocol/Values.h" #include "public/web/WebInputEvent.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -110,8 +109,8 @@ // InspectorDOMAgent::Client implementation. void hideHighlight() override; void highlightNode(Node*, const InspectorHighlightConfig&, bool omitTooltip) override; - void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlightConfig&) override; - void setInspectMode(InspectorDOMAgent::SearchMode, PassOwnPtr<InspectorHighlightConfig>) override; + void highlightQuad(std::unique_ptr<FloatQuad>, const InspectorHighlightConfig&) override; + void setInspectMode(InspectorDOMAgent::SearchMode, std::unique_ptr<InspectorHighlightConfig>) override; void setInspectedNode(Node*) override; void highlightNode(Node*, Node* eventTarget, const InspectorHighlightConfig&, bool omitTooltip); @@ -145,7 +144,7 @@ Member<Node> m_highlightNode; Member<Node> m_eventTargetNode; InspectorHighlightConfig m_nodeHighlightConfig; - OwnPtr<FloatQuad> m_highlightQuad; + std::unique_ptr<FloatQuad> m_highlightQuad; Member<Page> m_overlayPage; Member<InspectorOverlayChromeClient> m_overlayChromeClient; Member<InspectorOverlayHost> m_overlayHost; @@ -161,10 +160,10 @@ Member<InspectorDOMAgent> m_domAgent; Member<InspectorCSSAgent> m_cssAgent; Member<LayoutEditor> m_layoutEditor; - OwnPtr<PageOverlay> m_pageOverlay; + std::unique_ptr<PageOverlay> m_pageOverlay; Member<Node> m_hoveredNodeForInspectMode; InspectorDOMAgent::SearchMode m_inspectMode; - OwnPtr<InspectorHighlightConfig> m_inspectModeHighlightConfig; + std::unique_ptr<InspectorHighlightConfig> m_inspectModeHighlightConfig; }; } // namespace blink
diff --git a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp index 9df40f3..81153985a 100644 --- a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp +++ b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp
@@ -59,13 +59,15 @@ #include "web/WebSettingsImpl.h" #include "web/WebViewImpl.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> namespace blink { -PassOwnPtr<LinkHighlightImpl> LinkHighlightImpl::create(Node* node, WebViewImpl* owningWebViewImpl) +std::unique_ptr<LinkHighlightImpl> LinkHighlightImpl::create(Node* node, WebViewImpl* owningWebViewImpl) { - return adoptPtr(new LinkHighlightImpl(node, owningWebViewImpl)); + return wrapUnique(new LinkHighlightImpl(node, owningWebViewImpl)); } LinkHighlightImpl::LinkHighlightImpl(Node* node, WebViewImpl* owningWebViewImpl) @@ -81,8 +83,8 @@ DCHECK(owningWebViewImpl); WebCompositorSupport* compositorSupport = Platform::current()->compositorSupport(); DCHECK(compositorSupport); - m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); - m_clipLayer = adoptPtr(compositorSupport->createLayer()); + m_contentLayer = wrapUnique(compositorSupport->createContentLayer(this)); + m_clipLayer = wrapUnique(compositorSupport->createLayer()); m_clipLayer->setTransformOrigin(WebFloatPoint3D()); m_clipLayer->addChild(m_contentLayer->layer()); @@ -302,7 +304,7 @@ m_contentLayer->layer()->setOpacity(startOpacity); - OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); + std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); const auto easeType = CubicBezierTimingFunction::EaseType::EASE; @@ -314,10 +316,10 @@ // For layout tests we don't fade out. curve->addCubicBezierKeyframe(CompositorFloatKeyframe(fadeDuration + extraDurationRequired, layoutTestMode() ? startOpacity : 0), easeType); - OwnPtr<CompositorAnimation> animation = CompositorAnimation::create(*curve, CompositorTargetProperty::OPACITY, 0, 0); + std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create(*curve, CompositorTargetProperty::OPACITY, 0, 0); m_contentLayer->layer()->setDrawsContent(true); - m_compositorPlayer->addAnimation(animation.leakPtr()); + m_compositorPlayer->addAnimation(animation.release()); invalidate(); m_owningWebViewImpl->scheduleAnimation();
diff --git a/third_party/WebKit/Source/web/LinkHighlightImpl.h b/third_party/WebKit/Source/web/LinkHighlightImpl.h index d92a28a..86c28fc 100644 --- a/third_party/WebKit/Source/web/LinkHighlightImpl.h +++ b/third_party/WebKit/Source/web/LinkHighlightImpl.h
@@ -36,7 +36,7 @@ #include "public/platform/WebContentLayerClient.h" #include "web/WebExport.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -52,7 +52,7 @@ , public CompositorAnimationDelegate , public CompositorAnimationPlayerClient { public: - static PassOwnPtr<LinkHighlightImpl> create(Node*, WebViewImpl*); + static std::unique_ptr<LinkHighlightImpl> create(Node*, WebViewImpl*); ~LinkHighlightImpl() override; WebContentLayer* contentLayer(); @@ -91,15 +91,15 @@ // size since the last call to this function. bool computeHighlightLayerPathAndPosition(const LayoutBoxModelObject&); - OwnPtr<WebContentLayer> m_contentLayer; - OwnPtr<WebLayer> m_clipLayer; + std::unique_ptr<WebContentLayer> m_contentLayer; + std::unique_ptr<WebLayer> m_clipLayer; Path m_path; Persistent<Node> m_node; WebViewImpl* m_owningWebViewImpl; GraphicsLayer* m_currentGraphicsLayer; bool m_isScrollingGraphicsLayer; - OwnPtr<CompositorAnimationPlayer> m_compositorPlayer; + std::unique_ptr<CompositorAnimationPlayer> m_compositorPlayer; bool m_geometryNeedsUpdate; bool m_isAnimating;
diff --git a/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp b/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp index 4a7f761a..c4551696 100644 --- a/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp +++ b/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp
@@ -47,7 +47,8 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" #include "web/tests/FrameTestHelpers.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -166,7 +167,7 @@ // A lifetime test: delete LayerTreeView while running LinkHighlights. TEST(LinkHighlightImplTest, resetLayerTreeView) { - OwnPtr<FakeCompositingWebViewClient> webViewClient = adoptPtr(new FakeCompositingWebViewClient()); + std::unique_ptr<FakeCompositingWebViewClient> webViewClient = wrapUnique(new FakeCompositingWebViewClient()); const std::string baseURL("http://www.test.com/"); const std::string fileName("test_touch_link_highlight.html");
diff --git a/third_party/WebKit/Source/web/LocalFileSystemClient.cpp b/third_party/WebKit/Source/web/LocalFileSystemClient.cpp index ad431ca..76e1690 100644 --- a/third_party/WebKit/Source/web/LocalFileSystemClient.cpp +++ b/third_party/WebKit/Source/web/LocalFileSystemClient.cpp
@@ -38,13 +38,15 @@ #include "public/web/WebContentSettingsClient.h" #include "web/WebLocalFrameImpl.h" #include "web/WorkerContentSettingsClient.h" +#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { -PassOwnPtr<FileSystemClient> LocalFileSystemClient::create() +std::unique_ptr<FileSystemClient> LocalFileSystemClient::create() { - return adoptPtr(static_cast<FileSystemClient*>(new LocalFileSystemClient())); + return wrapUnique(static_cast<FileSystemClient*>(new LocalFileSystemClient())); } LocalFileSystemClient::~LocalFileSystemClient() @@ -63,7 +65,7 @@ return WorkerContentSettingsClient::from(*toWorkerGlobalScope(context))->requestFileSystemAccessSync(); } -void LocalFileSystemClient::requestFileSystemAccessAsync(ExecutionContext* context, PassOwnPtr<ContentSettingCallbacks> callbacks) +void LocalFileSystemClient::requestFileSystemAccessAsync(ExecutionContext* context, std::unique_ptr<ContentSettingCallbacks> callbacks) { DCHECK(context); if (!context->isDocument()) {
diff --git a/third_party/WebKit/Source/web/LocalFileSystemClient.h b/third_party/WebKit/Source/web/LocalFileSystemClient.h index 597d55f..4326d2b 100644 --- a/third_party/WebKit/Source/web/LocalFileSystemClient.h +++ b/third_party/WebKit/Source/web/LocalFileSystemClient.h
@@ -33,17 +33,18 @@ #include "modules/filesystem/FileSystemClient.h" #include "wtf/Forward.h" +#include <memory> namespace blink { class LocalFileSystemClient final : public FileSystemClient { public: - static PassOwnPtr<FileSystemClient> create(); + static std::unique_ptr<FileSystemClient> create(); ~LocalFileSystemClient() override; bool requestFileSystemAccessSync(ExecutionContext*) override; - void requestFileSystemAccessAsync(ExecutionContext*, PassOwnPtr<ContentSettingCallbacks>) override; + void requestFileSystemAccessAsync(ExecutionContext*, std::unique_ptr<ContentSettingCallbacks>) override; private: LocalFileSystemClient();
diff --git a/third_party/WebKit/Source/web/MIDIClientProxy.h b/third_party/WebKit/Source/web/MIDIClientProxy.h index 05395e8d..9f8cefaf 100644 --- a/third_party/WebKit/Source/web/MIDIClientProxy.h +++ b/third_party/WebKit/Source/web/MIDIClientProxy.h
@@ -33,6 +33,8 @@ #include "modules/webmidi/MIDIClient.h" #include "platform/heap/Handle.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -42,9 +44,9 @@ class MIDIClientProxy final : public MIDIClient { public: - static PassOwnPtr<MIDIClientProxy> create(WebMIDIClient* client) + static std::unique_ptr<MIDIClientProxy> create(WebMIDIClient* client) { - return adoptPtr(new MIDIClientProxy(client)); + return wrapUnique(new MIDIClientProxy(client)); } // MIDIClient
diff --git a/third_party/WebKit/Source/web/PageOverlay.cpp b/third_party/WebKit/Source/web/PageOverlay.cpp index cfb2d80e..e113b7f 100644 --- a/third_party/WebKit/Source/web/PageOverlay.cpp +++ b/third_party/WebKit/Source/web/PageOverlay.cpp
@@ -40,12 +40,14 @@ #include "public/web/WebViewClient.h" #include "web/WebDevToolsAgentImpl.h" #include "web/WebViewImpl.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { -PassOwnPtr<PageOverlay> PageOverlay::create(WebViewImpl* viewImpl, PageOverlay::Delegate* delegate) +std::unique_ptr<PageOverlay> PageOverlay::create(WebViewImpl* viewImpl, PageOverlay::Delegate* delegate) { - return adoptPtr(new PageOverlay(viewImpl, delegate)); + return wrapUnique(new PageOverlay(viewImpl, delegate)); } PageOverlay::PageOverlay(WebViewImpl* viewImpl, PageOverlay::Delegate* delegate)
diff --git a/third_party/WebKit/Source/web/PageOverlay.h b/third_party/WebKit/Source/web/PageOverlay.h index c027ea2..e261c4f2 100644 --- a/third_party/WebKit/Source/web/PageOverlay.h +++ b/third_party/WebKit/Source/web/PageOverlay.h
@@ -33,9 +33,8 @@ #include "platform/graphics/GraphicsLayerClient.h" #include "platform/graphics/paint/DisplayItemClient.h" #include "web/WebExport.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -59,7 +58,7 @@ virtual ~Delegate() { } }; - static PassOwnPtr<PageOverlay> create(WebViewImpl*, PageOverlay::Delegate*); + static std::unique_ptr<PageOverlay> create(WebViewImpl*, PageOverlay::Delegate*); ~PageOverlay(); @@ -83,7 +82,7 @@ WebViewImpl* m_viewImpl; Persistent<PageOverlay::Delegate> m_delegate; - OwnPtr<GraphicsLayer> m_layer; + std::unique_ptr<GraphicsLayer> m_layer; }; } // namespace blink
diff --git a/third_party/WebKit/Source/web/PageOverlayTest.cpp b/third_party/WebKit/Source/web/PageOverlayTest.cpp index 5eddde85..5ada6d1 100644 --- a/third_party/WebKit/Source/web/PageOverlayTest.cpp +++ b/third_party/WebKit/Source/web/PageOverlayTest.cpp
@@ -22,6 +22,7 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" #include "web/tests/FrameTestHelpers.h" +#include <memory> using testing::_; using testing::AtLeast; @@ -79,7 +80,7 @@ WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } - PassOwnPtr<PageOverlay> createSolidYellowOverlay() + std::unique_ptr<PageOverlay> createSolidYellowOverlay() { return PageOverlay::create(webViewImpl(), new SolidColorOverlay(SK_ColorYELLOW)); } @@ -111,7 +112,7 @@ initialize(AcceleratedCompositing); webViewImpl()->layerTreeView()->setViewportSize(WebSize(viewportWidth, viewportHeight)); - OwnPtr<PageOverlay> pageOverlay = createSolidYellowOverlay(); + std::unique_ptr<PageOverlay> pageOverlay = createSolidYellowOverlay(); pageOverlay->update(); webViewImpl()->updateAllLifecyclePhases(); @@ -141,7 +142,7 @@ TEST_F(PageOverlayTest, PageOverlay_VisualRect) { initialize(AcceleratedCompositing); - OwnPtr<PageOverlay> pageOverlay = createSolidYellowOverlay(); + std::unique_ptr<PageOverlay> pageOverlay = createSolidYellowOverlay(); pageOverlay->update(); webViewImpl()->updateAllLifecyclePhases(); EXPECT_EQ(LayoutRect(0, 0, viewportWidth, viewportHeight), pageOverlay->visualRect());
diff --git a/third_party/WebKit/Source/web/PageWidgetDelegate.h b/third_party/WebKit/Source/web/PageWidgetDelegate.h index ef12d7a..95f9b1ef 100644 --- a/third_party/WebKit/Source/web/PageWidgetDelegate.h +++ b/third_party/WebKit/Source/web/PageWidgetDelegate.h
@@ -35,7 +35,6 @@ #include "public/web/WebInputEvent.h" #include "public/web/WebWidget.h" #include "web/WebExport.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp b/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp index e3b220f..b22754b 100644 --- a/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp +++ b/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp
@@ -18,6 +18,8 @@ #include "web/WebInputEventConversion.h" #include "web/WebLocalFrameImpl.h" #include "web/WebRemoteFrameImpl.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -172,11 +174,11 @@ // This is only called when we have out-of-process iframes, which // need to forward input events across processes. // FIXME: Add a check for out-of-process iframes enabled. - OwnPtr<WebInputEvent> webEvent; + std::unique_ptr<WebInputEvent> webEvent; if (event->isKeyboardEvent()) - webEvent = adoptPtr(new WebKeyboardEventBuilder(*static_cast<KeyboardEvent*>(event))); + webEvent = wrapUnique(new WebKeyboardEventBuilder(*static_cast<KeyboardEvent*>(event))); else if (event->isMouseEvent()) - webEvent = adoptPtr(new WebMouseEventBuilder(m_webFrame->frame()->view(), LayoutItem(m_webFrame->toImplBase()->frame()->ownerLayoutObject()), *static_cast<MouseEvent*>(event))); + webEvent = wrapUnique(new WebMouseEventBuilder(m_webFrame->frame()->view(), LayoutItem(m_webFrame->toImplBase()->frame()->ownerLayoutObject()), *static_cast<MouseEvent*>(event))); // Other or internal Blink events should not be forwarded. if (!webEvent || webEvent->type == WebInputEvent::Undefined)
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.cpp index b3cfe304..2983d67 100644 --- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.cpp +++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.cpp
@@ -34,7 +34,7 @@ #include "public/platform/WebURL.h" #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -122,14 +122,14 @@ m_client.didHandleSyncEvent(syncEventID, result); } -void ServiceWorkerGlobalScopeClientImpl::postMessageToClient(const WebString& clientUUID, const WebString& message, PassOwnPtr<WebMessagePortChannelArray> webChannels) +void ServiceWorkerGlobalScopeClientImpl::postMessageToClient(const WebString& clientUUID, const WebString& message, std::unique_ptr<WebMessagePortChannelArray> webChannels) { - m_client.postMessageToClient(clientUUID, message, webChannels.leakPtr()); + m_client.postMessageToClient(clientUUID, message, webChannels.release()); } -void ServiceWorkerGlobalScopeClientImpl::postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient& client, const WebString& message, PassOwnPtr<WebMessagePortChannelArray> webChannels) +void ServiceWorkerGlobalScopeClientImpl::postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient& client, const WebString& message, std::unique_ptr<WebMessagePortChannelArray> webChannels) { - m_client.postMessageToCrossOriginClient(client, message, webChannels.leakPtr()); + m_client.postMessageToCrossOriginClient(client, message, webChannels.release()); } void ServiceWorkerGlobalScopeClientImpl::skipWaiting(WebServiceWorkerSkipWaitingCallbacks* callbacks)
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.h b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.h index 52d6d4a..e9ca382 100644 --- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.h +++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.h
@@ -34,7 +34,7 @@ #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" #include "public/platform/modules/serviceworker/WebServiceWorkerSkipWaitingCallbacks.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -65,8 +65,8 @@ void didHandleNotificationCloseEvent(int eventID, WebServiceWorkerEventResult) override; void didHandlePushEvent(int pushEventID, WebServiceWorkerEventResult) override; void didHandleSyncEvent(int syncEventID, WebServiceWorkerEventResult) override; - void postMessageToClient(const WebString& clientUUID, const WebString& message, PassOwnPtr<WebMessagePortChannelArray>) override; - void postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient&, const WebString& message, PassOwnPtr<WebMessagePortChannelArray>) override; + void postMessageToClient(const WebString& clientUUID, const WebString& message, std::unique_ptr<WebMessagePortChannelArray>) override; + void postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient&, const WebString& message, std::unique_ptr<WebMessagePortChannelArray>) override; void skipWaiting(WebServiceWorkerSkipWaitingCallbacks*) override; void claim(WebServiceWorkerClientsClaimCallbacks*) override; void focus(const WebString& clientUUID, WebServiceWorkerClientCallbacks*) override;
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp index e998bb0..80b9d7d 100644 --- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp +++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -64,8 +64,8 @@ #include "web/WebEmbeddedWorkerImpl.h" #include "wtf/Assertions.h" #include "wtf/Functional.h" -#include "wtf/PassOwnPtr.h" - +#include "wtf/PtrUtil.h" +#include <memory> #include <utility> namespace blink { @@ -124,7 +124,7 @@ String origin; if (!sourceOrigin.isUnique()) origin = sourceOrigin.toString(); - ServiceWorker* source = ServiceWorker::from(m_workerGlobalScope->getExecutionContext(), adoptPtr(handle.release())); + ServiceWorker* source = ServiceWorker::from(m_workerGlobalScope->getExecutionContext(), wrapUnique(handle.release())); WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Message, eventID); Event* event = ExtendableMessageEvent::create(value, origin, ports, source, observer); @@ -217,7 +217,7 @@ return m_workerGlobalScope->hasEventListeners(EventTypeNames::fetch); } -void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, PassOwnPtr<SourceLocation> location) +void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, std::unique_ptr<SourceLocation> location) { client().reportException(errorMessage, location->lineNumber(), location->columnNumber(), location->url()); }
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h index bddf8ab9..70c9a54 100644 --- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h +++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h
@@ -37,7 +37,7 @@ #include "public/platform/WebString.h" #include "public/web/modules/serviceworker/WebServiceWorkerContextProxy.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" +#include <memory> namespace blink { @@ -84,7 +84,7 @@ bool hasFetchEventHandler() override; // WorkerReportingProxy overrides: - void reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) override; + void reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) override; void reportConsoleMessage(ConsoleMessage*) override; void postMessageToPageInspector(const String&) override; void postWorkerConsoleAgentEnabled() override { }
diff --git a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp index 9971e968..d70c05e 100644 --- a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp +++ b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp
@@ -50,13 +50,15 @@ #include "public/web/WebSharedWorkerCreationErrors.h" #include "public/web/WebSharedWorkerRepositoryClient.h" #include "web/WebLocalFrameImpl.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { // Callback class that keeps the SharedWorker and WebSharedWorker objects alive while connecting. class SharedWorkerConnector : private WebSharedWorkerConnector::ConnectListener { public: - SharedWorkerConnector(SharedWorker* worker, const KURL& url, const String& name, WebMessagePortChannelUniquePtr channel, PassOwnPtr<WebSharedWorkerConnector> webWorkerConnector) + SharedWorkerConnector(SharedWorker* worker, const KURL& url, const String& name, WebMessagePortChannelUniquePtr channel, std::unique_ptr<WebSharedWorkerConnector> webWorkerConnector) : m_worker(worker) , m_url(url) , m_name(name) @@ -74,7 +76,7 @@ Persistent<SharedWorker> m_worker; KURL m_url; String m_name; - OwnPtr<WebSharedWorkerConnector> m_webWorkerConnector; + std::unique_ptr<WebSharedWorkerConnector> m_webWorkerConnector; WebMessagePortChannelUniquePtr m_channel; }; @@ -120,7 +122,7 @@ // when multiple might have been sent. Fix by making the // SharedWorkerConnector interface take a map that can contain // multiple headers. - OwnPtr<Vector<CSPHeaderAndType>> headers = worker->getExecutionContext()->contentSecurityPolicy()->headers(); + std::unique_ptr<Vector<CSPHeaderAndType>> headers = worker->getExecutionContext()->contentSecurityPolicy()->headers(); WebString header; WebContentSecurityPolicyType headerType = WebContentSecurityPolicyTypeReport; @@ -132,7 +134,7 @@ WebWorkerCreationError creationError; String unusedSecureContextError; bool isSecureContext = worker->getExecutionContext()->isSecureContext(unusedSecureContextError); - OwnPtr<WebSharedWorkerConnector> webWorkerConnector = adoptPtr(m_client->createSharedWorkerConnector(url, name, getId(document), header, headerType, worker->getExecutionContext()->securityContext().addressSpace(), isSecureContext ? WebSharedWorkerCreationContextTypeSecure : WebSharedWorkerCreationContextTypeNonsecure, &creationError)); + std::unique_ptr<WebSharedWorkerConnector> webWorkerConnector = wrapUnique(m_client->createSharedWorkerConnector(url, name, getId(document), header, headerType, worker->getExecutionContext()->securityContext().addressSpace(), isSecureContext ? WebSharedWorkerCreationContextTypeSecure : WebSharedWorkerCreationContextTypeNonsecure, &creationError)); if (creationError != WebWorkerCreationErrorNone) { if (creationError == WebWorkerCreationErrorURLMismatch) { // Existing worker does not match this url, so return an error back to the caller.
diff --git a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h index ce91215..fbc621d 100644 --- a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h +++ b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h
@@ -33,8 +33,9 @@ #include "core/workers/SharedWorkerRepositoryClient.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -44,9 +45,9 @@ WTF_MAKE_NONCOPYABLE(SharedWorkerRepositoryClientImpl); USING_FAST_MALLOC(SharedWorkerRepositoryClientImpl); public: - static PassOwnPtr<SharedWorkerRepositoryClientImpl> create(WebSharedWorkerRepositoryClient* client) + static std::unique_ptr<SharedWorkerRepositoryClientImpl> create(WebSharedWorkerRepositoryClient* client) { - return adoptPtr(new SharedWorkerRepositoryClientImpl(client)); + return wrapUnique(new SharedWorkerRepositoryClientImpl(client)); } ~SharedWorkerRepositoryClientImpl() override { }
diff --git a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp index 798091f..62f929c3 100644 --- a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp +++ b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp
@@ -42,6 +42,8 @@ #include "public/web/WebSpeechRecognitionResult.h" #include "public/web/WebSpeechRecognizer.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -49,9 +51,9 @@ { } -PassOwnPtr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::create(WebSpeechRecognizer* recognizer) +std::unique_ptr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::create(WebSpeechRecognizer* recognizer) { - return adoptPtr(new SpeechRecognitionClientProxy(recognizer)); + return wrapUnique(new SpeechRecognitionClientProxy(recognizer)); } void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const SpeechGrammarList* grammarList, const String& lang, bool continuous, bool interimResults, unsigned long maxAlternatives, MediaStreamTrack* audioTrack)
diff --git a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h index 0ff2721d..c23ac5fd 100644 --- a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h +++ b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h
@@ -29,8 +29,8 @@ #include "modules/speech/SpeechRecognitionClient.h" #include "public/web/WebSpeechRecognizerClient.h" #include "wtf/Compiler.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -44,7 +44,7 @@ // Constructing a proxy object with a 0 WebSpeechRecognizer is safe in // itself, but attempting to call start/stop/abort on it will crash. - static PassOwnPtr<SpeechRecognitionClientProxy> create(WebSpeechRecognizer*); + static std::unique_ptr<SpeechRecognitionClientProxy> create(WebSpeechRecognizer*); // SpeechRecognitionClient: void start(SpeechRecognition*, const SpeechGrammarList*, const String& lang, bool continuous, bool interimResults, unsigned long maxAlternatives, MediaStreamTrack*) override;
diff --git a/third_party/WebKit/Source/web/StorageClientImpl.cpp b/third_party/WebKit/Source/web/StorageClientImpl.cpp index 9db053e..6c651c2b6 100644 --- a/third_party/WebKit/Source/web/StorageClientImpl.cpp +++ b/third_party/WebKit/Source/web/StorageClientImpl.cpp
@@ -31,6 +31,8 @@ #include "public/web/WebViewClient.h" #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -39,11 +41,11 @@ { } -PassOwnPtr<StorageNamespace> StorageClientImpl::createSessionStorageNamespace() +std::unique_ptr<StorageNamespace> StorageClientImpl::createSessionStorageNamespace() { if (!m_webView->client()) return nullptr; - return adoptPtr(new StorageNamespace(adoptPtr(m_webView->client()->createSessionStorageNamespace()))); + return wrapUnique(new StorageNamespace(wrapUnique(m_webView->client()->createSessionStorageNamespace()))); } bool StorageClientImpl::canAccessStorage(LocalFrame* frame, StorageType type) const
diff --git a/third_party/WebKit/Source/web/StorageClientImpl.h b/third_party/WebKit/Source/web/StorageClientImpl.h index 019b1d3..d8de138 100644 --- a/third_party/WebKit/Source/web/StorageClientImpl.h +++ b/third_party/WebKit/Source/web/StorageClientImpl.h
@@ -6,6 +6,7 @@ #define StorageClientImpl_h #include "modules/storage/StorageClient.h" +#include <memory> namespace blink { @@ -15,7 +16,7 @@ public: explicit StorageClientImpl(WebViewImpl*); - PassOwnPtr<StorageNamespace> createSessionStorageNamespace() override; + std::unique_ptr<StorageNamespace> createSessionStorageNamespace() override; bool canAccessStorage(LocalFrame*, StorageType) const override; private:
diff --git a/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp b/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp index 3a0a955..9a3dabc 100644 --- a/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp +++ b/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp
@@ -11,6 +11,8 @@ #include "platform/UserGestureIndicator.h" #include "public/platform/WebVector.h" #include "public/web/WebScriptExecutionCallback.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -65,9 +67,9 @@ { // after calling the destructor of object - object will be unsubscribed from // resumed and contextDestroyed LifecycleObserver methods - OwnPtr<UserGestureIndicator> indicator; + std::unique_ptr<UserGestureIndicator> indicator; if (m_userGesture) - indicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); + indicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); v8::HandleScope scope(v8::Isolate::GetCurrent()); Vector<v8::Local<v8::Value>> results;
diff --git a/third_party/WebKit/Source/web/TextFinder.h b/third_party/WebKit/Source/web/TextFinder.h index 267f2335..7466c43c11 100644 --- a/third_party/WebKit/Source/web/TextFinder.h +++ b/third_party/WebKit/Source/web/TextFinder.h
@@ -40,7 +40,6 @@ #include "public/web/WebFindOptions.h" #include "web/WebExport.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/web/WebBlob.cpp b/third_party/WebKit/Source/web/WebBlob.cpp index 370a6b10..977cc96 100644 --- a/third_party/WebKit/Source/web/WebBlob.cpp +++ b/third_party/WebKit/Source/web/WebBlob.cpp
@@ -35,7 +35,7 @@ #include "core/fileapi/Blob.h" #include "platform/FileMetadata.h" #include "platform/blob/BlobData.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { @@ -46,7 +46,7 @@ WebBlob WebBlob::createFromFile(const WebString& path, long long size) { - OwnPtr<BlobData> blobData = BlobData::create(); + std::unique_ptr<BlobData> blobData = BlobData::create(); blobData->appendFile(path, 0, size, invalidFileTime()); return Blob::create(BlobDataHandle::create(std::move(blobData), size)); }
diff --git a/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp b/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp index 71236d1..ff332a0 100644 --- a/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp +++ b/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp
@@ -35,13 +35,15 @@ #include "core/dom/Document.h" #include "core/frame/LocalDOMWindow.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { class DOMActivityLoggerContainer : public V8DOMActivityLogger { public: - explicit DOMActivityLoggerContainer(PassOwnPtr<WebDOMActivityLogger> logger) + explicit DOMActivityLoggerContainer(std::unique_ptr<WebDOMActivityLogger> logger) : m_domActivityLogger(std::move(logger)) { } @@ -84,7 +86,7 @@ return WebString(); } - OwnPtr<WebDOMActivityLogger> m_domActivityLogger; + std::unique_ptr<WebDOMActivityLogger> m_domActivityLogger; }; bool hasDOMActivityLogger(int worldId, const WebString& extensionId) @@ -95,7 +97,7 @@ void setDOMActivityLogger(int worldId, const WebString& extensionId, WebDOMActivityLogger* logger) { DCHECK(logger); - V8DOMActivityLogger::setActivityLogger(worldId, extensionId, adoptPtr(new DOMActivityLoggerContainer(adoptPtr(logger)))); + V8DOMActivityLogger::setActivityLogger(worldId, extensionId, wrapUnique(new DOMActivityLoggerContainer(wrapUnique(logger)))); } } // namespace blink
diff --git a/third_party/WebKit/Source/web/WebDataSourceImpl.cpp b/third_party/WebKit/Source/web/WebDataSourceImpl.cpp index 4be3221..1cf7e7b4 100644 --- a/third_party/WebKit/Source/web/WebDataSourceImpl.cpp +++ b/third_party/WebKit/Source/web/WebDataSourceImpl.cpp
@@ -35,7 +35,8 @@ #include "public/platform/WebURL.h" #include "public/platform/WebURLError.h" #include "public/platform/WebVector.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -104,8 +105,8 @@ void WebDataSourceImpl::setExtraData(ExtraData* extraData) { - // extraData can't be a PassOwnPtr because setExtraData is a WebKit API function. - m_extraData = adoptPtr(extraData); + // extraData can't be a std::unique_ptr because setExtraData is a WebKit API function. + m_extraData = wrapUnique(extraData); } void WebDataSourceImpl::setNavigationStartTime(double navigationStart) @@ -151,7 +152,7 @@ void WebDataSourceImpl::setSubresourceFilter(WebDocumentSubresourceFilter* subresourceFilter) { - DocumentLoader::setSubresourceFilter(WTF::adoptPtr(subresourceFilter)); + DocumentLoader::setSubresourceFilter(WTF::wrapUnique(subresourceFilter)); } DEFINE_TRACE(WebDataSourceImpl)
diff --git a/third_party/WebKit/Source/web/WebDataSourceImpl.h b/third_party/WebKit/Source/web/WebDataSourceImpl.h index 5bb0cecf..717c9c6a 100644 --- a/third_party/WebKit/Source/web/WebDataSourceImpl.h +++ b/third_party/WebKit/Source/web/WebDataSourceImpl.h
@@ -37,9 +37,8 @@ #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" #include "public/web/WebDataSource.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -84,7 +83,7 @@ mutable WrappedResourceRequest m_requestWrapper; mutable WrappedResourceResponse m_responseWrapper; - OwnPtr<ExtraData> m_extraData; + std::unique_ptr<ExtraData> m_extraData; }; } // namespace blink
diff --git a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp index 0e5a4f94..7b5a6e3 100644 --- a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp +++ b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp
@@ -90,7 +90,9 @@ #include "web/WebViewImpl.h" #include "wtf/MathExtras.h" #include "wtf/Noncopyable.h" +#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -116,7 +118,7 @@ { if (s_instance) return; - OwnPtr<ClientMessageLoopAdapter> instance = adoptPtr(new ClientMessageLoopAdapter(adoptPtr(client->createClientMessageLoop()))); + std::unique_ptr<ClientMessageLoopAdapter> instance = wrapUnique(new ClientMessageLoopAdapter(wrapUnique(client->createClientMessageLoop()))); s_instance = instance.get(); MainThreadDebugger::instance()->setClientMessageLoop(std::move(instance)); } @@ -152,7 +154,7 @@ } private: - ClientMessageLoopAdapter(PassOwnPtr<WebDevToolsAgentClient::WebKitClientMessageLoop> messageLoop) + ClientMessageLoopAdapter(std::unique_ptr<WebDevToolsAgentClient::WebKitClientMessageLoop> messageLoop) : m_runningForDebugBreak(false) , m_runningForCreateWindow(false) , m_messageLoop(std::move(messageLoop)) @@ -267,7 +269,7 @@ bool m_runningForDebugBreak; bool m_runningForCreateWindow; - OwnPtr<WebDevToolsAgentClient::WebKitClientMessageLoop> m_messageLoop; + std::unique_ptr<WebDevToolsAgentClient::WebKitClientMessageLoop> m_messageLoop; typedef HashSet<WebViewImpl*> FrozenViewsSet; FrozenViewsSet m_frozenViews; WebFrameWidgetsSet m_frozenWidgets; @@ -646,7 +648,7 @@ flushProtocolNotifications(); } -void WebDevToolsAgentImpl::runDebuggerTask(int sessionId, PassOwnPtr<WebDevToolsAgent::MessageDescriptor> descriptor) +void WebDevToolsAgentImpl::runDebuggerTask(int sessionId, std::unique_ptr<WebDevToolsAgent::MessageDescriptor> descriptor) { WebDevToolsAgent* webagent = descriptor->agent(); if (!webagent) @@ -659,8 +661,8 @@ void WebDevToolsAgent::interruptAndDispatch(int sessionId, MessageDescriptor* rawDescriptor) { - // rawDescriptor can't be a PassOwnPtr because interruptAndDispatch is a WebKit API function. - MainThreadDebugger::interruptMainThreadAndRun(threadSafeBind(WebDevToolsAgentImpl::runDebuggerTask, sessionId, passed(adoptPtr(rawDescriptor)))); + // rawDescriptor can't be a std::unique_ptr because interruptAndDispatch is a WebKit API function. + MainThreadDebugger::interruptMainThreadAndRun(threadSafeBind(WebDevToolsAgentImpl::runDebuggerTask, sessionId, passed(wrapUnique(rawDescriptor)))); } bool WebDevToolsAgent::shouldInterruptForMethod(const WebString& method)
diff --git a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h index 222a0d2..a25d5a1 100644 --- a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h +++ b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h
@@ -40,8 +40,8 @@ #include "public/web/WebDevToolsAgent.h" #include "web/InspectorEmulationAgent.h" #include "wtf/Forward.h" -#include "wtf/OwnPtr.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -135,7 +135,7 @@ void dispatchMessageFromFrontend(int sessionId, const String& method, const String& message); friend class WebDevToolsAgent; - static void runDebuggerTask(int sessionId, PassOwnPtr<WebDevToolsAgent::MessageDescriptor>); + static void runDebuggerTask(int sessionId, std::unique_ptr<WebDevToolsAgent::MessageDescriptor>); bool attached() const { return m_session.get(); }
diff --git a/third_party/WebKit/Source/web/WebElementTest.cpp b/third_party/WebKit/Source/web/WebElementTest.cpp index 3395001..58cecc69 100644 --- a/third_party/WebKit/Source/web/WebElementTest.cpp +++ b/third_party/WebKit/Source/web/WebElementTest.cpp
@@ -9,6 +9,7 @@ #include "core/dom/shadow/ShadowRoot.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -68,7 +69,7 @@ private: void SetUp() override; - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; }; void WebElementTest::insertHTML(String html)
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp index d6d3b30..e995bff4 100644 --- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp +++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
@@ -71,12 +71,14 @@ #include "web/WebLocalFrameImpl.h" #include "web/WorkerContentSettingsClient.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { WebEmbeddedWorker* WebEmbeddedWorker::create(WebServiceWorkerContextClient* client, WebWorkerContentSettingsClientProxy* contentSettingsClient) { - return new WebEmbeddedWorkerImpl(adoptPtr(client), adoptPtr(contentSettingsClient)); + return new WebEmbeddedWorkerImpl(wrapUnique(client), wrapUnique(contentSettingsClient)); } static HashSet<WebEmbeddedWorkerImpl*>& runningWorkerInstances() @@ -85,7 +87,7 @@ return set; } -WebEmbeddedWorkerImpl::WebEmbeddedWorkerImpl(PassOwnPtr<WebServiceWorkerContextClient> client, PassOwnPtr<WebWorkerContentSettingsClientProxy> contentSettingsClient) +WebEmbeddedWorkerImpl::WebEmbeddedWorkerImpl(std::unique_ptr<WebServiceWorkerContextClient> client, std::unique_ptr<WebWorkerContentSettingsClientProxy> contentSettingsClient) : m_workerContextClient(std::move(client)) , m_contentSettingsClient(std::move(contentSettingsClient)) , m_workerInspectorProxy(WorkerInspectorProxy::create()) @@ -327,7 +329,7 @@ DCHECK(m_loadingShadowPage); DCHECK(!m_askedToTerminate); m_loadingShadowPage = false; - m_networkProvider = adoptPtr(m_workerContextClient->createServiceWorkerNetworkProvider(frame->dataSource())); + m_networkProvider = wrapUnique(m_workerContextClient->createServiceWorkerNetworkProvider(frame->dataSource())); m_mainScriptLoader = WorkerScriptLoader::create(); m_mainScriptLoader->setRequestContext(WebURLRequest::RequestContextServiceWorker); m_mainScriptLoader->loadAsynchronously( @@ -406,7 +408,7 @@ provideContentSettingsClientToWorker(workerClients, std::move(m_contentSettingsClient)); provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create()); provideServiceWorkerGlobalScopeClientToWorker(workerClients, ServiceWorkerGlobalScopeClientImpl::create(*m_workerContextClient)); - provideServiceWorkerContainerClientToWorker(workerClients, adoptPtr(m_workerContextClient->createServiceWorkerProvider())); + provideServiceWorkerContainerClientToWorker(workerClients, wrapUnique(m_workerContextClient->createServiceWorkerProvider())); // We need to set the CSP to both the shadow page's document and the ServiceWorkerGlobalScope. document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecurityPolicy()); @@ -414,7 +416,7 @@ KURL scriptURL = m_mainScriptLoader->url(); WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(document); - OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create( + std::unique_ptr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create( scriptURL, m_workerStartData.userAgent, m_mainScriptLoader->script(),
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h index 1997bc8..614f4e19 100644 --- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h +++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h
@@ -38,6 +38,7 @@ #include "public/web/WebEmbeddedWorker.h" #include "public/web/WebEmbeddedWorkerStartData.h" #include "public/web/WebFrameClient.h" +#include <memory> namespace blink { @@ -56,7 +57,7 @@ , private WorkerLoaderProxyProvider { WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); public: - WebEmbeddedWorkerImpl(PassOwnPtr<WebServiceWorkerContextClient>, PassOwnPtr<WebWorkerContentSettingsClientProxy>); + WebEmbeddedWorkerImpl(std::unique_ptr<WebServiceWorkerContextClient>, std::unique_ptr<WebWorkerContentSettingsClientProxy>); ~WebEmbeddedWorkerImpl() override; // WebEmbeddedWorker overrides. @@ -95,20 +96,20 @@ WebEmbeddedWorkerStartData m_workerStartData; - OwnPtr<WebServiceWorkerContextClient> m_workerContextClient; + std::unique_ptr<WebServiceWorkerContextClient> m_workerContextClient; // This is kept until startWorkerContext is called, and then passed on // to WorkerContext. - OwnPtr<WebWorkerContentSettingsClientProxy> m_contentSettingsClient; + std::unique_ptr<WebWorkerContentSettingsClientProxy> m_contentSettingsClient; // We retain ownership of this one which is for use on the // main thread only. - OwnPtr<WebServiceWorkerNetworkProvider> m_networkProvider; + std::unique_ptr<WebServiceWorkerNetworkProvider> m_networkProvider; // Kept around only while main script loading is ongoing. RefPtr<WorkerScriptLoader> m_mainScriptLoader; - OwnPtr<WorkerThread> m_workerThread; + std::unique_ptr<WorkerThread> m_workerThread; RefPtr<WorkerLoaderProxy> m_loaderProxy; Persistent<ServiceWorkerGlobalScopeProxy> m_workerGlobalScopeProxy; Persistent<WorkerInspectorProxy> m_workerInspectorProxy;
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp b/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp index 8b2cea6f..bb6f205f 100644 --- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp +++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp
@@ -16,6 +16,8 @@ #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { namespace { @@ -61,7 +63,7 @@ void SetUp() override { m_mockClient = new MockServiceWorkerContextClient(); - m_worker = adoptPtr(WebEmbeddedWorker::create(m_mockClient, nullptr)); + m_worker = wrapUnique(WebEmbeddedWorker::create(m_mockClient, nullptr)); WebURL scriptURL = URLTestHelpers::toKURL("https://www.example.com/sw.js"); WebURLResponse response; @@ -85,7 +87,7 @@ WebEmbeddedWorkerStartData m_startData; MockServiceWorkerContextClient* m_mockClient; - OwnPtr<WebEmbeddedWorker> m_worker; + std::unique_ptr<WebEmbeddedWorker> m_worker; }; } // namespace
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp index f4c83cd..5b8b065 100644 --- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp +++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
@@ -61,6 +61,8 @@ #include "web/WebPluginContainerImpl.h" #include "web/WebRemoteFrameImpl.h" #include "web/WebViewFrameWidget.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -344,7 +346,7 @@ if (inputEvent.type == WebInputEvent::MouseUp) mouseCaptureLost(); - OwnPtr<UserGestureIndicator> gestureIndicator; + std::unique_ptr<UserGestureIndicator> gestureIndicator; AtomicString eventType; switch (inputEvent.type) { @@ -356,12 +358,12 @@ break; case WebInputEvent::MouseDown: eventType = EventTypeNames::mousedown; - gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); + gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); m_mouseCaptureGestureToken = gestureIndicator->currentToken(); break; case WebInputEvent::MouseUp: eventType = EventTypeNames::mouseup; - gestureIndicator = adoptPtr(new UserGestureIndicator(m_mouseCaptureGestureToken.release())); + gestureIndicator = wrapUnique(new UserGestureIndicator(m_mouseCaptureGestureToken.release())); break; default: NOTREACHED();
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h index d94ae869..a2e21f96 100644 --- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h +++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
@@ -43,7 +43,6 @@ #include "web/WebViewImpl.h" #include "wtf/Assertions.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" namespace blink { class Frame;
diff --git a/third_party/WebKit/Source/web/WebHelperPluginImpl.h b/third_party/WebKit/Source/web/WebHelperPluginImpl.h index 89a09a2..d632b380 100644 --- a/third_party/WebKit/Source/web/WebHelperPluginImpl.h +++ b/third_party/WebKit/Source/web/WebHelperPluginImpl.h
@@ -35,7 +35,6 @@ #include "public/web/WebHelperPlugin.h" #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/web/WebImageDecoder.cpp b/third_party/WebKit/Source/web/WebImageDecoder.cpp index 1750509..d4ffb79 100644 --- a/third_party/WebKit/Source/web/WebImageDecoder.cpp +++ b/third_party/WebKit/Source/web/WebImageDecoder.cpp
@@ -37,8 +37,6 @@ #include "public/platform/WebData.h" #include "public/platform/WebImage.h" #include "public/platform/WebSize.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/WebKit.cpp b/third_party/WebKit/Source/web/WebKit.cpp index 37681a9..a7dc8e7 100644 --- a/third_party/WebKit/Source/web/WebKit.cpp +++ b/third_party/WebKit/Source/web/WebKit.cpp
@@ -45,10 +45,12 @@ #include "public/platform/Platform.h" #include "public/platform/WebThread.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" #include "wtf/WTF.h" #include "wtf/allocator/Partitions.h" #include "wtf/text/AtomicString.h" #include "wtf/text/TextEncoding.h" +#include <memory> #include <v8.h> namespace blink { @@ -74,7 +76,7 @@ static ModulesInitializer& modulesInitializer() { - DEFINE_STATIC_LOCAL(OwnPtr<ModulesInitializer>, initializer, (adoptPtr(new ModulesInitializer))); + DEFINE_STATIC_LOCAL(std::unique_ptr<ModulesInitializer>, initializer, (wrapUnique(new ModulesInitializer))); return *initializer; }
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp index 0893b67..0192b11 100644 --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -114,9 +114,9 @@ #include "core/editing/spellcheck/SpellChecker.h" #include "core/fetch/ResourceFetcher.h" #include "core/fetch/SubstituteData.h" -#include "core/frame/LocalDOMWindow.h" #include "core/frame/FrameHost.h" #include "core/frame/FrameView.h" +#include "core/frame/LocalDOMWindow.h" #include "core/frame/RemoteFrame.h" #include "core/frame/Settings.h" #include "core/frame/UseCounter.h" @@ -136,7 +136,6 @@ #include "core/layout/LayoutObject.h" #include "core/layout/LayoutPart.h" #include "core/layout/api/LayoutViewItem.h" -#include "core/style/StyleInheritedData.h" #include "core/loader/DocumentLoader.h" #include "core/loader/FrameLoadRequest.h" #include "core/loader/FrameLoader.h" @@ -149,6 +148,7 @@ #include "core/page/PrintContext.h" #include "core/paint/PaintLayer.h" #include "core/paint/TransformRecorder.h" +#include "core/style/StyleInheritedData.h" #include "core/timing/DOMWindowPerformance.h" #include "core/timing/Performance.h" #include "modules/app_banner/AppBannerController.h" @@ -235,7 +235,9 @@ #include "web/WebViewImpl.h" #include "wtf/CurrentTime.h" #include "wtf/HashMap.h" +#include "wtf/PtrUtil.h" #include <algorithm> +#include <memory> namespace blink { @@ -496,9 +498,9 @@ class WebSuspendableTaskWrapper: public SuspendableTask { public: - static PassOwnPtr<WebSuspendableTaskWrapper> create(PassOwnPtr<WebSuspendableTask> task) + static std::unique_ptr<WebSuspendableTaskWrapper> create(std::unique_ptr<WebSuspendableTask> task) { - return adoptPtr(new WebSuspendableTaskWrapper(std::move(task))); + return wrapUnique(new WebSuspendableTaskWrapper(std::move(task))); } void run() override @@ -512,12 +514,12 @@ } private: - explicit WebSuspendableTaskWrapper(PassOwnPtr<WebSuspendableTask> task) + explicit WebSuspendableTaskWrapper(std::unique_ptr<WebSuspendableTask> task) : m_task(std::move(task)) { } - OwnPtr<WebSuspendableTask> m_task; + std::unique_ptr<WebSuspendableTask> m_task; }; // WebFrame ------------------------------------------------------------------- @@ -1947,7 +1949,7 @@ { DCHECK(frame()); DCHECK(frame()->document()); - frame()->document()->postSuspendableTask(WebSuspendableTaskWrapper::create(adoptPtr(task))); + frame()->document()->postSuspendableTask(WebSuspendableTaskWrapper::create(wrapUnique(task))); } void WebLocalFrameImpl::didCallAddSearchProvider()
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.h b/third_party/WebKit/Source/web/WebLocalFrameImpl.h index a05039bd..8e98f5a 100644 --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.h +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.h
@@ -43,8 +43,8 @@ #include "web/WebExport.h" #include "web/WebFrameImplBase.h" #include "wtf/Compiler.h" -#include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -371,7 +371,7 @@ WebFrameClient* m_client; WebAutofillClient* m_autofillClient; WebContentSettingsClient* m_contentSettingsClient; - OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient; + std::unique_ptr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient; // Will be initialized after first call to find() or scopeStringMatches(). Member<TextFinder> m_textFinder;
diff --git a/third_party/WebKit/Source/web/WebNode.cpp b/third_party/WebKit/Source/web/WebNode.cpp index d133bbc8..60933df 100644 --- a/third_party/WebKit/Source/web/WebNode.cpp +++ b/third_party/WebKit/Source/web/WebNode.cpp
@@ -57,6 +57,7 @@ #include "web/FrameLoaderClientImpl.h" #include "web/WebLocalFrameImpl.h" #include "web/WebPluginContainerImpl.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -195,7 +196,7 @@ void WebNode::simulateClick() { - m_private->getExecutionContext()->postSuspendableTask(adoptPtr(new NodeDispatchSimulatedClickTask(m_private))); + m_private->getExecutionContext()->postSuspendableTask(wrapUnique(new NodeDispatchSimulatedClickTask(m_private))); } WebElementCollection WebNode::getElementsByHTMLTagName(const WebString& tag) const
diff --git a/third_party/WebKit/Source/web/WebNodeTest.cpp b/third_party/WebKit/Source/web/WebNodeTest.cpp index 171dcc82..aa2fffd 100644 --- a/third_party/WebKit/Source/web/WebNodeTest.cpp +++ b/third_party/WebKit/Source/web/WebNodeTest.cpp
@@ -10,6 +10,7 @@ #include "public/web/WebElement.h" #include "public/web/WebElementCollection.h" #include "testing/gtest/include/gtest/gtest.h" +#include <memory> namespace blink { @@ -33,7 +34,7 @@ private: void SetUp() override; - OwnPtr<DummyPageHolder> m_pageHolder; + std::unique_ptr<DummyPageHolder> m_pageHolder; }; void WebNodeTest::SetUp()
diff --git a/third_party/WebKit/Source/web/WebPagePopupImpl.cpp b/third_party/WebKit/Source/web/WebPagePopupImpl.cpp index 6add730..5b8f766 100644 --- a/third_party/WebKit/Source/web/WebPagePopupImpl.cpp +++ b/third_party/WebKit/Source/web/WebPagePopupImpl.cpp
@@ -63,6 +63,7 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebSettingsImpl.h" #include "web/WebViewImpl.h" +#include "wtf/PtrUtil.h" namespace blink { @@ -284,7 +285,7 @@ m_page->settings().setAccessibilityEnabled(m_webView->page()->settings().accessibilityEnabled()); m_page->settings().setScrollAnimatorEnabled(m_webView->page()->settings().scrollAnimatorEnabled()); - provideContextFeaturesTo(*m_page, adoptPtr(new PagePopupFeaturesClient())); + provideContextFeaturesTo(*m_page, wrapUnique(new PagePopupFeaturesClient())); DEFINE_STATIC_LOCAL(FrameLoaderClient, emptyFrameLoaderClient, (EmptyFrameLoaderClient::create())); LocalFrame* frame = LocalFrame::create(&emptyFrameLoaderClient, &m_page->frameHost(), 0); frame->setPagePopupOwner(m_popupClient->ownerElement());
diff --git a/third_party/WebKit/Source/web/WebPagePopupImpl.h b/third_party/WebKit/Source/web/WebPagePopupImpl.h index 5f9c599..8f953e4 100644 --- a/third_party/WebKit/Source/web/WebPagePopupImpl.h +++ b/third_party/WebKit/Source/web/WebPagePopupImpl.h
@@ -34,7 +34,6 @@ #include "core/page/PagePopup.h" #include "public/web/WebPagePopup.h" #include "web/PageWidgetDelegate.h" -#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/WebPepperSocket.cpp b/third_party/WebKit/Source/web/WebPepperSocket.cpp index fccbba0..65ce079 100644 --- a/third_party/WebKit/Source/web/WebPepperSocket.cpp +++ b/third_party/WebKit/Source/web/WebPepperSocket.cpp
@@ -31,6 +31,8 @@ #include "public/web/WebPepperSocket.h" #include "web/WebPepperSocketImpl.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -39,10 +41,10 @@ if (!client) return 0; - OwnPtr<WebPepperSocketImpl> websocket = adoptPtr(new WebPepperSocketImpl(document, client)); + std::unique_ptr<WebPepperSocketImpl> websocket = wrapUnique(new WebPepperSocketImpl(document, client)); if (websocket && websocket->isNull()) return 0; - return websocket.leakPtr(); + return websocket.release(); } } // namespace blink
diff --git a/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h b/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h index 0c35cbe..fc714ba5 100644 --- a/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h +++ b/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h
@@ -8,9 +8,9 @@ #include "modules/websockets/WebSocketChannelClient.h" #include "platform/heap/Handle.h" #include "web/WebPepperSocketImpl.h" -#include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +#include <memory> #include <stdint.h> namespace blink { @@ -36,7 +36,7 @@ { m_impl->didReceiveTextMessage(payload); } - void didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload) override + void didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) override { m_impl->didReceiveBinaryMessage(std::move(payload)); }
diff --git a/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp b/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp index 2a65d50..d225683 100644 --- a/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp +++ b/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp
@@ -42,6 +42,7 @@ #include "web/WebPepperSocketChannelClientProxy.h" #include "wtf/text/CString.h" #include "wtf/text/WTFString.h" +#include <memory> namespace blink { @@ -164,7 +165,7 @@ m_client->didReceiveMessage(WebString(payload)); } -void WebPepperSocketImpl::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload) +void WebPepperSocketImpl::didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) { switch (m_binaryType) { case BinaryTypeBlob:
diff --git a/third_party/WebKit/Source/web/WebPepperSocketImpl.h b/third_party/WebKit/Source/web/WebPepperSocketImpl.h index 62c67261..cc5dea86 100644 --- a/third_party/WebKit/Source/web/WebPepperSocketImpl.h +++ b/third_party/WebKit/Source/web/WebPepperSocketImpl.h
@@ -37,8 +37,8 @@ #include "public/platform/WebString.h" #include "public/web/WebPepperSocket.h" #include "public/web/WebPepperSocketClient.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -69,7 +69,7 @@ // WebSocketChannelClient methods proxied by WebPepperSocketChannelClientProxy. void didConnect(const String& subprotocol, const String& extensions); void didReceiveTextMessage(const String& payload); - void didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload); + void didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload); void didError(); void didConsumeBufferedAmount(unsigned long consumed); void didStartClosingHandshake();
diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.h b/third_party/WebKit/Source/web/WebPluginContainerImpl.h index ff84d43..213c45ba 100644 --- a/third_party/WebKit/Source/web/WebPluginContainerImpl.h +++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.h
@@ -38,7 +38,6 @@ #include "public/web/WebPluginContainer.h" #include "web/WebExport.h" #include "wtf/Compiler.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" #include "wtf/text/WTFString.h"
diff --git a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h index c0bbe2a..d50a7d3 100644 --- a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h +++ b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
@@ -14,7 +14,6 @@ #include "web/WebExport.h" #include "web/WebFrameImplBase.h" #include "wtf/Compiler.h" -#include "wtf/OwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp index 5060946..51b411c 100644 --- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp +++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
@@ -72,6 +72,8 @@ #include "web/WebLocalFrameImpl.h" #include "web/WorkerContentSettingsClient.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -170,7 +172,7 @@ { DCHECK(!m_loadingDocument); DCHECK(!m_mainScriptLoader); - m_networkProvider = adoptPtr(m_client->createServiceWorkerNetworkProvider(frame->dataSource())); + m_networkProvider = wrapUnique(m_client->createServiceWorkerNetworkProvider(frame->dataSource())); m_mainScriptLoader = WorkerScriptLoader::create(); m_mainScriptLoader->setRequestContext(WebURLRequest::RequestContextSharedWorker); m_loadingDocument = toWebLocalFrameImpl(frame)->frame()->document(); @@ -217,7 +219,7 @@ // WorkerReportingProxy -------------------------------------------------------- -void WebSharedWorkerImpl::reportException(const String& errorMessage, PassOwnPtr<SourceLocation>) +void WebSharedWorkerImpl::reportException(const String& errorMessage, std::unique_ptr<SourceLocation>) { // Not suppported in SharedWorker. } @@ -331,11 +333,11 @@ WorkerClients* workerClients = WorkerClients::create(); provideLocalFileSystemToWorker(workerClients, LocalFileSystemClient::create()); WebSecurityOrigin webSecurityOrigin(m_loadingDocument->getSecurityOrigin()); - provideContentSettingsClientToWorker(workerClients, adoptPtr(m_client->createWorkerContentSettingsClientProxy(webSecurityOrigin))); + provideContentSettingsClientToWorker(workerClients, wrapUnique(m_client->createWorkerContentSettingsClientProxy(webSecurityOrigin))); provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create()); ContentSecurityPolicy* contentSecurityPolicy = m_mainScriptLoader->releaseContentSecurityPolicy(); WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(document); - OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create( + std::unique_ptr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create( m_url, m_loadingDocument->userAgent(), m_mainScriptLoader->script(),
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.h b/third_party/WebKit/Source/web/WebSharedWorkerImpl.h index 9a00362..3c675336 100644 --- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.h +++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.h
@@ -42,8 +42,8 @@ #include "public/web/WebDevToolsAgentClient.h" #include "public/web/WebFrameClient.h" #include "public/web/WebSharedWorkerClient.h" -#include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" +#include <memory> namespace blink { @@ -75,7 +75,7 @@ explicit WebSharedWorkerImpl(WebSharedWorkerClient*); // WorkerReportingProxy methods: - void reportException(const WTF::String&, PassOwnPtr<SourceLocation>) override; + void reportException(const WTF::String&, std::unique_ptr<SourceLocation>) override; void reportConsoleMessage(ConsoleMessage*) override; void postMessageToPageInspector(const WTF::String&) override; void postWorkerConsoleAgentEnabled() override { } @@ -141,11 +141,11 @@ bool m_askedToTerminate; // This one is bound to and used only on the main thread. - OwnPtr<WebServiceWorkerNetworkProvider> m_networkProvider; + std::unique_ptr<WebServiceWorkerNetworkProvider> m_networkProvider; Persistent<WorkerInspectorProxy> m_workerInspectorProxy; - OwnPtr<WorkerThread> m_workerThread; + std::unique_ptr<WorkerThread> m_workerThread; WebSharedWorkerClient* m_client;
diff --git a/third_party/WebKit/Source/web/WebStorageEventDispatcherImpl.cpp b/third_party/WebKit/Source/web/WebStorageEventDispatcherImpl.cpp index c0a333f..228b8bae 100644 --- a/third_party/WebKit/Source/web/WebStorageEventDispatcherImpl.cpp +++ b/third_party/WebKit/Source/web/WebStorageEventDispatcherImpl.cpp
@@ -35,7 +35,6 @@ #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/WebURL.h" #include "web/WebViewImpl.h" -#include "wtf/PassOwnPtr.h" namespace blink {
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp index 3df57d6..af351b3 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -180,8 +180,10 @@ #include "web/WebRemoteFrameImpl.h" #include "web/WebSettingsImpl.h" #include "wtf/CurrentTime.h" +#include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" #include "wtf/TemporaryChange.h" +#include <memory> #if USE(DEFAULT_RENDER_THEME) #include "core/layout/LayoutThemeDefault.h" @@ -229,9 +231,9 @@ // Used to defer all page activity in cases where the embedder wishes to run // a nested event loop. Using a stack enables nesting of message loop invocations. -static Vector<OwnPtr<ScopedPageLoadDeferrer>>& pageLoadDeferrerStack() +static Vector<std::unique_ptr<ScopedPageLoadDeferrer>>& pageLoadDeferrerStack() { - DEFINE_STATIC_LOCAL(Vector<OwnPtr<ScopedPageLoadDeferrer>>, deferrerStack, ()); + DEFINE_STATIC_LOCAL(Vector<std::unique_ptr<ScopedPageLoadDeferrer>>, deferrerStack, ()); return deferrerStack; } @@ -362,7 +364,7 @@ void WebView::willEnterModalLoop() { - pageLoadDeferrerStack().append(adoptPtr(new ScopedPageLoadDeferrer())); + pageLoadDeferrerStack().append(wrapUnique(new ScopedPageLoadDeferrer())); } void WebView::didExitModalLoop() @@ -448,7 +450,7 @@ , m_displayMode(WebDisplayModeBrowser) , m_elasticOverscroll(FloatSize()) , m_mutator(nullptr) - , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->createWebViewScheduler(this).release())) + , m_scheduler(wrapUnique(Platform::current()->currentThread()->scheduler()->createWebViewScheduler(this).release())) , m_lastFrameTimeMonotonic(0) { Page::PageClients pageClients; @@ -738,7 +740,7 @@ m_flingModifier = event.modifiers; m_flingSourceDevice = event.sourceDevice; DCHECK_NE(m_flingSourceDevice, WebGestureDeviceUninitialized); - OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->createFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.velocityX, event.data.flingStart.velocityY), WebSize())); + std::unique_ptr<WebGestureCurve> flingCurve = wrapUnique(Platform::current()->createFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.velocityX, event.data.flingStart.velocityY), WebSize())); DCHECK(flingCurve); m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(std::move(flingCurve), this); scheduleAnimation(); @@ -959,7 +961,7 @@ m_positionOnFlingStart = parameters.point; m_globalPositionOnFlingStart = parameters.globalPoint; m_flingModifier = parameters.modifiers; - OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAnimationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters.cumulativeScroll)); + std::unique_ptr<WebGestureCurve> curve = wrapUnique(Platform::current()->createFlingAnimationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters.cumulativeScroll)); DCHECK(curve); m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(std::move(curve), this, parameters.startTime); DCHECK_NE(parameters.sourceDevice, WebGestureDeviceUninitialized); @@ -2190,7 +2192,7 @@ if (inputEvent.type == WebInputEvent::MouseUp) mouseCaptureLost(); - OwnPtr<UserGestureIndicator> gestureIndicator; + std::unique_ptr<UserGestureIndicator> gestureIndicator; AtomicString eventType; switch (inputEvent.type) { @@ -2202,12 +2204,12 @@ break; case WebInputEvent::MouseDown: eventType = EventTypeNames::mousedown; - gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); + gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); m_mouseCaptureGestureToken = gestureIndicator->currentToken(); break; case WebInputEvent::MouseUp: eventType = EventTypeNames::mouseup; - gestureIndicator = adoptPtr(new UserGestureIndicator(m_mouseCaptureGestureToken.release())); + gestureIndicator = wrapUnique(new UserGestureIndicator(m_mouseCaptureGestureToken.release())); break; default: NOTREACHED(); @@ -2837,7 +2839,7 @@ WebSettingsImpl* WebViewImpl::settingsImpl() { if (!m_webSettings) - m_webSettings = adoptPtr(new WebSettingsImpl(&m_page->settings(), m_devToolsEmulator.get())); + m_webSettings = wrapUnique(new WebSettingsImpl(&m_page->settings(), m_devToolsEmulator.get())); DCHECK(m_webSettings); return m_webSettings.get(); } @@ -4474,17 +4476,17 @@ void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) { - OwnPtr<UserGestureIndicator> gestureIndicator; + std::unique_ptr<UserGestureIndicator> gestureIndicator; AtomicString eventType; switch (event.type) { case WebInputEvent::MouseDown: eventType = EventTypeNames::mousedown; - gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); + gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingNewUserGesture)); m_pointerLockGestureToken = gestureIndicator->currentToken(); break; case WebInputEvent::MouseUp: eventType = EventTypeNames::mouseup; - gestureIndicator = adoptPtr(new UserGestureIndicator(m_pointerLockGestureToken.release())); + gestureIndicator = wrapUnique(new UserGestureIndicator(m_pointerLockGestureToken.release())); break; case WebInputEvent::MouseMove: eventType = EventTypeNames::mousemove;
diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h index 716e264..d327836b 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.h +++ b/third_party/WebKit/Source/web/WebViewImpl.h
@@ -63,9 +63,9 @@ #include "web/WebExport.h" #include "wtf/Compiler.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" +#include <memory> namespace blink { @@ -642,7 +642,7 @@ // An object that can be used to manipulate m_page->settings() without linking // against WebCore. This is lazily allocated the first time GetWebSettings() // is called. - OwnPtr<WebSettingsImpl> m_webSettings; + std::unique_ptr<WebSettingsImpl> m_webSettings; // A copy of the web drop data object we received from the browser. Persistent<DataObject> m_currentDragData; @@ -702,7 +702,7 @@ RefPtr<WebPagePopupImpl> m_pagePopup; Persistent<DevToolsEmulator> m_devToolsEmulator; - OwnPtr<PageOverlay> m_pageColorOverlay; + std::unique_ptr<PageOverlay> m_pageColorOverlay; // Whether the webview is rendering transparently. bool m_isTransparent; @@ -724,13 +724,13 @@ static const WebInputEvent* m_currentInputEvent; MediaKeysClientImpl m_mediaKeysClientImpl; - OwnPtr<WebActiveGestureAnimation> m_gestureAnimation; + std::unique_ptr<WebActiveGestureAnimation> m_gestureAnimation; WebPoint m_positionOnFlingStart; WebPoint m_globalPositionOnFlingStart; int m_flingModifier; WebGestureDevice m_flingSourceDevice; - Vector<OwnPtr<LinkHighlightImpl>> m_linkHighlights; - OwnPtr<CompositorAnimationTimeline> m_linkHighlightsTimeline; + Vector<std::unique_ptr<LinkHighlightImpl>> m_linkHighlights; + std::unique_ptr<CompositorAnimationTimeline> m_linkHighlightsTimeline; Persistent<FullscreenController> m_fullscreenController; WebColor m_baseBackgroundColor; @@ -754,7 +754,7 @@ WebPageImportanceSignals m_pageImportanceSignals; - const OwnPtr<WebViewScheduler> m_scheduler; + const std::unique_ptr<WebViewScheduler> m_scheduler; // Manages the layer tree created for this page in Slimming Paint v2. PaintArtifactCompositor m_paintArtifactCompositor;
diff --git a/third_party/WebKit/Source/web/WorkerContentSettingsClient.cpp b/third_party/WebKit/Source/web/WorkerContentSettingsClient.cpp index e396aa7..889f979 100644 --- a/third_party/WebKit/Source/web/WorkerContentSettingsClient.cpp +++ b/third_party/WebKit/Source/web/WorkerContentSettingsClient.cpp
@@ -33,11 +33,11 @@ #include "core/workers/WorkerGlobalScope.h" #include "public/platform/WebString.h" #include "public/web/WebWorkerContentSettingsClientProxy.h" -#include "wtf/PassOwnPtr.h" +#include <memory> namespace blink { -WorkerContentSettingsClient* WorkerContentSettingsClient::create(PassOwnPtr<WebWorkerContentSettingsClientProxy> proxy) +WorkerContentSettingsClient* WorkerContentSettingsClient::create(std::unique_ptr<WebWorkerContentSettingsClientProxy> proxy) { return new WorkerContentSettingsClient(std::move(proxy)); } @@ -72,12 +72,12 @@ return static_cast<WorkerContentSettingsClient*>(Supplement<WorkerClients>::from(*clients, supplementName())); } -WorkerContentSettingsClient::WorkerContentSettingsClient(PassOwnPtr<WebWorkerContentSettingsClientProxy> proxy) +WorkerContentSettingsClient::WorkerContentSettingsClient(std::unique_ptr<WebWorkerContentSettingsClientProxy> proxy) : m_proxy(std::move(proxy)) { } -void provideContentSettingsClientToWorker(WorkerClients* clients, PassOwnPtr<WebWorkerContentSettingsClientProxy> proxy) +void provideContentSettingsClientToWorker(WorkerClients* clients, std::unique_ptr<WebWorkerContentSettingsClientProxy> proxy) { DCHECK(clients); WorkerContentSettingsClient::provideTo(*clients, WorkerContentSettingsClient::supplementName(), WorkerContentSettingsClient::create(std::move(proxy)));
diff --git a/third_party/WebKit/Source/web/WorkerContentSettingsClient.h b/third_party/WebKit/Source/web/WorkerContentSettingsClient.h index d2b92723..ed02e11 100644 --- a/third_party/WebKit/Source/web/WorkerContentSettingsClient.h +++ b/third_party/WebKit/Source/web/WorkerContentSettingsClient.h
@@ -33,6 +33,7 @@ #include "core/workers/WorkerClients.h" #include "wtf/Forward.h" +#include <memory> namespace blink { @@ -43,7 +44,7 @@ class WorkerContentSettingsClient final : public GarbageCollectedFinalized<WorkerContentSettingsClient>, public Supplement<WorkerClients> { USING_GARBAGE_COLLECTED_MIXIN(WorkerContentSettingsClient); public: - static WorkerContentSettingsClient* create(PassOwnPtr<WebWorkerContentSettingsClientProxy>); + static WorkerContentSettingsClient* create(std::unique_ptr<WebWorkerContentSettingsClientProxy>); virtual ~WorkerContentSettingsClient(); bool requestFileSystemAccessSync(); @@ -55,12 +56,12 @@ DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<WorkerClients>::trace(visitor); } private: - explicit WorkerContentSettingsClient(PassOwnPtr<WebWorkerContentSettingsClientProxy>); + explicit WorkerContentSettingsClient(std::unique_ptr<WebWorkerContentSettingsClientProxy>); - OwnPtr<WebWorkerContentSettingsClientProxy> m_proxy; + std::unique_ptr<WebWorkerContentSettingsClientProxy> m_proxy; }; -void provideContentSettingsClientToWorker(WorkerClients*, PassOwnPtr<WebWorkerContentSettingsClientProxy>); +void provideContentSettingsClientToWorker(WorkerClients*, std::unique_ptr<WebWorkerContentSettingsClientProxy>); } // namespace blink
diff --git a/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp b/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp index 5f313ac..a999ac8 100644 --- a/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp +++ b/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp
@@ -11,6 +11,7 @@ #include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" #include "wtf/Forward.h" +#include "wtf/PtrUtil.h" #include "wtf/text/Base64.h" #include <v8.h> @@ -69,7 +70,7 @@ ActivityLoggerTest() { m_activityLogger = new TestActivityLogger(); - V8DOMActivityLogger::setActivityLogger(isolatedWorldId, String(), adoptPtr(m_activityLogger)); + V8DOMActivityLogger::setActivityLogger(isolatedWorldId, String(), wrapUnique(m_activityLogger)); m_webViewHelper.initialize(true); m_scriptController = &m_webViewHelper.webViewImpl()->mainFrameImpl()->frame()->script(); FrameTestHelpers::loadFrame(m_webViewHelper.webViewImpl()->mainFrame(), "about:blank");
diff --git a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp index c405ad1..eb6d633 100644 --- a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp +++ b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp
@@ -21,7 +21,9 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebViewImpl.h" #include "web/tests/FrameTestHelpers.h" +#include "wtf/PtrUtil.h" #include <gtest/gtest.h> +#include <memory> namespace blink { @@ -277,7 +279,7 @@ EXPECT_NE(0UL, elementId); TransformationMatrix transformMatrix(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44); - OwnPtr<CompositorMutation> mutation = adoptPtr(new CompositorMutation); + std::unique_ptr<CompositorMutation> mutation = wrapUnique(new CompositorMutation); mutation->setTransform(TransformationMatrix::toSkMatrix44(transformMatrix)); mutation->setOpacity(0.5); @@ -291,7 +293,7 @@ } // Verify that updating one property does not impact others - mutation = adoptPtr(new CompositorMutation); + mutation = wrapUnique(new CompositorMutation); mutation->setOpacity(0.8); proxiedElement->updateFromCompositorMutation(*mutation);
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp index 438ebbf..12bc6d2 100644 --- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp +++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
@@ -48,6 +48,7 @@ #include "web/WebLocalFrameImpl.h" #include "web/WebRemoteFrameImpl.h" #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/text/StringBuilder.h" @@ -306,7 +307,7 @@ void TestWebViewClient::initializeLayerTreeView() { - m_layerTreeView = adoptPtr(new WebLayerTreeViewImplForTesting); + m_layerTreeView = wrapUnique(new WebLayerTreeViewImplForTesting); } } // namespace FrameTestHelpers
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h index eaadcac..067e7fa 100644 --- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h +++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h
@@ -42,9 +42,9 @@ #include "public/web/WebRemoteFrameClient.h" #include "public/web/WebViewClient.h" #include "web/WebViewImpl.h" -#include "wtf/PassOwnPtr.h" #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <memory> #include <string> namespace blink { @@ -134,7 +134,7 @@ WebWidgetClient* widgetClient() { return this; } private: - OwnPtr<WebLayerTreeView> m_layerTreeView; + std::unique_ptr<WebLayerTreeView> m_layerTreeView; bool m_animationScheduled; };
diff --git a/third_party/WebKit/Source/web/tests/KeyboardTest.cpp b/third_party/WebKit/Source/web/tests/KeyboardTest.cpp index d5275e0c..bf1877e0 100644 --- a/third_party/WebKit/Source/web/tests/KeyboardTest.cpp +++ b/third_party/WebKit/Source/web/tests/KeyboardTest.cpp
@@ -37,6 +37,7 @@ #include "public/web/WebInputEvent.h" #include "testing/gtest/include/gtest/gtest.h" #include "web/WebInputEventConversion.h" +#include <memory> namespace blink { @@ -53,7 +54,7 @@ PlatformKeyboardEventBuilder evt(webKeyboardEvent); evt.setKeyType(keyType); KeyboardEvent* keyboardEvent = KeyboardEvent::create(evt, 0); - OwnPtr<Settings> settings = Settings::create(); + std::unique_ptr<Settings> settings = Settings::create(); EditingBehavior behavior(settings->editingBehaviorType()); return behavior.interpretKeyEvent(*keyboardEvent); }
diff --git a/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp b/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp index 67f8091..ca5ca224 100644 --- a/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp +++ b/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp
@@ -44,9 +44,10 @@ #include "testing/gtest/include/gtest/gtest.h" #include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include <functional> #include <list> +#include <memory> using namespace blink; using blink::URLTestHelpers::toKURL; @@ -66,7 +67,7 @@ void setExtraDataForNextPrerender(WebPrerender::ExtraData* extraData) { DCHECK(!m_extraData); - m_extraData = adoptPtr(extraData); + m_extraData = wrapUnique(extraData); } WebPrerender releaseWebPrerender() @@ -91,13 +92,13 @@ // From WebPrerendererClient: void willAddPrerender(WebPrerender* prerender) override { - prerender->setExtraData(m_extraData.leakPtr()); + prerender->setExtraData(m_extraData.release()); DCHECK(!prerender->isNull()); m_webPrerenders.push_back(*prerender); } - OwnPtr<WebPrerender::ExtraData> m_extraData; + std::unique_ptr<WebPrerender::ExtraData> m_extraData; std::list<WebPrerender> m_webPrerenders; };
diff --git a/third_party/WebKit/Source/web/tests/SpinLockTest.cpp b/third_party/WebKit/Source/web/tests/SpinLockTest.cpp index 80531c59..769d349 100644 --- a/third_party/WebKit/Source/web/tests/SpinLockTest.cpp +++ b/third_party/WebKit/Source/web/tests/SpinLockTest.cpp
@@ -36,8 +36,8 @@ #include "public/platform/WebThread.h" #include "public/platform/WebTraceLocation.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace blink { @@ -77,8 +77,8 @@ { char sharedBuffer[bufferSize]; - OwnPtr<WebThread> thread1 = adoptPtr(Platform::current()->createThread("thread1")); - OwnPtr<WebThread> thread2 = adoptPtr(Platform::current()->createThread("thread2")); + std::unique_ptr<WebThread> thread1 = wrapUnique(Platform::current()->createThread("thread1")); + std::unique_ptr<WebThread> thread2 = wrapUnique(Platform::current()->createThread("thread2")); thread1->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&threadMain, AllowCrossThreadAccess(static_cast<char*>(sharedBuffer)))); thread2->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&threadMain, AllowCrossThreadAccess(static_cast<char*>(sharedBuffer))));
diff --git a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp index bfa8a86f..9ee5ae5 100644 --- a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp +++ b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
@@ -22,7 +22,6 @@ #include "web/FindInPageCoordinates.h" #include "web/WebLocalFrameImpl.h" #include "web/tests/FrameTestHelpers.h" -#include "wtf/OwnPtr.h" using blink::testing::runPendingTasks;
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp index cc7b83617..7bcfe35 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -128,8 +128,10 @@ #include "web/WebViewImpl.h" #include "web/tests/FrameTestHelpers.h" #include "wtf/Forward.h" +#include "wtf/PtrUtil.h" #include "wtf/dtoa/utils.h" #include <map> +#include <memory> #include <stdarg.h> #include <v8.h> @@ -254,7 +256,7 @@ webViewHelper->resize(WebSize(640, 480)); } - PassOwnPtr<DragImage> nodeImageTestSetup(FrameTestHelpers::WebViewHelper* webViewHelper, const std::string& testcase) + std::unique_ptr<DragImage> nodeImageTestSetup(FrameTestHelpers::WebViewHelper* webViewHelper, const std::string& testcase) { registerMockedHttpURLLoad("nodeimage.html"); webViewHelper->initializeAndLoad(m_baseURL + "nodeimage.html"); @@ -2447,7 +2449,7 @@ int viewWidth = 500; int viewHeight = 500; - OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr(new FakeCompositingWebViewClient()); + std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = wrapUnique(new FakeCompositingWebViewClient()); FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(), nullptr, &configueCompositingWebView); @@ -3422,18 +3424,18 @@ releaseNotifications.clear(); } - Vector<OwnPtr<Notification>> createNotifications; - Vector<OwnPtr<Notification>> releaseNotifications; + Vector<std::unique_ptr<Notification>> createNotifications; + Vector<std::unique_ptr<Notification>> releaseNotifications; private: void didCreateScriptContext(WebLocalFrame* frame, v8::Local<v8::Context> context, int extensionGroup, int worldId) override { - createNotifications.append(adoptPtr(new Notification(frame, context, worldId))); + createNotifications.append(wrapUnique(new Notification(frame, context, worldId))); } void willReleaseScriptContext(WebLocalFrame* frame, v8::Local<v8::Context> context, int worldId) override { - releaseNotifications.append(adoptPtr(new Notification(frame, context, worldId))); + releaseNotifications.append(wrapUnique(new Notification(frame, context, worldId))); } }; @@ -4541,7 +4543,7 @@ void registerSelection(const WebSelection& selection) override { - m_selection = adoptPtr(new WebSelection(selection)); + m_selection = wrapUnique(new WebSelection(selection)); } void clearSelection() override @@ -4563,7 +4565,7 @@ private: bool m_selectionCleared; - OwnPtr<WebSelection> m_selection; + std::unique_ptr<WebSelection> m_selection; }; class CompositedSelectionBoundsTestWebViewClient : public FrameTestHelpers::TestWebViewClient { @@ -6252,7 +6254,7 @@ TEST_F(WebFrameTest, overflowHiddenRewrite) { registerMockedHttpURLLoad("non-scrollable.html"); - OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr(new FakeCompositingWebViewClient()); + std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = wrapUnique(new FakeCompositingWebViewClient()); FrameTestHelpers::WebViewHelper webViewHelper; webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(), nullptr, &configueCompositingWebView); @@ -6968,7 +6970,7 @@ TEST_P(ParameterizedWebFrameTest, NodeImageTestCSSTransformDescendant) { FrameTestHelpers::WebViewHelper webViewHelper(this); - OwnPtr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-3dtransform-descendant")); + std::unique_ptr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-3dtransform-descendant")); EXPECT_TRUE(dragImage); nodeImageTestValidation(IntSize(40, 40), dragImage.get()); @@ -6977,7 +6979,7 @@ TEST_P(ParameterizedWebFrameTest, NodeImageTestCSSTransform) { FrameTestHelpers::WebViewHelper webViewHelper(this); - OwnPtr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-transform")); + std::unique_ptr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-transform")); EXPECT_TRUE(dragImage); nodeImageTestValidation(IntSize(40, 40), dragImage.get()); @@ -6986,7 +6988,7 @@ TEST_P(ParameterizedWebFrameTest, NodeImageTestCSS3DTransform) { FrameTestHelpers::WebViewHelper webViewHelper(this); - OwnPtr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-3dtransform")); + std::unique_ptr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-3dtransform")); EXPECT_TRUE(dragImage); nodeImageTestValidation(IntSize(40, 40), dragImage.get()); @@ -6995,7 +6997,7 @@ TEST_P(ParameterizedWebFrameTest, NodeImageTestInlineBlock) { FrameTestHelpers::WebViewHelper webViewHelper(this); - OwnPtr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-inlineblock")); + std::unique_ptr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-inlineblock")); EXPECT_TRUE(dragImage); nodeImageTestValidation(IntSize(40, 40), dragImage.get()); @@ -7004,7 +7006,7 @@ TEST_P(ParameterizedWebFrameTest, NodeImageTestFloatLeft) { FrameTestHelpers::WebViewHelper webViewHelper(this); - OwnPtr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-float-left-overflow-hidden")); + std::unique_ptr<DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-float-left-overflow-hidden")); EXPECT_TRUE(dragImage); nodeImageTestValidation(IntSize(40, 40), dragImage.get());
diff --git a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp index b69327a..f6084a73 100644 --- a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
@@ -66,6 +66,8 @@ #include "web/WebViewImpl.h" #include "web/tests/FakeWebPlugin.h" #include "web/tests/FrameTestHelpers.h" +#include "wtf/PtrUtil.h" +#include <memory> using blink::testing::runPendingTasks; @@ -602,7 +604,7 @@ public: CompositedPlugin(WebLocalFrame* frame, const WebPluginParams& params) : FakeWebPlugin(frame, params) - , m_layer(adoptPtr(Platform::current()->compositorSupport()->createLayer())) + , m_layer(wrapUnique(Platform::current()->compositorSupport()->createLayer())) { } @@ -625,7 +627,7 @@ } private: - OwnPtr<WebLayer> m_layer; + std::unique_ptr<WebLayer> m_layer; }; class ScopedSPv2 { @@ -656,7 +658,7 @@ Element* element = static_cast<Element*>(container->element()); const auto* plugin = static_cast<const CompositedPlugin*>(container->plugin()); - OwnPtr<PaintController> paintController = PaintController::create(); + std::unique_ptr<PaintController> paintController = PaintController::create(); GraphicsContext graphicsContext(*paintController); container->paint(graphicsContext, CullRect(IntRect(10, 10, 400, 300))); paintController->commitNewDisplayItems();
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp index b99c5ba0..237a8c6 100644 --- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -96,6 +96,8 @@ #include "web/WebSettingsImpl.h" #include "web/WebViewImpl.h" #include "web/tests/FrameTestHelpers.h" +#include "wtf/PtrUtil.h" +#include <memory> #if OS(MACOSX) #include "public/web/mac/WebSubstringUtil.h" @@ -1864,7 +1866,7 @@ TEST_F(WebViewTest, ShowPressOnTransformedLink) { - OwnPtr<FrameTestHelpers::TestWebViewClient> fakeCompositingWebViewClient = adoptPtr(new FrameTestHelpers::TestWebViewClient()); + std::unique_ptr<FrameTestHelpers::TestWebViewClient> fakeCompositingWebViewClient = wrapUnique(new FrameTestHelpers::TestWebViewClient()); FrameTestHelpers::WebViewHelper webViewHelper; WebViewImpl* webViewImpl = webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(), nullptr, &configueCompositingWebView);
diff --git a/third_party/WebKit/Source/wtf/Assertions.cpp b/third_party/WebKit/Source/wtf/Assertions.cpp index ec94840..ed523882 100644 --- a/third_party/WebKit/Source/wtf/Assertions.cpp +++ b/third_party/WebKit/Source/wtf/Assertions.cpp
@@ -34,10 +34,10 @@ #include "wtf/Assertions.h" #include "wtf/Compiler.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/ThreadSpecific.h" #include "wtf/Threading.h" +#include <memory> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -115,7 +115,7 @@ return; } - OwnPtr<char[]> formatWithNewline = adoptArrayPtr(new char[formatLength + 2]); + std::unique_ptr<char[]> formatWithNewline = wrapArrayUnique(new char[formatLength + 2]); memcpy(formatWithNewline.get(), format, formatLength); formatWithNewline[formatLength] = '\n'; formatWithNewline[formatLength + 1] = 0;
diff --git a/third_party/WebKit/Source/wtf/DataLog.cpp b/third_party/WebKit/Source/wtf/DataLog.cpp index 5d8d981..61076f4 100644 --- a/third_party/WebKit/Source/wtf/DataLog.cpp +++ b/third_party/WebKit/Source/wtf/DataLog.cpp
@@ -59,7 +59,7 @@ snprintf(actualFilename, sizeof(actualFilename), "%s.%d.txt", filename, getpid()); if (filename) { - file = FilePrintStream::open(actualFilename, "w").leakPtr(); + file = FilePrintStream::open(actualFilename, "w").release(); if (!file) fprintf(stderr, "Warning: Could not open log file %s for writing.\n", actualFilename); }
diff --git a/third_party/WebKit/Source/wtf/DequeTest.cpp b/third_party/WebKit/Source/wtf/DequeTest.cpp index 114afbb9..8c6e360b 100644 --- a/third_party/WebKit/Source/wtf/DequeTest.cpp +++ b/third_party/WebKit/Source/wtf/DequeTest.cpp
@@ -27,8 +27,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include <memory> namespace WTF { @@ -178,11 +177,11 @@ { int destructNumber = 0; OwnPtrDeque deque; - deque.append(adoptPtr(new DestructCounter(0, &destructNumber))); - deque.append(adoptPtr(new DestructCounter(1, &destructNumber))); + deque.append(wrapUnique(new DestructCounter(0, &destructNumber))); + deque.append(wrapUnique(new DestructCounter(1, &destructNumber))); EXPECT_EQ(2u, deque.size()); - OwnPtr<DestructCounter>& counter0 = deque.first(); + std::unique_ptr<DestructCounter>& counter0 = deque.first(); EXPECT_EQ(0, counter0->get()); int counter1 = deque.last()->get(); EXPECT_EQ(1, counter1); @@ -190,7 +189,7 @@ size_t index = 0; for (auto iter = deque.begin(); iter != deque.end(); ++iter) { - OwnPtr<DestructCounter>& refCounter = *iter; + std::unique_ptr<DestructCounter>& refCounter = *iter; EXPECT_EQ(index, static_cast<size_t>(refCounter->get())); EXPECT_EQ(index, static_cast<size_t>((*refCounter).get())); index++; @@ -199,7 +198,7 @@ auto it = deque.begin(); for (index = 0; index < deque.size(); ++index) { - OwnPtr<DestructCounter>& refCounter = *it; + std::unique_ptr<DestructCounter>& refCounter = *it; EXPECT_EQ(index, static_cast<size_t>(refCounter->get())); index++; ++it; @@ -212,7 +211,7 @@ EXPECT_EQ(1u, deque.size()); EXPECT_EQ(1, destructNumber); - OwnPtr<DestructCounter> ownCounter1 = std::move(deque.first()); + std::unique_ptr<DestructCounter> ownCounter1 = std::move(deque.first()); deque.removeFirst(); EXPECT_EQ(counter1, ownCounter1->get()); EXPECT_EQ(0u, deque.size()); @@ -224,9 +223,9 @@ size_t count = 1025; destructNumber = 0; for (size_t i = 0; i < count; ++i) - deque.prepend(adoptPtr(new DestructCounter(i, &destructNumber))); + deque.prepend(wrapUnique(new DestructCounter(i, &destructNumber))); - // Deque relocation must not destruct OwnPtr element. + // Deque relocation must not destruct std::unique_ptr element. EXPECT_EQ(0, destructNumber); EXPECT_EQ(count, deque.size()); @@ -242,8 +241,8 @@ TEST(DequeTest, OwnPtr) { - ownPtrTest<Deque<OwnPtr<DestructCounter>>>(); - ownPtrTest<Deque<OwnPtr<DestructCounter>, 2>>(); + ownPtrTest<Deque<std::unique_ptr<DestructCounter>>>(); + ownPtrTest<Deque<std::unique_ptr<DestructCounter>, 2>>(); } class MoveOnly {
diff --git a/third_party/WebKit/Source/wtf/FilePrintStream.cpp b/third_party/WebKit/Source/wtf/FilePrintStream.cpp index d248c8c..c967e8a 100644 --- a/third_party/WebKit/Source/wtf/FilePrintStream.cpp +++ b/third_party/WebKit/Source/wtf/FilePrintStream.cpp
@@ -25,6 +25,9 @@ #include "wtf/FilePrintStream.h" +#include "wtf/PtrUtil.h" +#include <memory> + namespace WTF { FilePrintStream::FilePrintStream(FILE* file, AdoptionMode adoptionMode) @@ -40,13 +43,13 @@ fclose(m_file); } -PassOwnPtr<FilePrintStream> FilePrintStream::open(const char* filename, const char* mode) +std::unique_ptr<FilePrintStream> FilePrintStream::open(const char* filename, const char* mode) { FILE* file = fopen(filename, mode); if (!file) - return PassOwnPtr<FilePrintStream>(); + return std::unique_ptr<FilePrintStream>(); - return adoptPtr(new FilePrintStream(file)); + return wrapUnique(new FilePrintStream(file)); } void FilePrintStream::vprintf(const char* format, va_list argList)
diff --git a/third_party/WebKit/Source/wtf/FilePrintStream.h b/third_party/WebKit/Source/wtf/FilePrintStream.h index 6f4eccdf6..8756472 100644 --- a/third_party/WebKit/Source/wtf/FilePrintStream.h +++ b/third_party/WebKit/Source/wtf/FilePrintStream.h
@@ -26,8 +26,8 @@ #ifndef FilePrintStream_h #define FilePrintStream_h -#include "wtf/PassOwnPtr.h" #include "wtf/PrintStream.h" +#include <memory> #include <stdio.h> namespace WTF { @@ -42,7 +42,7 @@ FilePrintStream(FILE*, AdoptionMode = Adopt); ~FilePrintStream() override; - static PassOwnPtr<FilePrintStream> open(const char* filename, const char* mode); + static std::unique_ptr<FilePrintStream> open(const char* filename, const char* mode); FILE* file() { return m_file; }
diff --git a/third_party/WebKit/Source/wtf/Forward.h b/third_party/WebKit/Source/wtf/Forward.h index 03f1333..521fffe8 100644 --- a/third_party/WebKit/Source/wtf/Forward.h +++ b/third_party/WebKit/Source/wtf/Forward.h
@@ -26,15 +26,6 @@ namespace WTF { -template <typename T> class OwnPtr; -#if COMPILER(MSVC) -#ifndef PassOwnPtr -#define PassOwnPtr OwnPtr -#endif -#else -template <typename T> -using PassOwnPtr = OwnPtr<T>; -#endif template <typename T> class PassRefPtr; template <typename T> class RefPtr; template <size_t size> class SizeSpecificPartitionAllocator; @@ -63,8 +54,6 @@ } // namespace WTF -using WTF::OwnPtr; -using WTF::PassOwnPtr; using WTF::PassRefPtr; using WTF::RefPtr; using WTF::Vector;
diff --git a/third_party/WebKit/Source/wtf/Functional.h b/third_party/WebKit/Source/wtf/Functional.h index 694963a..dd3b7a2 100644 --- a/third_party/WebKit/Source/wtf/Functional.h +++ b/third_party/WebKit/Source/wtf/Functional.h
@@ -29,7 +29,6 @@ #include "base/tuple.h" #include "wtf/Allocator.h" #include "wtf/Assertions.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/PtrUtil.h" #include "wtf/RefPtr.h" @@ -168,12 +167,6 @@ } template <typename... IncomingParameters> - R operator()(const PassOwnPtr<C>& c, IncomingParameters&&... parameters) - { - return (c.get()->*m_function)(std::forward<IncomingParameters>(parameters)...); - } - - template <typename... IncomingParameters> R operator()(const std::unique_ptr<C>& c, IncomingParameters&&... parameters) { return (c.get()->*m_function)(std::forward<IncomingParameters>(parameters)...);
diff --git a/third_party/WebKit/Source/wtf/HashFunctions.h b/third_party/WebKit/Source/wtf/HashFunctions.h index 31fc76a..569282b 100644 --- a/third_party/WebKit/Source/wtf/HashFunctions.h +++ b/third_party/WebKit/Source/wtf/HashFunctions.h
@@ -21,7 +21,6 @@ #ifndef WTF_HashFunctions_h #define WTF_HashFunctions_h -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/StdLibExtras.h" #include <memory> @@ -155,18 +154,6 @@ }; template <typename T> -struct OwnPtrHash : PtrHash<T> { - using PtrHash<T>::hash; - static unsigned hash(const OwnPtr<T>& key) { return hash(key.get()); } - - static bool equal(const OwnPtr<T>& a, const OwnPtr<T>& b) - { - return a.get() == b.get(); - } - static bool equal(const OwnPtr<T>& a, T* b) { return a == b; } -}; - -template <typename T> struct UniquePtrHash : PtrHash<T> { using PtrHash<T>::hash; static unsigned hash(const std::unique_ptr<T>& key) { return hash(key.get()); } @@ -215,10 +202,6 @@ using Hash = RefPtrHash<T>; }; template <typename T> -struct DefaultHash<OwnPtr<T>> { - using Hash = OwnPtrHash<T>; -}; -template <typename T> struct DefaultHash<std::unique_ptr<T>> { using Hash = UniquePtrHash<T>; };
diff --git a/third_party/WebKit/Source/wtf/HashMapTest.cpp b/third_party/WebKit/Source/wtf/HashMapTest.cpp index f8b97ed0..17583d95 100644 --- a/third_party/WebKit/Source/wtf/HashMapTest.cpp +++ b/third_party/WebKit/Source/wtf/HashMapTest.cpp
@@ -26,9 +26,8 @@ #include "wtf/HashMap.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" #include <memory> @@ -104,14 +103,14 @@ int* m_destructNumber; }; -using OwnPtrHashMap = HashMap<int, OwnPtr<DestructCounter>>; +using OwnPtrHashMap = HashMap<int, std::unique_ptr<DestructCounter>>; TEST(HashMapTest, OwnPtrAsValue) { int destructNumber = 0; OwnPtrHashMap map; - map.add(1, adoptPtr(new DestructCounter(1, &destructNumber))); - map.add(2, adoptPtr(new DestructCounter(2, &destructNumber))); + map.add(1, wrapUnique(new DestructCounter(1, &destructNumber))); + map.add(2, wrapUnique(new DestructCounter(2, &destructNumber))); DestructCounter* counter1 = map.get(1); EXPECT_EQ(1, counter1->get()); @@ -120,12 +119,12 @@ EXPECT_EQ(0, destructNumber); for (OwnPtrHashMap::iterator iter = map.begin(); iter != map.end(); ++iter) { - OwnPtr<DestructCounter>& ownCounter = iter->value; + std::unique_ptr<DestructCounter>& ownCounter = iter->value; EXPECT_EQ(iter->key, ownCounter->get()); } ASSERT_EQ(0, destructNumber); - OwnPtr<DestructCounter> ownCounter1 = map.take(1); + std::unique_ptr<DestructCounter> ownCounter1 = map.take(1); EXPECT_EQ(ownCounter1.get(), counter1); EXPECT_FALSE(map.contains(1)); EXPECT_EQ(0, destructNumber); @@ -243,7 +242,7 @@ private: int m_v; }; -using IntSimpleMap = HashMap<int, OwnPtr<SimpleClass>>; +using IntSimpleMap = HashMap<int, std::unique_ptr<SimpleClass>>; TEST(HashMapTest, AddResult) { @@ -254,10 +253,10 @@ EXPECT_EQ(0, result.storedValue->value.get()); SimpleClass* simple1 = new SimpleClass(1); - result.storedValue->value = adoptPtr(simple1); + result.storedValue->value = wrapUnique(simple1); EXPECT_EQ(simple1, map.get(1)); - IntSimpleMap::AddResult result2 = map.add(1, adoptPtr(new SimpleClass(2))); + IntSimpleMap::AddResult result2 = map.add(1, wrapUnique(new SimpleClass(2))); EXPECT_FALSE(result2.isNewEntry); EXPECT_EQ(1, result.storedValue->key); EXPECT_EQ(1, result.storedValue->value->v());
diff --git a/third_party/WebKit/Source/wtf/HashSetTest.cpp b/third_party/WebKit/Source/wtf/HashSetTest.cpp index d9497665..2313b7c 100644 --- a/third_party/WebKit/Source/wtf/HashSetTest.cpp +++ b/third_party/WebKit/Source/wtf/HashSetTest.cpp
@@ -26,9 +26,9 @@ #include "wtf/HashSet.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" +#include <memory> namespace WTF { @@ -90,14 +90,14 @@ { bool deleted1 = false, deleted2 = false; - typedef HashSet<OwnPtr<Dummy>> OwnPtrSet; + typedef HashSet<std::unique_ptr<Dummy>> OwnPtrSet; OwnPtrSet set; Dummy* ptr1 = new Dummy(deleted1); { // AddResult in a separate scope to avoid assertion hit, // since we modify the container further. - HashSet<OwnPtr<Dummy>>::AddResult res1 = set.add(adoptPtr(ptr1)); + HashSet<std::unique_ptr<Dummy>>::AddResult res1 = set.add(wrapUnique(ptr1)); EXPECT_EQ(ptr1, res1.storedValue->get()); } @@ -105,11 +105,11 @@ EXPECT_EQ(1UL, set.size()); OwnPtrSet::iterator it1 = set.find(ptr1); EXPECT_NE(set.end(), it1); - EXPECT_EQ(ptr1, (*it1)); + EXPECT_EQ(ptr1, (*it1).get()); Dummy* ptr2 = new Dummy(deleted2); { - HashSet<OwnPtr<Dummy>>::AddResult res2 = set.add(adoptPtr(ptr2)); + HashSet<std::unique_ptr<Dummy>>::AddResult res2 = set.add(wrapUnique(ptr2)); EXPECT_EQ(res2.storedValue->get(), ptr2); } @@ -117,7 +117,7 @@ EXPECT_EQ(2UL, set.size()); OwnPtrSet::iterator it2 = set.find(ptr2); EXPECT_NE(set.end(), it2); - EXPECT_EQ(ptr2, (*it2)); + EXPECT_EQ(ptr2, (*it2).get()); set.remove(ptr1); EXPECT_TRUE(deleted1); @@ -130,22 +130,22 @@ deleted2 = false; { OwnPtrSet set; - set.add(adoptPtr(new Dummy(deleted1))); - set.add(adoptPtr(new Dummy(deleted2))); + set.add(wrapUnique(new Dummy(deleted1))); + set.add(wrapUnique(new Dummy(deleted2))); } EXPECT_TRUE(deleted1); EXPECT_TRUE(deleted2); deleted1 = false; deleted2 = false; - OwnPtr<Dummy> ownPtr1; - OwnPtr<Dummy> ownPtr2; + std::unique_ptr<Dummy> ownPtr1; + std::unique_ptr<Dummy> ownPtr2; ptr1 = new Dummy(deleted1); ptr2 = new Dummy(deleted2); { OwnPtrSet set; - set.add(adoptPtr(ptr1)); - set.add(adoptPtr(ptr2)); + set.add(wrapUnique(ptr1)); + set.add(wrapUnique(ptr2)); ownPtr1 = set.take(ptr1); EXPECT_EQ(1UL, set.size()); ownPtr2 = set.takeAny(); @@ -154,8 +154,8 @@ EXPECT_FALSE(deleted1); EXPECT_FALSE(deleted2); - EXPECT_EQ(ptr1, ownPtr1); - EXPECT_EQ(ptr2, ownPtr2); + EXPECT_EQ(ptr1, ownPtr1.get()); + EXPECT_EQ(ptr2, ownPtr2.get()); } class DummyRefCounted : public RefCounted<DummyRefCounted> {
diff --git a/third_party/WebKit/Source/wtf/HashTable.h b/third_party/WebKit/Source/wtf/HashTable.h index 64c7018..f6720ab 100644 --- a/third_party/WebKit/Source/wtf/HashTable.h +++ b/third_party/WebKit/Source/wtf/HashTable.h
@@ -25,7 +25,9 @@ #include "wtf/Assertions.h" #include "wtf/ConditionalDestructor.h" #include "wtf/HashTraits.h" +#include "wtf/PtrUtil.h" #include "wtf/allocator/PartitionAllocator.h" +#include <memory> #define DUMP_HASHTABLE_STATS 0 #define DUMP_HASHTABLE_STATS_PER_TABLE 0 @@ -579,7 +581,7 @@ #if DUMP_HASHTABLE_STATS_PER_TABLE public: - mutable OwnPtr<Stats> m_stats; + mutable std::unique_ptr<Stats> m_stats; #endif template <WeakHandlingFlag x, typename T, typename U, typename V, typename W, typename X, typename Y, typename Z> friend struct WeakProcessingHashTableHelper; @@ -598,7 +600,7 @@ , m_modifications(0) #endif #if DUMP_HASHTABLE_STATS_PER_TABLE - , m_stats(adoptPtr(new Stats)) + , m_stats(wrapUnique(new Stats)) #endif { static_assert(Allocator::isGarbageCollected || (!IsPointerToGarbageCollectedType<Key>::value && !IsPointerToGarbageCollectedType<Value>::value), "Cannot put raw pointers to garbage-collected classes into an off-heap collection."); @@ -1235,7 +1237,7 @@ , m_modifications(0) #endif #if DUMP_HASHTABLE_STATS_PER_TABLE - , m_stats(adoptPtr(new Stats(*other.m_stats))) + , m_stats(wrapUnique(new Stats(*other.m_stats))) #endif { // Copy the hash table the dumb way, by adding each element to the new @@ -1258,7 +1260,7 @@ , m_modifications(0) #endif #if DUMP_HASHTABLE_STATS_PER_TABLE - , m_stats(adoptPtr(new Stats(*other.m_stats))) + , m_stats(wrapUnique(new Stats(*other.m_stats))) #endif { swap(other);
diff --git a/third_party/WebKit/Source/wtf/HashTraits.h b/third_party/WebKit/Source/wtf/HashTraits.h index bd8f8c9..3ddd834 100644 --- a/third_party/WebKit/Source/wtf/HashTraits.h +++ b/third_party/WebKit/Source/wtf/HashTraits.h
@@ -155,23 +155,6 @@ static bool isDeletedValue(const T& value) { return value.isHashTableDeletedValue(); } }; -template <typename P> struct HashTraits<OwnPtr<P>> : SimpleClassHashTraits<OwnPtr<P>> { - typedef std::nullptr_t EmptyValueType; - - static EmptyValueType emptyValue() { return nullptr; } - - static const bool hasIsEmptyValueFunction = true; - static bool isEmptyValue(const OwnPtr<P>& value) { return !value; } - - typedef typename OwnPtr<P>::PtrType PeekInType; - - static void store(PassOwnPtr<P> value, OwnPtr<P>& storage) { storage = std::move(value); } - - typedef typename OwnPtr<P>::PtrType PeekOutType; - static PeekOutType peek(const OwnPtr<P>& value) { return value.get(); } - static PeekOutType peek(std::nullptr_t) { return 0; } -}; - template <typename P> struct HashTraits<RefPtr<P>> : SimpleClassHashTraits<RefPtr<P>> { typedef std::nullptr_t EmptyValueType; static EmptyValueType emptyValue() { return nullptr; }
diff --git a/third_party/WebKit/Source/wtf/LinkedHashSet.h b/third_party/WebKit/Source/wtf/LinkedHashSet.h index 894138bf..e85c72fd 100644 --- a/third_party/WebKit/Source/wtf/LinkedHashSet.h +++ b/third_party/WebKit/Source/wtf/LinkedHashSet.h
@@ -24,8 +24,6 @@ #include "wtf/AddressSanitizer.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/allocator/PartitionAllocator.h" namespace WTF {
diff --git a/third_party/WebKit/Source/wtf/LinkedStack.h b/third_party/WebKit/Source/wtf/LinkedStack.h index 63bbbde7..3350c217 100644 --- a/third_party/WebKit/Source/wtf/LinkedStack.h +++ b/third_party/WebKit/Source/wtf/LinkedStack.h
@@ -32,7 +32,8 @@ #define LinkedStack_h #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> namespace WTF { @@ -45,7 +46,7 @@ // Iterative cleanup to prevent stack overflow problems. ~LinkedStack() { - OwnPtr<Node> ptr = m_head.release(); + std::unique_ptr<Node> ptr = m_head.release(); while (ptr) ptr = ptr->m_next.release(); } @@ -62,18 +63,18 @@ class Node { USING_FAST_MALLOC(LinkedStack::Node); public: - Node(const T&, PassOwnPtr<Node> next); + Node(const T&, std::unique_ptr<Node> next); T m_data; - OwnPtr<Node> m_next; + std::unique_ptr<Node> m_next; }; - OwnPtr<Node> m_head; + std::unique_ptr<Node> m_head; size_t m_size; }; template <typename T> -LinkedStack<T>::Node::Node(const T& data, PassOwnPtr<Node> next) +LinkedStack<T>::Node::Node(const T& data, std::unique_ptr<Node> next) : m_data(data) , m_next(next) { @@ -88,7 +89,7 @@ template <typename T> inline void LinkedStack<T>::push(const T& data) { - m_head = adoptPtr(new Node(data, m_head.release())); + m_head = wrapUnique(new Node(data, m_head.release())); ++m_size; }
diff --git a/third_party/WebKit/Source/wtf/ListHashSet.h b/third_party/WebKit/Source/wtf/ListHashSet.h index 54aded52..ebc2220 100644 --- a/third_party/WebKit/Source/wtf/ListHashSet.h +++ b/third_party/WebKit/Source/wtf/ListHashSet.h
@@ -23,9 +23,8 @@ #define WTF_ListHashSet_h #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/allocator/PartitionAllocator.h" +#include <memory> namespace WTF { @@ -268,7 +267,7 @@ } private: - // Not using OwnPtr as this pointer should be deleted at + // Not using std::unique_ptr as this pointer should be deleted at // releaseAllocator() method rather than at destructor. ListHashSetAllocator* m_allocator; };
diff --git a/third_party/WebKit/Source/wtf/ListHashSetTest.cpp b/third_party/WebKit/Source/wtf/ListHashSetTest.cpp index 1c5a3545..97a1443 100644 --- a/third_party/WebKit/Source/wtf/ListHashSetTest.cpp +++ b/third_party/WebKit/Source/wtf/ListHashSetTest.cpp
@@ -28,8 +28,10 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/LinkedHashSet.h" #include "wtf/PassRefPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" +#include <memory> #include <type_traits> namespace WTF { @@ -552,14 +554,14 @@ { bool deleted1 = false, deleted2 = false; - typedef ListHashSet<OwnPtr<Dummy>> OwnPtrSet; + typedef ListHashSet<std::unique_ptr<Dummy>> OwnPtrSet; OwnPtrSet set; Dummy* ptr1 = new Dummy(deleted1); { // AddResult in a separate scope to avoid assertion hit, // since we modify the container further. - OwnPtrSet::AddResult res1 = set.add(adoptPtr(ptr1)); + OwnPtrSet::AddResult res1 = set.add(wrapUnique(ptr1)); EXPECT_EQ(res1.storedValue->get(), ptr1); } @@ -567,11 +569,11 @@ EXPECT_EQ(1UL, set.size()); OwnPtrSet::iterator it1 = set.find(ptr1); EXPECT_NE(set.end(), it1); - EXPECT_EQ(ptr1, (*it1)); + EXPECT_EQ(ptr1, (*it1).get()); Dummy* ptr2 = new Dummy(deleted2); { - OwnPtrSet::AddResult res2 = set.add(adoptPtr(ptr2)); + OwnPtrSet::AddResult res2 = set.add(wrapUnique(ptr2)); EXPECT_EQ(res2.storedValue->get(), ptr2); } @@ -579,7 +581,7 @@ EXPECT_EQ(2UL, set.size()); OwnPtrSet::iterator it2 = set.find(ptr2); EXPECT_NE(set.end(), it2); - EXPECT_EQ(ptr2, (*it2)); + EXPECT_EQ(ptr2, (*it2).get()); set.remove(ptr1); EXPECT_TRUE(deleted1); @@ -592,8 +594,8 @@ deleted2 = false; { OwnPtrSet set; - set.add(adoptPtr(new Dummy(deleted1))); - set.add(adoptPtr(new Dummy(deleted2))); + set.add(wrapUnique(new Dummy(deleted1))); + set.add(wrapUnique(new Dummy(deleted2))); } EXPECT_TRUE(deleted1); EXPECT_TRUE(deleted2); @@ -601,14 +603,14 @@ deleted1 = false; deleted2 = false; - OwnPtr<Dummy> ownPtr1; - OwnPtr<Dummy> ownPtr2; + std::unique_ptr<Dummy> ownPtr1; + std::unique_ptr<Dummy> ownPtr2; ptr1 = new Dummy(deleted1); ptr2 = new Dummy(deleted2); { OwnPtrSet set; - set.add(adoptPtr(ptr1)); - set.add(adoptPtr(ptr2)); + set.add(wrapUnique(ptr1)); + set.add(wrapUnique(ptr2)); ownPtr1 = set.takeFirst(); EXPECT_EQ(1UL, set.size()); ownPtr2 = set.take(ptr2); @@ -617,8 +619,8 @@ EXPECT_FALSE(deleted1); EXPECT_FALSE(deleted2); - EXPECT_EQ(ptr1, ownPtr1); - EXPECT_EQ(ptr2, ownPtr2); + EXPECT_EQ(ptr1, ownPtr1.get()); + EXPECT_EQ(ptr2, ownPtr2.get()); } class CountCopy final {
diff --git a/third_party/WebKit/Source/wtf/OwnPtr.h b/third_party/WebKit/Source/wtf/OwnPtr.h deleted file mode 100644 index 6725c07..0000000 --- a/third_party/WebKit/Source/wtf/OwnPtr.h +++ /dev/null
@@ -1,196 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef WTF_OwnPtr_h -#define WTF_OwnPtr_h - -#include "wtf/Allocator.h" -#include "wtf/Compiler.h" -#include "wtf/Forward.h" -#include "wtf/HashTableDeletedValueType.h" -#include "wtf/Noncopyable.h" -#include "wtf/OwnPtrCommon.h" -#include <algorithm> -#include <utility> - -namespace WTF { - -template <typename T> class OwnPtr { - USING_FAST_MALLOC(OwnPtr); - WTF_MAKE_NONCOPYABLE(OwnPtr); -public: - template <typename U> friend PassOwnPtr<U> adoptPtr(U* ptr); - template <typename U> friend PassOwnPtr<U[]> adoptArrayPtr(U* ptr); - - typedef typename std::remove_extent<T>::type ValueType; - typedef ValueType* PtrType; - - OwnPtr() : m_ptr(nullptr) {} - OwnPtr(std::nullptr_t) : m_ptr(nullptr) {} - - // Hash table deleted values, which are only constructed and never copied or - // destroyed. - OwnPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) {} - bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); } - - ~OwnPtr() - { - OwnedPtrDeleter<T>::deletePtr(m_ptr); - m_ptr = nullptr; - } - - PtrType get() const { return m_ptr; } - - void reset(); - - PtrType leakPtr() WARN_UNUSED_RETURN; - - ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; } - PtrType operator->() const { ASSERT(m_ptr); return m_ptr; } - - ValueType& operator[](std::ptrdiff_t i) const; - - bool operator!() const { return !m_ptr; } - explicit operator bool() const { return m_ptr; } - - OwnPtr& operator=(std::nullptr_t) { reset(); return *this; } - - OwnPtr(OwnPtr&&); - template <typename U, typename = typename std::enable_if<std::is_convertible<U*, T*>::value>::type> OwnPtr(OwnPtr<U>&&); - - OwnPtr& operator=(OwnPtr&&); - template <typename U> OwnPtr& operator=(OwnPtr<U>&&); - - void swap(OwnPtr& o) { std::swap(m_ptr, o.m_ptr); } - - static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } - -private: - explicit OwnPtr(PtrType ptr) : m_ptr(ptr) {} - - // We should never have two OwnPtrs for the same underlying object - // (otherwise we'll get double-destruction), so these equality operators - // should never be needed. - template <typename U> bool operator==(const OwnPtr<U>&) const - { - static_assert(!sizeof(U*), "OwnPtrs should never be equal"); - return false; - } - template <typename U> bool operator!=(const OwnPtr<U>&) const - { - static_assert(!sizeof(U*), "OwnPtrs should never be equal"); - return false; - } - - PtrType m_ptr; -}; - -template <typename T> inline void OwnPtr<T>::reset() -{ - PtrType ptr = m_ptr; - m_ptr = nullptr; - OwnedPtrDeleter<T>::deletePtr(ptr); -} - -template <typename T> inline typename OwnPtr<T>::PtrType OwnPtr<T>::leakPtr() -{ - PtrType ptr = m_ptr; - m_ptr = nullptr; - return ptr; -} - -template <typename T> inline typename OwnPtr<T>::ValueType& OwnPtr<T>::operator[](std::ptrdiff_t i) const -{ - static_assert(std::is_array<T>::value, "elements access is possible for arrays only"); - ASSERT(m_ptr); - ASSERT(i >= 0); - return m_ptr[i]; -} - -template <typename T> inline OwnPtr<T>::OwnPtr(OwnPtr<T>&& o) - : m_ptr(o.leakPtr()) -{ -} - -template <typename T> -template <typename U, typename> inline OwnPtr<T>::OwnPtr(OwnPtr<U>&& o) - : m_ptr(o.leakPtr()) -{ - static_assert(!std::is_array<T>::value, "pointers to array must never be converted"); -} - -template <typename T> inline OwnPtr<T>& OwnPtr<T>::operator=(OwnPtr<T>&& o) -{ - PtrType ptr = m_ptr; - m_ptr = o.leakPtr(); - ASSERT(!ptr || m_ptr != ptr); - OwnedPtrDeleter<T>::deletePtr(ptr); - - return *this; -} - -template <typename T> -template <typename U> inline OwnPtr<T>& OwnPtr<T>::operator=(OwnPtr<U>&& o) -{ - static_assert(!std::is_array<T>::value, "pointers to array must never be converted"); - PtrType ptr = m_ptr; - m_ptr = o.leakPtr(); - ASSERT(!ptr || m_ptr != ptr); - OwnedPtrDeleter<T>::deletePtr(ptr); - - return *this; -} - -template <typename T> inline void swap(OwnPtr<T>& a, OwnPtr<T>& b) -{ - a.swap(b); -} - -template <typename T, typename U> inline bool operator==(const OwnPtr<T>& a, U* b) -{ - return a.get() == b; -} - -template <typename T, typename U> inline bool operator==(T* a, const OwnPtr<U>& b) -{ - return a == b.get(); -} - -template <typename T, typename U> inline bool operator!=(const OwnPtr<T>& a, U* b) -{ - return a.get() != b; -} - -template <typename T, typename U> inline bool operator!=(T* a, const OwnPtr<U>& b) -{ - return a != b.get(); -} - -template <typename T> inline typename OwnPtr<T>::PtrType getPtr(const OwnPtr<T>& p) -{ - return p.get(); -} - -} // namespace WTF - -using WTF::OwnPtr; - -#endif // WTF_OwnPtr_h
diff --git a/third_party/WebKit/Source/wtf/OwnPtrCommon.h b/third_party/WebKit/Source/wtf/OwnPtrCommon.h deleted file mode 100644 index 89e24895..0000000 --- a/third_party/WebKit/Source/wtf/OwnPtrCommon.h +++ /dev/null
@@ -1,77 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * Copyright (C) 2009 Torch Mobile, Inc. - * Copyright (C) 2010 Company 100 Inc. - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WTF_OwnPtrCommon_h -#define WTF_OwnPtrCommon_h - -#include "wtf/Assertions.h" -#include "wtf/TypeTraits.h" - -namespace WTF { - -class RefCountedBase; -class ThreadSafeRefCountedBase; - -template<typename T> -struct IsRefCounted { - STATIC_ONLY(IsRefCounted); - static const bool value = IsSubclass<T, RefCountedBase>::value - || IsSubclass<T, ThreadSafeRefCountedBase>::value; -}; - -template <typename T> -struct OwnedPtrDeleter { - STATIC_ONLY(OwnedPtrDeleter); - static void deletePtr(T* ptr) - { - static_assert(!IsRefCounted<T>::value, "use RefPtr for RefCounted objects"); - static_assert(sizeof(T) > 0, "type must be complete"); - delete ptr; - } -}; - -template <typename T> -struct OwnedPtrDeleter<T[]> { - STATIC_ONLY(OwnedPtrDeleter); - static void deletePtr(T* ptr) - { - static_assert(!IsRefCounted<T>::value, "use RefPtr for RefCounted objects"); - static_assert(sizeof(T) > 0, "type must be complete"); - delete[] ptr; - } -}; - -template <class T, int n> -struct OwnedPtrDeleter<T[n]> { - STATIC_ONLY(OwnedPtrDeleter); - static_assert(sizeof(T) < 0, "do not use array with size as type"); -}; - -} // namespace WTF - -#endif // WTF_OwnPtrCommon_h
diff --git a/third_party/WebKit/Source/wtf/PassOwnPtr.h b/third_party/WebKit/Source/wtf/PassOwnPtr.h deleted file mode 100644 index 37b1b37..0000000 --- a/third_party/WebKit/Source/wtf/PassOwnPtr.h +++ /dev/null
@@ -1,64 +0,0 @@ -/* - * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WTF_PassOwnPtr_h -#define WTF_PassOwnPtr_h - -#include "wtf/Allocator.h" -#include "wtf/Forward.h" -#include "wtf/Noncopyable.h" -#include "wtf/OwnPtr.h" - -namespace WTF { - -// PassOwnPtr is now an alias of OwnPtr, as defined in Forward.h. - -template <typename T> PassOwnPtr<T> adoptPtr(T*); -template <typename T> PassOwnPtr<T[]> adoptArrayPtr(T*); - -template <typename T> inline PassOwnPtr<T> adoptPtr(T* ptr) -{ - return PassOwnPtr<T>(ptr); -} - -template <typename T> inline PassOwnPtr<T[]> adoptArrayPtr(T* ptr) -{ - return PassOwnPtr<T[]>(ptr); -} - -template <typename T, typename U> inline PassOwnPtr<T> static_pointer_cast(PassOwnPtr<U>&& p) -{ - static_assert(!std::is_array<T>::value, "pointers to array must never be converted"); - return adoptPtr(static_cast<T*>(p.leakPtr())); -} - -} // namespace WTF - -using WTF::adoptPtr; -using WTF::adoptArrayPtr; -using WTF::static_pointer_cast; - -#endif // WTF_PassOwnPtr_h
diff --git a/third_party/WebKit/Source/wtf/SizeLimits.cpp b/third_party/WebKit/Source/wtf/SizeLimits.cpp index 9049b47..a0c9b03 100644 --- a/third_party/WebKit/Source/wtf/SizeLimits.cpp +++ b/third_party/WebKit/Source/wtf/SizeLimits.cpp
@@ -30,7 +30,6 @@ #include "wtf/Assertions.h" #include "wtf/ContainerAnnotations.h" -#include "wtf/OwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" @@ -38,6 +37,7 @@ #include "wtf/Vector.h" #include "wtf/text/AtomicString.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { @@ -77,7 +77,7 @@ #endif }; -static_assert(sizeof(OwnPtr<int>) == sizeof(int*), "OwnPtr should stay small"); +static_assert(sizeof(std::unique_ptr<int>) == sizeof(int*), "std::unique_ptr should stay small"); static_assert(sizeof(PassRefPtr<RefCounted<int>>) == sizeof(int*), "PassRefPtr should stay small"); static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCounted should stay small"); static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*), "RefPtr should stay small");
diff --git a/third_party/WebKit/Source/wtf/TerminatedArray.h b/third_party/WebKit/Source/wtf/TerminatedArray.h index 24c0ac4..43f3f09 100644 --- a/third_party/WebKit/Source/wtf/TerminatedArray.h +++ b/third_party/WebKit/Source/wtf/TerminatedArray.h
@@ -5,8 +5,9 @@ #define TerminatedArray_h #include "wtf/Allocator.h" -#include "wtf/OwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/allocator/Partitions.h" +#include <memory> namespace WTF { @@ -66,7 +67,7 @@ return count; } - // Match Allocator semantics to be able to use OwnPtr<TerminatedArray>. + // Match Allocator semantics to be able to use std::unique_ptr<TerminatedArray>. void operator delete(void* p) { ::WTF::Partitions::fastFree(p); } private: @@ -74,8 +75,8 @@ // of TerminateArray and manage their lifetimes. struct Allocator { STATIC_ONLY(Allocator); - using PassPtr = PassOwnPtr<TerminatedArray>; - using Ptr = OwnPtr<TerminatedArray>; + using PassPtr = std::unique_ptr<TerminatedArray>; + using Ptr = std::unique_ptr<TerminatedArray>; static PassPtr release(Ptr& ptr) { @@ -84,12 +85,12 @@ static PassPtr create(size_t capacity) { - return adoptPtr(static_cast<TerminatedArray*>(WTF::Partitions::fastMalloc(capacity * sizeof(T), WTF_HEAP_PROFILER_TYPE_NAME(T)))); + return wrapUnique(static_cast<TerminatedArray*>(WTF::Partitions::fastMalloc(capacity * sizeof(T), WTF_HEAP_PROFILER_TYPE_NAME(T)))); } static PassPtr resize(Ptr ptr, size_t capacity) { - return adoptPtr(static_cast<TerminatedArray*>(WTF::Partitions::fastRealloc(ptr.leakPtr(), capacity * sizeof(T), WTF_HEAP_PROFILER_TYPE_NAME(T)))); + return wrapUnique(static_cast<TerminatedArray*>(WTF::Partitions::fastRealloc(ptr.release(), capacity * sizeof(T), WTF_HEAP_PROFILER_TYPE_NAME(T)))); } };
diff --git a/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp b/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp index b270215..2a7cdd1 100644 --- a/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp +++ b/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp
@@ -35,8 +35,6 @@ #include "wtf/CurrentTime.h" #include "wtf/DateMath.h" #include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/StdLibExtras.h" #include "wtf/ThreadSpecific.h" #include "wtf/ThreadingPrimitives.h"
diff --git a/third_party/WebKit/Source/wtf/ThreadingWin.cpp b/third_party/WebKit/Source/wtf/ThreadingWin.cpp index 83805e58..86c610c1 100644 --- a/third_party/WebKit/Source/wtf/ThreadingWin.cpp +++ b/third_party/WebKit/Source/wtf/ThreadingWin.cpp
@@ -91,8 +91,6 @@ #include "wtf/DateMath.h" #include "wtf/HashMap.h" #include "wtf/MathExtras.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" #include "wtf/ThreadSpecific.h" #include "wtf/ThreadingPrimitives.h" #include "wtf/WTFThreadData.h"
diff --git a/third_party/WebKit/Source/wtf/Vector.h b/third_party/WebKit/Source/wtf/Vector.h index 9722d7e..5b50284 100644 --- a/third_party/WebKit/Source/wtf/Vector.h +++ b/third_party/WebKit/Source/wtf/Vector.h
@@ -271,6 +271,26 @@ }; template <typename T> +struct VectorElementComparer { + STATIC_ONLY(VectorElementComparer); + template <typename U> + static bool compareElement(const T& left, const U& right) + { + return left == right; + } +}; + +template <typename T> +struct VectorElementComparer<std::unique_ptr<T>> { + STATIC_ONLY(VectorElementComparer); + template <typename U> + static bool compareElement(const std::unique_ptr<T>& left, const U& right) + { + return left.get() == right; + } +}; + +template <typename T> struct VectorTypeOperations { STATIC_ONLY(VectorTypeOperations); static void destruct(T* begin, T* end) @@ -312,6 +332,12 @@ { return VectorComparer<VectorTraits<T>::canCompareWithMemcmp, T>::compare(a, b, size); } + + template <typename U> + static bool compareElement(const T& left, U&& right) + { + return VectorElementComparer<T>::compareElement(left, std::forward<U>(right)); + } }; template <typename T, bool hasInlineCapacity, typename Allocator> @@ -1095,7 +1121,7 @@ const T* b = begin(); const T* e = end(); for (const T* iter = b; iter < e; ++iter) { - if (*iter == value) + if (TypeOperations::compareElement(*iter, value)) return iter - b; } return kNotFound; @@ -1109,7 +1135,7 @@ const T* iter = end(); while (iter > b) { --iter; - if (*iter == value) + if (TypeOperations::compareElement(*iter, value)) return iter - b; } return kNotFound;
diff --git a/third_party/WebKit/Source/wtf/VectorTest.cpp b/third_party/WebKit/Source/wtf/VectorTest.cpp index 11e508c0..f0d164d3 100644 --- a/third_party/WebKit/Source/wtf/VectorTest.cpp +++ b/third_party/WebKit/Source/wtf/VectorTest.cpp
@@ -27,8 +27,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/HashSet.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/WTFString.h" #include <memory> @@ -162,17 +161,17 @@ int* m_destructNumber; }; -typedef WTF::Vector<OwnPtr<DestructCounter>> OwnPtrVector; +typedef WTF::Vector<std::unique_ptr<DestructCounter>> OwnPtrVector; TEST(VectorTest, OwnPtr) { int destructNumber = 0; OwnPtrVector vector; - vector.append(adoptPtr(new DestructCounter(0, &destructNumber))); - vector.append(adoptPtr(new DestructCounter(1, &destructNumber))); + vector.append(wrapUnique(new DestructCounter(0, &destructNumber))); + vector.append(wrapUnique(new DestructCounter(1, &destructNumber))); EXPECT_EQ(2u, vector.size()); - OwnPtr<DestructCounter>& counter0 = vector.first(); + std::unique_ptr<DestructCounter>& counter0 = vector.first(); ASSERT_EQ(0, counter0->get()); int counter1 = vector.last()->get(); ASSERT_EQ(1, counter1); @@ -180,7 +179,7 @@ size_t index = 0; for (OwnPtrVector::iterator iter = vector.begin(); iter != vector.end(); ++iter) { - OwnPtr<DestructCounter>* refCounter = iter; + std::unique_ptr<DestructCounter>* refCounter = iter; EXPECT_EQ(index, static_cast<size_t>(refCounter->get()->get())); EXPECT_EQ(index, static_cast<size_t>((*refCounter)->get())); index++; @@ -188,7 +187,7 @@ EXPECT_EQ(0, destructNumber); for (index = 0; index < vector.size(); index++) { - OwnPtr<DestructCounter>& refCounter = vector[index]; + std::unique_ptr<DestructCounter>& refCounter = vector[index]; EXPECT_EQ(index, static_cast<size_t>(refCounter->get())); } EXPECT_EQ(0, destructNumber); @@ -200,7 +199,7 @@ EXPECT_EQ(1u, vector.size()); EXPECT_EQ(1, destructNumber); - OwnPtr<DestructCounter> ownCounter1 = std::move(vector[0]); + std::unique_ptr<DestructCounter> ownCounter1 = std::move(vector[0]); vector.remove(0); ASSERT_EQ(counter1, ownCounter1->get()); ASSERT_EQ(0u, vector.size()); @@ -212,9 +211,9 @@ size_t count = 1025; destructNumber = 0; for (size_t i = 0; i < count; i++) - vector.prepend(adoptPtr(new DestructCounter(i, &destructNumber))); + vector.prepend(wrapUnique(new DestructCounter(i, &destructNumber))); - // Vector relocation must not destruct OwnPtr element. + // Vector relocation must not destruct std::unique_ptr element. EXPECT_EQ(0, destructNumber); EXPECT_EQ(count, vector.size());
diff --git a/third_party/WebKit/Source/wtf/VectorTraits.h b/third_party/WebKit/Source/wtf/VectorTraits.h index 04e0e68e..e085ec4 100644 --- a/third_party/WebKit/Source/wtf/VectorTraits.h +++ b/third_party/WebKit/Source/wtf/VectorTraits.h
@@ -21,9 +21,9 @@ #ifndef WTF_VectorTraits_h #define WTF_VectorTraits_h -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/TypeTraits.h" +#include <memory> #include <type_traits> #include <utility> @@ -68,23 +68,23 @@ static const bool canCompareWithMemcmp = true; }; -// We know OwnPtr and RefPtr are simple enough that initializing to 0 and moving +// We know std::unique_ptr and RefPtr are simple enough that initializing to 0 and moving // with memcpy (and then not destructing the original) will totally work. template <typename P> struct VectorTraits<RefPtr<P>> : SimpleClassVectorTraits<RefPtr<P>> {}; template <typename P> -struct VectorTraits<OwnPtr<P>> : SimpleClassVectorTraits<OwnPtr<P>> { - // OwnPtr -> PassOwnPtr has a very particular structure that tricks the +struct VectorTraits<std::unique_ptr<P>> : SimpleClassVectorTraits<std::unique_ptr<P>> { + // std::unique_ptr -> std::unique_ptr has a very particular structure that tricks the // normal type traits into thinking that the class is "trivially copyable". static const bool canCopyWithMemcpy = false; }; static_assert(VectorTraits<RefPtr<int>>::canInitializeWithMemset, "inefficient RefPtr Vector"); static_assert(VectorTraits<RefPtr<int>>::canMoveWithMemcpy, "inefficient RefPtr Vector"); static_assert(VectorTraits<RefPtr<int>>::canCompareWithMemcmp, "inefficient RefPtr Vector"); -static_assert(VectorTraits<OwnPtr<int>>::canInitializeWithMemset, "inefficient OwnPtr Vector"); -static_assert(VectorTraits<OwnPtr<int>>::canMoveWithMemcpy, "inefficient OwnPtr Vector"); -static_assert(VectorTraits<OwnPtr<int>>::canCompareWithMemcmp, "inefficient OwnPtr Vector"); +static_assert(VectorTraits<std::unique_ptr<int>>::canInitializeWithMemset, "inefficient std::unique_ptr Vector"); +static_assert(VectorTraits<std::unique_ptr<int>>::canMoveWithMemcpy, "inefficient std::unique_ptr Vector"); +static_assert(VectorTraits<std::unique_ptr<int>>::canCompareWithMemcmp, "inefficient std::unique_ptr Vector"); template <typename First, typename Second> struct VectorTraits<std::pair<First, Second>> {
diff --git a/third_party/WebKit/Source/wtf/WTFThreadData.cpp b/third_party/WebKit/Source/wtf/WTFThreadData.cpp index 286c1182..4fe60343 100644 --- a/third_party/WebKit/Source/wtf/WTFThreadData.cpp +++ b/third_party/WebKit/Source/wtf/WTFThreadData.cpp
@@ -26,6 +26,7 @@ #include "wtf/WTFThreadData.h" +#include "wtf/PtrUtil.h" #include "wtf/text/TextCodecICU.h" namespace WTF { @@ -37,7 +38,7 @@ , m_atomicStringTableDestructor(nullptr) , m_compressibleStringTable(nullptr) , m_compressibleStringTableDestructor(nullptr) - , m_cachedConverterICU(adoptPtr(new ICUConverterWrapper)) + , m_cachedConverterICU(wrapUnique(new ICUConverterWrapper)) { }
diff --git a/third_party/WebKit/Source/wtf/WTFThreadData.h b/third_party/WebKit/Source/wtf/WTFThreadData.h index b07fd5d..3460e93 100644 --- a/third_party/WebKit/Source/wtf/WTFThreadData.h +++ b/third_party/WebKit/Source/wtf/WTFThreadData.h
@@ -34,6 +34,7 @@ #include "wtf/Threading.h" #include "wtf/WTFExport.h" #include "wtf/text/StringHash.h" +#include <memory> namespace blink { @@ -76,7 +77,7 @@ AtomicStringTableDestructor m_atomicStringTableDestructor; blink::CompressibleStringTable* m_compressibleStringTable; blink::CompressibleStringTableDestructor m_compressibleStringTableDestructor; - OwnPtr<ICUConverterWrapper> m_cachedConverterICU; + std::unique_ptr<ICUConverterWrapper> m_cachedConverterICU; static ThreadSpecific<WTFThreadData>* staticData; friend WTFThreadData& wtfThreadData();
diff --git a/third_party/WebKit/Source/wtf/allocator/PartitionAllocTest.cpp b/third_party/WebKit/Source/wtf/allocator/PartitionAllocTest.cpp index cdc4302..213ba334 100644 --- a/third_party/WebKit/Source/wtf/allocator/PartitionAllocTest.cpp +++ b/third_party/WebKit/Source/wtf/allocator/PartitionAllocTest.cpp
@@ -33,9 +33,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "wtf/BitwiseOperations.h" #include "wtf/CPU.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/Vector.h" +#include <memory> #include <stdlib.h> #include <string.h> @@ -447,7 +447,7 @@ // The +1 is because we need to account for the fact that the current page // never gets thrown on the freelist. ++numToFillFreeListPage; - OwnPtr<PartitionPage*[]> pages = adoptArrayPtr(new PartitionPage*[numToFillFreeListPage]); + std::unique_ptr<PartitionPage*[]> pages = wrapArrayUnique(new PartitionPage*[numToFillFreeListPage]); size_t i; for (i = 0; i < numToFillFreeListPage; ++i) { @@ -493,8 +493,8 @@ --numPagesNeeded; EXPECT_GT(numPagesNeeded, 1u); - OwnPtr<PartitionPage*[]> pages; - pages = adoptArrayPtr(new PartitionPage*[numPagesNeeded]); + std::unique_ptr<PartitionPage*[]> pages; + pages = wrapArrayUnique(new PartitionPage*[numPagesNeeded]); uintptr_t firstSuperPageBase = 0; size_t i; for (i = 0; i < numPagesNeeded; ++i) { @@ -1026,8 +1026,8 @@ // The -2 is because the first and last partition pages in a super page are // guard pages. size_t numPartitionPagesNeeded = kNumPartitionPagesPerSuperPage - 2; - OwnPtr<PartitionPage*[]> firstSuperPagePages = adoptArrayPtr(new PartitionPage*[numPartitionPagesNeeded]); - OwnPtr<PartitionPage*[]> secondSuperPagePages = adoptArrayPtr(new PartitionPage*[numPartitionPagesNeeded]); + std::unique_ptr<PartitionPage*[]> firstSuperPagePages = wrapArrayUnique(new PartitionPage*[numPartitionPagesNeeded]); + std::unique_ptr<PartitionPage*[]> secondSuperPagePages = wrapArrayUnique(new PartitionPage*[numPartitionPagesNeeded]); size_t i; for (i = 0; i < numPartitionPagesNeeded; ++i)
diff --git a/third_party/WebKit/Source/wtf/text/Collator.h b/third_party/WebKit/Source/wtf/text/Collator.h index 247d65d8..18b1efe 100644 --- a/third_party/WebKit/Source/wtf/text/Collator.h +++ b/third_party/WebKit/Source/wtf/text/Collator.h
@@ -31,9 +31,9 @@ #include "wtf/Allocator.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/WTFExport.h" #include "wtf/text/Unicode.h" +#include <memory> struct UCollator; @@ -52,7 +52,7 @@ ~Collator(); void setOrderLowerFirst(bool); - static PassOwnPtr<Collator> userDefault(); + static std::unique_ptr<Collator> userDefault(); Result collate(const ::UChar*, size_t, const ::UChar*, size_t) const;
diff --git a/third_party/WebKit/Source/wtf/text/StringImpl.cpp b/third_party/WebKit/Source/wtf/text/StringImpl.cpp index c9c1a14b..77ddb65 100644 --- a/third_party/WebKit/Source/wtf/text/StringImpl.cpp +++ b/third_party/WebKit/Source/wtf/text/StringImpl.cpp
@@ -26,8 +26,7 @@ #include "wtf/DynamicAnnotations.h" #include "wtf/LeakAnnotations.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include "wtf/allocator/PartitionAlloc.h" #include "wtf/allocator/Partitions.h" @@ -37,6 +36,7 @@ #include "wtf/text/StringHash.h" #include "wtf/text/StringToNumber.h" #include <algorithm> +#include <memory> #include <unicode/translit.h> #include <unicode/unistr.h> @@ -793,8 +793,8 @@ // TODO(jungshik): Cache transliterator if perf penaly warrants it for Greek. UErrorCode status = U_ZERO_ERROR; - OwnPtr<icu::Transliterator> translit = - adoptPtr(icu::Transliterator::createInstance(transliteratorId, UTRANS_FORWARD, status)); + std::unique_ptr<icu::Transliterator> translit = + wrapUnique(icu::Transliterator::createInstance(transliteratorId, UTRANS_FORWARD, status)); if (U_FAILURE(status)) return upper();
diff --git a/third_party/WebKit/Source/wtf/text/TextCodec.h b/third_party/WebKit/Source/wtf/text/TextCodec.h index 28f547c..aae9438f 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodec.h +++ b/third_party/WebKit/Source/wtf/text/TextCodec.h
@@ -29,9 +29,9 @@ #include "wtf/Forward.h" #include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" #include "wtf/text/Unicode.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { @@ -98,7 +98,7 @@ typedef void (*EncodingNameRegistrar)(const char* alias, const char* name); -typedef PassOwnPtr<TextCodec> (*NewTextCodecFunction)(const TextEncoding&, const void* additionalData); +typedef std::unique_ptr<TextCodec> (*NewTextCodecFunction)(const TextEncoding&, const void* additionalData); typedef void (*TextCodecRegistrar)(const char* name, NewTextCodecFunction, const void* additionalData); } // namespace WTF
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp b/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp index b157bf9..b2c4d3f 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp
@@ -27,12 +27,14 @@ #include "wtf/text/TextCodecICU.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" #include "wtf/StringExtras.h" #include "wtf/Threading.h" #include "wtf/WTFThreadData.h" #include "wtf/text/CString.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/StringBuilder.h" +#include <memory> #include <unicode/ucnv.h> #include <unicode/ucnv_cb.h> @@ -51,9 +53,9 @@ return wtfThreadData().cachedConverterICU().converter; } -PassOwnPtr<TextCodec> TextCodecICU::create(const TextEncoding& encoding, const void*) +std::unique_ptr<TextCodec> TextCodecICU::create(const TextEncoding& encoding, const void*) { - return adoptPtr(new TextCodecICU(encoding)); + return wrapUnique(new TextCodecICU(encoding)); } void TextCodecICU::registerEncodingNames(EncodingNameRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecICU.h b/third_party/WebKit/Source/wtf/text/TextCodecICU.h index 9b11005..9b34d64 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecICU.h +++ b/third_party/WebKit/Source/wtf/text/TextCodecICU.h
@@ -29,6 +29,7 @@ #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" +#include <memory> #include <unicode/utypes.h> typedef struct UConverter UConverter; @@ -46,7 +47,7 @@ private: TextCodecICU(const TextEncoding&); - static PassOwnPtr<TextCodec> create(const TextEncoding&, const void*); + static std::unique_ptr<TextCodec> create(const TextEncoding&, const void*); String decode(const char*, size_t length, FlushBehavior, bool stopOnError, bool& sawError) override; CString encode(const UChar*, size_t length, UnencodableHandling) override;
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecLatin1.cpp b/third_party/WebKit/Source/wtf/text/TextCodecLatin1.cpp index ebe9d020..94f89b2 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecLatin1.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecLatin1.cpp
@@ -25,11 +25,12 @@ #include "wtf/text/TextCodecLatin1.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/TextCodecASCIIFastPath.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { @@ -90,9 +91,9 @@ registrar("x-cp1252", "windows-1252"); } -static PassOwnPtr<TextCodec> newStreamingTextDecoderWindowsLatin1(const TextEncoding&, const void*) +static std::unique_ptr<TextCodec> newStreamingTextDecoderWindowsLatin1(const TextEncoding&, const void*) { - return adoptPtr(new TextCodecLatin1); + return wrapUnique(new TextCodecLatin1); } void TextCodecLatin1::registerCodecs(TextCodecRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecReplacement.cpp b/third_party/WebKit/Source/wtf/text/TextCodecReplacement.cpp index 274bae84f..47dc54a 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecReplacement.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecReplacement.cpp
@@ -4,9 +4,10 @@ #include "wtf/text/TextCodecReplacement.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { @@ -30,9 +31,9 @@ registrar("iso-2022-kr", "replacement"); } -static PassOwnPtr<TextCodec> newStreamingTextDecoderReplacement(const TextEncoding&, const void*) +static std::unique_ptr<TextCodec> newStreamingTextDecoderReplacement(const TextEncoding&, const void*) { - return adoptPtr(new TextCodecReplacement); + return wrapUnique(new TextCodecReplacement); } void TextCodecReplacement::registerCodecs(TextCodecRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecReplacementTest.cpp b/third_party/WebKit/Source/wtf/text/TextCodecReplacementTest.cpp index 835b69c..9533604 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecReplacementTest.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecReplacementTest.cpp
@@ -5,12 +5,12 @@ #include "wtf/text/TextCodecReplacement.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" #include "wtf/text/CString.h" #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/TextEncodingRegistry.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { @@ -32,7 +32,7 @@ TEST(TextCodecReplacement, DecodesToFFFD) { TextEncoding encoding(replacementAlias); - OwnPtr<TextCodec> codec(newTextCodec(encoding)); + std::unique_ptr<TextCodec> codec(newTextCodec(encoding)); bool sawError = false; const char testCase[] = "hello world"; @@ -47,7 +47,7 @@ TEST(TextCodecReplacement, EncodesToUTF8) { TextEncoding encoding(replacementAlias); - OwnPtr<TextCodec> codec(newTextCodec(encoding)); + std::unique_ptr<TextCodec> codec(newTextCodec(encoding)); // "Kanji" in Chinese characters. const UChar testCase[] = { 0x6F22, 0x5B57 };
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecUTF16.cpp b/third_party/WebKit/Source/wtf/text/TextCodecUTF16.cpp index 6fc1f15a..f3e2c12 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecUTF16.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecUTF16.cpp
@@ -25,11 +25,12 @@ #include "wtf/text/TextCodecUTF16.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/WTFString.h" +#include <memory> using namespace std; @@ -50,14 +51,14 @@ registrar("unicodeFFFE", "UTF-16BE"); } -static PassOwnPtr<TextCodec> newStreamingTextDecoderUTF16LE(const TextEncoding&, const void*) +static std::unique_ptr<TextCodec> newStreamingTextDecoderUTF16LE(const TextEncoding&, const void*) { - return adoptPtr(new TextCodecUTF16(true)); + return wrapUnique(new TextCodecUTF16(true)); } -static PassOwnPtr<TextCodec> newStreamingTextDecoderUTF16BE(const TextEncoding&, const void*) +static std::unique_ptr<TextCodec> newStreamingTextDecoderUTF16BE(const TextEncoding&, const void*) { - return adoptPtr(new TextCodecUTF16(false)); + return wrapUnique(new TextCodecUTF16(false)); } void TextCodecUTF16::registerCodecs(TextCodecRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp b/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp index bc4f0ed..865d67cc 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecUTF8.cpp
@@ -25,10 +25,12 @@ #include "wtf/text/TextCodecUTF8.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/CharacterNames.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/TextCodecASCIIFastPath.h" +#include <memory> namespace WTF { @@ -36,9 +38,9 @@ const int nonCharacter = -1; -PassOwnPtr<TextCodec> TextCodecUTF8::create(const TextEncoding&, const void*) +std::unique_ptr<TextCodec> TextCodecUTF8::create(const TextEncoding&, const void*) { - return adoptPtr(new TextCodecUTF8); + return wrapUnique(new TextCodecUTF8); } void TextCodecUTF8::registerEncodingNames(EncodingNameRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecUTF8.h b/third_party/WebKit/Source/wtf/text/TextCodecUTF8.h index feb5682..5f943dd 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecUTF8.h +++ b/third_party/WebKit/Source/wtf/text/TextCodecUTF8.h
@@ -27,6 +27,7 @@ #define TextCodecUTF8_h #include "wtf/text/TextCodec.h" +#include <memory> namespace WTF { @@ -39,7 +40,7 @@ TextCodecUTF8() : m_partialSequenceSize(0) { } private: - static PassOwnPtr<TextCodec> create(const TextEncoding&, const void*); + static std::unique_ptr<TextCodec> create(const TextEncoding&, const void*); String decode(const char*, size_t length, FlushBehavior, bool stopOnError, bool& sawError) override; CString encode(const UChar*, size_t length, UnencodableHandling) override;
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecUTF8Test.cpp b/third_party/WebKit/Source/wtf/text/TextCodecUTF8Test.cpp index 66fe49f..c2b1814c 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecUTF8Test.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecUTF8Test.cpp
@@ -31,11 +31,11 @@ #include "wtf/text/TextCodecUTF8.h" #include "testing/gtest/include/gtest/gtest.h" -#include "wtf/OwnPtr.h" #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/TextEncodingRegistry.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { @@ -44,7 +44,7 @@ TEST(TextCodecUTF8, DecodeAscii) { TextEncoding encoding("UTF-8"); - OwnPtr<TextCodec> codec(newTextCodec(encoding)); + std::unique_ptr<TextCodec> codec(newTextCodec(encoding)); const char testCase[] = "HelloWorld"; size_t testCaseSize = sizeof(testCase) - 1; @@ -61,7 +61,7 @@ TEST(TextCodecUTF8, DecodeChineseCharacters) { TextEncoding encoding("UTF-8"); - OwnPtr<TextCodec> codec(newTextCodec(encoding)); + std::unique_ptr<TextCodec> codec(newTextCodec(encoding)); // "Kanji" in Chinese characters. const char testCase[] = "\xe6\xbc\xa2\xe5\xad\x97"; @@ -78,7 +78,7 @@ TEST(TextCodecUTF8, Decode0xFF) { TextEncoding encoding("UTF-8"); - OwnPtr<TextCodec> codec(newTextCodec(encoding)); + std::unique_ptr<TextCodec> codec(newTextCodec(encoding)); bool sawError = false; const String& result = codec->decode("\xff", 1, DataEOF, false, sawError);
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecUserDefined.cpp b/third_party/WebKit/Source/wtf/text/TextCodecUserDefined.cpp index 8438bf2..164befc 100644 --- a/third_party/WebKit/Source/wtf/text/TextCodecUserDefined.cpp +++ b/third_party/WebKit/Source/wtf/text/TextCodecUserDefined.cpp
@@ -25,11 +25,12 @@ #include "wtf/text/TextCodecUserDefined.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/text/CString.h" #include "wtf/text/StringBuffer.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { @@ -38,9 +39,9 @@ registrar("x-user-defined", "x-user-defined"); } -static PassOwnPtr<TextCodec> newStreamingTextDecoderUserDefined(const TextEncoding&, const void*) +static std::unique_ptr<TextCodec> newStreamingTextDecoderUserDefined(const TextEncoding&, const void*) { - return adoptPtr(new TextCodecUserDefined); + return wrapUnique(new TextCodecUserDefined); } void TextCodecUserDefined::registerCodecs(TextCodecRegistrar registrar)
diff --git a/third_party/WebKit/Source/wtf/text/TextEncoding.cpp b/third_party/WebKit/Source/wtf/text/TextEncoding.cpp index f3f231d..31cdfb8 100644 --- a/third_party/WebKit/Source/wtf/text/TextEncoding.cpp +++ b/third_party/WebKit/Source/wtf/text/TextEncoding.cpp
@@ -27,12 +27,12 @@ #include "wtf/text/TextEncoding.h" -#include "wtf/OwnPtr.h" #include "wtf/StdLibExtras.h" #include "wtf/Threading.h" #include "wtf/text/CString.h" #include "wtf/text/TextEncodingRegistry.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { @@ -74,7 +74,7 @@ if (string.isEmpty()) return ""; - OwnPtr<TextCodec> textCodec = newTextCodec(*this); + std::unique_ptr<TextCodec> textCodec = newTextCodec(*this); CString encodedString; if (string.is8Bit()) encodedString = textCodec->encode(string.characters8(), string.length(), handling);
diff --git a/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.cpp b/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.cpp index 9f64aee..129722e 100644 --- a/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.cpp +++ b/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.cpp
@@ -42,6 +42,7 @@ #include "wtf/text/TextCodecUTF8.h" #include "wtf/text/TextCodecUserDefined.h" #include "wtf/text/TextEncoding.h" +#include <memory> namespace WTF { @@ -243,7 +244,7 @@ pruneBlacklistedCodecs(); } -PassOwnPtr<TextCodec> newTextCodec(const TextEncoding& encoding) +std::unique_ptr<TextCodec> newTextCodec(const TextEncoding& encoding) { MutexLocker lock(encodingRegistryMutex());
diff --git a/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.h b/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.h index 6b8a2f197..c6d0efd4 100644 --- a/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.h +++ b/third_party/WebKit/Source/wtf/text/TextEncodingRegistry.h
@@ -26,10 +26,10 @@ #ifndef TextEncodingRegistry_h #define TextEncodingRegistry_h -#include "wtf/PassOwnPtr.h" #include "wtf/WTFExport.h" #include "wtf/text/Unicode.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { @@ -38,7 +38,7 @@ // Use TextResourceDecoder::decode to decode resources, since it handles BOMs. // Use TextEncoding::encode to encode, since it takes care of normalization. -WTF_EXPORT PassOwnPtr<TextCodec> newTextCodec(const TextEncoding&); +WTF_EXPORT std::unique_ptr<TextCodec> newTextCodec(const TextEncoding&); // Only TextEncoding should use the following functions directly. const char* atomicCanonicalTextEncodingName(const char* alias);
diff --git a/third_party/WebKit/Source/wtf/text/TextPosition.cpp b/third_party/WebKit/Source/wtf/text/TextPosition.cpp index 32a0314f..2fc0207 100644 --- a/third_party/WebKit/Source/wtf/text/TextPosition.cpp +++ b/third_party/WebKit/Source/wtf/text/TextPosition.cpp
@@ -24,15 +24,16 @@ #include "wtf/text/TextPosition.h" -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" #include "wtf/StdLibExtras.h" #include <algorithm> +#include <memory> namespace WTF { -PassOwnPtr<Vector<unsigned>> lineEndings(const String& text) +std::unique_ptr<Vector<unsigned>> lineEndings(const String& text) { - OwnPtr<Vector<unsigned>> result(adoptPtr(new Vector<unsigned>())); + std::unique_ptr<Vector<unsigned>> result(wrapUnique(new Vector<unsigned>())); unsigned start = 0; while (start < text.length()) {
diff --git a/third_party/WebKit/Source/wtf/text/TextPosition.h b/third_party/WebKit/Source/wtf/text/TextPosition.h index 17140c3..f4c62eb 100644 --- a/third_party/WebKit/Source/wtf/text/TextPosition.h +++ b/third_party/WebKit/Source/wtf/text/TextPosition.h
@@ -30,6 +30,7 @@ #include "wtf/Vector.h" #include "wtf/WTFExport.h" #include "wtf/text/WTFString.h" +#include <memory> namespace WTF { @@ -86,7 +87,7 @@ OrdinalNumber m_column; }; -WTF_EXPORT PassOwnPtr<Vector<unsigned>> lineEndings(const String&); +WTF_EXPORT std::unique_ptr<Vector<unsigned>> lineEndings(const String&); } // namespace WTF
diff --git a/third_party/WebKit/Source/wtf/text/icu/CollatorICU.cpp b/third_party/WebKit/Source/wtf/text/icu/CollatorICU.cpp index f5efcee..0bfe2b60 100644 --- a/third_party/WebKit/Source/wtf/text/icu/CollatorICU.cpp +++ b/third_party/WebKit/Source/wtf/text/icu/CollatorICU.cpp
@@ -29,9 +29,11 @@ #include "wtf/text/Collator.h" #include "wtf/Assertions.h" +#include "wtf/PtrUtil.h" #include "wtf/StringExtras.h" #include "wtf/Threading.h" #include "wtf/ThreadingPrimitives.h" +#include <memory> #include <stdlib.h> #include <string.h> #include <unicode/ucol.h> @@ -54,9 +56,9 @@ setEquivalentLocale(m_locale, m_equivalentLocale); } -PassOwnPtr<Collator> Collator::userDefault() +std::unique_ptr<Collator> Collator::userDefault() { - return adoptPtr(new Collator(0)); + return wrapUnique(new Collator(0)); } Collator::~Collator()
diff --git a/third_party/WebKit/Source/wtf/wtf.gypi b/third_party/WebKit/Source/wtf/wtf.gypi index 3a7362ee..639c912 100644 --- a/third_party/WebKit/Source/wtf/wtf.gypi +++ b/third_party/WebKit/Source/wtf/wtf.gypi
@@ -59,9 +59,6 @@ 'Noncopyable.h', 'NotFound.h', 'Optional.h', - 'OwnPtr.h', - 'OwnPtrCommon.h', - 'PassOwnPtr.h', 'PassRefPtr.h', 'PrintStream.cpp', 'PrintStream.h',
diff --git a/third_party/WebKit/public/platform/WebBlobData.h b/third_party/WebKit/public/platform/WebBlobData.h index 2674210..6c028ae 100644 --- a/third_party/WebKit/public/platform/WebBlobData.h +++ b/third_party/WebKit/public/platform/WebBlobData.h
@@ -38,8 +38,7 @@ #include "WebURL.h" #if INSIDE_BLINK -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> #endif namespace blink { @@ -78,9 +77,9 @@ BLINK_PLATFORM_EXPORT WebString contentType() const; #if INSIDE_BLINK - BLINK_PLATFORM_EXPORT WebBlobData(WTF::PassOwnPtr<BlobData>); - BLINK_PLATFORM_EXPORT WebBlobData& operator=(WTF::PassOwnPtr<BlobData>); - BLINK_PLATFORM_EXPORT operator WTF::PassOwnPtr<BlobData>(); + BLINK_PLATFORM_EXPORT WebBlobData(std::unique_ptr<BlobData>); + BLINK_PLATFORM_EXPORT WebBlobData& operator=(std::unique_ptr<BlobData>); + BLINK_PLATFORM_EXPORT operator std::unique_ptr<BlobData>(); #endif private:
diff --git a/third_party/WebKit/public/platform/WebContentSettingCallbacks.h b/third_party/WebKit/public/platform/WebContentSettingCallbacks.h index 7d4f0d3..7bd13b8 100644 --- a/third_party/WebKit/public/platform/WebContentSettingCallbacks.h +++ b/third_party/WebKit/public/platform/WebContentSettingCallbacks.h
@@ -8,8 +8,7 @@ #include "WebPrivatePtr.h" #if INSIDE_BLINK -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> #endif namespace blink { @@ -32,7 +31,7 @@ BLINK_PLATFORM_EXPORT void assign(const WebContentSettingCallbacks&); #if INSIDE_BLINK - BLINK_PLATFORM_EXPORT WebContentSettingCallbacks(WTF::PassOwnPtr<ContentSettingCallbacks>&&); + BLINK_PLATFORM_EXPORT WebContentSettingCallbacks(std::unique_ptr<ContentSettingCallbacks>&&); #endif BLINK_PLATFORM_EXPORT void doAllow();
diff --git a/third_party/WebKit/public/platform/WebCryptoAlgorithm.h b/third_party/WebKit/public/platform/WebCryptoAlgorithm.h index 7df6f3ae..408cb7c0e 100644 --- a/third_party/WebKit/public/platform/WebCryptoAlgorithm.h +++ b/third_party/WebKit/public/platform/WebCryptoAlgorithm.h
@@ -35,7 +35,7 @@ #include "WebPrivatePtr.h" #if INSIDE_BLINK -#include "wtf/PassOwnPtr.h" +#include <memory> #endif namespace blink { @@ -153,7 +153,7 @@ public: #if INSIDE_BLINK WebCryptoAlgorithm() { } - BLINK_PLATFORM_EXPORT WebCryptoAlgorithm(WebCryptoAlgorithmId, PassOwnPtr<WebCryptoAlgorithmParams>); + BLINK_PLATFORM_EXPORT WebCryptoAlgorithm(WebCryptoAlgorithmId, std::unique_ptr<WebCryptoAlgorithmParams>); #endif BLINK_PLATFORM_EXPORT static WebCryptoAlgorithm createNull();
diff --git a/third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h b/third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h index df96d30..113670d 100644 --- a/third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h +++ b/third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h
@@ -37,7 +37,7 @@ #include "WebPrivatePtr.h" #if INSIDE_BLINK -#include "wtf/PassOwnPtr.h" +#include <memory> #endif namespace blink { @@ -53,7 +53,7 @@ WebCryptoKeyAlgorithm() { } #if INSIDE_BLINK - BLINK_PLATFORM_EXPORT WebCryptoKeyAlgorithm(WebCryptoAlgorithmId, PassOwnPtr<WebCryptoKeyAlgorithmParams>); + BLINK_PLATFORM_EXPORT WebCryptoKeyAlgorithm(WebCryptoAlgorithmId, std::unique_ptr<WebCryptoKeyAlgorithmParams>); #endif // FIXME: Delete this in favor of the create*() functions.
diff --git a/third_party/WebKit/public/platform/WebDataConsumerHandle.h b/third_party/WebKit/public/platform/WebDataConsumerHandle.h index 4a36d05..4632ff9 100644 --- a/third_party/WebKit/public/platform/WebDataConsumerHandle.h +++ b/third_party/WebKit/public/platform/WebDataConsumerHandle.h
@@ -8,7 +8,7 @@ #include <stddef.h> #if INSIDE_BLINK -#include "wtf/PassOwnPtr.h" +#include <memory> #endif #include "public/platform/WebCommon.h" @@ -104,7 +104,7 @@ // If |client| is not null and the handle is not waiting, client // notification is called asynchronously. #if INSIDE_BLINK - PassOwnPtr<Reader> obtainReader(Client*); + std::unique_ptr<Reader> obtainReader(Client*); #endif // Returns a string literal (e.g. class name) for debugging only.
diff --git a/third_party/WebKit/public/platform/WebFileSystemCallbacks.h b/third_party/WebKit/public/platform/WebFileSystemCallbacks.h index 39189a67..13b50014 100644 --- a/third_party/WebKit/public/platform/WebFileSystemCallbacks.h +++ b/third_party/WebKit/public/platform/WebFileSystemCallbacks.h
@@ -39,8 +39,7 @@ #include "WebVector.h" #if INSIDE_BLINK -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <memory> #endif namespace blink { @@ -67,7 +66,7 @@ BLINK_PLATFORM_EXPORT void assign(const WebFileSystemCallbacks&); #if INSIDE_BLINK - BLINK_PLATFORM_EXPORT WebFileSystemCallbacks(WTF::PassOwnPtr<AsyncFileSystemCallbacks>&&); + BLINK_PLATFORM_EXPORT WebFileSystemCallbacks(std::unique_ptr<AsyncFileSystemCallbacks>&&); #endif // Callback for WebFileSystem's various operations that don't require
diff --git a/third_party/WebKit/public/platform/WebPrivateOwnPtr.h b/third_party/WebKit/public/platform/WebPrivateOwnPtr.h index 64d0451..9f29792 100644 --- a/third_party/WebKit/public/platform/WebPrivateOwnPtr.h +++ b/third_party/WebKit/public/platform/WebPrivateOwnPtr.h
@@ -33,7 +33,8 @@ #include <cstddef> #if INSIDE_BLINK -#include "wtf/PassOwnPtr.h" +#include "wtf/PtrUtil.h" +#include <memory> #endif namespace blink { @@ -60,7 +61,7 @@ #if INSIDE_BLINK template <typename U> - WebPrivateOwnPtr(PassOwnPtr<U>, EnsurePtrConvertibleArgDecl(U, T)); + WebPrivateOwnPtr(std::unique_ptr<U>, EnsurePtrConvertibleArgDecl(U, T)); void reset(T* ptr) { @@ -68,16 +69,16 @@ m_ptr = ptr; } - void reset(PassOwnPtr<T> o) + void reset(std::unique_ptr<T> o) { - reset(o.leakPtr()); + reset(o.release()); } - PassOwnPtr<T> release() + std::unique_ptr<T> release() { T* ptr = m_ptr; m_ptr = nullptr; - return adoptPtr(ptr); + return wrapUnique(ptr); } T& operator*() const @@ -100,8 +101,8 @@ #if INSIDE_BLINK template <typename T> template <typename U> -inline WebPrivateOwnPtr<T>::WebPrivateOwnPtr(PassOwnPtr<U> o, EnsurePtrConvertibleArgDefn(U, T)) - : m_ptr(o.leakPtr()) +inline WebPrivateOwnPtr<T>::WebPrivateOwnPtr(std::unique_ptr<U> o, EnsurePtrConvertibleArgDefn(U, T)) + : m_ptr(o.release()) { static_assert(!std::is_array<T>::value, "Pointers to array must never be converted"); }
diff --git a/third_party/WebKit/public/platform/WebScrollbar.h b/third_party/WebKit/public/platform/WebScrollbar.h index 16b9964..a57cff19 100644 --- a/third_party/WebKit/public/platform/WebScrollbar.h +++ b/third_party/WebKit/public/platform/WebScrollbar.h
@@ -29,9 +29,6 @@ #include "WebRect.h" #include "WebSize.h" #include "WebVector.h" -#if INSIDE_BLINK -#include "wtf/PassOwnPtr.h" -#endif namespace blink {
diff --git a/third_party/WebKit/public/platform/WebTaskRunner.h b/third_party/WebKit/public/platform/WebTaskRunner.h index 81ac626..2fee34c2 100644 --- a/third_party/WebKit/public/platform/WebTaskRunner.h +++ b/third_party/WebKit/public/platform/WebTaskRunner.h
@@ -9,6 +9,8 @@ #ifdef INSIDE_BLINK #include "wtf/Functional.h" +#include "wtf/PtrUtil.h" +#include <memory> #endif namespace blink { @@ -66,9 +68,9 @@ void postTask(const WebTraceLocation&, std::unique_ptr<SameThreadClosure>); void postDelayedTask(const WebTraceLocation&, std::unique_ptr<SameThreadClosure>, long long delayMs); - PassOwnPtr<WebTaskRunner> adoptClone() + std::unique_ptr<WebTaskRunner> adoptClone() { - return adoptPtr(clone()); + return wrapUnique(clone()); } #endif };
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 9036ea2..e7894c8 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -314,33 +314,33 @@ }, 'chromium.lkgr': { - 'ASAN Debug': 'gyp_asan_lsan_edge_debug_bot', + 'ASAN Debug': 'gn_asan_lsan_edge_debug_bot', 'ASAN Release (symbolized)': - 'gyp_asan_lsan_edge_fuzzer_v8_heap_symbolized_release_bot', + 'gn_asan_lsan_edge_fuzzer_v8_heap_symbolized_release_bot', 'ASAN Release Media': - 'gyp_asan_lsan_edge_fuzzer_v8_heap_chromeos_codecs_release_bot', - 'ASAN Release': 'gyp_asan_lsan_edge_fuzzer_v8_heap_release_bot', + 'gn_asan_lsan_edge_fuzzer_v8_heap_chromeos_codecs_release_bot', + 'ASAN Release': 'gn_asan_lsan_edge_fuzzer_v8_heap_release_bot', 'ASan Debug (32-bit x86 with V8-ARM)': - 'gyp_asan_edge_v8_heap_debug_bot_hybrid', + 'gn_asan_edge_v8_heap_debug_bot_hybrid', 'ASan Release (32-bit x86 with V8-ARM)': - 'gyp_asan_edge_fuzzer_v8_heap_release_bot_hybrid', + 'gn_asan_edge_fuzzer_v8_heap_release_bot_hybrid', 'ASan Release (32-bit x86 with V8-ARM, symbolized)': - 'gyp_asan_edge_fuzzer_v8_heap_symbolized_release_bot_hybrid', + 'gn_asan_edge_fuzzer_v8_heap_symbolized_release_bot_hybrid', 'ASan Release Media (32-bit x86 with V8-ARM)': - 'gyp_asan_edge_fuzzer_v8_heap_chromeos_codecs_release_bot_hybrid', + 'gn_asan_edge_fuzzer_v8_heap_chromeos_codecs_release_bot_hybrid', 'ChromiumOS ASAN Release': - 'gyp_chromeos_asan_lsan_edge_fuzzer_v8_heap_release_bot', + 'gn_chromeos_asan_lsan_edge_fuzzer_v8_heap_release_bot', 'MSAN Release (chained origins)': 'gn_msan_edge_release_bot', 'MSAN Release (no origins)': 'gn_msan_no_origins_edge_release_bot', 'Mac ASAN Debug': 'gyp_asan_fuzzer_v8_heap_debug_symbols_static_bot', 'Mac ASAN Release Media': 'gyp_asan_fuzzer_v8_heap_chrome_with_codecs_release_bot', 'Mac ASAN Release': 'gyp_asan_fuzzer_v8_heap_release_bot', - 'TSAN Debug': 'gyp_tsan_disable_nacl_line_tables_debug_bot', - 'TSAN Release': 'gyp_tsan_disable_nacl_line_tables_release_bot', + 'TSAN Debug': 'gn_tsan_disable_nacl_line_tables_debug_bot', + 'TSAN Release': 'gn_tsan_disable_nacl_line_tables_release_bot', 'Telemetry Harness Upload': 'none', - 'UBSan Release': 'gyp_ubsan_release_bot', - 'UBSan vptr Release': 'gyp_ubsan_vptr_edge_release_bot', + 'UBSan Release': 'gn_ubsan_release_bot', + 'UBSan vptr Release': 'gn_ubsan_vptr_edge_release_bot', 'Win ASan Release Coverage': 'gyp_asan_edge_fuzzer_v8_heap_release_bot_x86', 'Win ASan Release Media': @@ -1216,25 +1216,25 @@ 'gn', 'ubsan_vptr', 'ubsan_no_recover_hack', 'release_bot', ], - 'gyp_asan_edge_fuzzer_v8_heap_chromeos_codecs_release_bot_hybrid': [ - 'gyp', 'asan', 'edge', 'fuzzer', 'v8_heap', 'chromeos_codecs', + 'gn_asan_edge_fuzzer_v8_heap_chromeos_codecs_release_bot_hybrid': [ + 'gn', 'asan', 'edge', 'fuzzer', 'v8_heap', 'chromeos_codecs', 'release_bot', 'hybrid', ], - 'gyp_asan_edge_v8_heap_debug_bot_hybrid': [ - 'gyp', 'asan', 'edge', 'v8_heap', 'debug_bot', 'hybrid', + 'gn_asan_edge_v8_heap_debug_bot_hybrid': [ + 'gn', 'asan', 'edge', 'v8_heap', 'debug_bot', 'hybrid', ], - 'gyp_asan_edge_fuzzer_v8_heap_release_bot_hybrid': [ - 'gyp', 'asan', 'edge', 'fuzzer', 'v8_heap', 'release_bot', 'hybrid', + 'gn_asan_edge_fuzzer_v8_heap_release_bot_hybrid': [ + 'gn', 'asan', 'edge', 'fuzzer', 'v8_heap', 'release_bot', 'hybrid', ], 'gyp_asan_edge_fuzzer_v8_heap_release_bot_x86': [ 'gyp', 'asan', 'edge', 'fuzzer', 'v8_heap', 'release_bot', 'x86', ], - 'gyp_asan_edge_fuzzer_v8_heap_symbolized_release_bot_hybrid': [ - 'gyp', 'asan', 'edge', 'fuzzer', 'v8_heap', 'symbolized', + 'gn_asan_edge_fuzzer_v8_heap_symbolized_release_bot_hybrid': [ + 'gn', 'asan', 'edge', 'fuzzer', 'v8_heap', 'symbolized', 'release_bot', 'hybrid', ], @@ -1259,25 +1259,25 @@ 'gyp', 'asan', 'fuzzer', 'v8_heap', 'release_bot', 'x86', ], - 'gyp_asan_lsan_edge_debug_bot': [ - 'gyp', 'asan', 'lsan', 'edge', 'debug_bot', + 'gn_asan_lsan_edge_debug_bot': [ + 'gn', 'asan', 'lsan', 'edge', 'debug_bot', ], - 'gyp_asan_lsan_edge_fuzzer_v8_heap_chromeos_codecs_release_bot': [ - 'gyp', 'asan', 'lsan', 'edge', 'v8_heap', 'chromeos_codecs', + 'gn_asan_lsan_edge_fuzzer_v8_heap_chromeos_codecs_release_bot': [ + 'gn', 'asan', 'lsan', 'edge', 'v8_heap', 'chromeos_codecs', 'release_bot', ], - 'gyp_asan_lsan_edge_fuzzer_v8_heap_release_bot': [ - 'gyp', 'asan', 'lsan', 'edge', 'fuzzer', 'v8_heap', 'release_bot', + 'gn_asan_lsan_edge_fuzzer_v8_heap_release_bot': [ + 'gn', 'asan', 'lsan', 'edge', 'fuzzer', 'v8_heap', 'release_bot', ], - 'gyp_asan_lsan_edge_fuzzer_v8_heap_symbolized_release_bot': [ - 'gyp', 'asan', 'lsan', 'edge', 'v8_heap', 'symbolized', 'release_bot', + 'gn_asan_lsan_edge_fuzzer_v8_heap_symbolized_release_bot': [ + 'gn', 'asan', 'lsan', 'edge', 'v8_heap', 'symbolized', 'release_bot', ], - 'gyp_chromeos_asan_lsan_edge_fuzzer_v8_heap_release_bot': [ - 'gyp', 'chromeos', 'asan', 'lsan', 'edge', 'fuzzer', 'v8_heap', + 'gn_chromeos_asan_lsan_edge_fuzzer_v8_heap_release_bot': [ + 'gn', 'chromeos', 'asan', 'lsan', 'edge', 'fuzzer', 'v8_heap', 'release_bot', ], @@ -1375,20 +1375,20 @@ 'gyp', 'syzyasan', 'no_pch', 'win_z7', 'x86', ], - 'gyp_tsan_disable_nacl_line_tables_debug_bot': [ - 'gyp', 'tsan', 'disable_nacl', 'line_tables', 'debug_bot', + 'gn_tsan_disable_nacl_line_tables_debug_bot': [ + 'gn', 'tsan', 'disable_nacl', 'line_tables', 'debug_bot', ], - 'gyp_tsan_disable_nacl_line_tables_release_bot': [ - 'gyp', 'tsan', 'disable_nacl', 'line_tables', 'release_bot', + 'gn_tsan_disable_nacl_line_tables_release_bot': [ + 'gn', 'tsan', 'disable_nacl', 'line_tables', 'release_bot', ], - 'gyp_ubsan_release_bot': [ - 'gyp', 'ubsan', 'release_bot', + 'gn_ubsan_release_bot': [ + 'gn', 'ubsan', 'release_bot', ], - 'gyp_ubsan_vptr_edge_release_bot': [ - 'gyp', 'ubsan_vptr', 'edge', 'release_bot', + 'gn_ubsan_vptr_edge_release_bot': [ + 'gn', 'ubsan_vptr', 'edge', 'release_bot', ], # The 'ios' configs are just used for auditing. iOS bots