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 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 DCHECK(backend); | 218 DCHECK(backend); |
219 } | 219 } |
220 | 220 |
221 URLRequestChromeJob::~URLRequestChromeJob() { | 221 URLRequestChromeJob::~URLRequestChromeJob() { |
222 CHECK(!backend_->HasPendingJob(this)); | 222 CHECK(!backend_->HasPendingJob(this)); |
223 } | 223 } |
224 | 224 |
225 void URLRequestChromeJob::Start() { | 225 void URLRequestChromeJob::Start() { |
226 // Start reading asynchronously so that all error reporting and data | 226 // Start reading asynchronously so that all error reporting and data |
227 // callbacks happen as they would for network requests. | 227 // callbacks happen as they would for network requests. |
228 MessageLoop::current()->PostTask( | 228 base::MessageLoop::current()->PostTask( |
229 FROM_HERE, | 229 FROM_HERE, |
230 base::Bind(&URLRequestChromeJob::StartAsync, | 230 base::Bind(&URLRequestChromeJob::StartAsync, weak_factory_.GetWeakPtr())); |
231 weak_factory_.GetWeakPtr())); | |
232 | 231 |
233 TRACE_EVENT_ASYNC_BEGIN1("browser", "DataManager:Request", this, "URL", | 232 TRACE_EVENT_ASYNC_BEGIN1("browser", "DataManager:Request", this, "URL", |
234 request_->url().possibly_invalid_spec()); | 233 request_->url().possibly_invalid_spec()); |
235 } | 234 } |
236 | 235 |
237 void URLRequestChromeJob::Kill() { | 236 void URLRequestChromeJob::Kill() { |
238 backend_->RemoveRequest(this); | 237 backend_->RemoveRequest(this); |
239 } | 238 } |
240 | 239 |
241 bool URLRequestChromeJob::GetMimeType(std::string* mime_type) const { | 240 bool URLRequestChromeJob::GetMimeType(std::string* mime_type) const { |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 source->source()->ShouldDenyXFrameOptions()); | 510 source->source()->ShouldDenyXFrameOptions()); |
512 | 511 |
513 // Look up additional request info to pass down. | 512 // Look up additional request info to pass down. |
514 int render_process_id = -1; | 513 int render_process_id = -1; |
515 int render_view_id = -1; | 514 int render_view_id = -1; |
516 ResourceRequestInfo::GetRenderViewForRequest(request, | 515 ResourceRequestInfo::GetRenderViewForRequest(request, |
517 &render_process_id, | 516 &render_process_id, |
518 &render_view_id); | 517 &render_view_id); |
519 | 518 |
520 // Forward along the request to the data source. | 519 // Forward along the request to the data source. |
521 MessageLoop* target_message_loop = | 520 base::MessageLoop* target_message_loop = |
522 source->source()->MessageLoopForRequestPath(path); | 521 source->source()->MessageLoopForRequestPath(path); |
523 if (!target_message_loop) { | 522 if (!target_message_loop) { |
524 job->MimeTypeAvailable(source->source()->GetMimeType(path)); | 523 job->MimeTypeAvailable(source->source()->GetMimeType(path)); |
525 // Eliminate potentially dangling pointer to avoid future use. | 524 // Eliminate potentially dangling pointer to avoid future use. |
526 job = NULL; | 525 job = NULL; |
527 | 526 |
528 // The DataSource is agnostic to which thread StartDataRequest is called | 527 // The DataSource is agnostic to which thread StartDataRequest is called |
529 // on for this path. Call directly into it from this thread, the IO | 528 // on for this path. Call directly into it from this thread, the IO |
530 // thread. | 529 // thread. |
531 source->source()->StartDataRequest( | 530 source->source()->StartDataRequest( |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | 642 |
644 } // namespace | 643 } // namespace |
645 | 644 |
646 net::URLRequestJobFactory::ProtocolHandler* | 645 net::URLRequestJobFactory::ProtocolHandler* |
647 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 646 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
648 bool is_incognito) { | 647 bool is_incognito) { |
649 return new DevToolsJobFactory(resource_context, is_incognito); | 648 return new DevToolsJobFactory(resource_context, is_incognito); |
650 } | 649 } |
651 | 650 |
652 } // namespace content | 651 } // namespace content |
OLD | NEW |