Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(796)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp

Issue 2308343002: Replaced PassRefPtr copites with moves in Source/modules. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ReadableStreamDataConsumerHandle.h" 5 #include "modules/fetch/ReadableStreamDataConsumerHandle.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScopedPersistent.h" 8 #include "bindings/core/v8/ScopedPersistent.h"
9 #include "bindings/core/v8/ScriptFunction.h" 9 #include "bindings/core/v8/ScriptFunction.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 using Flags = WebDataConsumerHandle::Flags; 47 using Flags = WebDataConsumerHandle::Flags;
48 48
49 // This context is not yet thread-safe. 49 // This context is not yet thread-safe.
50 class ReadableStreamDataConsumerHandle::ReadingContext final : public RefCounted <ReadingContext> { 50 class ReadableStreamDataConsumerHandle::ReadingContext final : public RefCounted <ReadingContext> {
51 WTF_MAKE_NONCOPYABLE(ReadingContext); 51 WTF_MAKE_NONCOPYABLE(ReadingContext);
52 public: 52 public:
53 class OnFulfilled final : public ScriptFunction { 53 class OnFulfilled final : public ScriptFunction {
54 public: 54 public:
55 static v8::Local<v8::Function> createFunction(ScriptState* scriptState, PassRefPtr<ReadingContext> context) 55 static v8::Local<v8::Function> createFunction(ScriptState* scriptState, PassRefPtr<ReadingContext> context)
56 { 56 {
57 return (new OnFulfilled(scriptState, context))->bindToV8Function(); 57 return (new OnFulfilled(scriptState, std::move(context)))->bindToV8F unction();
58 } 58 }
59 59
60 ScriptValue call(ScriptValue v) override 60 ScriptValue call(ScriptValue v) override
61 { 61 {
62 RefPtr<ReadingContext> readingContext(m_readingContext); 62 RefPtr<ReadingContext> readingContext(m_readingContext);
63 if (!readingContext) 63 if (!readingContext)
64 return v; 64 return v;
65 bool done; 65 bool done;
66 v8::Local<v8::Value> item = v.v8Value(); 66 v8::Local<v8::Value> item = v.v8Value();
67 ASSERT(item->IsObject()); 67 ASSERT(item->IsObject());
(...skipping 19 matching lines...) Expand all
87 OnFulfilled(ScriptState* scriptState, PassRefPtr<ReadingContext> context ) 87 OnFulfilled(ScriptState* scriptState, PassRefPtr<ReadingContext> context )
88 : ScriptFunction(scriptState), m_readingContext(context) {} 88 : ScriptFunction(scriptState), m_readingContext(context) {}
89 89
90 RefPtr<ReadingContext> m_readingContext; 90 RefPtr<ReadingContext> m_readingContext;
91 }; 91 };
92 92
93 class OnRejected final : public ScriptFunction { 93 class OnRejected final : public ScriptFunction {
94 public: 94 public:
95 static v8::Local<v8::Function> createFunction(ScriptState* scriptState, PassRefPtr<ReadingContext> context) 95 static v8::Local<v8::Function> createFunction(ScriptState* scriptState, PassRefPtr<ReadingContext> context)
96 { 96 {
97 return (new OnRejected(scriptState, context))->bindToV8Function(); 97 return (new OnRejected(scriptState, std::move(context)))->bindToV8Fu nction();
98 } 98 }
99 99
100 ScriptValue call(ScriptValue v) override 100 ScriptValue call(ScriptValue v) override
101 { 101 {
102 RefPtr<ReadingContext> readingContext(m_readingContext); 102 RefPtr<ReadingContext> readingContext(m_readingContext);
103 if (!readingContext) 103 if (!readingContext)
104 return v; 104 return v;
105 readingContext->onRejected(); 105 readingContext->onRejected();
106 return v; 106 return v;
107 } 107 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 { 292 {
293 } 293 }
294 ReadableStreamDataConsumerHandle::~ReadableStreamDataConsumerHandle() = default; 294 ReadableStreamDataConsumerHandle::~ReadableStreamDataConsumerHandle() = default;
295 295
296 std::unique_ptr<FetchDataConsumerHandle::Reader> ReadableStreamDataConsumerHandl e::obtainFetchDataReader(Client* client) 296 std::unique_ptr<FetchDataConsumerHandle::Reader> ReadableStreamDataConsumerHandl e::obtainFetchDataReader(Client* client)
297 { 297 {
298 return WTF::wrapUnique(new ReadingContext::ReaderImpl(m_readingContext, clie nt)); 298 return WTF::wrapUnique(new ReadingContext::ReaderImpl(m_readingContext, clie nt));
299 } 299 }
300 300
301 } // namespace blink 301 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698