diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 23:29:22 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 23:29:22 +0000 |
commit | 217c21ab080bd909fd53da57a66a9d9e1d68b147 (patch) | |
tree | d6ab20039f0327984814c23ea8f01431f4ff097c /o3d | |
parent | db8d659e61cb3ffbfe54731ff4d161390c691954 (diff) | |
download | chromium_src-217c21ab080bd909fd53da57a66a9d9e1d68b147.zip chromium_src-217c21ab080bd909fd53da57a66a9d9e1d68b147.tar.gz chromium_src-217c21ab080bd909fd53da57a66a9d9e1d68b147.tar.bz2 |
Fixed gpu_plugin and added to o3d_all.gyp so it gets built on buildbot.
Review URL: http://codereview.chromium.org/361012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/build/o3d_all.gyp | 7 | ||||
-rw-r--r-- | o3d/command_buffer/command_buffer.gyp | 6 | ||||
-rw-r--r-- | o3d/gpu_plugin/gpu_plugin.cc | 11 | ||||
-rw-r--r-- | o3d/gpu_plugin/gpu_plugin.gyp | 47 | ||||
-rw-r--r-- | o3d/gpu_plugin/gpu_plugin.h | 8 | ||||
-rw-r--r-- | o3d/gpu_plugin/gpu_plugin_object_unittest.cc | 2 | ||||
-rw-r--r-- | o3d/gpu_plugin/gpu_plugin_unittest.cc | 86 | ||||
-rw-r--r-- | o3d/gpu_plugin/gpu_processor_unittest.cc | 9 |
8 files changed, 73 insertions, 103 deletions
diff --git a/o3d/build/o3d_all.gyp b/o3d/build/o3d_all.gyp index 9901e71..80447b7 100644 --- a/o3d/build/o3d_all.gyp +++ b/o3d/build/o3d_all.gyp @@ -47,6 +47,13 @@ ], }, ], + ['renderer=="cb"', + { + 'dependencies': [ + '../gpu_plugin/gpu_plugin.gyp:*', + ], + }, + ], ], }, ], diff --git a/o3d/command_buffer/command_buffer.gyp b/o3d/command_buffer/command_buffer.gyp index 23e9c48..e398830 100644 --- a/o3d/command_buffer/command_buffer.gyp +++ b/o3d/command_buffer/command_buffer.gyp @@ -191,9 +191,9 @@ ], ['cb_service == "gl"', { - 'include_dirs': [ - '../../<(glewdir)/include', - '../../<(cgdir)/include', + 'dependencies': [ + '../build/libs.gyp:gl_libs', + '../build/libs.gyp:cg_libs', ], 'sources': [ 'service/cross/gl/effect_gl.cc', diff --git a/o3d/gpu_plugin/gpu_plugin.cc b/o3d/gpu_plugin/gpu_plugin.cc index 7e487b7..f72f44a 100644 --- a/o3d/gpu_plugin/gpu_plugin.cc +++ b/o3d/gpu_plugin/gpu_plugin.cc @@ -7,7 +7,12 @@ #include "o3d/gpu_plugin/np_utils/np_browser.h" #include "o3d/gpu_plugin/np_utils/np_plugin_object.h" #include "o3d/gpu_plugin/np_utils/np_plugin_object_factory.h" + +#if defined(O3D_IN_CHROME) #include "webkit/glue/plugins/nphostapi.h" +#else +#include "o3d/third_party/npapi/include/npupp.h" +#endif namespace o3d { namespace gpu_plugin { @@ -89,7 +94,7 @@ NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) { } } -NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* funcs) { +NPError NP_GetEntryPoints(NPPluginFuncs* funcs) { funcs->newp = NPP_New; funcs->destroy = NPP_Destroy; funcs->setwindow = NPP_SetWindow; @@ -103,7 +108,7 @@ NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* funcs) { NPError API_CALL NP_Initialize(NPNetscapeFuncs *browser_funcs, NPPluginFuncs* plugin_funcs) { #else -NPError API_CALL NP_Initialize(NPNetscapeFuncs *browser_funcs) { +NPError NP_Initialize(NPNetscapeFuncs *browser_funcs) { #endif if (!browser_funcs) return NPERR_INVALID_FUNCTABLE_ERROR; @@ -120,7 +125,7 @@ NPError API_CALL NP_Initialize(NPNetscapeFuncs *browser_funcs) { return NPERR_NO_ERROR; } -NPError API_CALL NP_Shutdown() { +NPError NP_Shutdown() { if (!g_browser) return NPERR_GENERIC_ERROR; diff --git a/o3d/gpu_plugin/gpu_plugin.gyp b/o3d/gpu_plugin/gpu_plugin.gyp index 923f003..7f22619 100644 --- a/o3d/gpu_plugin/gpu_plugin.gyp +++ b/o3d/gpu_plugin/gpu_plugin.gyp @@ -94,46 +94,10 @@ '../command_buffer/command_buffer.gyp:command_buffer_service', 'np_utils', ], - 'conditions': [ - ['cb_service == "d3d9"', - { - 'include_dirs': [ - '../..', - '$(DXSDK_DIR)/Include', - ], - } - ], - ['cb_service == "gl"', - { - 'include_dirs': [ - '../../<(glewdir)/include', - '../../<(cgdir)/include', - ], - } - ], - ], 'all_dependent_settings': { 'include_dirs': [ '../..', ], - 'conditions': [ - ['cb_service == "d3d9"', - { - 'include_dirs': [ - '../..', - '$(DXSDK_DIR)/Include', - ], - } - ], - ['cb_service == "gl"', - { - 'include_dirs': [ - '../../<(glewdir)/include', - '../../<(cgdir)/include', - ], - } - ], - ], }, # 'all_dependent_settings' 'sources': [ 'command_buffer.cc', @@ -184,17 +148,6 @@ 'include_dirs': [ '../..', ], - 'conditions': [ - ['OS == "win" and (renderer == "d3d9" or renderer == "cb")', - { - 'link_settings': { - 'libraries': [ - '"$(DXSDK_DIR)/Lib/x86/DxErr.lib"', - ], - }, - }, - ], - ], 'sources': [ 'command_buffer_unittest.cc', 'gpu_plugin_unittest.cc', diff --git a/o3d/gpu_plugin/gpu_plugin.h b/o3d/gpu_plugin/gpu_plugin.h index a8fa9ef..42fbbf5 100644 --- a/o3d/gpu_plugin/gpu_plugin.h +++ b/o3d/gpu_plugin/gpu_plugin.h @@ -15,16 +15,16 @@ namespace gpu_plugin { // Declarations of NPAPI plugin entry points. -NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* funcs); +NPError NP_GetEntryPoints(NPPluginFuncs* funcs); #if defined(OS_LINUX) -NPError API_CALL NP_Initialize(NPNetscapeFuncs *browser_funcs, +NPError NP_Initialize(NPNetscapeFuncs *browser_funcs, NPPluginFuncs* plugin_funcs); #else -NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs); +NPError NP_Initialize(NPNetscapeFuncs* browser_funcs); #endif -NPError API_CALL NP_Shutdown(); +NPError NP_Shutdown(); } // namespace gpu_plugin } // namespace o3d diff --git a/o3d/gpu_plugin/gpu_plugin_object_unittest.cc b/o3d/gpu_plugin/gpu_plugin_object_unittest.cc index 370cc33..a299c0d 100644 --- a/o3d/gpu_plugin/gpu_plugin_object_unittest.cc +++ b/o3d/gpu_plugin/gpu_plugin_object_unittest.cc @@ -16,7 +16,7 @@ #if defined(O3D_IN_CHROME) #include "webkit/glue/plugins/nphostapi.h" #else -#include "npupp.h" +#include "o3d/third_party/npapi/include/npupp.h" #endif using testing::_; diff --git a/o3d/gpu_plugin/gpu_plugin_unittest.cc b/o3d/gpu_plugin/gpu_plugin_unittest.cc index 5cf0b77..9e1475a 100644 --- a/o3d/gpu_plugin/gpu_plugin_unittest.cc +++ b/o3d/gpu_plugin/gpu_plugin_unittest.cc @@ -8,7 +8,12 @@ #include "o3d/gpu_plugin/np_utils/np_plugin_object_factory_mock.h" #include "o3d/gpu_plugin/np_utils/np_plugin_object_mock.h" #include "testing/gtest/include/gtest/gtest.h" + +#if defined(O3D_IN_CHROME) #include "webkit/glue/plugins/nphostapi.h" +#else +#include "o3d/third_party/npapi/include/npupp.h" +#endif #if defined(OS_LINUX) #define INITIALIZE_PLUGIN_FUNCS , &plugin_funcs_ @@ -51,10 +56,11 @@ class GPUPluginTest : public testing::Test { TEST_F(GPUPluginTest, GetEntryPointsSetsNeededFunctionPointers) { #if defined(OS_LINUX) - NPError error = NP_Initialize(&browser_funcs_, &plugin_funcs_); - NP_Shutdown(); + NPError error = o3d::gpu_plugin::NP_Initialize(&browser_funcs_, + &plugin_funcs_); + o3d::gpu_plugin::NP_Shutdown(); #else - NPError error = NP_GetEntryPoints(&plugin_funcs_); + NPError error = o3d::gpu_plugin::NP_GetEntryPoints(&plugin_funcs_); #endif EXPECT_EQ(NPERR_NO_ERROR, error); @@ -68,74 +74,74 @@ TEST_F(GPUPluginTest, GetEntryPointsSetsNeededFunctionPointers) { TEST_F(GPUPluginTest, CanInitializeAndShutdownPlugin) { EXPECT_EQ(NPERR_NO_ERROR, - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS)); - EXPECT_EQ(NPERR_NO_ERROR, NP_Shutdown()); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS)); + EXPECT_EQ(NPERR_NO_ERROR, o3d::gpu_plugin::NP_Shutdown()); } TEST_F(GPUPluginTest, InitializeFailsIfBrowserFuncsIsNull) { EXPECT_EQ(NPERR_INVALID_FUNCTABLE_ERROR, - NP_Initialize(NULL INITIALIZE_PLUGIN_FUNCS)); + o3d::gpu_plugin::NP_Initialize(NULL INITIALIZE_PLUGIN_FUNCS)); } TEST_F(GPUPluginTest, InitializeFailsIfAlreadyInitialized) { EXPECT_EQ(NPERR_NO_ERROR, - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS)); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS)); EXPECT_EQ(NPERR_GENERIC_ERROR, - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS)); - EXPECT_EQ(NPERR_NO_ERROR, NP_Shutdown()); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS)); + EXPECT_EQ(NPERR_NO_ERROR, o3d::gpu_plugin::NP_Shutdown()); } TEST_F(GPUPluginTest, ShutdownFailsIfNotInitialized) { - EXPECT_EQ(NPERR_GENERIC_ERROR, NP_Shutdown()); + EXPECT_EQ(NPERR_GENERIC_ERROR, o3d::gpu_plugin::NP_Shutdown()); } TEST_F(GPUPluginTest, NewReturnsErrorForInvalidInstance) { - NP_GetEntryPoints(&plugin_funcs_); - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); + o3d::gpu_plugin::NP_GetEntryPoints(&plugin_funcs_); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); EXPECT_EQ(NPERR_INVALID_INSTANCE_ERROR, plugin_funcs_.newp( const_cast<NPMIMEType>(GPUPluginObject::kPluginType), NULL, 0, 0, NULL, NULL, NULL)); - NP_Shutdown(); + o3d::gpu_plugin::NP_Shutdown(); } TEST_F(GPUPluginTest, GetValueReturnsErrorForInvalidInstance) { - NP_GetEntryPoints(&plugin_funcs_); - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); + o3d::gpu_plugin::NP_GetEntryPoints(&plugin_funcs_); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); int* result = NULL; EXPECT_EQ(NPERR_INVALID_INSTANCE_ERROR, plugin_funcs_.getvalue( NULL, NPPVjavaClass, &result)); - NP_Shutdown(); + o3d::gpu_plugin::NP_Shutdown(); } TEST_F(GPUPluginTest, DestroyReturnsErrorForInvalidInstance) { - NP_GetEntryPoints(&plugin_funcs_); - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); + o3d::gpu_plugin::NP_GetEntryPoints(&plugin_funcs_); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); EXPECT_EQ(NPERR_INVALID_INSTANCE_ERROR, plugin_funcs_.destroy(NULL, NULL)); - NP_Shutdown(); + o3d::gpu_plugin::NP_Shutdown(); } TEST_F(GPUPluginTest, SetWindowReturnsErrorForInvalidInstance) { - NP_GetEntryPoints(&plugin_funcs_); - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); + o3d::gpu_plugin::NP_GetEntryPoints(&plugin_funcs_); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); EXPECT_EQ(NPERR_INVALID_INSTANCE_ERROR, plugin_funcs_.setwindow(NULL, NULL)); - NP_Shutdown(); + o3d::gpu_plugin::NP_Shutdown(); } TEST_F(GPUPluginTest, HandleEventReturnsFalseForInvalidInstance) { - NP_GetEntryPoints(&plugin_funcs_); - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); + o3d::gpu_plugin::NP_GetEntryPoints(&plugin_funcs_); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); EXPECT_EQ(0, plugin_funcs_.event(NULL, NULL)); - NP_Shutdown(); + o3d::gpu_plugin::NP_Shutdown(); } TEST_F(GPUPluginTest, NewCreatesAPluginObjectAndInitializesIt) { @@ -160,8 +166,8 @@ TEST_F(GPUPluginTest, NewCreatesAPluginObjectAndInitializesIt) { EXPECT_CALL(plugin_object, Release()); - NP_GetEntryPoints(&plugin_funcs_); - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); + o3d::gpu_plugin::NP_GetEntryPoints(&plugin_funcs_); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); EXPECT_EQ(NPERR_NO_ERROR, plugin_funcs_.newp( const_cast<NPMIMEType>(GPUPluginObject::kPluginType), @@ -174,7 +180,7 @@ TEST_F(GPUPluginTest, NewCreatesAPluginObjectAndInitializesIt) { EXPECT_EQ(NPERR_NO_ERROR, plugin_funcs_.destroy(&npp_, NULL)); - NP_Shutdown(); + o3d::gpu_plugin::NP_Shutdown(); } TEST_F(GPUPluginTest, NewFailsIfPluginObjectFactoryFails) { @@ -182,14 +188,14 @@ TEST_F(GPUPluginTest, NewFailsIfPluginObjectFactoryFails) { &npp_, const_cast<NPMIMEType>(GPUPluginObject::kPluginType))) .WillOnce(Return(static_cast<PluginObject*>(NULL))); - NP_GetEntryPoints(&plugin_funcs_); - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); + o3d::gpu_plugin::NP_GetEntryPoints(&plugin_funcs_); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); EXPECT_EQ(NPERR_GENERIC_ERROR, plugin_funcs_.newp( const_cast<NPMIMEType>(GPUPluginObject::kPluginType), &npp_, 0, 0, NULL, NULL, NULL)); - NP_Shutdown(); + o3d::gpu_plugin::NP_Shutdown(); } TEST_F(GPUPluginTest, SetWindowForwardsToPluginObject) { @@ -214,8 +220,8 @@ TEST_F(GPUPluginTest, SetWindowForwardsToPluginObject) { EXPECT_CALL(plugin_object, Release()); - NP_GetEntryPoints(&plugin_funcs_); - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); + o3d::gpu_plugin::NP_GetEntryPoints(&plugin_funcs_); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); EXPECT_EQ(NPERR_NO_ERROR, plugin_funcs_.newp( const_cast<NPMIMEType>(GPUPluginObject::kPluginType), @@ -225,7 +231,7 @@ TEST_F(GPUPluginTest, SetWindowForwardsToPluginObject) { EXPECT_EQ(NPERR_NO_ERROR, plugin_funcs_.destroy(&npp_, NULL)); - NP_Shutdown(); + o3d::gpu_plugin::NP_Shutdown(); } TEST_F(GPUPluginTest, HandleEventForwardsToPluginObject) { @@ -250,8 +256,8 @@ TEST_F(GPUPluginTest, HandleEventForwardsToPluginObject) { EXPECT_CALL(plugin_object, Release()); - NP_GetEntryPoints(&plugin_funcs_); - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); + o3d::gpu_plugin::NP_GetEntryPoints(&plugin_funcs_); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); EXPECT_EQ(NPERR_NO_ERROR, plugin_funcs_.newp( const_cast<NPMIMEType>(GPUPluginObject::kPluginType), @@ -261,7 +267,7 @@ TEST_F(GPUPluginTest, HandleEventForwardsToPluginObject) { EXPECT_EQ(NPERR_NO_ERROR, plugin_funcs_.destroy(&npp_, NULL)); - NP_Shutdown(); + o3d::gpu_plugin::NP_Shutdown(); } TEST_F(GPUPluginTest, GetValueReturnsErrorForUnknownVariable) { @@ -281,8 +287,8 @@ TEST_F(GPUPluginTest, GetValueReturnsErrorForUnknownVariable) { EXPECT_CALL(plugin_object, Release()); - NP_GetEntryPoints(&plugin_funcs_); - NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); + o3d::gpu_plugin::NP_GetEntryPoints(&plugin_funcs_); + o3d::gpu_plugin::NP_Initialize(&browser_funcs_ INITIALIZE_PLUGIN_FUNCS); EXPECT_EQ(NPERR_NO_ERROR, plugin_funcs_.newp( const_cast<NPMIMEType>(GPUPluginObject::kPluginType), @@ -294,7 +300,7 @@ TEST_F(GPUPluginTest, GetValueReturnsErrorForUnknownVariable) { EXPECT_EQ(NPERR_NO_ERROR, plugin_funcs_.destroy(&npp_, NULL)); - NP_Shutdown(); + o3d::gpu_plugin::NP_Shutdown(); } } // namespace gpu_plugin diff --git a/o3d/gpu_plugin/gpu_processor_unittest.cc b/o3d/gpu_plugin/gpu_processor_unittest.cc index 3ee57a9..91f422e 100644 --- a/o3d/gpu_plugin/gpu_processor_unittest.cc +++ b/o3d/gpu_plugin/gpu_processor_unittest.cc @@ -4,7 +4,6 @@ #include "base/at_exit.h" #include "base/message_loop.h" -#include "o3d/command_buffer/common/cross/cmd_buffer_format.h" #include "o3d/command_buffer/service/cross/mocks.h" #include "o3d/gpu_plugin/command_buffer_mock.h" #include "o3d/gpu_plugin/gpu_processor.h" @@ -47,12 +46,12 @@ class GPUProcessorTest : public testing::Test { .WillByDefault(Return(sizeof(buffer_))); #if defined(OS_WIN) - gapi_ = new command_buffer::GAPID3D9; + gapi_ = new GPUProcessor::GPUGAPIInterface; #endif async_api_.reset(new StrictMock<command_buffer::AsyncAPIMock>); - decoder_ = new command_buffer::GAPIDecoder(gapi_); + decoder_ = new command_buffer::o3d::GAPIDecoder(gapi_); parser_ = new command_buffer::CommandParser(buffer_, sizeof(buffer_), @@ -81,13 +80,13 @@ class GPUProcessorTest : public testing::Test { NPObjectPointer<MockCommandBuffer> command_buffer_; NPObjectPointer<NiceMock<MockSharedMemory> > shared_memory_; int32 buffer_[1024 / sizeof(int32)]; - command_buffer::GAPIDecoder* decoder_; + command_buffer::o3d::GAPIDecoder* decoder_; command_buffer::CommandParser* parser_; scoped_ptr<command_buffer::AsyncAPIMock> async_api_; scoped_refptr<GPUProcessor> processor_; #if defined(OS_WIN) - command_buffer::GAPID3D9* gapi_; + GPUProcessor::GPUGAPIInterface* gapi_; #endif }; |