summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-08 00:10:26 +0000
committerapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-08 00:10:26 +0000
commit5a6b89ec97685b1e7f4795b2ddc1e0cd2b7fd7bf (patch)
tree938549d1f6bbc4922cfb31fcfece0dbb682946db /gpu
parent6a12f0febe4d54155f55fad0c8c15978fcb3e909 (diff)
downloadchromium_src-5a6b89ec97685b1e7f4795b2ddc1e0cd2b7fd7bf.zip
chromium_src-5a6b89ec97685b1e7f4795b2ddc1e0cd2b7fd7bf.tar.gz
chromium_src-5a6b89ec97685b1e7f4795b2ddc1e0cd2b7fd7bf.tar.bz2
Removed command buffer's last dependency on NPAPI.
Fixed some failing tests resulting from size of command field. TEST=none BUG=none Review URL: http://codereview.chromium.org/465099 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34021 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper.cc4
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper_test.cc7
-rw-r--r--gpu/command_buffer/client/fenced_allocator_test.cc7
-rw-r--r--gpu/command_buffer/client/gles2_demo.cc9
-rw-r--r--gpu/command_buffer/service/cmd_parser_test.cc12
-rw-r--r--gpu/command_buffer/service/command_buffer_service_unittest.cc7
-rw-r--r--gpu/command_buffer/service/gpu_processor.cc12
-rw-r--r--gpu/command_buffer/service/gpu_processor.h5
-rw-r--r--gpu/command_buffer/service/gpu_processor_mock.h2
-rw-r--r--gpu/command_buffer/service/gpu_processor_unittest.cc8
-rw-r--r--gpu/command_buffer/service/gpu_processor_win.cc8
11 files changed, 20 insertions, 61 deletions
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.cc b/gpu/command_buffer/client/cmd_buffer_helper.cc
index e8f6fef..67227fb 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper.cc
@@ -34,14 +34,10 @@
#include "gpu/command_buffer/client/cmd_buffer_helper.h"
#include "gpu/command_buffer/common/command_buffer.h"
-#include "gpu/np_utils/np_utils.h"
namespace command_buffer {
using command_buffer::CommandBuffer;
-using np_utils::NPBrowser;
-using np_utils::NPInvoke;
-using np_utils::NPObjectPointer;
CommandBufferHelper::CommandBufferHelper(CommandBuffer* command_buffer)
: command_buffer_(command_buffer),
diff --git a/gpu/command_buffer/client/cmd_buffer_helper_test.cc b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
index 4e2b31b..912df89 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper_test.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
@@ -38,16 +38,12 @@
#include "gpu/command_buffer/service/mocks.h"
#include "gpu/command_buffer/service/command_buffer_service.h"
#include "gpu/command_buffer/service/gpu_processor.h"
-#include "gpu/np_utils/np_object_pointer.h"
-#include "gpu/np_utils/np_browser_stub.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace command_buffer {
using command_buffer::CommandBufferService;
using command_buffer::GPUProcessor;
-using np_utils::NPCreateObject;
-using np_utils::NPObjectPointer;
using testing::Return;
using testing::Mock;
using testing::Truly;
@@ -71,7 +67,7 @@ class CommandBufferHelperTest : public testing::Test {
EXPECT_CALL(*api_mock_, DoCommand(0, 0, _))
.WillRepeatedly(Return(parse_error::kParseNoError));
- ::base::SharedMemory* ring_buffer = new ::base::SharedMemory;
+ base::SharedMemory* ring_buffer = new base::SharedMemory;
ring_buffer->Create(std::wstring(), false, false, kCommandBufferSizeBytes);
ring_buffer->Map(1024);
@@ -142,7 +138,6 @@ class CommandBufferHelperTest : public testing::Test {
base::AtExitManager at_exit_manager_;
MessageLoop message_loop_;
- np_utils::StubNPBrowser browser_;
scoped_ptr<AsyncAPIMock> api_mock_;
scoped_ptr<CommandBufferService> command_buffer_;
command_buffer::CommandParser* parser_;
diff --git a/gpu/command_buffer/client/fenced_allocator_test.cc b/gpu/command_buffer/client/fenced_allocator_test.cc
index dcb75bc..f6bde77 100644
--- a/gpu/command_buffer/client/fenced_allocator_test.cc
+++ b/gpu/command_buffer/client/fenced_allocator_test.cc
@@ -40,16 +40,12 @@
#include "gpu/command_buffer/service/mocks.h"
#include "gpu/command_buffer/service/command_buffer_service.h"
#include "gpu/command_buffer/service/gpu_processor.h"
-#include "gpu/np_utils/np_browser_stub.h"
-#include "gpu/np_utils/np_object_pointer.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace command_buffer {
using command_buffer::CommandBufferService;
using command_buffer::GPUProcessor;
-using np_utils::NPCreateObject;
-using np_utils::NPObjectPointer;
using testing::Return;
using testing::Mock;
using testing::Truly;
@@ -73,7 +69,7 @@ class BaseFencedAllocatorTest : public testing::Test {
.WillRepeatedly(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken),
Return(parse_error::kParseNoError)));
- ::base::SharedMemory* ring_buffer = new ::base::SharedMemory;
+ base::SharedMemory* ring_buffer = new base::SharedMemory;
ring_buffer->Create(std::wstring(), false, false, 1024);
ring_buffer->Map(1024);
@@ -104,7 +100,6 @@ class BaseFencedAllocatorTest : public testing::Test {
base::AtExitManager at_exit_manager_;
MessageLoop message_loop_;
- np_utils::StubNPBrowser browser_;
scoped_ptr<AsyncAPIMock> api_mock_;
scoped_ptr<CommandBufferService> command_buffer_;
command_buffer::CommandParser* parser_;
diff --git a/gpu/command_buffer/client/gles2_demo.cc b/gpu/command_buffer/client/gles2_demo.cc
index 1595ea3..d213792 100644
--- a/gpu/command_buffer/client/gles2_demo.cc
+++ b/gpu/command_buffer/client/gles2_demo.cc
@@ -15,7 +15,6 @@
#include "base/scoped_ptr.h"
#include "gpu/command_buffer/service/gpu_processor.h"
#include "gpu/command_buffer/service/command_buffer_service.h"
-#include "gpu/np_utils/np_utils.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/gles2_lib.h"
#include "gpu/command_buffer/client/gles2_demo_c.h"
@@ -31,7 +30,7 @@ class GLES2Demo {
public:
GLES2Demo();
- bool GLES2Demo::Setup(NPP npp, void* hwnd, int32 size);
+ bool GLES2Demo::Setup(void* hwnd, int32 size);
private:
DISALLOW_COPY_AND_ASSIGN(GLES2Demo);
@@ -40,7 +39,7 @@ class GLES2Demo {
GLES2Demo::GLES2Demo() {
}
-bool GLES2Demo::Setup(NPP npp, void* hwnd, int32 size) {
+bool GLES2Demo::Setup(void* hwnd, int32 size) {
scoped_ptr<SharedMemory> ring_buffer(new SharedMemory);
if (!ring_buffer->Create(std::wstring(), false, false, size)) {
return NULL;
@@ -56,7 +55,7 @@ bool GLES2Demo::Setup(NPP npp, void* hwnd, int32 size) {
}
scoped_refptr<GPUProcessor> gpu_processor(
- new GPUProcessor(npp, command_buffer.get()));
+ new GPUProcessor(command_buffer.get()));
if (!gpu_processor->Initialize(reinterpret_cast<HWND>(hwnd))) {
return NULL;
}
@@ -201,7 +200,7 @@ int main(int argc, const char** argv) {
return EXIT_FAILURE;
}
- demo->Setup(NULL, hwnd, kCommandBufferSize);
+ demo->Setup(hwnd, kCommandBufferSize);
ProcessMessages(hwnd);
diff --git a/gpu/command_buffer/service/cmd_parser_test.cc b/gpu/command_buffer/service/cmd_parser_test.cc
index 347eef2..59c5528 100644
--- a/gpu/command_buffer/service/cmd_parser_test.cc
+++ b/gpu/command_buffer/service/cmd_parser_test.cc
@@ -155,7 +155,7 @@ TEST_F(CommandParserTest, TestMultipleCommands) {
CommandBufferOffset put_cmd2 = put;
header.size = 2;
- header.command = 2121;
+ header.command = 876;
buffer()[put++].value_header = header;
buffer()[put++].value_int32 = 3434;
@@ -166,7 +166,7 @@ TEST_F(CommandParserTest, TestMultipleCommands) {
param_array[0].value_int32 = 5151;
AddDoCommandExpect(parse_error::kParseNoError, 789, 1, param_array);
param_array[1].value_int32 = 3434;
- AddDoCommandExpect(parse_error::kParseNoError, 2121, 1,
+ AddDoCommandExpect(parse_error::kParseNoError, 876, 1,
param_array+1);
EXPECT_EQ(parse_error::kParseNoError, parser->ProcessCommand());
@@ -177,12 +177,12 @@ TEST_F(CommandParserTest, TestMultipleCommands) {
// add 2 commands again, test with ProcessAllCommands()
header.size = 2;
- header.command = 4545;
+ header.command = 123;
buffer()[put++].value_header = header;
buffer()[put++].value_int32 = 5656;
header.size = 2;
- header.command = 6767;
+ header.command = 321;
buffer()[put++].value_header = header;
buffer()[put++].value_int32 = 7878;
@@ -190,9 +190,9 @@ TEST_F(CommandParserTest, TestMultipleCommands) {
EXPECT_EQ(put, parser->put());
param_array[0].value_int32 = 5656;
- AddDoCommandExpect(parse_error::kParseNoError, 4545, 1, param_array);
+ AddDoCommandExpect(parse_error::kParseNoError, 123, 1, param_array);
param_array[1].value_int32 = 7878;
- AddDoCommandExpect(parse_error::kParseNoError, 6767, 1,
+ AddDoCommandExpect(parse_error::kParseNoError, 321, 1,
param_array+1);
EXPECT_EQ(parse_error::kParseNoError, parser->ProcessAllCommands());
diff --git a/gpu/command_buffer/service/command_buffer_service_unittest.cc b/gpu/command_buffer/service/command_buffer_service_unittest.cc
index 2f9c1fb..68ff221 100644
--- a/gpu/command_buffer/service/command_buffer_service_unittest.cc
+++ b/gpu/command_buffer/service/command_buffer_service_unittest.cc
@@ -4,16 +4,10 @@
#include "base/thread.h"
#include "gpu/command_buffer/service/command_buffer_service.h"
-#include "gpu/np_utils/np_browser_mock.h"
-#include "gpu/np_utils/dynamic_np_object.h"
-#include "gpu/np_utils/np_object_mock.h"
-#include "gpu/np_utils/np_object_pointer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gmock/include/gmock/gmock.h"
using base::SharedMemory;
-using np_utils::NPCreateObject;
-using np_utils::NPObjectPointer;
using testing::_;
using testing::DoAll;
using testing::Return;
@@ -28,7 +22,6 @@ class CommandBufferServiceTest : public testing::Test {
command_buffer_.reset(new CommandBufferService);
}
- np_utils::MockNPBrowser mock_browser_;
scoped_ptr<CommandBufferService> command_buffer_;
};
diff --git a/gpu/command_buffer/service/gpu_processor.cc b/gpu/command_buffer/service/gpu_processor.cc
index 845d5b6..6d71a9c 100644
--- a/gpu/command_buffer/service/gpu_processor.cc
+++ b/gpu/command_buffer/service/gpu_processor.cc
@@ -2,23 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/message_loop.h"
#include "gpu/command_buffer/service/gpu_processor.h"
-#include "gpu/np_utils/np_browser.h"
using ::base::SharedMemory;
-using np_utils::NPBrowser;
namespace command_buffer {
GPUProcessor::~GPUProcessor() {
}
-namespace {
-void InvokeProcessCommands(void* data) {
- static_cast<GPUProcessor*>(data)->ProcessCommands();
-}
-} // namespace anonymous
-
void GPUProcessor::ProcessCommands() {
if (command_buffer_->GetErrorStatus())
return;
@@ -48,7 +41,8 @@ void GPUProcessor::ProcessCommands() {
command_buffer_->SetGetOffset(static_cast<int32>(parser_->get()));
if (!parser_->IsEmpty()) {
- NPBrowser::get()->PluginThreadAsyncCall(npp_, InvokeProcessCommands, this);
+ MessageLoop::current()->PostTask(
+ FROM_HERE, NewRunnableMethod(this, &GPUProcessor::ProcessCommands));
}
}
diff --git a/gpu/command_buffer/service/gpu_processor.h b/gpu/command_buffer/service/gpu_processor.h
index 786e504..6797ef1 100644
--- a/gpu/command_buffer/service/gpu_processor.h
+++ b/gpu/command_buffer/service/gpu_processor.h
@@ -12,7 +12,6 @@
#include "gpu/command_buffer/service/cmd_buffer_engine.h"
#include "gpu/command_buffer/service/cmd_parser.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
-#include "gpu/np_utils/np_object_pointer.h"
namespace command_buffer {
@@ -21,7 +20,7 @@ namespace command_buffer {
class GPUProcessor : public ::base::RefCounted<GPUProcessor>,
public command_buffer::CommandBufferEngine {
public:
- GPUProcessor(NPP npp, CommandBuffer* command_buffer);
+ explicit GPUProcessor(CommandBuffer* command_buffer);
// This constructor is for unit tests.
GPUProcessor(CommandBuffer* command_buffer,
@@ -57,8 +56,6 @@ class GPUProcessor : public ::base::RefCounted<GPUProcessor>,
virtual void set_token(int32 token);
private:
- NPP npp_;
-
// The GPUProcessor holds a weak reference to the CommandBuffer. The
// CommandBuffer owns the GPUProcessor and holds a strong reference to it
// through the ProcessCommands callback.
diff --git a/gpu/command_buffer/service/gpu_processor_mock.h b/gpu/command_buffer/service/gpu_processor_mock.h
index d65965f..852782b 100644
--- a/gpu/command_buffer/service/gpu_processor_mock.h
+++ b/gpu/command_buffer/service/gpu_processor_mock.h
@@ -13,7 +13,7 @@ namespace command_buffer {
class MockGPUProcessor : public GPUProcessor {
public:
explicit MockGPUProcessor(CommandBuffer* command_buffer)
- : GPUProcessor(NULL, command_buffer) {
+ : GPUProcessor(command_buffer) {
}
#if defined(OS_WIN)
diff --git a/gpu/command_buffer/service/gpu_processor_unittest.cc b/gpu/command_buffer/service/gpu_processor_unittest.cc
index 89a9392..db60f3a 100644
--- a/gpu/command_buffer/service/gpu_processor_unittest.cc
+++ b/gpu/command_buffer/service/gpu_processor_unittest.cc
@@ -8,7 +8,6 @@
#include "gpu/command_buffer/service/mocks.h"
#include "gpu/command_buffer/service/gpu_processor.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
-#include "gpu/np_utils/np_browser_mock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -35,12 +34,6 @@ class GPUProcessorTest : public testing::Test {
memset(buffer_, 0, kRingBufferSize);
- // Don't mock PluginThreadAsyncCall. Have it schedule the task.
- ON_CALL(mock_browser_, PluginThreadAsyncCall(_, _, _))
- .WillByDefault(
- Invoke(&mock_browser_,
- &np_utils::MockNPBrowser::ConcretePluginThreadAsyncCall));
-
command_buffer_.reset(new MockCommandBuffer);
ON_CALL(*command_buffer_.get(), GetRingBuffer())
.WillByDefault(Return(shared_memory_.get()));
@@ -72,7 +65,6 @@ class GPUProcessorTest : public testing::Test {
base::AtExitManager at_exit_manager;
MessageLoop message_loop;
- np_utils::MockNPBrowser mock_browser_;
scoped_ptr<MockCommandBuffer> command_buffer_;
scoped_ptr<::base::SharedMemory> shared_memory_;
int32* buffer_;
diff --git a/gpu/command_buffer/service/gpu_processor_win.cc b/gpu/command_buffer/service/gpu_processor_win.cc
index d672c12..a4e138b 100644
--- a/gpu/command_buffer/service/gpu_processor_win.cc
+++ b/gpu/command_buffer/service/gpu_processor_win.cc
@@ -10,9 +10,8 @@ using ::base::SharedMemory;
namespace command_buffer {
-GPUProcessor::GPUProcessor(NPP npp, CommandBuffer* command_buffer)
- : npp_(npp),
- command_buffer_(command_buffer),
+GPUProcessor::GPUProcessor(CommandBuffer* command_buffer)
+ : command_buffer_(command_buffer),
commands_per_update_(100) {
DCHECK(command_buffer);
decoder_.reset(gles2::GLES2Decoder::Create());
@@ -23,8 +22,7 @@ GPUProcessor::GPUProcessor(CommandBuffer* command_buffer,
gles2::GLES2Decoder* decoder,
CommandParser* parser,
int commands_per_update)
- : npp_(NULL),
- command_buffer_(command_buffer),
+ : command_buffer_(command_buffer),
commands_per_update_(commands_per_update) {
DCHECK(command_buffer);
decoder_.reset(decoder);