diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-28 15:34:39 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-28 15:34:39 +0000 |
commit | 589eea0775fd994434d31820cce357b66427fb97 (patch) | |
tree | 6f48842dd54b2b94e42333e94221b5815a2ba864 /ash | |
parent | 883d204bff94be8a40cd9b31bd41bc9436e54772 (diff) | |
download | chromium_src-589eea0775fd994434d31820cce357b66427fb97.zip chromium_src-589eea0775fd994434d31820cce357b66427fb97.tar.gz chromium_src-589eea0775fd994434d31820cce357b66427fb97.tar.bz2 |
Remove --ash-memory-monitor and related code
BUG=340466
Review URL: https://codereview.chromium.org/182063003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254128 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash.gyp | 8 | ||||
-rw-r--r-- | ash/ash_switches.cc | 5 | ||||
-rw-r--r-- | ash/ash_switches.h | 3 | ||||
-rw-r--r-- | ash/system/monitor/tray_monitor.cc | 103 | ||||
-rw-r--r-- | ash/system/monitor/tray_monitor.h | 43 | ||||
-rw-r--r-- | ash/system/tray/system_tray.cc | 7 |
6 files changed, 0 insertions, 169 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index fe1b0e0..86ca022 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -370,8 +370,6 @@ 'system/logout_button/logout_button_tray.h', 'system/logout_button/logout_confirmation_dialog_view.cc', 'system/logout_button/logout_confirmation_dialog_view.h', - 'system/monitor/tray_monitor.cc', - 'system/monitor/tray_monitor.h', 'system/session_length_limit/session_length_limit_observer.h', 'system/session_length_limit/tray_session_length_limit.cc', 'system/session_length_limit/tray_session_length_limit.h', @@ -650,12 +648,6 @@ # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. 'msvs_disabled_warnings': [ 4267, ], }], - ['OS!="linux"', { - 'sources/': [ - ['exclude', 'system/monitor/tray_monitor.cc'], - ['exclude', 'system/monitor/tray_monitor.h'], - ], - }], ['use_x11!=1', { 'sources/': [ ['exclude', 'accelerators/key_hold_detector.cc'], diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index ace0e5d..cdb49ee 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -105,11 +105,6 @@ const char kAshEnableImmersiveFullscreenForAllWindows[] = const char kAshEnableImmersiveFullscreenForBrowserOnly[] = "ash-enable-immersive-browser-only"; -#if defined(OS_LINUX) -// Enable memory monitoring. -const char kAshEnableMemoryMonitor[] = "ash-enable-memory-monitor"; -#endif - #if defined(OS_CHROMEOS) // Enables key bindings to scroll magnified screen. const char kAshEnableMagnifierKeyScroller[] = diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 58b862a..11b40c6 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -43,9 +43,6 @@ ASH_EXPORT extern const char kAshEnableAlternateFrameCaptionButtonStyle[]; ASH_EXPORT extern const char kAshEnableBrightnessControl[]; ASH_EXPORT extern const char kAshEnableImmersiveFullscreenForAllWindows[]; ASH_EXPORT extern const char kAshEnableImmersiveFullscreenForBrowserOnly[]; -#if defined(OS_LINUX) -ASH_EXPORT extern const char kAshEnableMemoryMonitor[]; -#endif #if defined(OS_CHROMEOS) ASH_EXPORT extern const char kAshEnableMagnifierKeyScroller[]; ASH_EXPORT extern const char kAshEnableMultiUserTray[]; diff --git a/ash/system/monitor/tray_monitor.cc b/ash/system/monitor/tray_monitor.cc deleted file mode 100644 index a2f40c9..0000000 --- a/ash/system/monitor/tray_monitor.cc +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/system/monitor/tray_monitor.h" - -#include "ash/gpu_support.h" -#include "ash/shell.h" -#include "ash/system/tray/tray_item_view.h" -#include "base/process/memory.h" -#include "base/process/process_metrics.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "ui/base/text/bytes_formatting.h" -#include "ui/views/border.h" -#include "ui/views/controls/label.h" - -namespace { -const int kRefreshTimeoutMs = 1000; -} - -namespace ash { -namespace internal { - -TrayMonitor::TrayMonitor(SystemTray* system_tray) - : SystemTrayItem(system_tray), - label_(NULL) { - refresh_timer_.Start(FROM_HERE, - base::TimeDelta::FromMilliseconds(kRefreshTimeoutMs), - this, &TrayMonitor::OnTimer); -} - -TrayMonitor::~TrayMonitor() { - label_ = NULL; -} - -views::View* TrayMonitor::CreateTrayView(user::LoginStatus status) { - TrayItemView* view = new TrayItemView(this); - view->CreateLabel(); - label_ = view->label(); - label_->SetAutoColorReadabilityEnabled(false); - label_->SetEnabledColor(SK_ColorWHITE); - label_->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); - label_->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), - SkColorSetARGB(64, 0, 0, 0)); - label_->SetShadowOffset(0, 1); - label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); - label_->SetFontList(label_->font_list().DeriveWithSizeDelta(-2)); - return view; -} - -void TrayMonitor::DestroyTrayView() { - label_ = NULL; -} - -void TrayMonitor::OnTimer() { - GPUSupport::GetGpuProcessHandlesCallback callback = - base::Bind(&TrayMonitor::OnGotHandles, base::Unretained(this)); - refresh_timer_.Stop(); - Shell::GetInstance()->gpu_support()->GetGpuProcessHandles(callback); -} - -void TrayMonitor::OnGotHandles(const std::list<base::ProcessHandle>& handles) { - base::SystemMemoryInfoKB mem_info; - base::GetSystemMemoryInfo(&mem_info); - std::string output; - base::string16 free_bytes = - ui::FormatBytes(static_cast<int64>(mem_info.free) * 1024); - output = base::StringPrintf("free: %s", - base::UTF16ToUTF8(free_bytes).c_str()); -#if defined(OS_CHROMEOS) - if (mem_info.gem_size != -1) { - base::string16 gem_size = ui::FormatBytes(mem_info.gem_size); - output += base::StringPrintf(" gmem: %s", - base::UTF16ToUTF8(gem_size).c_str()); - if (mem_info.gem_objects != -1) - output += base::StringPrintf(" gobjects: %d", mem_info.gem_objects); - } -#endif - size_t total_private_bytes = 0, total_shared_bytes = 0; - for (std::list<base::ProcessHandle>::const_iterator i = handles.begin(); - i != handles.end(); ++i) { - base::ProcessMetrics* pm = base::ProcessMetrics::CreateProcessMetrics(*i); - size_t private_bytes, shared_bytes; - pm->GetMemoryBytes(&private_bytes, &shared_bytes); - total_private_bytes += private_bytes; - total_shared_bytes += shared_bytes; - delete pm; - } - base::string16 private_size = ui::FormatBytes(total_private_bytes); - base::string16 shared_size = ui::FormatBytes(total_shared_bytes); - - output += base::StringPrintf("\nGPU private: %s shared: %s", - base::UTF16ToUTF8(private_size).c_str(), - base::UTF16ToUTF8(shared_size).c_str()); - label_->SetText(base::UTF8ToUTF16(output)); - refresh_timer_.Start(FROM_HERE, - base::TimeDelta::FromMilliseconds(kRefreshTimeoutMs), - this, &TrayMonitor::OnTimer); -} - -} // namespace internal -} // namespace ash diff --git a/ash/system/monitor/tray_monitor.h b/ash/system/monitor/tray_monitor.h deleted file mode 100644 index 31c4f14..0000000 --- a/ash/system/monitor/tray_monitor.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_SYSTEM_DATE_TRAY_MONITOR_H_ -#define ASH_SYSTEM_DATE_TRAY_MONITOR_H_ - -#include <list> - -#include "ash/system/tray/system_tray_item.h" -#include "base/process/process.h" -#include "base/timer/timer.h" - -namespace views { -class Label; -} - -namespace ash { -namespace internal { - -class TrayMonitor : public SystemTrayItem { - public: - explicit TrayMonitor(SystemTray* system_tray); - virtual ~TrayMonitor(); - - private: - // Overridden from SystemTrayItem. - virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE; - virtual void DestroyTrayView() OVERRIDE; - - void OnTimer(); - void OnGotHandles(const std::list<base::ProcessHandle>& handles); - - views::Label* label_; - base::RepeatingTimer<TrayMonitor> refresh_timer_; - - DISALLOW_COPY_AND_ASSIGN(TrayMonitor); -}; - -} // namespace internal -} // namespace ash - -#endif // ASH_SYSTEM_DATE_TRAY_MONITOR_H_ diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index 59f6970..ebb5e68 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -15,7 +15,6 @@ #include "ash/system/date/tray_date.h" #include "ash/system/drive/tray_drive.h" #include "ash/system/ime/tray_ime.h" -#include "ash/system/monitor/tray_monitor.h" #include "ash/system/session_length_limit/tray_session_length_limit.h" #include "ash/system/status_area_widget.h" #include "ash/system/tray/system_tray_delegate.h" @@ -216,12 +215,6 @@ void SystemTray::CreateItems(SystemTrayDelegate* delegate) { AddTrayItem(tray_date_); #endif -#if defined(OS_LINUX) - CommandLine* cmd = CommandLine::ForCurrentProcess(); - if (cmd->HasSwitch(ash::switches::kAshEnableMemoryMonitor)) - AddTrayItem(new internal::TrayMonitor(this)); -#endif - SetVisible(ash::Shell::GetInstance()->system_tray_delegate()-> GetTrayVisibilityOnStartup()); } |