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/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/notification_types.h" | 26 #include "content/public/browser/notification_types.h" |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 | 1095 |
1095 // We only try the fast shutdown path if the whole browser process is *not* | 1096 // We only try the fast shutdown path if the whole browser process is *not* |
1096 // shutting down. Fast shutdown during browser termination is handled in | 1097 // shutting down. Fast shutdown during browser termination is handled in |
1097 // BrowserShutdown. | 1098 // BrowserShutdown. |
1098 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) { | 1099 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) { |
1099 // Construct a map of processes to the number of associated tabs that are | 1100 // Construct a map of processes to the number of associated tabs that are |
1100 // closing. | 1101 // closing. |
1101 std::map<content::RenderProcessHost*, size_t> processes; | 1102 std::map<content::RenderProcessHost*, size_t> processes; |
1102 for (size_t i = 0; i < indices.size(); ++i) { | 1103 for (size_t i = 0; i < indices.size(); ++i) { |
1103 WebContents* closing_contents = GetWebContentsAtImpl(indices[i]); | 1104 WebContents* closing_contents = GetWebContentsAtImpl(indices[i]); |
| 1105 if (DevToolsWindow::GetInstanceForInspectedRenderViewHost( |
| 1106 closing_contents->GetRenderViewHost())) |
| 1107 continue; |
1104 content::RenderProcessHost* process = | 1108 content::RenderProcessHost* process = |
1105 closing_contents->GetRenderProcessHost(); | 1109 closing_contents->GetRenderProcessHost(); |
1106 ++processes[process]; | 1110 ++processes[process]; |
1107 } | 1111 } |
1108 | 1112 |
1109 // Try to fast shutdown the tabs that can close. | 1113 // Try to fast shutdown the tabs that can close. |
1110 for (std::map<content::RenderProcessHost*, size_t>::iterator iter = | 1114 for (std::map<content::RenderProcessHost*, size_t>::iterator iter = |
1111 processes.begin(); iter != processes.end(); ++iter) { | 1115 processes.begin(); iter != processes.end(); ++iter) { |
1112 iter->first->FastShutdownForPageCount(iter->second); | 1116 iter->first->FastShutdownForPageCount(iter->second); |
1113 } | 1117 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 void TabStripModel::ForgetOpenersAndGroupsReferencing( | 1301 void TabStripModel::ForgetOpenersAndGroupsReferencing( |
1298 const WebContents* tab) { | 1302 const WebContents* tab) { |
1299 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); | 1303 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); |
1300 i != contents_data_.end(); ++i) { | 1304 i != contents_data_.end(); ++i) { |
1301 if ((*i)->group == tab) | 1305 if ((*i)->group == tab) |
1302 (*i)->group = NULL; | 1306 (*i)->group = NULL; |
1303 if ((*i)->opener == tab) | 1307 if ((*i)->opener == tab) |
1304 (*i)->opener = NULL; | 1308 (*i)->opener = NULL; |
1305 } | 1309 } |
1306 } | 1310 } |
OLD | NEW |