Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: plugin/cross/o3d_glue.cc

Issue 6538102: Add support for runtime fall-back from o3d to o2d. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« core/cross/renderer.cc ('K') | « core/cross/renderer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if (!o3d::CheckConfig(npp_)) { 260 renderer_init_status_ = o3d::Renderer::GPU_NOT_UP_TO_SPEC;
Tristan Schmelcher 2 2011/02/23 02:08:51 I preferred the previous code structure where this
261 renderer_init_status_ = o3d::Renderer::GPU_NOT_UP_TO_SPEC; 261 #if !defined(FORCE_CAIRO)
262 } else { 262 if (o3d::CheckConfig(npp_)) {
263 renderer_ = o3d::Renderer::CreateDefaultRenderer(&service_locator_); 263 renderer_ = o3d::Renderer::CreateDefaultRenderer(&service_locator_);
264 DCHECK(renderer_); 264 DCHECK(renderer_);
265 265
266 // Attempt to initialize renderer. 266 // Attempt to initialize renderer.
267 renderer_init_status_ = renderer_->Init(display_window, false); 267 renderer_init_status_ = renderer_->Init(display_window, false);
268 if (renderer_init_status_ != o3d::Renderer::SUCCESS) { 268 if (renderer_init_status_ != o3d::Renderer::SUCCESS) {
269 DeleteRenderer(); 269 DeleteRenderer();
270 } 270 }
271 } 271 }
272 #endif
273 #if defined(SUPPORT_CAIRO)
274 if (renderer_init_status_ != o3d::Renderer::SUCCESS) {
275 // Attempt to fall back to o2d renderer
276 renderer_ = o3d::Renderer::Create2DRenderer(&service_locator_);
277 if (renderer_) {
278 Renderer::InitStatus temp_status = renderer_->Init(display_window,
Tristan Schmelcher 2 2011/02/23 02:08:51 I don't think you need this temp_status variable.
279 false);
280 if (temp_status != o3d::Renderer::SUCCESS) {
281 DeleteRenderer();
282 } else {
283 renderer_init_status_ = o3d::Renderer::SUCCESS;
284 ClientInfoManager* client_info_manager =
285 service_locator()->GetService<ClientInfoManager>();
286 client_info_manager->SetRenderer2d(true);
287 }
288 }
289 }
290 #endif
272 } 291 }
273 292
274 void PluginObject::DeleteRenderer() { 293 void PluginObject::DeleteRenderer() {
275 if (renderer_) { 294 if (renderer_) {
276 delete renderer_; 295 delete renderer_;
277 renderer_ = NULL; 296 renderer_ = NULL;
278 } 297 }
279 } 298 }
280 299
281 300
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 PluginObject *plugin_object = static_cast<PluginObject *>(npp->pdata); 1217 PluginObject *plugin_object = static_cast<PluginObject *>(npp->pdata);
1199 if (plugin_object) { // May not be initialized yet. 1218 if (plugin_object) { // May not be initialized yet.
1200 return plugin_object->client()->ProfileToString(); 1219 return plugin_object->client()->ProfileToString();
1201 } else { 1220 } else {
1202 return ""; 1221 return "";
1203 } 1222 }
1204 } 1223 }
1205 1224
1206 } // namespace globals 1225 } // namespace globals
1207 } // namespace glue 1226 } // namespace glue
OLDNEW
« core/cross/renderer.cc ('K') | « core/cross/renderer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698