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

Side by Side Diff: ios/web/webui/url_data_manager_ios_backend.mm

Issue 2473823002: Remove BrowserThread::UnsafeGetMessageLoopForThread() (Closed)
Patch Set: rebase again? Created 4 years, 1 month 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 | « ios/web/web_thread_impl.cc ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ios/web/webui/url_data_manager_ios_backend.h" 5 #include "ios/web/webui/url_data_manager_ios_backend.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 source->source()->GetContentSecurityPolicyObjectSrc()); 457 source->source()->GetContentSecurityPolicyObjectSrc());
458 job->set_content_security_policy_frame_source("frame-src 'none';"); 458 job->set_content_security_policy_frame_source("frame-src 'none';");
459 job->set_deny_xframe_options(source->source()->ShouldDenyXFrameOptions()); 459 job->set_deny_xframe_options(source->source()->ShouldDenyXFrameOptions());
460 job->set_send_content_type_header(false); 460 job->set_send_content_type_header(false);
461 461
462 // Forward along the request to the data source. 462 // Forward along the request to the data source.
463 // URLRequestChromeJob should receive mime type before data. This 463 // URLRequestChromeJob should receive mime type before data. This
464 // is guaranteed because request for mime type is placed in the 464 // is guaranteed because request for mime type is placed in the
465 // message loop before request for data. And correspondingly their 465 // message loop before request for data. And correspondingly their
466 // replies are put on the IO thread in the same order. 466 // replies are put on the IO thread in the same order.
467 base::MessageLoop* target_message_loop = 467 scoped_refptr<base::SingleThreadTaskRunner> target_runner =
468 web::WebThread::UnsafeGetMessageLoopForThread(web::WebThread::UI); 468 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI);
469 target_message_loop->task_runner()->PostTask( 469 target_runner->PostTask(
470 FROM_HERE, base::Bind(&GetMimeTypeOnUI, base::RetainedRef(source), path, 470 FROM_HERE, base::Bind(&GetMimeTypeOnUI, base::RetainedRef(source), path,
471 job->weak_factory_.GetWeakPtr())); 471 job->weak_factory_.GetWeakPtr()));
472 472
473 target_message_loop->task_runner()->PostTask( 473 target_runner->PostTask(
474 FROM_HERE, base::Bind(&URLDataManagerIOSBackend::CallStartRequest, 474 FROM_HERE, base::Bind(&URLDataManagerIOSBackend::CallStartRequest,
475 make_scoped_refptr(source), path, request_id)); 475 make_scoped_refptr(source), path, request_id));
476 return true; 476 return true;
477 } 477 }
478 478
479 URLDataSourceIOSImpl* URLDataManagerIOSBackend::GetDataSourceFromURL( 479 URLDataSourceIOSImpl* URLDataManagerIOSBackend::GetDataSourceFromURL(
480 const GURL& url) { 480 const GURL& url) {
481 // The input usually looks like: chrome://source_name/extra_bits?foo 481 // The input usually looks like: chrome://source_name/extra_bits?foo
482 // so do a lookup using the host of the URL. 482 // so do a lookup using the host of the URL.
483 DataSourceMap::iterator i = data_sources_.find(url.host()); 483 DataSourceMap::iterator i = data_sources_.find(url.host());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // Forward this data on to the pending net::URLRequest, if it exists. 521 // Forward this data on to the pending net::URLRequest, if it exists.
522 PendingRequestMap::iterator i = pending_requests_.find(request_id); 522 PendingRequestMap::iterator i = pending_requests_.find(request_id);
523 if (i != pending_requests_.end()) { 523 if (i != pending_requests_.end()) {
524 URLRequestChromeJob* job(i->second); 524 URLRequestChromeJob* job(i->second);
525 pending_requests_.erase(i); 525 pending_requests_.erase(i);
526 job->DataAvailable(bytes); 526 job->DataAvailable(bytes);
527 } 527 }
528 } 528 }
529 529
530 } // namespace web 530 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698