| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_PLUGIN_OBJECT_H_ | 26 #ifndef WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_PLUGIN_OBJECT_H_ |
| 27 #define WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_PLUGIN_OBJECT_H_ | 27 #define WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_PLUGIN_OBJECT_H_ |
| 28 | 28 |
| 29 #include "base/basictypes.h" | 29 #include "base/basictypes.h" |
| 30 #include "base/gfx/size.h" |
| 30 #include "base/scoped_ptr.h" | 31 #include "base/scoped_ptr.h" |
| 31 #include "webkit/glue/plugins/nphostapi.h" | |
| 32 #if !defined(INDEPENDENT_PLUGIN) | |
| 33 #include "gpu/command_buffer/client/gles2_implementation.h" | 32 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 34 #include "webkit/tools/pepper_test_plugin/command_buffer_pepper.h" | 33 #include "webkit/tools/pepper_test_plugin/command_buffer_pepper.h" |
| 35 #endif | 34 #include "webkit/glue/plugins/nphostapi.h" |
| 36 | 35 |
| 37 extern NPNetscapeFuncs* browser; | 36 extern NPNetscapeFuncs* browser; |
| 38 | 37 |
| 39 class PluginObject { | 38 class PluginObject { |
| 40 public: | 39 public: |
| 41 explicit PluginObject(NPP npp); | 40 explicit PluginObject(NPP npp); |
| 42 ~PluginObject(); | 41 ~PluginObject(); |
| 43 | 42 |
| 44 static NPClass* GetPluginClass(); | 43 static NPClass* GetPluginClass(); |
| 45 | 44 |
| 46 NPObject* header() { return &header_; } | 45 NPObject* header() { return &header_; } |
| 47 NPP npp() const { return npp_; } | 46 NPP npp() const { return npp_; } |
| 48 | 47 |
| 49 void New(NPMIMEType pluginType, int16 argc, char* argn[], char* argv[]); | 48 void New(NPMIMEType pluginType, int16 argc, char* argn[], char* argv[]); |
| 50 void SetWindow(const NPWindow& window); | 49 void SetWindow(const NPWindow& window); |
| 51 void Draw3D(); | 50 void Draw3D(); |
| 52 | 51 |
| 53 private: | 52 private: |
| 54 bool InitializeCommandBuffer(); | 53 bool InitializeCommandBuffer(); |
| 55 | 54 |
| 56 NPObject header_; | 55 NPObject header_; |
| 57 NPP npp_; | 56 NPP npp_; |
| 58 NPObject* test_object_; | 57 NPObject* test_object_; |
| 59 int dimensions_; | 58 int dimensions_; |
| 60 | 59 |
| 61 NPDevice* device2d_; | 60 NPDevice* device2d_; |
| 62 | 61 |
| 63 // TODO(apatrick): this destruction order causes the plugin to crash on | 62 // TODO(apatrick): this destruction order causes the plugin to crash on |
| 64 // shutdown. | 63 // shutdown. |
| 65 #if !defined(INDEPENDENT_PLUGIN) | |
| 66 scoped_ptr<CommandBufferPepper> command_buffer_; | 64 scoped_ptr<CommandBufferPepper> command_buffer_; |
| 67 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_implementation_; | 65 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_implementation_; |
| 68 scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_; | 66 scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_; |
| 69 #endif | |
| 70 | 67 |
| 71 int width_; | 68 gfx::Size size_; |
| 72 int height_; | |
| 73 | 69 |
| 74 DISALLOW_COPY_AND_ASSIGN(PluginObject); | 70 DISALLOW_COPY_AND_ASSIGN(PluginObject); |
| 75 }; | 71 }; |
| 76 | 72 |
| 77 | 73 |
| 78 #endif // WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_PLUGIN_OBJECT_H_ | 74 #endif // WEBKIT_TOOLS_PEPPER_TEST_PLUGIN_PLUGIN_OBJECT_H_ |
| OLD | NEW |