OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 features_ = NULL; | 250 features_ = NULL; |
251 | 251 |
252 // There is a reference cycle between the V8 bridge and the plugin. | 252 // There is a reference cycle between the V8 bridge and the plugin. |
253 // Explicitly remove all V8 references during tear-down, so that the cycle is | 253 // Explicitly remove all V8 references during tear-down, so that the cycle is |
254 // broken, and the reference counting system will successfully delete the | 254 // broken, and the reference counting system will successfully delete the |
255 // plugin. | 255 // plugin. |
256 np_v8_bridge_.ReleaseNPObjects(); | 256 np_v8_bridge_.ReleaseNPObjects(); |
257 } | 257 } |
258 | 258 |
259 void PluginObject::CreateRenderer(const o3d::DisplayWindow& display_window) { | 259 void PluginObject::CreateRenderer(const o3d::DisplayWindow& display_window) { |
| 260 // In case CreateRenderer is called more than once, reset to the |
| 261 // uninitialized state.. |
| 262 DeleteRenderer(); |
| 263 renderer_init_status_ = o3d::Renderer::UNINITIALIZED; |
| 264 |
| 265 #if !defined(FORCE_CAIRO) |
260 if (!o3d::CheckConfig(npp_)) { | 266 if (!o3d::CheckConfig(npp_)) { |
261 renderer_init_status_ = o3d::Renderer::GPU_NOT_UP_TO_SPEC; | 267 renderer_init_status_ = o3d::Renderer::GPU_NOT_UP_TO_SPEC; |
262 } else { | 268 } else { |
263 renderer_ = o3d::Renderer::CreateDefaultRenderer(&service_locator_); | 269 renderer_ = o3d::Renderer::CreateDefaultRenderer(&service_locator_); |
264 DCHECK(renderer_); | 270 DCHECK(renderer_); |
265 | 271 |
266 // Attempt to initialize renderer. | 272 // Attempt to initialize renderer. |
267 renderer_init_status_ = renderer_->Init(display_window, false); | 273 renderer_init_status_ = renderer_->Init(display_window, false); |
268 if (renderer_init_status_ != o3d::Renderer::SUCCESS) { | 274 if (renderer_init_status_ != o3d::Renderer::SUCCESS) { |
269 DeleteRenderer(); | 275 DeleteRenderer(); |
270 } | 276 } |
271 } | 277 } |
| 278 #endif |
| 279 |
| 280 #if defined(SUPPORT_CAIRO) |
| 281 if (renderer_init_status_ != o3d::Renderer::SUCCESS) { |
| 282 // Attempt to fall back to o2d renderer |
| 283 renderer_ = o3d::Renderer::Create2DRenderer(&service_locator_); |
| 284 if (renderer_) { |
| 285 renderer_init_status_ = renderer_->Init(display_window, false); |
| 286 if (renderer_init_status_ != o3d::Renderer::SUCCESS) { |
| 287 DeleteRenderer(); |
| 288 } else { |
| 289 ClientInfoManager* client_info_manager = |
| 290 service_locator()->GetService<ClientInfoManager>(); |
| 291 client_info_manager->SetRender2d(true); |
| 292 } |
| 293 } |
| 294 } |
| 295 #endif |
272 } | 296 } |
273 | 297 |
274 void PluginObject::DeleteRenderer() { | 298 void PluginObject::DeleteRenderer() { |
275 if (renderer_) { | 299 if (renderer_) { |
276 delete renderer_; | 300 delete renderer_; |
277 renderer_ = NULL; | 301 renderer_ = NULL; |
278 } | 302 } |
279 } | 303 } |
280 | 304 |
281 | 305 |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 PluginObject *plugin_object = static_cast<PluginObject *>(npp->pdata); | 1222 PluginObject *plugin_object = static_cast<PluginObject *>(npp->pdata); |
1199 if (plugin_object) { // May not be initialized yet. | 1223 if (plugin_object) { // May not be initialized yet. |
1200 return plugin_object->client()->ProfileToString(); | 1224 return plugin_object->client()->ProfileToString(); |
1201 } else { | 1225 } else { |
1202 return ""; | 1226 return ""; |
1203 } | 1227 } |
1204 } | 1228 } |
1205 | 1229 |
1206 } // namespace globals | 1230 } // namespace globals |
1207 } // namespace glue | 1231 } // namespace glue |
OLD | NEW |