OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 5 #include <set> |
6 | 6 |
7 #include "content/browser/loader/resource_scheduler.h" | 7 #include "content/browser/loader/resource_scheduler.h" |
8 | 8 |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 : ResourceMessageDelegate(request), | 164 : ResourceMessageDelegate(request), |
165 client_id_(client_id), | 165 client_id_(client_id), |
166 client_state_on_creation_(scheduler->GetClientState(client_id_)), | 166 client_state_on_creation_(scheduler->GetClientState(client_id_)), |
167 request_(request), | 167 request_(request), |
168 ready_(false), | 168 ready_(false), |
169 deferred_(false), | 169 deferred_(false), |
170 classification_(NORMAL_REQUEST), | 170 classification_(NORMAL_REQUEST), |
171 scheduler_(scheduler), | 171 scheduler_(scheduler), |
172 priority_(priority), | 172 priority_(priority), |
173 fifo_ordering_(0) { | 173 fifo_ordering_(0) { |
174 TRACE_EVENT_ASYNC_BEGIN1("net", "URLRequest", request_, | |
175 "url", request->url().spec()); | |
176 } | 174 } |
177 | 175 |
178 ~ScheduledResourceRequest() override { scheduler_->RemoveRequest(this); } | 176 ~ScheduledResourceRequest() override { scheduler_->RemoveRequest(this); } |
179 | 177 |
180 void Start() { | 178 void Start() { |
181 TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request_, "Queued"); | |
182 ready_ = true; | 179 ready_ = true; |
183 if (!request_->status().is_success()) | 180 if (!request_->status().is_success()) |
184 return; | 181 return; |
185 base::TimeTicks time = base::TimeTicks::Now(); | 182 base::TimeTicks time = base::TimeTicks::Now(); |
186 ClientState current_state = scheduler_->GetClientState(client_id_); | 183 ClientState current_state = scheduler_->GetClientState(client_id_); |
187 // Note: the client state isn't perfectly accurate since it won't capture | 184 // Note: the client state isn't perfectly accurate since it won't capture |
188 // tabs which have switched between active and background multiple times. | 185 // tabs which have switched between active and background multiple times. |
189 // Ex: A tab with the following transitions Active -> Background -> Active | 186 // Ex: A tab with the following transitions Active -> Background -> Active |
190 // will be recorded as Active. | 187 // will be recorded as Active. |
191 const char* client_state = "Other"; | 188 const char* client_state = "Other"; |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 client->ReprioritizeRequest( | 1140 client->ReprioritizeRequest( |
1144 request, old_priority_params, new_priority_params); | 1141 request, old_priority_params, new_priority_params); |
1145 } | 1142 } |
1146 | 1143 |
1147 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( | 1144 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( |
1148 int child_id, int route_id) { | 1145 int child_id, int route_id) { |
1149 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; | 1146 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; |
1150 } | 1147 } |
1151 | 1148 |
1152 } // namespace content | 1149 } // namespace content |
OLD | NEW |