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

Side by Side Diff: net/url_request/url_request_simple_job.cc

Issue 880973002: Instrumenting CopyData to analyze its slowing down (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/url_request/url_request_simple_job.h" 5 #include "net/url_request/url_request_simple_job.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted_memory.h" 11 #include "base/memory/ref_counted_memory.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/profiler/scoped_tracker.h" 13 #include "base/profiler/scoped_tracker.h"
14 #include "base/threading/worker_pool.h" 14 #include "base/threading/worker_pool.h"
15 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
16 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
17 #include "net/http/http_request_headers.h" 17 #include "net/http/http_request_headers.h"
18 #include "net/http/http_util.h" 18 #include "net/http/http_util.h"
19 #include "net/url_request/url_request_status.h" 19 #include "net/url_request/url_request_status.h"
20 20
21 namespace net { 21 namespace net {
22 22
23 namespace { 23 namespace {
24 24
25 void CopyData(const scoped_refptr<IOBuffer>& buf, 25 void CopyData(const scoped_refptr<IOBuffer>& buf,
26 int buf_size, 26 int buf_size,
27 const scoped_refptr<base::RefCountedMemory>& data, 27 const scoped_refptr<base::RefCountedMemory>& data,
28 int64 data_offset) { 28 int64 data_offset) {
29 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422489 is fixed.
30 tracked_objects::ScopedTracker tracking_profile(
31 FROM_HERE_WITH_EXPLICIT_FUNCTION("422489 CopyData"));
32
29 memcpy(buf->data(), data->front() + data_offset, buf_size); 33 memcpy(buf->data(), data->front() + data_offset, buf_size);
30 } 34 }
31 35
32 } // namespace 36 } // namespace
33 37
34 URLRequestSimpleJob::URLRequestSimpleJob(URLRequest* request, 38 URLRequestSimpleJob::URLRequestSimpleJob(URLRequest* request,
35 NetworkDelegate* network_delegate) 39 NetworkDelegate* network_delegate)
36 : URLRangeRequestJob(request, network_delegate), 40 : URLRangeRequestJob(request, network_delegate),
37 next_data_offset_(0), 41 next_data_offset_(0),
38 task_runner_(base::WorkerPool::GetTaskRunner(false)), 42 task_runner_(base::WorkerPool::GetTaskRunner(false)),
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 next_data_offset_ = byte_range_.first_byte_position(); 178 next_data_offset_ = byte_range_.first_byte_position();
175 set_expected_content_size(byte_range_.last_byte_position() - 179 set_expected_content_size(byte_range_.last_byte_position() -
176 next_data_offset_ + 1); 180 next_data_offset_ + 1);
177 NotifyHeadersComplete(); 181 NotifyHeadersComplete();
178 } else { 182 } else {
179 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); 183 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
180 } 184 }
181 } 185 }
182 186
183 } // namespace net 187 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698