summaryrefslogtreecommitdiffstats
path: root/ash/content_support
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-15 22:57:00 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-15 22:57:00 +0000
commitac12ae9f32314d329e21b63ebee475e3664996f4 (patch)
treebff25594faabca65c7327693f6f4ec7a85cd1105 /ash/content_support
parent9ac9a8e9135080026667004525370dd3ad69f9d3 (diff)
downloadchromium_src-ac12ae9f32314d329e21b63ebee475e3664996f4.zip
chromium_src-ac12ae9f32314d329e21b63ebee475e3664996f4.tar.gz
chromium_src-ac12ae9f32314d329e21b63ebee475e3664996f4.tar.bz2
Inject GPUDataManager support into ash to abstract a content dependency.
http://crbug.com/332504 R=oshima@chromium.org Review URL: https://codereview.chromium.org/138223004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245010 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/content_support')
-rw-r--r--ash/content_support/DEPS5
-rw-r--r--ash/content_support/ash_with_content_export.h32
-rw-r--r--ash/content_support/gpu_support_impl.cc32
-rw-r--r--ash/content_support/gpu_support_impl.h29
-rw-r--r--ash/content_support/inject.cc17
-rw-r--r--ash/content_support/inject.h16
6 files changed, 131 insertions, 0 deletions
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/content_support/ash_with_content_export.h b/ash/content_support/ash_with_content_export.h
new file mode 100644
index 0000000..155b0b3
--- /dev/null
+++ b/ash/content_support/ash_with_content_export.h
@@ -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.
+
+#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.
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(ASH_WITH_CONTENT_IMPLEMENTATION)
+#define ASH_WITH_CONTENT_EXPORT __declspec(dllexport)
+#else
+#define ASH_WITH_CONTENT_EXPORT __declspec(dllimport)
+#endif // defined(ASH_WITH_CONTENT_IMPLEMENTATION)
+
+#else // defined(WIN32)
+#if defined(ASH_WITH_CONTENT_IMPLEMENTATION)
+#define ASH_WITH_CONTENT_EXPORT __attribute__((visibility("default")))
+#else
+#define ASH_WITH_CONTENT_EXPORT
+#endif
+#endif
+
+#else // defined(COMPONENT_BUILD)
+#define ASH_WITH_CONTENT_EXPORT
+#endif
+
+#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..7f37865
--- /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<GPUSupportImpl> 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_