diff options
-rw-r--r-- | ash/DEPS | 3 | ||||
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 4 | ||||
-rw-r--r-- | ash/ash.gyp | 7 | ||||
-rw-r--r-- | ash/content_support/DEPS | 5 | ||||
-rw-r--r-- | ash/content_support/ash_with_content_export.h (renamed from ash/ash_with_content_export.h) | 6 | ||||
-rw-r--r-- | ash/content_support/gpu_support_impl.cc | 32 | ||||
-rw-r--r-- | ash/content_support/gpu_support_impl.h | 29 | ||||
-rw-r--r-- | ash/content_support/inject.cc | 17 | ||||
-rw-r--r-- | ash/content_support/inject.h | 16 | ||||
-rw-r--r-- | ash/gpu_support.h | 34 | ||||
-rw-r--r-- | ash/keyboard_overlay/keyboard_overlay_delegate.h | 2 | ||||
-rw-r--r-- | ash/keyboard_overlay/keyboard_overlay_view.h | 2 | ||||
-rw-r--r-- | ash/screensaver/screensaver_view.h | 2 | ||||
-rw-r--r-- | ash/shell.cc | 33 | ||||
-rw-r--r-- | ash/shell.h | 7 | ||||
-rw-r--r-- | ash/shell/content_client/shell_browser_main_parts.cc | 2 | ||||
-rw-r--r-- | ash/system/monitor/tray_monitor.cc | 7 | ||||
-rw-r--r-- | chrome/browser/ui/ash/ash_init.cc | 2 |
18 files changed, 187 insertions, 23 deletions
@@ -13,7 +13,4 @@ include_rules = [ "+net", "+ui", "+win8", - - # Used by shell.cc, accelerator_controller.cc, tray_monitor.h - "+content/public/browser/gpu_data_manager.h", ] diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index c4e6691..b7a51cf 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -18,6 +18,7 @@ #include "ash/display/display_controller.h" #include "ash/display/display_manager.h" #include "ash/focus_cycler.h" +#include "ash/gpu_support.h" #include "ash/ime_control_delegate.h" #include "ash/magnifier/magnification_controller.h" #include "ash/magnifier/partial_magnification_controller.h" @@ -55,7 +56,6 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/metrics/user_metrics.h" -#include "content/public/browser/gpu_data_manager.h" #include "ui/aura/env.h" #include "ui/aura/root_window.h" #include "ui/base/accelerators/accelerator.h" @@ -968,7 +968,7 @@ bool AcceleratorController::PerformAction(int action, case TOUCH_HUD_PROJECTION_TOGGLE: return HandleTouchHudProjectToggle(); case DISABLE_GPU_WATCHDOG: - content::GpuDataManager::GetInstance()->DisableGpuWatchdog(); + Shell::GetInstance()->gpu_support()->DisableGpuWatchdog(); return true; #endif // OS_CHROMEOS case OPEN_FEEDBACK_PAGE: diff --git a/ash/ash.gyp b/ash/ash.gyp index ecf4275..fb332ba 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -148,6 +148,7 @@ 'first_run/first_run_helper_impl.h', 'focus_cycler.cc', 'focus_cycler.h', + 'gpu_support.h', 'high_contrast/high_contrast_controller.cc', 'high_contrast/high_contrast_controller.h', 'host/root_window_host_factory.cc', @@ -679,7 +680,11 @@ 'ASH_WITH_CONTENT_IMPLEMENTATION', ], 'sources': [ - 'ash_with_content_export.h', + 'content_support/ash_with_content_export.h', + 'content_support/inject.cc', + 'content_support/inject.h', + 'content_support/gpu_support_impl.cc', + 'content_support/gpu_support_impl.h', 'screensaver/screensaver_view.cc', 'screensaver/screensaver_view.h', 'keyboard_overlay/keyboard_overlay_delegate.cc', diff --git a/ash/content_support/DEPS b/ash/content_support/DEPS new file mode 100644 index 0000000..5ed73eb --- /dev/null +++ b/ash/content_support/DEPS @@ -0,0 +1,5 @@ +include_rules = [ + # TODO(beng): It may make sense to have a broad permit of content/public + # in this file, but I'm starting out conservative. + "+content/public/browser/gpu_data_manager.h", +] diff --git a/ash/ash_with_content_export.h b/ash/content_support/ash_with_content_export.h index b282e4e..155b0b3 100644 --- a/ash/ash_with_content_export.h +++ b/ash/content_support/ash_with_content_export.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_ASH_WITH_CONTENT_EXPORT_H_ -#define ASH_ASH_WITH_CONTENT_EXPORT_H_ +#ifndef ASH_CONTENT_SUPPORT_ASH_WITH_CONTENT_EXPORT_H_ +#define ASH_CONTENT_SUPPORT_ASH_WITH_CONTENT_EXPORT_H_ // Defines ASH_EXPORT so that functionality implemented by the Ash module can // be exported to consumers. @@ -29,4 +29,4 @@ #define ASH_WITH_CONTENT_EXPORT #endif -#endif // ASH_ASH_WITH_CONTENT_EXPORT_H_ +#endif // ASH_CONTENT_SUPPORT_ASH_WITH_CONTENT_EXPORT_H_ diff --git a/ash/content_support/gpu_support_impl.cc b/ash/content_support/gpu_support_impl.cc new file mode 100644 index 0000000..d425d89 --- /dev/null +++ b/ash/content_support/gpu_support_impl.cc @@ -0,0 +1,32 @@ +// Copyright 2014 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/content_support/gpu_support_impl.h" + +#include "content/public/browser/gpu_data_manager.h" +#include "gpu/config/gpu_feature_type.h" + +namespace ash { + +GPUSupportImpl::GPUSupportImpl() { +} + +GPUSupportImpl::~GPUSupportImpl() { +} + +bool GPUSupportImpl::IsPanelFittingDisabled() const { + return content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( + gpu::GPU_FEATURE_TYPE_PANEL_FITTING); +} + +void GPUSupportImpl::DisableGpuWatchdog() { + content::GpuDataManager::GetInstance()->DisableGpuWatchdog(); +} + +void GPUSupportImpl::GetGpuProcessHandles( + const GetGpuProcessHandlesCallback& callback) const { + content::GpuDataManager::GetInstance()->GetGpuProcessHandles(callback); +} + +} // namespace ash diff --git a/ash/content_support/gpu_support_impl.h b/ash/content_support/gpu_support_impl.h new file mode 100644 index 0000000..ee82d06 --- /dev/null +++ b/ash/content_support/gpu_support_impl.h @@ -0,0 +1,29 @@ +// Copyright 2014 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_CONTENT_SUPPORT_GPU_SUPPORT_IMPL_H_ +#define ASH_CONTENT_SUPPORT_GPU_SUPPORT_IMPL_H_ + +#include "ash/gpu_support.h" + +namespace ash { + +class GPUSupportImpl : public GPUSupport { + public: + GPUSupportImpl(); + virtual ~GPUSupportImpl(); + + private: + // Overridden from GPUSupport: + virtual bool IsPanelFittingDisabled() const OVERRIDE; + virtual void DisableGpuWatchdog() OVERRIDE; + virtual void GetGpuProcessHandles( + const GetGpuProcessHandlesCallback& callback) const OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(GPUSupportImpl); +}; + +} // namespace ash + +#endif // ASH_CONTENT_SUPPORT_GPU_SUPPORT_IMPL_H_ diff --git a/ash/content_support/inject.cc b/ash/content_support/inject.cc new file mode 100644 index 0000000..ba9f95a --- /dev/null +++ b/ash/content_support/inject.cc @@ -0,0 +1,17 @@ +// Copyright 2014 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/content_support/inject.h" + +#include "ash/content_support/gpu_support_impl.h" +#include "ash/shell.h" + +namespace ash { + +void InitContentSupport() { + scoped_ptr<GPUSupport> gpu_support(new GPUSupportImpl); + Shell::GetInstance()->SetGPUSupport(gpu_support.Pass()); +} + +} // namespace ash diff --git a/ash/content_support/inject.h b/ash/content_support/inject.h new file mode 100644 index 0000000..b821029 --- /dev/null +++ b/ash/content_support/inject.h @@ -0,0 +1,16 @@ +// Copyright 2014 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_CONTENT_SUPPORT_INJECT_H_ +#define ASH_CONTENT_SUPPORT_INJECT_H_ + +#include "ash/content_support/ash_with_content_export.h" + +namespace ash { + +ASH_WITH_CONTENT_EXPORT void InitContentSupport(); + +} // namespace ash + +#endif // ASH_CONTENT_SUPPORT_INJECT_H_ diff --git a/ash/gpu_support.h b/ash/gpu_support.h new file mode 100644 index 0000000..089f121 --- /dev/null +++ b/ash/gpu_support.h @@ -0,0 +1,34 @@ +// Copyright 2014 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_GPU_SUPPORT_H_ +#define ASH_GPU_SUPPORT_H_ + +#include <list> + +#include "base/callback_forward.h" +#include "base/process/process.h" + +namespace ash { + +// An interface to allow use of content::GpuDataManager to be injected in +// configurations that permit a dependency on content. +class GPUSupport { + public: + typedef base::Callback<void(const std::list<base::ProcessHandle>&)> + GetGpuProcessHandlesCallback; + + virtual ~GPUSupport() {} + + virtual bool IsPanelFittingDisabled() const = 0; + + virtual void DisableGpuWatchdog() = 0; + + virtual void GetGpuProcessHandles( + const GetGpuProcessHandlesCallback& callback) const = 0; +}; + +} // namespace ash + +#endif // ASH_GPU_SUPPORT_H_ diff --git a/ash/keyboard_overlay/keyboard_overlay_delegate.h b/ash/keyboard_overlay/keyboard_overlay_delegate.h index 3d7c22f..91d7ddd 100644 --- a/ash/keyboard_overlay/keyboard_overlay_delegate.h +++ b/ash/keyboard_overlay/keyboard_overlay_delegate.h @@ -5,7 +5,7 @@ #ifndef ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_ #define ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_ -#include "ash/ash_with_content_export.h" +#include "ash/content_support/ash_with_content_export.h" #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" diff --git a/ash/keyboard_overlay/keyboard_overlay_view.h b/ash/keyboard_overlay/keyboard_overlay_view.h index c3235ca..0fc339a 100644 --- a/ash/keyboard_overlay/keyboard_overlay_view.h +++ b/ash/keyboard_overlay/keyboard_overlay_view.h @@ -7,7 +7,7 @@ #include <vector> -#include "ash/ash_with_content_export.h" +#include "ash/content_support/ash_with_content_export.h" #include "ash/wm/overlay_event_filter.h" #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" diff --git a/ash/screensaver/screensaver_view.h b/ash/screensaver/screensaver_view.h index bf140fa..cb565b8 100644 --- a/ash/screensaver/screensaver_view.h +++ b/ash/screensaver/screensaver_view.h @@ -5,7 +5,7 @@ #ifndef ASH_SCREENSAVER_SCREENSAVER_VIEW_H_ #define ASH_SCREENSAVER_SCREENSAVER_VIEW_H_ -#include "ash/ash_with_content_export.h" +#include "ash/content_support/ash_with_content_export.h" #include "base/callback.h" #include "content/public/browser/web_contents_observer.h" #include "ui/views/widget/widget_delegate.h" diff --git a/ash/shell.cc b/ash/shell.cc index be56615..6845d4a 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -27,6 +27,7 @@ #include "ash/drag_drop/drag_drop_controller.h" #include "ash/first_run/first_run_helper_impl.h" #include "ash/focus_cycler.h" +#include "ash/gpu_support.h" #include "ash/high_contrast/high_contrast_controller.h" #include "ash/host/root_window_host_factory.h" #include "ash/keyboard_uma_event_filter.h" @@ -125,8 +126,6 @@ #include "base/message_loop/message_pump_x11.h" #include "base/sys_info.h" #include "chromeos/display/output_configurator.h" -#include "content/public/browser/gpu_data_manager.h" -#include "gpu/config/gpu_feature_type.h" #endif // defined(USE_X11) #include "ash/sticky_keys/sticky_keys_controller.h" #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" @@ -161,6 +160,23 @@ class AshVisibilityController : public views::corewm::VisibilityController { DISALLOW_COPY_AND_ASSIGN(AshVisibilityController); }; +class DefaultGPUSupportImpl : public GPUSupport { + public: + DefaultGPUSupportImpl() {} + virtual ~DefaultGPUSupportImpl() {} + + private: + // Overridden from GPUSupport: + virtual bool IsPanelFittingDisabled() const OVERRIDE { + return false; + } + virtual void DisableGpuWatchdog() OVERRIDE {} + virtual void GetGpuProcessHandles( + const GetGpuProcessHandlesCallback& callback) const OVERRIDE {} + + DISALLOW_COPY_AND_ASSIGN(DefaultGPUSupportImpl); +}; + } // namespace // static @@ -545,6 +561,10 @@ void Shell::DoInitialWorkspaceAnimation() { DoInitialAnimation(); } +void Shell::SetGPUSupport(scoped_ptr<GPUSupport> gpu_support) { + gpu_support_ = gpu_support.Pass(); +} + //////////////////////////////////////////////////////////////////////////////// // Shell, private: @@ -562,7 +582,8 @@ Shell::Shell(ShellDelegate* delegate) cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( native_cursor_manager_)), simulate_modal_window_open_for_testing_(false), - is_touch_hud_projection_enabled_(false) { + is_touch_hud_projection_enabled_(false), + gpu_support_(new DefaultGPUSupportImpl) { DCHECK(delegate_.get()); display_manager_.reset(new internal::DisplayManager); @@ -572,11 +593,7 @@ Shell::Shell(ShellDelegate* delegate) gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); display_controller_.reset(new DisplayController); #if defined(OS_CHROMEOS) && defined(USE_X11) - bool is_panel_fitting_disabled = - content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( - gpu::GPU_FEATURE_TYPE_PANEL_FITTING); - - output_configurator_->Init(!is_panel_fitting_disabled); + output_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); user_metrics_recorder_.reset(new UserMetricsRecorder); base::MessagePumpX11::Current()->AddDispatcherForRootWindow( diff --git a/ash/shell.h b/ash/shell.h index a452cd5..ff58e66 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -83,6 +83,7 @@ class CapsLockDelegate; class DesktopBackgroundController; class DisplayController; class FirstRunHelper; +class GPUSupport; class HighContrastController; class LockStateController; class MagnificationController; @@ -535,6 +536,9 @@ class ASH_EXPORT Shell } #endif // defined(OS_CHROMEOS) + GPUSupport* gpu_support() { return gpu_support_.get(); } + void SetGPUSupport(scoped_ptr<GPUSupport> gpu_support); + private: FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, TestCursor); FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors); @@ -707,6 +711,9 @@ class ASH_EXPORT Shell bool is_touch_hud_projection_enabled_; + // Injected content::GPUDataManager support. + scoped_ptr<GPUSupport> gpu_support_; + DISALLOW_COPY_AND_ASSIGN(Shell); }; diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc index 2e4a4c4..9d088b5 100644 --- a/ash/shell/content_client/shell_browser_main_parts.cc +++ b/ash/shell/content_client/shell_browser_main_parts.cc @@ -5,6 +5,7 @@ #include "ash/shell/content_client/shell_browser_main_parts.h" #include "ash/ash_switches.h" +#include "ash/content_support/inject.h" #include "ash/desktop_background/desktop_background_controller.h" #include "ash/shell.h" #include "ash/shell/shell_delegate_impl.h" @@ -123,6 +124,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { #endif ash::Shell::CreateInstance(delegate_); + ash::InitContentSupport(); delegate_->set_browser_context(browser_context_.get()); ash::Shell::GetInstance()->CreateShelf(); ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( diff --git a/ash/system/monitor/tray_monitor.cc b/ash/system/monitor/tray_monitor.cc index 6719a5d0..e6fe59b 100644 --- a/ash/system/monitor/tray_monitor.cc +++ b/ash/system/monitor/tray_monitor.cc @@ -4,12 +4,13 @@ #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 "content/public/browser/gpu_data_manager.h" #include "ui/base/text/bytes_formatting.h" #include "ui/views/border.h" #include "ui/views/controls/label.h" @@ -53,10 +54,10 @@ void TrayMonitor::DestroyTrayView() { } void TrayMonitor::OnTimer() { - content::GpuDataManager::GetGpuProcessHandlesCallback callback = + GPUSupport::GetGpuProcessHandlesCallback callback = base::Bind(&TrayMonitor::OnGotHandles, base::Unretained(this)); refresh_timer_.Stop(); - content::GpuDataManager::GetInstance()->GetGpuProcessHandles(callback); + Shell::GetInstance()->gpu_support()->GetGpuProcessHandles(callback); } void TrayMonitor::OnGotHandles(const std::list<base::ProcessHandle>& handles) { diff --git a/chrome/browser/ui/ash/ash_init.cc b/chrome/browser/ui/ash/ash_init.cc index f6a482f..7d980af 100644 --- a/chrome/browser/ui/ash/ash_init.cc +++ b/chrome/browser/ui/ash/ash_init.cc @@ -6,6 +6,7 @@ #include "ash/accelerators/accelerator_controller.h" #include "ash/ash_switches.h" +#include "ash/content_support/inject.h" #include "ash/high_contrast/high_contrast_controller.h" #include "ash/magnifier/magnification_controller.h" #include "ash/magnifier/partial_magnification_controller.h" @@ -58,6 +59,7 @@ void OpenAsh() { // Shell takes ownership of ChromeShellDelegate. ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); + ash::InitContentSupport(); shell->event_rewriter_filter()->SetEventRewriterDelegate( scoped_ptr<ash::EventRewriterDelegate>(new EventRewriter).Pass()); shell->accelerator_controller()->SetScreenshotDelegate( |