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

Side by Side Diff: chrome/browser/renderer_host/buffered_resource_handler.cc

Issue 306032: Simplify threading in browser thread by making only ChromeThread deal with di... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: a few more simplifications Created 11 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/buffered_resource_handler.h" 5 #include "chrome/browser/renderer_host/buffered_resource_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 ResourceDispatcherHost::InfoForRequest(request_); 395 ResourceDispatcherHost::InfoForRequest(request_);
396 host_->PauseRequest(info->child_id(), info->request_id(), true); 396 host_->PauseRequest(info->child_id(), info->request_id(), true);
397 397
398 // Schedule plugin loading on the file thread. 398 // Schedule plugin loading on the file thread.
399 // Note: it's possible that the only reference to this object is the task. If 399 // Note: it's possible that the only reference to this object is the task. If
400 // If the task executes on the file thread, and before it returns, the task it 400 // If the task executes on the file thread, and before it returns, the task it
401 // posts to the IO thread runs, then this object will get destructed on the 401 // posts to the IO thread runs, then this object will get destructed on the
402 // file thread. This breaks assumptions in other message handlers (i.e. when 402 // file thread. This breaks assumptions in other message handlers (i.e. when
403 // unregistering with NotificationService in the destructor). 403 // unregistering with NotificationService in the destructor).
404 AddRef(); 404 AddRef();
405 ChromeThread::GetMessageLoop(ChromeThread::FILE)->PostTask(FROM_HERE, 405 ChromeThread::PostTask(
406 ChromeThread::FILE, FROM_HERE,
406 NewRunnableFunction(&BufferedResourceHandler::LoadPlugins, 407 NewRunnableFunction(&BufferedResourceHandler::LoadPlugins,
407 this, host_->ui_loop())); 408 this, host_->ui_loop()));
408 return true; 409 return true;
409 } 410 }
410 411
411 // This test mirrors the decision that WebKit makes in 412 // This test mirrors the decision that WebKit makes in
412 // WebFrameLoaderClient::dispatchDecidePolicyForMIMEType. 413 // WebFrameLoaderClient::dispatchDecidePolicyForMIMEType.
413 bool BufferedResourceHandler::ShouldDownload(bool* need_plugin_list) { 414 bool BufferedResourceHandler::ShouldDownload(bool* need_plugin_list) {
414 if (need_plugin_list) 415 if (need_plugin_list)
415 *need_plugin_list = false; 416 *need_plugin_list = false;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 wait_for_plugins_ = false; 493 wait_for_plugins_ = false;
493 if (request_) { 494 if (request_) {
494 ResourceDispatcherHostRequestInfo* info = 495 ResourceDispatcherHostRequestInfo* info =
495 ResourceDispatcherHost::InfoForRequest(request_); 496 ResourceDispatcherHost::InfoForRequest(request_);
496 host_->PauseRequest(info->child_id(), info->request_id(), false); 497 host_->PauseRequest(info->child_id(), info->request_id(), false);
497 if (!CompleteResponseStarted(info->request_id(), false)) 498 if (!CompleteResponseStarted(info->request_id(), false))
498 host_->CancelRequest(info->child_id(), info->request_id(), false); 499 host_->CancelRequest(info->child_id(), info->request_id(), false);
499 } 500 }
500 Release(); 501 Release();
501 } 502 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698