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

Side by Side Diff: third_party/WebKit/Source/web/tests/sim/SimNetwork.cpp

Issue 2510333002: Send encoded_body_length to renderer when response completed (2/3) (Closed)
Patch Set: rebase Created 4 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 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 "web/tests/sim/SimNetwork.h" 5 #include "web/tests/sim/SimNetwork.h"
6 6
7 #include "public/platform/Platform.h" 7 #include "public/platform/Platform.h"
8 #include "public/platform/WebURLError.h" 8 #include "public/platform/WebURLError.h"
9 #include "public/platform/WebURLLoader.h" 9 #include "public/platform/WebURLLoader.h"
10 #include "public/platform/WebURLLoaderClient.h" 10 #include "public/platform/WebURLLoaderClient.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 m_currentRequest = it->value; 49 m_currentRequest = it->value;
50 m_currentRequest->didReceiveResponse(client, loader, response); 50 m_currentRequest->didReceiveResponse(client, loader, response);
51 } 51 }
52 52
53 void SimNetwork::didReceiveData(WebURLLoaderClient* client, 53 void SimNetwork::didReceiveData(WebURLLoaderClient* client,
54 WebURLLoader* loader, 54 WebURLLoader* loader,
55 const char* data, 55 const char* data,
56 int dataLength, 56 int dataLength,
57 int encodedDataLength) { 57 int encodedDataLength) {
58 if (!m_currentRequest) 58 if (!m_currentRequest)
59 client->didReceiveData(loader, data, dataLength, encodedDataLength, 59 client->didReceiveData(loader, data, dataLength, encodedDataLength);
60 dataLength);
61 } 60 }
62 61
63 void SimNetwork::didFail(WebURLLoaderClient* client, 62 void SimNetwork::didFail(WebURLLoaderClient* client,
64 WebURLLoader* loader, 63 WebURLLoader* loader,
65 const WebURLError& error, 64 const WebURLError& error,
66 int64_t encodedDataLength) { 65 int64_t totalEncodedDataLength,
66 int64_t totalEncodedBodyLength) {
67 if (!m_currentRequest) { 67 if (!m_currentRequest) {
68 client->didFail(loader, error, encodedDataLength); 68 client->didFail(loader, error, totalEncodedDataLength,
69 totalEncodedBodyLength);
69 return; 70 return;
70 } 71 }
71 m_currentRequest->didFail(error); 72 m_currentRequest->didFail(error);
72 } 73 }
73 74
74 void SimNetwork::didFinishLoading(WebURLLoaderClient* client, 75 void SimNetwork::didFinishLoading(WebURLLoaderClient* client,
75 WebURLLoader* loader, 76 WebURLLoader* loader,
76 double finishTime, 77 double finishTime,
77 int64_t totalEncodedDataLength) { 78 int64_t totalEncodedDataLength,
79 int64_t totalEncodedBodyLength) {
78 if (!m_currentRequest) { 80 if (!m_currentRequest) {
79 client->didFinishLoading(loader, finishTime, totalEncodedDataLength); 81 client->didFinishLoading(loader, finishTime, totalEncodedDataLength,
82 totalEncodedBodyLength);
80 return; 83 return;
81 } 84 }
82 m_currentRequest = nullptr; 85 m_currentRequest = nullptr;
83 } 86 }
84 87
85 void SimNetwork::addRequest(SimRequest& request) { 88 void SimNetwork::addRequest(SimRequest& request) {
86 m_requests.add(request.url(), &request); 89 m_requests.add(request.url(), &request);
87 } 90 }
88 91
89 void SimNetwork::removeRequest(SimRequest& request) { 92 void SimNetwork::removeRequest(SimRequest& request) {
90 m_requests.remove(request.url()); 93 m_requests.remove(request.url());
91 } 94 }
92 95
93 } // namespace blink 96 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/sim/SimNetwork.h ('k') | third_party/WebKit/Source/web/tests/sim/SimRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698