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

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

Issue 2835123005: Send the decoded size when response completed and stop summing in ResourceLoader::DidReceiveData() (Closed)
Patch Set: Created 3 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 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void SimNetwork::DidReceiveData(WebURLLoaderClient* client, 54 void SimNetwork::DidReceiveData(WebURLLoaderClient* client,
55 const char* data, 55 const char* data,
56 int data_length) { 56 int data_length) {
57 if (!current_request_) 57 if (!current_request_)
58 client->DidReceiveData(data, data_length); 58 client->DidReceiveData(data, data_length);
59 } 59 }
60 60
61 void SimNetwork::DidFail(WebURLLoaderClient* client, 61 void SimNetwork::DidFail(WebURLLoaderClient* client,
62 const WebURLError& error, 62 const WebURLError& error,
63 int64_t total_encoded_data_length, 63 int64_t total_encoded_data_length,
64 int64_t total_encoded_body_length) { 64 int64_t total_encoded_body_length,
65 int64_t total_decoded_body_length) {
65 if (!current_request_) { 66 if (!current_request_) {
66 client->DidFail(error, total_encoded_data_length, 67 client->DidFail(error, total_encoded_data_length, total_encoded_body_length,
67 total_encoded_body_length); 68 total_decoded_body_length);
68 return; 69 return;
69 } 70 }
70 current_request_->DidFail(error); 71 current_request_->DidFail(error);
71 } 72 }
72 73
73 void SimNetwork::DidFinishLoading(WebURLLoaderClient* client, 74 void SimNetwork::DidFinishLoading(WebURLLoaderClient* client,
74 double finish_time, 75 double finish_time,
75 int64_t total_encoded_data_length, 76 int64_t total_encoded_data_length,
76 int64_t total_encoded_body_length) { 77 int64_t total_encoded_body_length,
78 int64_t total_decoded_body_length) {
77 if (!current_request_) { 79 if (!current_request_) {
78 client->DidFinishLoading(finish_time, total_encoded_data_length, 80 client->DidFinishLoading(finish_time, total_encoded_data_length,
79 total_encoded_body_length); 81 total_encoded_body_length,
82 total_decoded_body_length);
80 return; 83 return;
81 } 84 }
82 current_request_ = nullptr; 85 current_request_ = nullptr;
83 } 86 }
84 87
85 void SimNetwork::AddRequest(SimRequest& request) { 88 void SimNetwork::AddRequest(SimRequest& request) {
86 requests_.insert(request.Url(), &request); 89 requests_.insert(request.Url(), &request);
87 } 90 }
88 91
89 void SimNetwork::RemoveRequest(SimRequest& request) { 92 void SimNetwork::RemoveRequest(SimRequest& request) {
90 requests_.erase(request.Url()); 93 requests_.erase(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