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

Side by Side Diff: Source/modules/serviceworkers/Body.cpp

Issue 783423003: Make ScriptPromiseResolver RefCountedWillBeRefCountedGarbageCollected. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: WIP: 1st trial Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "modules/serviceworkers/Body.h" 6 #include "modules/serviceworkers/Body.h"
7 7
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 { 224 {
225 if (m_resolver) 225 if (m_resolver)
226 return true; 226 return true;
227 if (m_streamAccessed && (m_stream->state() == ReadableStream::Readable || m_ stream->state() == ReadableStream::Waiting)) 227 if (m_streamAccessed && (m_stream->state() == ReadableStream::Readable || m_ stream->state() == ReadableStream::Waiting))
228 return true; 228 return true;
229 return false; 229 return false;
230 } 230 }
231 231
232 void Body::trace(Visitor* visitor) 232 void Body::trace(Visitor* visitor)
233 { 233 {
234 visitor->trace(m_resolver);
234 visitor->trace(m_stream); 235 visitor->trace(m_stream);
235 visitor->trace(m_streamSource); 236 visitor->trace(m_streamSource);
236 } 237 }
237 238
238 Body::Body(ExecutionContext* context) 239 Body::Body(ExecutionContext* context)
239 : ActiveDOMObject(context) 240 : ActiveDOMObject(context)
240 , m_bodyUsed(false) 241 , m_bodyUsed(false)
241 , m_streamAccessed(false) 242 , m_streamAccessed(false)
242 , m_responseType(ResponseType::ResponseUnknown) 243 , m_responseType(ResponseType::ResponseUnknown)
243 , m_streamSource(new ReadableStreamSource(this)) 244 , m_streamSource(new ReadableStreamSource(this))
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 369
369 if (m_resolver) { 370 if (m_resolver) {
370 // FIXME: We should reject the promise. 371 // FIXME: We should reject the promise.
371 m_resolver->resolve(""); 372 m_resolver->resolve("");
372 m_resolver.clear(); 373 m_resolver.clear();
373 } 374 }
374 m_stream->error(DOMException::create(NetworkError, "network error")); 375 m_stream->error(DOMException::create(NetworkError, "network error"));
375 } 376 }
376 377
377 } // namespace blink 378 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698