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

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

Issue 1983783002: Remove OwnPtr::release() calls in modules/ (part 1). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 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 "modules/fetch/Response.h" 5 #include "modules/fetch/Response.h"
6 6
7 #include "bindings/core/v8/Dictionary.h" 7 #include "bindings/core/v8/Dictionary.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/V8ArrayBuffer.h" 10 #include "bindings/core/v8/V8ArrayBuffer.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 bodyHandle = ReadableStreamDataConsumerHandle::create(scriptState, r eader); 149 bodyHandle = ReadableStreamDataConsumerHandle::create(scriptState, r eader);
150 } 150 }
151 } else { 151 } else {
152 String string = toUSVString(isolate, body, exceptionState); 152 String string = toUSVString(isolate, body, exceptionState);
153 if (exceptionState.hadException()) 153 if (exceptionState.hadException())
154 return nullptr; 154 return nullptr;
155 bodyHandle = FetchFormDataConsumerHandle::create(string); 155 bodyHandle = FetchFormDataConsumerHandle::create(string);
156 contentType = "text/plain;charset=UTF-8"; 156 contentType = "text/plain;charset=UTF-8";
157 } 157 }
158 // TODO(yhirano): Add the URLSearchParams case. 158 // TODO(yhirano): Add the URLSearchParams case.
159 Response* response = create(scriptState, bodyHandle.release(), contentType, ResponseInit(init, exceptionState), exceptionState); 159 Response* response = create(scriptState, std::move(bodyHandle), contentType, ResponseInit(init, exceptionState), exceptionState);
160 if (!exceptionState.hadException() && !reader.isEmpty()) { 160 if (!exceptionState.hadException() && !reader.isEmpty()) {
161 // Add a hidden reference so that the weak persistent in the 161 // Add a hidden reference so that the weak persistent in the
162 // ReadableStreamDataConsumerHandle will be valid as long as the 162 // ReadableStreamDataConsumerHandle will be valid as long as the
163 // Response is valid. 163 // Response is valid.
164 v8::Local<v8::Value> wrapper = toV8(response, scriptState); 164 v8::Local<v8::Value> wrapper = toV8(response, scriptState);
165 if (wrapper.IsEmpty()) { 165 if (wrapper.IsEmpty()) {
166 exceptionState.throwTypeError("Cannot create a Response wrapper"); 166 exceptionState.throwTypeError("Cannot create a Response wrapper");
167 return nullptr; 167 return nullptr;
168 } 168 }
169 ASSERT(wrapper->IsObject()); 169 ASSERT(wrapper->IsObject());
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 412 }
413 413
414 DEFINE_TRACE(Response) 414 DEFINE_TRACE(Response)
415 { 415 {
416 Body::trace(visitor); 416 Body::trace(visitor);
417 visitor->trace(m_response); 417 visitor->trace(m_response);
418 visitor->trace(m_headers); 418 visitor->trace(m_headers);
419 } 419 }
420 420
421 } // namespace blink 421 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/Request.cpp ('k') | third_party/WebKit/Source/modules/fetch/ResponseTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698