summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorfsamuel <fsamuel@chromium.org>2016-03-22 20:41:04 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-23 03:42:18 +0000
commitefd3ce2aac23c08d4b3296a217359af73edc8629 (patch)
tree60b993571d7c7ba280fb1096b73835efa342bf37 /gpu
parent4567f4d81d97428183c2b78d2bfde53b18883c13 (diff)
downloadchromium_src-efd3ce2aac23c08d4b3296a217359af73edc8629.zip
chromium_src-efd3ce2aac23c08d4b3296a217359af73edc8629.tar.gz
chromium_src-efd3ce2aac23c08d4b3296a217359af73edc8629.tar.bz2
Move more files to gpu/ipc/common
This CL moves: content/common/gpu/gpu_memory_uma_stats.h content/common/gpu/gpu_surface_lookup.cc content/common/gpu/gpu_surface_lookup.h to gpu/ipc/common. BUG=596290 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel Review URL: https://codereview.chromium.org/1823763003 Cr-Commit-Position: refs/heads/master@{#382785}
Diffstat (limited to 'gpu')
-rw-r--r--gpu/gpu_ipc_common.gypi3
-rw-r--r--gpu/ipc/common/BUILD.gn3
-rw-r--r--gpu/ipc/common/gpu_memory_uma_stats.h35
-rw-r--r--gpu/ipc/common/gpu_surface_lookup.cc34
-rw-r--r--gpu/ipc/common/gpu_surface_lookup.h40
5 files changed, 115 insertions, 0 deletions
diff --git a/gpu/gpu_ipc_common.gypi b/gpu/gpu_ipc_common.gypi
index 8ca557c..6f2bfaa9 100644
--- a/gpu/gpu_ipc_common.gypi
+++ b/gpu/gpu_ipc_common.gypi
@@ -20,6 +20,7 @@
'..',
],
'sources': [
+ "ipc/common/gpu_memory_uma_stats.h",
"ipc/common/gpu_message_generator.cc",
"ipc/common/gpu_message_generator.h",
"ipc/common/gpu_messages.h",
@@ -27,6 +28,8 @@
'ipc/common/gpu_param_traits.h',
'ipc/common/gpu_param_traits_macros.h',
"ipc/common/gpu_stream_constants.h",
+ "ipc/common/gpu_surface_lookup.cc",
+ "ipc/common/gpu_surface_lookup.h",
],
'conditions': [
# This section applies to gpu_ipc_win64, used by the NaCl Win64 helper
diff --git a/gpu/ipc/common/BUILD.gn b/gpu/ipc/common/BUILD.gn
index e5f9aba..5bbbf43 100644
--- a/gpu/ipc/common/BUILD.gn
+++ b/gpu/ipc/common/BUILD.gn
@@ -52,6 +52,7 @@ source_set("ipc_common_sources") {
visibility = [ "//gpu/*" ]
sources = [
+ "gpu_memory_uma_stats.h",
"gpu_message_generator.cc",
"gpu_message_generator.h",
"gpu_messages.h",
@@ -59,6 +60,8 @@ source_set("ipc_common_sources") {
"gpu_param_traits.h",
"gpu_param_traits_macros.h",
"gpu_stream_constants.h",
+ "gpu_surface_lookup.cc",
+ "gpu_surface_lookup.h",
"memory_stats.cc",
"memory_stats.h",
]
diff --git a/gpu/ipc/common/gpu_memory_uma_stats.h b/gpu/ipc/common/gpu_memory_uma_stats.h
new file mode 100644
index 0000000..5b4075c
--- /dev/null
+++ b/gpu/ipc/common/gpu_memory_uma_stats.h
@@ -0,0 +1,35 @@
+// 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 GPU_IPC_COMMON_GPU_MEMORY_UMA_STATS_H_
+#define GPU_IPC_COMMON_GPU_MEMORY_UMA_STATS_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace gpu {
+
+// Memory usage statistics send periodically to the browser process to report
+// in UMA histograms if the GPU process crashes.
+// Note: we use uint64_t instead of size_t for byte count because this struct
+// is sent over IPC which could span 32 & 64 bit processes.
+struct GPUMemoryUmaStats {
+ GPUMemoryUmaStats()
+ : bytes_allocated_current(0),
+ bytes_allocated_max(0),
+ context_group_count(0) {}
+
+ // The number of bytes currently allocated.
+ uint64_t bytes_allocated_current;
+
+ // The maximum number of bytes ever allocated at once.
+ uint64_t bytes_allocated_max;
+
+ // The number of context groups.
+ uint32_t context_group_count;
+};
+
+} // namespace gpu
+
+#endif // GPU_IPC_COMMON_GPU_MEMORY_UMA_STATS_H_
diff --git a/gpu/ipc/common/gpu_surface_lookup.cc b/gpu/ipc/common/gpu_surface_lookup.cc
new file mode 100644
index 0000000..7cfd013
--- /dev/null
+++ b/gpu/ipc/common/gpu_surface_lookup.cc
@@ -0,0 +1,34 @@
+// 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 "gpu/ipc/common/gpu_surface_lookup.h"
+
+#include "base/logging.h"
+
+namespace gpu {
+
+namespace {
+GpuSurfaceLookup* g_instance = NULL;
+} // anonymous namespace
+
+// static
+GpuSurfaceLookup* GpuSurfaceLookup::GetInstance() {
+ DCHECK(g_instance);
+ return g_instance;
+}
+
+// static
+void GpuSurfaceLookup::InitInstance(GpuSurfaceLookup* lookup) {
+ DCHECK(!g_instance || !lookup);
+ g_instance = lookup;
+}
+
+#if defined(OS_ANDROID)
+gfx::ScopedJavaSurface GpuSurfaceLookup::AcquireJavaSurface(int surface_id) {
+ NOTIMPLEMENTED();
+ return gfx::ScopedJavaSurface();
+}
+#endif
+
+} // namespace gpu
diff --git a/gpu/ipc/common/gpu_surface_lookup.h b/gpu/ipc/common/gpu_surface_lookup.h
new file mode 100644
index 0000000..a1921a9
--- /dev/null
+++ b/gpu/ipc/common/gpu_surface_lookup.h
@@ -0,0 +1,40 @@
+// 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 GPU_IPC_COMMON_GPU_SURFACE_LOOKUP_H_
+#define GPU_IPC_COMMON_GPU_SURFACE_LOOKUP_H_
+
+#include "base/macros.h"
+#include "gpu/gpu_export.h"
+#include "ui/gfx/native_widget_types.h"
+
+#if defined(OS_ANDROID)
+#include "ui/gl/android/scoped_java_surface.h"
+#endif
+
+namespace gpu {
+
+// This class provides an interface to look up window surface handles
+// that cannot be sent through the IPC channel.
+class GPU_EXPORT GpuSurfaceLookup {
+ public:
+ GpuSurfaceLookup() {}
+ virtual ~GpuSurfaceLookup() {}
+
+ static GpuSurfaceLookup* GetInstance();
+ static void InitInstance(GpuSurfaceLookup* lookup);
+
+ virtual gfx::AcceleratedWidget AcquireNativeWidget(int surface_id) = 0;
+
+#if defined(OS_ANDROID)
+ virtual gfx::ScopedJavaSurface AcquireJavaSurface(int surface_id);
+#endif
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GpuSurfaceLookup);
+};
+
+} // namespace gpu
+
+#endif // GPU_IPC_COMMON_GPU_SURFACE_LOOKUP_H_