diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-21 21:25:01 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-21 21:25:01 +0000 |
commit | 2caf30e20420b411f4e70001632587ff6df7d476 (patch) | |
tree | c50a351996a4e2e6187a1e465191ac9b35d7ed94 /gpu | |
parent | 7b90ab7c5057a7775e130c17d4fb976e8a0231f1 (diff) | |
download | chromium_src-2caf30e20420b411f4e70001632587ff6df7d476.zip chromium_src-2caf30e20420b411f4e70001632587ff6df7d476.tar.gz chromium_src-2caf30e20420b411f4e70001632587ff6df7d476.tar.bz2 |
Removed the depedency of gpu::demos on base.
Review URL: http://codereview.chromium.org/6081003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/demos/demos.gyp | 22 | ||||
-rw-r--r-- | gpu/demos/framework/demo.cc | 10 | ||||
-rw-r--r-- | gpu/demos/framework/demo.h | 6 | ||||
-rw-r--r-- | gpu/demos/framework/main_pepper.cc | 12 | ||||
-rw-r--r-- | gpu/demos/framework/pepper.cc | 11 | ||||
-rw-r--r-- | gpu/demos/framework/plugin.cc | 8 | ||||
-rw-r--r-- | gpu/demos/gles2_book/example.h | 9 |
7 files changed, 25 insertions, 53 deletions
diff --git a/gpu/demos/demos.gyp b/gpu/demos/demos.gyp index 3997863..87dd29a 100644 --- a/gpu/demos/demos.gyp +++ b/gpu/demos/demos.gyp @@ -25,19 +25,14 @@ { 'target_name': 'gpu_demo_framework', 'type': 'static_library', - 'dependencies': [ - '../../base/base.gyp:base', + 'include_dirs': [ + '../..', ], 'sources': [ 'framework/demo.cc', 'framework/demo.h', 'framework/demo_factory.h', ], - 'all_dependent_settings': { - 'include_dirs': [ - '../..', - ], - }, }, { 'target_name': 'gpu_demo_framework_exe', @@ -74,14 +69,14 @@ 'gpu_demo_framework', '../gpu.gyp:pgl', ], + 'include_dirs': ['../..'], 'sources': [ 'framework/plugin.cc', 'framework/plugin.h', ], 'direct_dependent_settings': { - 'sources': [ - 'framework/main_pepper.cc', - ], + 'include_dirs': ['../..'], + 'sources': ['framework/main_pepper.cc'], 'run_as': { 'conditions': [ ['OS=="mac"', { @@ -135,7 +130,6 @@ ], 'include_dirs': [ '../..', - '../../ppapi', '../../ppapi/lib/gl/include', '../../third_party/gles2_book/Common/Include', ], @@ -150,11 +144,9 @@ ], 'direct_dependent_settings': { 'include_dirs': [ - '../../third_party', - '../../third_party/gles2_book/Common/Include', - '../../ppapi', + '../..', '../../ppapi/lib/gl/include', - '../..' + '../../third_party/gles2_book/Common/Include', ], 'run_as': { 'conditions': [ diff --git a/gpu/demos/framework/demo.cc b/gpu/demos/framework/demo.cc index 1679b3f..bc05b41 100644 --- a/gpu/demos/framework/demo.cc +++ b/gpu/demos/framework/demo.cc @@ -8,7 +8,7 @@ namespace gpu { namespace demos { -Demo::Demo() : width_(0), height_(0) { +Demo::Demo() : width_(0), height_(0), last_draw_time_(0) { } Demo::~Demo() { @@ -21,10 +21,10 @@ void Demo::InitWindowSize(int width, int height) { void Demo::Draw() { float elapsed_sec = 0.0f; - const base::Time current_time = base::Time::Now(); - if (!last_draw_time_.is_null()) { - base::TimeDelta time_delta = current_time - last_draw_time_; - elapsed_sec = static_cast<float>(time_delta.InSecondsF()); + clock_t current_time = clock(); + if (last_draw_time_ != 0) { + elapsed_sec = static_cast<float>(current_time - last_draw_time_) / + CLOCKS_PER_SEC; } last_draw_time_ = current_time; diff --git a/gpu/demos/framework/demo.h b/gpu/demos/framework/demo.h index 28c8923..8229272 100644 --- a/gpu/demos/framework/demo.h +++ b/gpu/demos/framework/demo.h @@ -7,7 +7,7 @@ #ifndef GPU_DEMOS_FRAMEWORK_DEMO_H_ #define GPU_DEMOS_FRAMEWORK_DEMO_H_ -#include "base/time.h" +#include <ctime> namespace gpu { namespace demos { @@ -61,9 +61,7 @@ class Demo { int height_; // Window height. // Time at which draw was called last. - base::Time last_draw_time_; - - DISALLOW_COPY_AND_ASSIGN(Demo); + clock_t last_draw_time_; }; } // namespace demos diff --git a/gpu/demos/framework/main_pepper.cc b/gpu/demos/framework/main_pepper.cc index 887c853f..2f50595 100644 --- a/gpu/demos/framework/main_pepper.cc +++ b/gpu/demos/framework/main_pepper.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/at_exit.h" -#include "base/logging.h" #include "gpu/demos/framework/plugin.h" #include "gpu/pgl/pgl.h" #include "third_party/npapi/bindings/nphostapi.h" @@ -17,13 +15,6 @@ #define EXPORT #endif // GNUC -namespace { -// AtExitManager is used by singleton classes to delete themselves when -// the program terminates. There should be only one instance of this class -// per thread; -base::AtExitManager* g_at_exit_manager; -} // namespace - namespace gpu { namespace demos { // NPP entry points. @@ -126,7 +117,6 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value) { break; } default: - LOG(INFO) << "Unhandled variable to NPP_GetValue\n"; err = NPERR_GENERIC_ERROR; break; } @@ -167,7 +157,6 @@ EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs , NPPluginFuncs* plugin_funcs #endif // OS_LINUX ) { - g_at_exit_manager = new base::AtExitManager(); gpu::demos::g_browser = browser_funcs; pglInitialize(); @@ -179,7 +168,6 @@ EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs EXPORT void API_CALL NP_Shutdown() { pglTerminate(); - delete g_at_exit_manager; } #if defined(OS_LINUX) diff --git a/gpu/demos/framework/pepper.cc b/gpu/demos/framework/pepper.cc index ca19e0f..ffb2460 100644 --- a/gpu/demos/framework/pepper.cc +++ b/gpu/demos/framework/pepper.cc @@ -4,8 +4,6 @@ #include <GLES2/gl2.h> -#include "base/at_exit.h" -#include "base/scoped_ptr.h" #include "gpu/demos/framework/demo.h" #include "gpu/demos/framework/demo_factory.h" #include "ppapi/cpp/completion_callback.h" @@ -33,7 +31,7 @@ class PluginInstance : public pp::Instance { ~PluginInstance() { if (!graphics_.is_null()) { glSetCurrentContextPPAPI(graphics_.pp_resource()); - demo_.reset(); + delete demo_; glSetCurrentContextPPAPI(0); } } @@ -80,7 +78,7 @@ class PluginInstance : public pp::Instance { } pp::Module* module_; - scoped_ptr<Demo> demo_; + Demo* demo_; pp::Graphics3D_Dev graphics_; pp::Size size_; pp::CompletionCallbackFactory<PluginInstance> callback_factory_; @@ -88,7 +86,7 @@ class PluginInstance : public pp::Instance { class PluginModule : public pp::Module { public: - PluginModule() : at_exit_manager_(new base::AtExitManager) {} + PluginModule() {} ~PluginModule() { glTerminatePPAPI(); } @@ -100,9 +98,6 @@ class PluginModule : public pp::Module { virtual pp::Instance* CreateInstance(PP_Instance instance) { return new PluginInstance(instance, this); } - - private: - scoped_ptr<base::AtExitManager> at_exit_manager_; }; } // namespace demos diff --git a/gpu/demos/framework/plugin.cc b/gpu/demos/framework/plugin.cc index ba79947..db605e6 100644 --- a/gpu/demos/framework/plugin.cc +++ b/gpu/demos/framework/plugin.cc @@ -4,7 +4,7 @@ #include "gpu/demos/framework/plugin.h" -#include "base/logging.h" +#include <cassert> #include "gpu/demos/framework/demo_factory.h" using gpu::demos::Plugin; @@ -114,11 +114,11 @@ void Plugin::New(NPMIMEType pluginType, int16 argc, char* argn[], char* argv[]) { if (!g_extensions) { g_browser->getvalue(npp_, NPNVPepperExtensions, &g_extensions); - CHECK(g_extensions); + assert(g_extensions); } device3d_ = g_extensions->acquireDevice(npp_, NPPepper3DDevice); - CHECK(device3d_); + assert(device3d_); } void Plugin::SetWindow(const NPWindow& window) { @@ -160,7 +160,7 @@ void Plugin::Paint() { } bool Plugin::CreateContext() { - DCHECK(!pgl_context_); + assert(!pgl_context_); // Initialize a 3D context. NPDeviceContext3DConfig config; diff --git a/gpu/demos/gles2_book/example.h b/gpu/demos/gles2_book/example.h index 0a1d4e8..25da94f 100644 --- a/gpu/demos/gles2_book/example.h +++ b/gpu/demos/gles2_book/example.h @@ -7,8 +7,9 @@ #ifndef GPU_DEMOS_GLES2_BOOK_EXAMPLE_H_ #define GPU_DEMOS_GLES2_BOOK_EXAMPLE_H_ -#include "base/logging.h" -#include "gpu/command_buffer/common/logging.h" +#include <cassert> +#include <cstring> + #include "gpu/demos/framework/demo.h" #include "third_party/gles2_book/Common/Include/esUtil.h" @@ -48,7 +49,7 @@ class Example : public gpu::demos::Demo { virtual bool InitGL() { // Note that update_func is optional. - CHECK(init_func_ && draw_func_ && shut_down_func_); + assert(init_func_ && draw_func_ && shut_down_func_); context_.width = width(); context_.height = height(); @@ -81,8 +82,6 @@ class Example : public gpu::demos::Demo { UpdateFunc* update_func_; DrawFunc* draw_func_; ShutDownFunc* shut_down_func_; - - DISALLOW_COPY_AND_ASSIGN(Example); }; } // namespace gles2_book |