| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/fetch/DataConsumerHandleTestUtil.h" | 5 #include "modules/fetch/DataConsumerHandleTestUtil.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "platform/bindings/DOMWrapperWorld.h" | 8 #include "platform/bindings/DOMWrapperWorld.h" |
| 9 #include "platform/scheduler/child/web_scheduler.h" | 9 #include "platform/scheduler/child/web_scheduler.h" |
| 10 #include "platform/wtf/PtrUtil.h" | 10 #include "platform/wtf/PtrUtil.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 GetIsolate()->RequestGarbageCollectionForTesting( | 92 GetIsolate()->RequestGarbageCollectionForTesting( |
| 93 GetIsolate()->kFullGarbageCollection); | 93 GetIsolate()->kFullGarbageCollection); |
| 94 isolate_holder_ = nullptr; | 94 isolate_holder_ = nullptr; |
| 95 } | 95 } |
| 96 waitable_event_->Signal(); | 96 waitable_event_->Signal(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 class DataConsumerHandleTestUtil::ReplayingHandle::ReaderImpl final | 99 class DataConsumerHandleTestUtil::ReplayingHandle::ReaderImpl final |
| 100 : public Reader { | 100 : public Reader { |
| 101 public: | 101 public: |
| 102 ReaderImpl(PassRefPtr<Context> context, Client* client) : context_(context) { | 102 ReaderImpl(PassRefPtr<Context> context, Client* client) |
| 103 : context_(std::move(context)) { |
| 103 context_->AttachReader(client); | 104 context_->AttachReader(client); |
| 104 } | 105 } |
| 105 ~ReaderImpl() { context_->DetachReader(); } | 106 ~ReaderImpl() { context_->DetachReader(); } |
| 106 | 107 |
| 107 Result BeginRead(const void** buffer, | 108 Result BeginRead(const void** buffer, |
| 108 Flags flags, | 109 Flags flags, |
| 109 size_t* available) override { | 110 size_t* available) override { |
| 110 return context_->BeginRead(buffer, flags, available); | 111 return context_->BeginRead(buffer, flags, available); |
| 111 } | 112 } |
| 112 Result EndRead(size_t read_size) override { | 113 Result EndRead(size_t read_size) override { |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 std::move(on_finished_reading_)); | 338 std::move(on_finished_reading_)); |
| 338 (*on_finished_reading)(std::move(result)); | 339 (*on_finished_reading)(std::move(result)); |
| 339 } | 340 } |
| 340 | 341 |
| 341 std::unique_ptr<WebDataConsumerHandle> | 342 std::unique_ptr<WebDataConsumerHandle> |
| 342 DataConsumerHandleTestUtil::CreateWaitingDataConsumerHandle() { | 343 DataConsumerHandleTestUtil::CreateWaitingDataConsumerHandle() { |
| 343 return WTF::WrapUnique(new WaitingHandle); | 344 return WTF::WrapUnique(new WaitingHandle); |
| 344 } | 345 } |
| 345 | 346 |
| 346 } // namespace blink | 347 } // namespace blink |
| OLD | NEW |