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

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

Issue 1773813007: blink: Rename modules/ method to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-modules: rebase-fixes Created 4 years, 9 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/ReadableStreamOperations.h" 9 #include "bindings/core/v8/ReadableStreamOperations.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 || (0x80 <= c && c <= 0xFF))) // obs-text 101 || (0x80 <= c && c <= 0xFF))) // obs-text
102 return false; 102 return false;
103 } 103 }
104 return true; 104 return true;
105 } 105 }
106 106
107 } // namespace 107 } // namespace
108 108
109 Response* Response::create(ScriptState* scriptState, ExceptionState& exceptionSt ate) 109 Response* Response::create(ScriptState* scriptState, ExceptionState& exceptionSt ate)
110 { 110 {
111 return create(scriptState->executionContext(), nullptr, String(), ResponseIn it(), exceptionState); 111 return create(scriptState->getExecutionContext(), nullptr, String(), Respons eInit(), exceptionState);
112 } 112 }
113 113
114 Response* Response::create(ScriptState* scriptState, ScriptValue bodyValue, cons t Dictionary& init, ExceptionState& exceptionState) 114 Response* Response::create(ScriptState* scriptState, ScriptValue bodyValue, cons t Dictionary& init, ExceptionState& exceptionState)
115 { 115 {
116 v8::Local<v8::Value> body = bodyValue.v8Value(); 116 v8::Local<v8::Value> body = bodyValue.v8Value();
117 ScriptValue reader; 117 ScriptValue reader;
118 v8::Isolate* isolate = scriptState->isolate(); 118 v8::Isolate* isolate = scriptState->isolate();
119 ExecutionContext* executionContext = scriptState->executionContext(); 119 ExecutionContext* executionContext = scriptState->getExecutionContext();
120 120
121 OwnPtr<FetchDataConsumerHandle> bodyHandle; 121 OwnPtr<FetchDataConsumerHandle> bodyHandle;
122 String contentType; 122 String contentType;
123 if (bodyValue.isUndefined() || bodyValue.isNull()) { 123 if (bodyValue.isUndefined() || bodyValue.isNull()) {
124 // Note: The IDL processor cannot handle this situation. See 124 // Note: The IDL processor cannot handle this situation. See
125 // https://crbug.com/335871. 125 // https://crbug.com/335871.
126 } else if (V8Blob::hasInstance(body, isolate)) { 126 } else if (V8Blob::hasInstance(body, isolate)) {
127 Blob* blob = V8Blob::toImpl(body.As<v8::Object>()); 127 Blob* blob = V8Blob::toImpl(body.As<v8::Object>());
128 bodyHandle = FetchBlobDataConsumerHandle::create(executionContext, blob- >blobDataHandle()); 128 bodyHandle = FetchBlobDataConsumerHandle::create(executionContext, blob- >blobDataHandle());
129 contentType = blob->type(); 129 contentType = blob->type();
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 return m_headers; 346 return m_headers;
347 } 347 }
348 348
349 Response* Response::clone(ExceptionState& exceptionState) 349 Response* Response::clone(ExceptionState& exceptionState)
350 { 350 {
351 if (isBodyLocked() || bodyUsed()) { 351 if (isBodyLocked() || bodyUsed()) {
352 exceptionState.throwTypeError("Response body is already used"); 352 exceptionState.throwTypeError("Response body is already used");
353 return nullptr; 353 return nullptr;
354 } 354 }
355 355
356 FetchResponseData* response = m_response->clone(executionContext()); 356 FetchResponseData* response = m_response->clone(getExecutionContext());
357 Headers* headers = Headers::create(response->headerList()); 357 Headers* headers = Headers::create(response->headerList());
358 headers->setGuard(m_headers->getGuard()); 358 headers->setGuard(m_headers->getGuard());
359 return new Response(executionContext(), response, headers); 359 return new Response(getExecutionContext(), response, headers);
360 } 360 }
361 361
362 bool Response::hasPendingActivity() const 362 bool Response::hasPendingActivity() const
363 { 363 {
364 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) 364 if (!getExecutionContext() || getExecutionContext()->activeDOMObjectsAreStop ped())
365 return false; 365 return false;
366 if (!internalBodyBuffer()) 366 if (!internalBodyBuffer())
367 return false; 367 return false;
368 if (internalBodyBuffer()->hasPendingActivity()) 368 if (internalBodyBuffer()->hasPendingActivity())
369 return true; 369 return true;
370 return Body::hasPendingActivity(); 370 return Body::hasPendingActivity();
371 } 371 }
372 372
373 void Response::stop() 373 void Response::stop()
374 { 374 {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 421 }
422 422
423 DEFINE_TRACE(Response) 423 DEFINE_TRACE(Response)
424 { 424 {
425 Body::trace(visitor); 425 Body::trace(visitor);
426 visitor->trace(m_response); 426 visitor->trace(m_response);
427 visitor->trace(m_headers); 427 visitor->trace(m_headers);
428 } 428 }
429 429
430 } // namespace blink 430 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/RequestTest.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