Chromium Code Reviews| 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 "content/browser/webui/url_data_manager_backend.h" | 5 #include "content/browser/webui/url_data_manager_backend.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/debug/alias.h" | 13 #include "base/debug/alias.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/ref_counted_memory.h" | 19 #include "base/memory/ref_counted_memory.h" |
| 20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 21 #include "base/profiler/scoped_tracker.h" | 21 #include "base/profiler/scoped_tracker.h" |
| 22 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
| 23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 25 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 26 #include "base/task_scheduler/post_task.h" | |
| 26 #include "base/threading/thread_task_runner_handle.h" | 27 #include "base/threading/thread_task_runner_handle.h" |
| 27 #include "base/threading/worker_pool.h" | |
| 28 #include "base/trace_event/trace_event.h" | 28 #include "base/trace_event/trace_event.h" |
| 29 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 29 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| 30 #include "content/browser/histogram_internals_request_job.h" | 30 #include "content/browser/histogram_internals_request_job.h" |
| 31 #include "content/browser/net/view_blob_internals_job_factory.h" | 31 #include "content/browser/net/view_blob_internals_job_factory.h" |
| 32 #include "content/browser/net/view_http_cache_job_factory.h" | 32 #include "content/browser/net/view_http_cache_job_factory.h" |
| 33 #include "content/browser/resource_context_impl.h" | 33 #include "content/browser/resource_context_impl.h" |
| 34 #include "content/browser/webui/i18n_source_stream.h" | 34 #include "content/browser/webui/i18n_source_stream.h" |
| 35 #include "content/browser/webui/shared_resources_data_source.h" | 35 #include "content/browser/webui/shared_resources_data_source.h" |
| 36 #include "content/browser/webui/url_data_source_impl.h" | 36 #include "content/browser/webui/url_data_source_impl.h" |
| 37 #include "content/browser/webui/web_ui_data_source_impl.h" | 37 #include "content/browser/webui/web_ui_data_source_impl.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 DCHECK(data_); | 471 DCHECK(data_); |
| 472 CHECK(buf->data()); | 472 CHECK(buf->data()); |
| 473 | 473 |
| 474 int remaining = data_->size() - data_offset_; | 474 int remaining = data_->size() - data_offset_; |
| 475 if (buf_size > remaining) | 475 if (buf_size > remaining) |
| 476 buf_size = remaining; | 476 buf_size = remaining; |
| 477 | 477 |
| 478 if (buf_size == 0) | 478 if (buf_size == 0) |
| 479 return 0; | 479 return 0; |
| 480 | 480 |
| 481 base::WorkerPool::GetTaskRunner(false)->PostTaskAndReply( | 481 base::PostTaskWithTraitsAndReply( |
|
boliu
2017/01/05 19:09:28
unrelated changes in this file?
Jinsuk Kim
2017/01/05 22:30:15
No idea how this sneaked in... reverted.
| |
| 482 FROM_HERE, base::Bind(&CopyData, base::RetainedRef(buf), buf_size, data_, | 482 FROM_HERE, base::TaskTraits().WithShutdownBehavior( |
| 483 data_offset_), | 483 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), |
| 484 base::Bind(&CopyData, base::RetainedRef(buf), buf_size, data_, | |
| 485 data_offset_), | |
| 484 base::Bind(&URLRequestChromeJob::ReadRawDataComplete, AsWeakPtr(), | 486 base::Bind(&URLRequestChromeJob::ReadRawDataComplete, AsWeakPtr(), |
| 485 buf_size)); | 487 buf_size)); |
| 486 data_offset_ += buf_size; | 488 data_offset_ += buf_size; |
| 487 | 489 |
| 488 return net::ERR_IO_PENDING; | 490 return net::ERR_IO_PENDING; |
| 489 } | 491 } |
| 490 | 492 |
| 491 void URLRequestChromeJob::DelayStartForDevTools( | 493 void URLRequestChromeJob::DelayStartForDevTools( |
| 492 const base::WeakPtr<URLRequestChromeJob>& job) { | 494 const base::WeakPtr<URLRequestChromeJob>& job) { |
| 493 BrowserThread::PostTask( | 495 BrowserThread::PostTask( |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 893 | 895 |
| 894 } // namespace | 896 } // namespace |
| 895 | 897 |
| 896 net::URLRequestJobFactory::ProtocolHandler* CreateDevToolsProtocolHandler( | 898 net::URLRequestJobFactory::ProtocolHandler* CreateDevToolsProtocolHandler( |
| 897 ResourceContext* resource_context, | 899 ResourceContext* resource_context, |
| 898 bool is_incognito) { | 900 bool is_incognito) { |
| 899 return new DevToolsJobFactory(resource_context, is_incognito); | 901 return new DevToolsJobFactory(resource_context, is_incognito); |
| 900 } | 902 } |
| 901 | 903 |
| 902 } // namespace content | 904 } // namespace content |
| OLD | NEW |