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 |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
14 #include "chrome/browser/browser_shutdown.h" | 14 #include "chrome/browser/browser_shutdown.h" |
15 #include "chrome/browser/defaults.h" | 15 #include "chrome/browser/defaults.h" |
16 #include "chrome/browser/devtools/devtools_window.h" | |
16 #include "chrome/browser/extensions/tab_helper.h" | 17 #include "chrome/browser/extensions/tab_helper.h" |
17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 19 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
19 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" | 20 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" |
20 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
21 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h" |
22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
23 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 24 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
24 #include "content/public/browser/render_process_host.h" | 25 #include "content/public/browser/render_process_host.h" |
25 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1195 | 1196 |
1196 // We only try the fast shutdown path if the whole browser process is *not* | 1197 // 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 | 1198 // shutting down. Fast shutdown during browser termination is handled in |
1198 // BrowserShutdown. | 1199 // BrowserShutdown. |
1199 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) { | 1200 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) { |
1200 // Construct a map of processes to the number of associated tabs that are | 1201 // Construct a map of processes to the number of associated tabs that are |
1201 // closing. | 1202 // closing. |
1202 std::map<content::RenderProcessHost*, size_t> processes; | 1203 std::map<content::RenderProcessHost*, size_t> processes; |
1203 for (size_t i = 0; i < indices.size(); ++i) { | 1204 for (size_t i = 0; i < indices.size(); ++i) { |
1204 WebContents* closing_contents = GetWebContentsAtImpl(indices[i]); | 1205 WebContents* closing_contents = GetWebContentsAtImpl(indices[i]); |
1206 if (DevToolsWindow::GetInstanceForInspectedRenderViewHost( | |
sky
2013/11/05 16:37:10
If you are going to tie the two together I think i
lushnikov
2013/11/05 17:27:22
We don't really tie anything here. This part of ta
lushnikov
2013/11/06 17:01:41
Removed explicit DevTools presence in tab_strip_mo
| |
1207 closing_contents->GetRenderViewHost())) | |
1208 continue; | |
1205 content::RenderProcessHost* process = | 1209 content::RenderProcessHost* process = |
1206 closing_contents->GetRenderProcessHost(); | 1210 closing_contents->GetRenderProcessHost(); |
1207 ++processes[process]; | 1211 ++processes[process]; |
1208 } | 1212 } |
1209 | 1213 |
1210 // Try to fast shutdown the tabs that can close. | 1214 // Try to fast shutdown the tabs that can close. |
1211 for (std::map<content::RenderProcessHost*, size_t>::iterator iter = | 1215 for (std::map<content::RenderProcessHost*, size_t>::iterator iter = |
1212 processes.begin(); iter != processes.end(); ++iter) { | 1216 processes.begin(); iter != processes.end(); ++iter) { |
1213 iter->first->FastShutdownForPageCount(iter->second); | 1217 iter->first->FastShutdownForPageCount(iter->second); |
1214 } | 1218 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1398 void TabStripModel::ForgetOpenersAndGroupsReferencing( | 1402 void TabStripModel::ForgetOpenersAndGroupsReferencing( |
1399 const WebContents* tab) { | 1403 const WebContents* tab) { |
1400 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); | 1404 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); |
1401 i != contents_data_.end(); ++i) { | 1405 i != contents_data_.end(); ++i) { |
1402 if ((*i)->group() == tab) | 1406 if ((*i)->group() == tab) |
1403 (*i)->set_group(NULL); | 1407 (*i)->set_group(NULL); |
1404 if ((*i)->opener() == tab) | 1408 if ((*i)->opener() == tab) |
1405 (*i)->set_opener(NULL); | 1409 (*i)->set_opener(NULL); |
1406 } | 1410 } |
1407 } | 1411 } |
OLD | NEW |