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

Side by Side Diff: chrome/browser/tabs/tab_strip_model.cc

Issue 274057: Add histogram for how tab closing time. Did some cleanup along the way. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/tabs/tab_strip_model.h" 5 #include "chrome/browser/tabs/tab_strip_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 for (std::map<RenderProcessHost*, size_t>::iterator iter = 637 for (std::map<RenderProcessHost*, size_t>::iterator iter =
638 processes.begin(); 638 processes.begin();
639 iter != processes.end(); ++iter) { 639 iter != processes.end(); ++iter) {
640 iter->first->FastShutdownForPageCount(iter->second); 640 iter->first->FastShutdownForPageCount(iter->second);
641 } 641 }
642 } 642 }
643 643
644 // We now return to our regularly scheduled shutdown procedure. 644 // We now return to our regularly scheduled shutdown procedure.
645 for (size_t i = 0; i < indices.size(); ++i) { 645 for (size_t i = 0; i < indices.size(); ++i) {
646 TabContents* detached_contents = GetContentsAt(indices[i]); 646 TabContents* detached_contents = GetContentsAt(indices[i]);
647 detached_contents->OnCloseStarted();
647 648
648 if (!delegate_->CanCloseContentsAt(indices[i]) || 649 if (!delegate_->CanCloseContentsAt(indices[i]) ||
649 delegate_->RunUnloadListenerBeforeClosing(detached_contents)) { 650 delegate_->RunUnloadListenerBeforeClosing(detached_contents)) {
650 retval = false; 651 retval = false;
651 continue; 652 continue;
652 } 653 }
653 654
654 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, 655 FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
655 TabClosingAt(detached_contents, indices[i])); 656 TabClosingAt(detached_contents, indices[i]));
656 657
657 if (detached_contents) { 658 // Ask the delegate to save an entry for this tab in the historical tab
tony 2009/10/14 23:20:06 Maybe we should DCHECK |detached_contents| above?
jam 2009/10/14 23:31:11 I took it out because delegate_->RunUnloadListener
658 // Ask the delegate to save an entry for this tab in the historical tab 659 // database if applicable.
659 // database if applicable. 660 if (create_historical_tabs)
660 if (create_historical_tabs) 661 delegate_->CreateHistoricalTab(detached_contents);
661 delegate_->CreateHistoricalTab(detached_contents);
662 662
663 // Deleting the TabContents will call back to us via NotificationObserver 663 // Deleting the TabContents will call back to us via NotificationObserver
664 // and detach it. 664 // and detach it.
665 delete detached_contents; 665 delete detached_contents;
666 }
667 } 666 }
668 667
669 return retval; 668 return retval;
670 } 669 }
671 670
672 void TabStripModel::MoveTabContentsAtImpl(int index, int to_position, 671 void TabStripModel::MoveTabContentsAtImpl(int index, int to_position,
673 bool select_after_move, 672 bool select_after_move,
674 bool update_pinned_state) { 673 bool update_pinned_state) {
675 DCHECK(ContainsIndex(index)); 674 DCHECK(ContainsIndex(index));
676 if (index == to_position) 675 if (index == to_position)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 int index = GetIndexOfTabContents(contents); 735 int index = GetIndexOfTabContents(contents);
737 contents_data_.at(index)->opener = &opener->controller(); 736 contents_data_.at(index)->opener = &opener->controller();
738 } 737 }
739 738
740 // static 739 // static
741 bool TabStripModel::OpenerMatches(const TabContentsData* data, 740 bool TabStripModel::OpenerMatches(const TabContentsData* data,
742 const NavigationController* opener, 741 const NavigationController* opener,
743 bool use_group) { 742 bool use_group) {
744 return data->opener == opener || (use_group && data->group == opener); 743 return data->opener == opener || (use_group && data->group == opener);
745 } 744 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698