OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/fast_unload_controller.h" | 5 #include "chrome/browser/ui/fast_unload_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/devtools/devtools_window.h" | 10 #include "chrome/browser/devtools/devtools_window.h" |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 WebContentsSet::iterator current = it++; | 415 WebContentsSet::iterator current = it++; |
416 content::WebContents* contents = *current; | 416 content::WebContents* contents = *current; |
417 tabs_needing_unload_.erase(current); | 417 tabs_needing_unload_.erase(current); |
418 // Null check render_view_host here as this gets called on a PostTask | 418 // Null check render_view_host here as this gets called on a PostTask |
419 // and the tab's render_view_host may have been nulled out. | 419 // and the tab's render_view_host may have been nulled out. |
420 if (contents->GetRenderViewHost()) { | 420 if (contents->GetRenderViewHost()) { |
421 CoreTabHelper* core_tab_helper = | 421 CoreTabHelper* core_tab_helper = |
422 CoreTabHelper::FromWebContents(contents); | 422 CoreTabHelper::FromWebContents(contents); |
423 core_tab_helper->OnUnloadStarted(); | 423 core_tab_helper->OnUnloadStarted(); |
424 DetachWebContents(contents); | 424 DetachWebContents(contents); |
425 contents->GetRenderViewHost()->ClosePage(); | 425 contents->ClosePage(); |
426 } | 426 } |
427 } | 427 } |
428 | 428 |
429 // Get the browser hidden. | 429 // Get the browser hidden. |
430 if (browser_->tab_strip_model()->empty()) { | 430 if (browser_->tab_strip_model()->empty()) { |
431 browser_->TabStripEmpty(); | 431 browser_->TabStripEmpty(); |
432 } else { | 432 } else { |
433 browser_->tab_strip_model()->CloseAllTabs(); // tabs not needing unload | 433 browser_->tab_strip_model()->CloseAllTabs(); // tabs not needing unload |
434 } | 434 } |
435 return; | 435 return; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 } | 473 } |
474 | 474 |
475 void FastUnloadController::PostTaskForProcessPendingTabs() { | 475 void FastUnloadController::PostTaskForProcessPendingTabs() { |
476 base::MessageLoop::current()->PostTask( | 476 base::MessageLoop::current()->PostTask( |
477 FROM_HERE, | 477 FROM_HERE, |
478 base::Bind(&FastUnloadController::ProcessPendingTabs, | 478 base::Bind(&FastUnloadController::ProcessPendingTabs, |
479 weak_factory_.GetWeakPtr())); | 479 weak_factory_.GetWeakPtr())); |
480 } | 480 } |
481 | 481 |
482 } // namespace chrome | 482 } // namespace chrome |
OLD | NEW |