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

Side by Side Diff: chrome/browser/ui/task_manager/task_manager_table_model.cc

Issue 2202563003: Fix bug avi found. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tm_stl_util
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/task_manager/task_manager_table_model.h" 5 #include "chrome/browser/ui/task_manager/task_manager_table_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/number_formatting.h" 10 #include "base/i18n/number_formatting.h"
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 555
556 default: 556 default:
557 NOTREACHED(); 557 NOTREACHED();
558 return 0; 558 return 0;
559 } 559 }
560 } 560 }
561 561
562 void TaskManagerTableModel::GetRowsGroupRange(int row_index, 562 void TaskManagerTableModel::GetRowsGroupRange(int row_index,
563 int* out_start, 563 int* out_start,
564 int* out_length) { 564 int* out_length) {
565 base::ProcessId process_id =
afakhry 2016/08/01 20:53:53 const
566 observed_task_manager()->GetProcessId(tasks_[row_index]);
565 int i = row_index; 567 int i = row_index;
566 for ( ; i >= 0; --i) { 568 int limit = row_index + 1;
567 if (IsTaskFirstInGroup(i)) 569 while (i > 0 &&
568 break; 570 observed_task_manager()->GetProcessId(tasks_[i - 1]) == process_id) {
571 i--;
afakhry 2016/08/01 20:53:53 ++i?
Avi (use Gerrit) 2016/08/01 20:57:39 --i?
afakhry 2016/08/01 21:02:59 Oops, yes, sorry! :)
569 } 572 }
570 573 while (limit < RowCount() &&
571 CHECK_GE(i, 0); 574 observed_task_manager()->GetProcessId(tasks_[limit]) == process_id) {
572 575 limit++;
afakhry 2016/08/01 20:53:53 ++limit?
576 }
573 *out_start = i; 577 *out_start = i;
574 *out_length = observed_task_manager()->GetNumberOfTasksOnSameProcess( 578 *out_length = limit - i;
afakhry 2016/08/01 20:53:53 You can ignore the following: :D Hmmm, that's a v
Avi (use Gerrit) 2016/08/01 20:57:39 Yes, I actually thought of Sean's talk. I searched
afakhry 2016/08/01 21:02:59 It's certainly not worth the hassle, that's why I
575 tasks_[row_index]);
576 } 579 }
577 580
578 void TaskManagerTableModel::OnTaskAdded(TaskId id) { 581 void TaskManagerTableModel::OnTaskAdded(TaskId id) {
579 // For the table view scrollbar to behave correctly we must inform it that 582 // For the table view scrollbar to behave correctly we must inform it that
580 // a new task has been added. 583 // a new task has been added.
581 584
582 // We will get a newly sorted list from the task manager as opposed to just 585 // We will get a newly sorted list from the task manager as opposed to just
583 // adding |id| to |tasks_| because we want to keep |tasks_| sorted by proc IDs 586 // adding |id| to |tasks_| because we want to keep |tasks_| sorted by proc IDs
584 // and then by Task IDs. 587 // and then by Task IDs.
585 tasks_ = observed_task_manager()->GetTaskIdsList(); 588 tasks_ = observed_task_manager()->GetTaskIdsList();
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const { 835 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const {
833 if (row_index == 0) 836 if (row_index == 0)
834 return true; 837 return true;
835 838
836 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) != 839 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) !=
837 observed_task_manager()->GetProcessId(tasks_[row_index]); 840 observed_task_manager()->GetProcessId(tasks_[row_index]);
838 } 841 }
839 842
840 843
841 } // namespace task_management 844 } // namespace task_management
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698