summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorboliu <boliu@chromium.org>2015-07-13 13:47:46 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-13 20:48:18 +0000
commit8e814cb21af0383d41287e34aa3cac0b220a477d (patch)
treed9dda2d26950bbe30e222b079d1bf969d338e0b0
parent194f4c6bea6ae714cfa6a0eb32bf7e79a70e0192 (diff)
downloadchromium_src-8e814cb21af0383d41287e34aa3cac0b220a477d.zip
chromium_src-8e814cb21af0383d41287e34aa3cac0b220a477d.tar.gz
chromium_src-8e814cb21af0383d41287e34aa3cac0b220a477d.tar.bz2
Create MailboxManagerSync based on command line switch
Goal here is to have ipc-based command buffer create MailboxManagerSync based on the command line switch as well. Implement by adding a MailboxManager::Create method that does the right thing. BUG=509702 Review URL: https://codereview.chromium.org/1229153002 Cr-Commit-Position: refs/heads/master@{#338559}
-rw-r--r--content/common/gpu/gpu_channel.cc6
-rw-r--r--content/common/gpu/gpu_channel_manager.cc4
-rw-r--r--gpu/command_buffer/service/BUILD.gn1
-rw-r--r--gpu/command_buffer/service/in_process_command_buffer.cc12
-rw-r--r--gpu/command_buffer/service/mailbox_manager.cc25
-rw-r--r--gpu/command_buffer/service/mailbox_manager.h2
-rw-r--r--gpu/command_buffer_service.gypi1
7 files changed, 37 insertions, 14 deletions
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc
index 6078d74..3cd18db 100644
--- a/content/common/gpu/gpu_channel.cc
+++ b/content/common/gpu/gpu_channel.cc
@@ -32,7 +32,7 @@
#include "gpu/command_buffer/common/value_state.h"
#include "gpu/command_buffer/service/gpu_scheduler.h"
#include "gpu/command_buffer/service/image_factory.h"
-#include "gpu/command_buffer/service/mailbox_manager_impl.h"
+#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
#include "gpu/command_buffer/service/valuebuffer_manager.h"
#include "ipc/ipc_channel.h"
@@ -413,7 +413,9 @@ GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager,
messages_processed_(0),
client_id_(client_id),
share_group_(share_group ? share_group : new gfx::GLShareGroup),
- mailbox_manager_(mailbox ? mailbox : new gpu::gles2::MailboxManagerImpl),
+ mailbox_manager_(mailbox
+ ? scoped_refptr<gpu::gles2::MailboxManager>(mailbox)
+ : gpu::gles2::MailboxManager::Create()),
watchdog_(watchdog),
software_(software),
handle_messages_scheduled_(false),
diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc
index d0b35c3..f0e40e3 100644
--- a/content/common/gpu/gpu_channel_manager.cc
+++ b/content/common/gpu/gpu_channel_manager.cc
@@ -17,7 +17,7 @@
#include "gpu/command_buffer/common/value_state.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/gpu_switches.h"
-#include "gpu/command_buffer/service/mailbox_manager_impl.h"
+#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/memory_program_cache.h"
#include "gpu/command_buffer/service/shader_translator_cache.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
@@ -139,7 +139,7 @@ void GpuChannelManager::OnEstablishChannel(int client_id,
if (!share_group_.get()) {
share_group_ = new gfx::GLShareGroup;
DCHECK(!mailbox_manager_.get());
- mailbox_manager_ = new gpu::gles2::MailboxManagerImpl;
+ mailbox_manager_ = gpu::gles2::MailboxManager::Create();
}
share_group = share_group_.get();
mailbox_manager = mailbox_manager_.get();
diff --git a/gpu/command_buffer/service/BUILD.gn b/gpu/command_buffer/service/BUILD.gn
index 0bcafdc..14f2402 100644
--- a/gpu/command_buffer/service/BUILD.gn
+++ b/gpu/command_buffer/service/BUILD.gn
@@ -92,6 +92,7 @@ source_set("service_sources") {
"in_process_command_buffer.h",
"logger.cc",
"logger.h",
+ "mailbox_manager.cc",
"mailbox_manager.h",
"mailbox_manager_impl.cc",
"mailbox_manager_impl.h",
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc
index 12c01c7..f85388b 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/logging.h"
@@ -26,11 +25,9 @@
#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/gl_context_virtual.h"
#include "gpu/command_buffer/service/gpu_scheduler.h"
-#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/image_factory.h"
#include "gpu/command_buffer/service/image_manager.h"
-#include "gpu/command_buffer/service/mailbox_manager_impl.h"
-#include "gpu/command_buffer/service/mailbox_manager_sync.h"
+#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/command_buffer/service/query_manager.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
@@ -252,12 +249,7 @@ InProcessCommandBuffer::Service::share_group() {
scoped_refptr<gles2::MailboxManager>
InProcessCommandBuffer::Service::mailbox_manager() {
if (!mailbox_manager_.get()) {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableThreadedTextureMailboxes)) {
- mailbox_manager_ = new gles2::MailboxManagerSync();
- } else {
- mailbox_manager_ = new gles2::MailboxManagerImpl();
- }
+ mailbox_manager_ = gles2::MailboxManager::Create();
}
return mailbox_manager_;
}
diff --git a/gpu/command_buffer/service/mailbox_manager.cc b/gpu/command_buffer/service/mailbox_manager.cc
new file mode 100644
index 0000000..e8432ed
--- /dev/null
+++ b/gpu/command_buffer/service/mailbox_manager.cc
@@ -0,0 +1,25 @@
+// Copyright 2015 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/command_buffer/service/mailbox_manager.h"
+
+#include "base/command_line.h"
+#include "gpu/command_buffer/service/gpu_switches.h"
+#include "gpu/command_buffer/service/mailbox_manager_impl.h"
+#include "gpu/command_buffer/service/mailbox_manager_sync.h"
+
+namespace gpu {
+namespace gles2 {
+
+// static
+scoped_refptr<MailboxManager> MailboxManager::Create() {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableThreadedTextureMailboxes)) {
+ return scoped_refptr<MailboxManager>(new MailboxManagerSync);
+ }
+ return scoped_refptr<MailboxManager>(new MailboxManagerImpl);
+}
+
+} // namespage gles2
+} // namespace gpu
diff --git a/gpu/command_buffer/service/mailbox_manager.h b/gpu/command_buffer/service/mailbox_manager.h
index 8b53ce4..2bfdb89 100644
--- a/gpu/command_buffer/service/mailbox_manager.h
+++ b/gpu/command_buffer/service/mailbox_manager.h
@@ -17,6 +17,8 @@ class Texture;
// Manages resources scoped beyond the context or context group level.
class GPU_EXPORT MailboxManager : public base::RefCounted<MailboxManager> {
public:
+ static scoped_refptr<MailboxManager> Create();
+
// Look up the texture definition from the named mailbox.
virtual Texture* ConsumeTexture(const Mailbox& mailbox) = 0;
diff --git a/gpu/command_buffer_service.gypi b/gpu/command_buffer_service.gypi
index af077f1..abdedc4 100644
--- a/gpu/command_buffer_service.gypi
+++ b/gpu/command_buffer_service.gypi
@@ -96,6 +96,7 @@
'command_buffer/service/in_process_command_buffer.h',
'command_buffer/service/logger.cc',
'command_buffer/service/logger.h',
+ 'command_buffer/service/mailbox_manager.cc',
'command_buffer/service/mailbox_manager.h',
'command_buffer/service/mailbox_manager_impl.cc',
'command_buffer/service/mailbox_manager_impl.h',