| Index: third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp
|
| diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp
|
| index a646561d6e7c65991d13fa7b62d2f9eeb0c4986e..71f3deb798201e6ae325fdaeef45a0880540b6e9 100644
|
| --- a/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp
|
| +++ b/third_party/WebKit/Source/modules/fetch/DataConsumerTee.cpp
|
| @@ -16,11 +16,9 @@
|
| #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 {
|
|
|
| @@ -150,7 +148,7 @@ public:
|
| {
|
| MutexLocker locker(m_mutex);
|
| needsNotification = m_queue.isEmpty();
|
| - std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>);
|
| + OwnPtr<Vector<char>> data = adoptPtr(new Vector<char>);
|
| data->append(buffer, size);
|
| m_queue.append(std::move(data));
|
| }
|
| @@ -211,7 +209,7 @@ public:
|
| m_readerThread = nullptr;
|
| m_client = nullptr;
|
| }
|
| - const std::unique_ptr<Vector<char>>& top() const { return m_queue.first(); }
|
| + const OwnPtr<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)
|
| @@ -247,7 +245,7 @@ private:
|
| }
|
|
|
| Result m_result;
|
| - Deque<std::unique_ptr<Vector<char>>> m_queue;
|
| + Deque<OwnPtr<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
|
| @@ -289,7 +287,7 @@ public:
|
| if (context()->isEmpty())
|
| return context()->getResult();
|
|
|
| - const std::unique_ptr<Vector<char>>& chunk = context()->top();
|
| + const OwnPtr<Vector<char>>& chunk = context()->top();
|
| *available = chunk->size() - context()->offset();
|
| *buffer = chunk->data() + context()->offset();
|
| return WebDataConsumerHandle::Ok;
|
| @@ -312,9 +310,9 @@ private:
|
|
|
| class DestinationHandle final : public WebDataConsumerHandle {
|
| public:
|
| - static std::unique_ptr<WebDataConsumerHandle> create(PassRefPtr<DestinationContext::Proxy> contextProxy)
|
| + static PassOwnPtr<WebDataConsumerHandle> create(PassRefPtr<DestinationContext::Proxy> contextProxy)
|
| {
|
| - return wrapUnique(new DestinationHandle(contextProxy));
|
| + return adoptPtr(new DestinationHandle(contextProxy));
|
| }
|
|
|
| private:
|
| @@ -331,7 +329,7 @@ class SourceContext final : public GarbageCollectedFinalized<SourceContext>, pub
|
| public:
|
| SourceContext(
|
| PassRefPtr<TeeRootObject> root,
|
| - std::unique_ptr<WebDataConsumerHandle> src,
|
| + PassOwnPtr<WebDataConsumerHandle> src,
|
| PassRefPtr<DestinationContext> dest1,
|
| PassRefPtr<DestinationContext> dest2,
|
| ExecutionContext* executionContext)
|
| @@ -396,14 +394,14 @@ private:
|
| }
|
|
|
| RefPtr<TeeRootObject> m_root;
|
| - std::unique_ptr<WebDataConsumerHandle::Reader> m_reader;
|
| + OwnPtr<WebDataConsumerHandle::Reader> m_reader;
|
| RefPtr<DestinationContext> m_dest1;
|
| RefPtr<DestinationContext> m_dest2;
|
| };
|
|
|
| } // namespace
|
|
|
| -void DataConsumerTee::create(ExecutionContext* executionContext, std::unique_ptr<WebDataConsumerHandle> src, std::unique_ptr<WebDataConsumerHandle>* dest1, std::unique_ptr<WebDataConsumerHandle>* dest2)
|
| +void DataConsumerTee::create(ExecutionContext* executionContext, PassOwnPtr<WebDataConsumerHandle> src, OwnPtr<WebDataConsumerHandle>* dest1, OwnPtr<WebDataConsumerHandle>* dest2)
|
| {
|
| RefPtr<TeeRootObject> root = TeeRootObject::create();
|
| RefPtr<DestinationTracker> tracker = DestinationTracker::create(root);
|
| @@ -416,7 +414,7 @@ void DataConsumerTee::create(ExecutionContext* executionContext, std::unique_ptr
|
| *dest2 = DestinationHandle::create(DestinationContext::Proxy::create(context2, tracker));
|
| }
|
|
|
| -void DataConsumerTee::create(ExecutionContext* executionContext, std::unique_ptr<FetchDataConsumerHandle> src, std::unique_ptr<FetchDataConsumerHandle>* dest1, std::unique_ptr<FetchDataConsumerHandle>* dest2)
|
| +void DataConsumerTee::create(ExecutionContext* executionContext, PassOwnPtr<FetchDataConsumerHandle> src, OwnPtr<FetchDataConsumerHandle>* dest1, OwnPtr<FetchDataConsumerHandle>* dest2)
|
| {
|
| RefPtr<BlobDataHandle> blobDataHandle = src->obtainReader(nullptr)->drainAsBlobDataHandle(FetchDataConsumerHandle::Reader::AllowBlobWithInvalidSize);
|
| if (blobDataHandle) {
|
| @@ -425,8 +423,8 @@ void DataConsumerTee::create(ExecutionContext* executionContext, std::unique_ptr
|
| return;
|
| }
|
|
|
| - std::unique_ptr<WebDataConsumerHandle> webDest1, webDest2;
|
| - DataConsumerTee::create(executionContext, static_cast<std::unique_ptr<WebDataConsumerHandle>>(std::move(src)), &webDest1, &webDest2);
|
| + OwnPtr<WebDataConsumerHandle> webDest1, webDest2;
|
| + DataConsumerTee::create(executionContext, static_cast<PassOwnPtr<WebDataConsumerHandle>>(std::move(src)), &webDest1, &webDest2);
|
| *dest1 = createFetchDataConsumerHandleFromWebHandle(std::move(webDest1));
|
| *dest2 = createFetchDataConsumerHandleFromWebHandle(std::move(webDest2));
|
| return;
|
|
|