summaryrefslogtreecommitdiffstats
path: root/android_webview/common
diff options
context:
space:
mode:
authorkaanb@chromium.org <kaanb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-08 20:38:15 +0000
committerkaanb@chromium.org <kaanb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-08 20:38:15 +0000
commit73ae0f3ea90c5913d66f88b69b4c0c62bec48781 (patch)
tree0037c030e2b2761cd1dc907692a6a9f6d366ffd2 /android_webview/common
parent95051d774a3f4e8266bb75310db5d9e053134a0a (diff)
downloadchromium_src-73ae0f3ea90c5913d66f88b69b4c0c62bec48781.zip
chromium_src-73ae0f3ea90c5913d66f88b69b4c0c62bec48781.tar.gz
chromium_src-73ae0f3ea90c5913d66f88b69b4c0c62bec48781.tar.bz2
android_webview: changes to support Android GraphicBuffers
BUG=175012 Review URL: https://chromiumcodereview.appspot.com/13135004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/common')
-rw-r--r--android_webview/common/DEPS2
-rw-r--r--android_webview/common/aw_switches.cc4
-rw-r--r--android_webview/common/aw_switches.h5
-rw-r--r--android_webview/common/gpu_memory_buffer_factory_proxy.cc27
-rw-r--r--android_webview/common/gpu_memory_buffer_factory_proxy.h19
5 files changed, 55 insertions, 2 deletions
diff --git a/android_webview/common/DEPS b/android_webview/common/DEPS
index d0f9352..cbef04a 100644
--- a/android_webview/common/DEPS
+++ b/android_webview/common/DEPS
@@ -1,4 +1,6 @@
include_rules = [
"-android_webview",
"+android_webview/common",
+
+ "+ui/gl/gpu_memory_buffer.h",
]
diff --git a/android_webview/common/aw_switches.cc b/android_webview/common/aw_switches.cc
index c3fbf1b..2b8a332 100644
--- a/android_webview/common/aw_switches.cc
+++ b/android_webview/common/aw_switches.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 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.
@@ -9,4 +9,6 @@ namespace switches {
const char kMergeUIAndRendererCompositorThreads[] =
"merge-ui-and-compositor-threads";
+const char kUseZeroCopyBuffers[] = "use-zero-copy-buffers";
+
} // namespace switches
diff --git a/android_webview/common/aw_switches.h b/android_webview/common/aw_switches.h
index c812122..a8df1ec 100644
--- a/android_webview/common/aw_switches.h
+++ b/android_webview/common/aw_switches.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 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.
@@ -10,6 +10,9 @@ namespace switches {
// Merge the Browser UI and the renderer compositor threads.
extern const char kMergeUIAndRendererCompositorThreads[];
+// Uses zero-copy buffers in graphics pipeline.
+extern const char kUseZeroCopyBuffers[];
+
} // namespace switches
#endif // ANDROID_WEBVIEW_COMMON_AW_SWITCHES_H_
diff --git a/android_webview/common/gpu_memory_buffer_factory_proxy.cc b/android_webview/common/gpu_memory_buffer_factory_proxy.cc
new file mode 100644
index 0000000..e10c042
--- /dev/null
+++ b/android_webview/common/gpu_memory_buffer_factory_proxy.cc
@@ -0,0 +1,27 @@
+// Copyright 2013 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 "android_webview/common/gpu_memory_buffer_factory_proxy.h"
+
+#include "android_webview/common/aw_switches.h"
+#include "base/command_line.h"
+#include "base/logging.h"
+
+namespace android_webview {
+
+gfx::GpuMemoryBuffer::Create* g_pixel_buffer_factory_ = NULL;
+
+const gfx::GpuMemoryBuffer::Create& GetGpuMemoryBufferFactoryProxy() {
+ return *g_pixel_buffer_factory_;
+}
+
+void SetGpuMemoryBufferFactoryProxy(
+ const gfx::GpuMemoryBuffer::Create& factory) {
+ DCHECK(g_pixel_buffer_factory_ == NULL);
+ g_pixel_buffer_factory_ =
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseZeroCopyBuffers)
+ ? new gfx::GpuMemoryBuffer::Create(factory) : NULL;
+}
+
+} // namespace android_webview
diff --git a/android_webview/common/gpu_memory_buffer_factory_proxy.h b/android_webview/common/gpu_memory_buffer_factory_proxy.h
new file mode 100644
index 0000000..8e24f18
--- /dev/null
+++ b/android_webview/common/gpu_memory_buffer_factory_proxy.h
@@ -0,0 +1,19 @@
+// Copyright 2013 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 ANDROID_WEBVIEW_COMMON_GPU_MEMORY_BUFFER_FACTORY_PROXY_H_
+#define ANDROID_WEBVIEW_COMMON_GPU_MEMORY_BUFFER_FACTORY_PROXY_H_
+
+#include "base/basictypes.h"
+#include "ui/gl/gpu_memory_buffer.h"
+
+namespace android_webview {
+
+const gfx::GpuMemoryBuffer::Create& GetGpuMemoryBufferFactoryProxy();
+void SetGpuMemoryBufferFactoryProxy(
+ const gfx::GpuMemoryBuffer::Create& factory);
+
+} // namespace android_webview
+
+#endif // ANDROID_WEBVIEW_COMMON_GPU_MEMORY_BUFFER_FACTORY_PROXY_H_