OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 PPAPI_SIMPLE_PS_INSTANCE_H_ | 5 #ifndef PPAPI_SIMPLE_PS_INSTANCE_H_ |
6 #define PPAPI_SIMPLE_PS_INSTANCE_H_ | 6 #define PPAPI_SIMPLE_PS_INSTANCE_H_ |
7 | 7 |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 | 9 |
10 #include "ppapi/c/pp_instance.h" | 10 #include "ppapi/c/pp_instance.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 // Called by the browser when the 3D context is lost. | 148 // Called by the browser when the 3D context is lost. |
149 virtual void Graphics3DContextLost(); | 149 virtual void Graphics3DContextLost(); |
150 | 150 |
151 // Called by the browser when the mouselock is lost. | 151 // Called by the browser when the mouselock is lost. |
152 virtual void MouseLockLost(); | 152 virtual void MouseLockLost(); |
153 | 153 |
154 // Called by Init to processes default and embed tag arguments prior to | 154 // Called by Init to processes default and embed tag arguments prior to |
155 // launching the 'ppapi_main' thread. | 155 // launching the 'ppapi_main' thread. |
156 virtual bool ProcessProperties(); | 156 virtual bool ProcessProperties(); |
| 157 |
157 private: | 158 private: |
158 static void* MainThreadThunk(void *start_info); | 159 static void* MainThreadThunk(void *start_info); |
159 ssize_t TtyOutputHandler(const char* buf, size_t count); | 160 ssize_t TtyOutputHandler(const char* buf, size_t count); |
160 void MessageHandlerExit(const pp::Var& message); | 161 void MessageHandlerExit(const pp::Var& message); |
161 void MessageHandlerInput(const pp::Var& message); | 162 void MessageHandlerInput(const pp::Var& key, const pp::Var& message); |
162 void MessageHandlerResize(const pp::Var& message); | 163 void MessageHandlerResize(const pp::Var& message); |
163 void HandleResize(int width, int height); | 164 void HandleResize(int width, int height); |
164 | 165 |
165 static void HandleExitStatic(int status, void* user_data); | 166 static void HandleExitStatic(int status, void* user_data); |
166 | 167 |
167 static ssize_t TtyOutputHandlerStatic(const char* buf, size_t count, | 168 static ssize_t TtyOutputHandlerStatic(const char* buf, size_t count, |
168 void* user_data); | 169 void* user_data); |
169 | 170 |
170 /// Handle exit confirmation message from JavaScript. | 171 /// Handle exit confirmation message from JavaScript. |
171 static void MessageHandlerExitStatic(const pp::Var& key, | 172 static void MessageHandlerExitStatic(const pp::Var& key, |
172 const pp::Var& value, | 173 const pp::Var& message, |
173 void* user_data); | 174 void* user_data); |
174 | 175 |
175 /// Handle input message from JavaScript. The value is | 176 /// Handle input message from JavaScript. The value is |
176 /// expected to be of type string. | 177 /// expected to be of type string. |
177 static void MessageHandlerInputStatic(const pp::Var& key, | 178 static void MessageHandlerInputStatic(const pp::Var& key, |
178 const pp::Var& value, | 179 const pp::Var& message, |
179 void* user_data); | 180 void* user_data); |
180 | 181 |
181 | 182 |
182 /// Handle resizs message from JavaScript. The value is | 183 /// Handle resizs message from JavaScript. The value is |
183 /// expected to be an array of 2 integers representing the | 184 /// expected to be an array of 2 integers representing the |
184 /// number of columns and rows in the TTY. | 185 /// number of columns and rows in the TTY. |
185 static void MessageHandlerResizeStatic(const pp::Var& key, | 186 static void MessageHandlerResizeStatic(const pp::Var& key, |
186 const pp::Var& value, | 187 const pp::Var& message, |
187 void* user_data); | 188 void* user_data); |
188 | 189 |
189 protected: | 190 protected: |
190 pp::MessageLoop* main_loop_; | 191 pp::MessageLoop* main_loop_; |
191 | 192 |
192 sdk_util::ThreadSafeQueue<PSEvent> event_queue_; | 193 sdk_util::ThreadSafeQueue<PSEvent> event_queue_; |
193 uint32_t events_enabled_; | 194 uint32_t events_enabled_; |
194 Verbosity verbosity_; | 195 Verbosity verbosity_; |
195 | 196 |
196 // TTY handling | 197 // TTY handling |
(...skipping 11 matching lines...) Expand all Loading... |
208 // JavaScript. | 209 // JavaScript. |
209 pthread_cond_t exit_cond_; | 210 pthread_cond_t exit_cond_; |
210 pthread_mutex_t exit_lock_; | 211 pthread_mutex_t exit_lock_; |
211 | 212 |
212 // A message to Post to JavaScript instead of exiting, or NULL if exit() | 213 // A message to Post to JavaScript instead of exiting, or NULL if exit() |
213 // should be called instead. | 214 // should be called instead. |
214 char* exit_message_; | 215 char* exit_message_; |
215 }; | 216 }; |
216 | 217 |
217 #endif // PPAPI_MAIN_PS_INSTANCE_H_ | 218 #endif // PPAPI_MAIN_PS_INSTANCE_H_ |
OLD | NEW |