| 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 "chrome/browser/ui/tabs/tab_strip_model.h" | 5 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 | 1195 |
| 1196 // We only try the fast shutdown path if the whole browser process is *not* | 1196 // We only try the fast shutdown path if the whole browser process is *not* |
| 1197 // shutting down. Fast shutdown during browser termination is handled in | 1197 // shutting down. Fast shutdown during browser termination is handled in |
| 1198 // BrowserShutdown. | 1198 // BrowserShutdown. |
| 1199 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) { | 1199 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) { |
| 1200 // Construct a map of processes to the number of associated tabs that are | 1200 // Construct a map of processes to the number of associated tabs that are |
| 1201 // closing. | 1201 // closing. |
| 1202 std::map<content::RenderProcessHost*, size_t> processes; | 1202 std::map<content::RenderProcessHost*, size_t> processes; |
| 1203 for (size_t i = 0; i < indices.size(); ++i) { | 1203 for (size_t i = 0; i < indices.size(); ++i) { |
| 1204 WebContents* closing_contents = GetWebContentsAtImpl(indices[i]); | 1204 WebContents* closing_contents = GetWebContentsAtImpl(indices[i]); |
| 1205 if (!delegate_->CanFastShutdownWebContents(closing_contents)) |
| 1206 continue; |
| 1205 content::RenderProcessHost* process = | 1207 content::RenderProcessHost* process = |
| 1206 closing_contents->GetRenderProcessHost(); | 1208 closing_contents->GetRenderProcessHost(); |
| 1207 ++processes[process]; | 1209 ++processes[process]; |
| 1208 } | 1210 } |
| 1209 | 1211 |
| 1210 // Try to fast shutdown the tabs that can close. | 1212 // Try to fast shutdown the tabs that can close. |
| 1211 for (std::map<content::RenderProcessHost*, size_t>::iterator iter = | 1213 for (std::map<content::RenderProcessHost*, size_t>::iterator iter = |
| 1212 processes.begin(); iter != processes.end(); ++iter) { | 1214 processes.begin(); iter != processes.end(); ++iter) { |
| 1213 iter->first->FastShutdownForPageCount(iter->second); | 1215 iter->first->FastShutdownForPageCount(iter->second); |
| 1214 } | 1216 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 void TabStripModel::ForgetOpenersAndGroupsReferencing( | 1400 void TabStripModel::ForgetOpenersAndGroupsReferencing( |
| 1399 const WebContents* tab) { | 1401 const WebContents* tab) { |
| 1400 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); | 1402 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); |
| 1401 i != contents_data_.end(); ++i) { | 1403 i != contents_data_.end(); ++i) { |
| 1402 if ((*i)->group() == tab) | 1404 if ((*i)->group() == tab) |
| 1403 (*i)->set_group(NULL); | 1405 (*i)->set_group(NULL); |
| 1404 if ((*i)->opener() == tab) | 1406 if ((*i)->opener() == tab) |
| 1405 (*i)->set_opener(NULL); | 1407 (*i)->set_opener(NULL); |
| 1406 } | 1408 } |
| 1407 } | 1409 } |
| OLD | NEW |