OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webui/task_manager_handler.h" | 5 #include "chrome/browser/ui/webui/task_manager_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } else { | 395 } else { |
396 DCHECK(false); | 396 DCHECK(false); |
397 } | 397 } |
398 | 398 |
399 task_manager_->OpenAboutMemory(); | 399 task_manager_->OpenAboutMemory(); |
400 } | 400 } |
401 | 401 |
402 // TaskManagerHandler, private: ----------------------------------------------- | 402 // TaskManagerHandler, private: ----------------------------------------------- |
403 | 403 |
404 bool TaskManagerHandler::is_alive() { | 404 bool TaskManagerHandler::is_alive() { |
405 return web_ui_->tab_contents()->render_view_host(); | 405 return web_ui_->tab_contents()->render_view_host() != 0; |
406 } | 406 } |
407 | 407 |
408 void TaskManagerHandler::UpdateResourceGroupTable(int start, int length) { | 408 void TaskManagerHandler::UpdateResourceGroupTable(int start, int length) { |
409 if (resource_to_group_table_.size() < static_cast<size_t>(start)) { | 409 if (resource_to_group_table_.size() < static_cast<size_t>(start)) { |
410 length += start - resource_to_group_table_.size(); | 410 length += start - resource_to_group_table_.size(); |
411 start = resource_to_group_table_.size(); | 411 start = resource_to_group_table_.size(); |
412 } | 412 } |
413 | 413 |
414 // Makes room to fill group_index at first since inserting vector is too slow. | 414 // Makes room to fill group_index at first since inserting vector is too slow. |
415 std::vector<int>::iterator it = resource_to_group_table_.begin() + start; | 415 std::vector<int>::iterator it = resource_to_group_table_.begin() + start; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 } | 450 } |
451 } | 451 } |
452 | 452 |
453 void TaskManagerHandler::OnGroupRemoved(const int group_start, | 453 void TaskManagerHandler::OnGroupRemoved(const int group_start, |
454 const int group_length) { | 454 const int group_length) { |
455 base::FundamentalValue start_value(group_start); | 455 base::FundamentalValue start_value(group_start); |
456 base::FundamentalValue length_value(group_length); | 456 base::FundamentalValue length_value(group_length); |
457 if (is_enabled_ && is_alive()) | 457 if (is_enabled_ && is_alive()) |
458 web_ui_->CallJavascriptFunction("taskRemoved", start_value, length_value); | 458 web_ui_->CallJavascriptFunction("taskRemoved", start_value, length_value); |
459 } | 459 } |
OLD | NEW |