OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef O3D_GPU_PLUGIN_GPU_PLUGIN_OBJECT_H_ | 5 #ifndef O3D_GPU_PLUGIN_GPU_PLUGIN_OBJECT_H_ |
6 #define O3D_GPU_PLUGIN_GPU_PLUGIN_OBJECT_H_ | 6 #define O3D_GPU_PLUGIN_GPU_PLUGIN_OBJECT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 virtual void Release(); | 61 virtual void Release(); |
62 | 62 |
63 virtual NPObject* GetScriptableNPObject(); | 63 virtual NPObject* GetScriptableNPObject(); |
64 | 64 |
65 // Returns the current initialization status. See Status enum. | 65 // Returns the current initialization status. See Status enum. |
66 int32 GetStatus() { | 66 int32 GetStatus() { |
67 return status_; | 67 return status_; |
68 } | 68 } |
69 | 69 |
| 70 // Get the width of the plugin window. |
| 71 int32 GetWidth() { |
| 72 return window_.width; |
| 73 } |
| 74 |
| 75 // Get the height of the plugin window. |
| 76 int32 GetHeight() { |
| 77 return window_.height; |
| 78 } |
| 79 |
| 80 // Set the object that receives notifications of GPU plugin object events |
| 81 // such as resize and keyboard and mouse input. |
| 82 void SetEventSync(NPObjectPointer<NPObject> event_sync) { |
| 83 event_sync_ = event_sync; |
| 84 } |
| 85 |
| 86 NPObjectPointer<NPObject> GetEventSync() { |
| 87 return event_sync_; |
| 88 } |
| 89 |
70 // Initializes and returns the command buffer object. Returns NULL if the | 90 // Initializes and returns the command buffer object. Returns NULL if the |
71 // command buffer cannot be initialized, for example if the plugin does not | 91 // command buffer cannot be initialized, for example if the plugin does not |
72 // yet have a window handle. | 92 // yet have a window handle. |
73 NPObjectPointer<NPObject> OpenCommandBuffer(); | 93 NPObjectPointer<NPObject> OpenCommandBuffer(); |
74 | 94 |
75 // Set the status for testing. | 95 // Set the status for testing. |
76 void set_status(Status status) { | 96 void set_status(Status status) { |
77 status_ = status; | 97 status_ = status; |
78 } | 98 } |
79 | 99 |
80 // Replace the default command buffer for testing. | 100 // Replace the default command buffer for testing. |
81 void set_command_buffer( | 101 void set_command_buffer( |
82 const NPObjectPointer<CommandBuffer>& command_buffer) { | 102 const NPObjectPointer<CommandBuffer>& command_buffer) { |
83 command_buffer_ = command_buffer; | 103 command_buffer_ = command_buffer; |
84 } | 104 } |
85 | 105 |
86 // Replace the default GPU processor for testing. | 106 // Replace the default GPU processor for testing. |
87 void set_gpu_processor(const scoped_refptr<GPUProcessor>& processor) { | 107 void set_gpu_processor(const scoped_refptr<GPUProcessor>& processor) { |
88 processor_ = processor; | 108 processor_ = processor; |
89 } | 109 } |
90 | 110 |
91 NP_UTILS_BEGIN_DISPATCHER_CHAIN(GPUPluginObject, DefaultNPObject<NPObject>) | 111 NP_UTILS_BEGIN_DISPATCHER_CHAIN(GPUPluginObject, DefaultNPObject<NPObject>) |
92 NP_UTILS_DISPATCHER(GetStatus, int32()); | 112 NP_UTILS_DISPATCHER(GetStatus, int32()); |
| 113 NP_UTILS_DISPATCHER(GetWidth, int32()); |
| 114 NP_UTILS_DISPATCHER(GetHeight, int32()); |
| 115 NP_UTILS_DISPATCHER(SetEventSync, void(NPObjectPointer<NPObject> sync)); |
| 116 NP_UTILS_DISPATCHER(GetEventSync, NPObjectPointer<NPObject>()); |
93 NP_UTILS_DISPATCHER(OpenCommandBuffer, NPObjectPointer<NPObject>()) | 117 NP_UTILS_DISPATCHER(OpenCommandBuffer, NPObjectPointer<NPObject>()) |
94 NP_UTILS_END_DISPATCHER_CHAIN | 118 NP_UTILS_END_DISPATCHER_CHAIN |
95 | 119 |
96 private: | 120 private: |
97 NPError PlatformSpecificSetWindow(NPWindow* new_window); | 121 NPError PlatformSpecificSetWindow(NPWindow* new_window); |
98 | 122 |
99 NPP npp_; | 123 NPP npp_; |
100 Status status_; | 124 Status status_; |
101 NPWindow window_; | 125 NPWindow window_; |
102 NPObjectPointer<CommandBuffer> command_buffer_; | 126 NPObjectPointer<CommandBuffer> command_buffer_; |
103 scoped_refptr<GPUProcessor> processor_; | 127 scoped_refptr<GPUProcessor> processor_; |
| 128 NPObjectPointer<NPObject> event_sync_; |
104 }; | 129 }; |
105 | 130 |
106 } // namespace gpu_plugin | 131 } // namespace gpu_plugin |
107 } // namespace o3d | 132 } // namespace o3d |
108 | 133 |
109 #endif // O3D_GPU_PLUGIN_GPU_PLUGIN_OBJECT_H_ | 134 #endif // O3D_GPU_PLUGIN_GPU_PLUGIN_OBJECT_H_ |
OLD | NEW |