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

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
« no previous file with comments | « core/cross/renderer.h ('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 !defined(FORCE_CAIRO)
260 if (!o3d::CheckConfig(npp_)) { 261 if (!o3d::CheckConfig(npp_)) {
261 renderer_init_status_ = o3d::Renderer::GPU_NOT_UP_TO_SPEC; 262 renderer_init_status_ = o3d::Renderer::GPU_NOT_UP_TO_SPEC;
262 } else { 263 } else {
263 renderer_ = o3d::Renderer::CreateDefaultRenderer(&service_locator_); 264 renderer_ = o3d::Renderer::CreateDefaultRenderer(&service_locator_);
264 DCHECK(renderer_); 265 DCHECK(renderer_);
265 266
266 // Attempt to initialize renderer. 267 // Attempt to initialize renderer.
267 renderer_init_status_ = renderer_->Init(display_window, false); 268 renderer_init_status_ = renderer_->Init(display_window, false);
268 if (renderer_init_status_ != o3d::Renderer::SUCCESS) { 269 if (renderer_init_status_ != o3d::Renderer::SUCCESS) {
269 DeleteRenderer(); 270 DeleteRenderer();
270 } 271 }
271 } 272 }
273 #else
274 // To force cairo, pretend all previous renderer initialization has failed.
Tristan Schmelcher 2 2011/02/23 19:27:30 You shouldn't need this, because renderer_init_sta
275 renderer_init_status_ = o3d::Renderer::GPU_NOT_UP_TO_SPEC;
276 #endif
277
278 #if defined(SUPPORT_CAIRO)
279 if (renderer_init_status_ != o3d::Renderer::SUCCESS) {
280 // Attempt to fall back to o2d renderer
281 renderer_ = o3d::Renderer::Create2DRenderer(&service_locator_);
282 if (renderer_) {
283 if (renderer_->Init(display_window, false) != o3d::Renderer::SUCCESS) {
Tristan Schmelcher 2 2011/02/23 19:27:30 I think we might as well just assign this result d
284 DeleteRenderer();
285 } else {
286 renderer_init_status_ = o3d::Renderer::SUCCESS;
287 ClientInfoManager* client_info_manager =
288 service_locator()->GetService<ClientInfoManager>();
289 client_info_manager->SetRender2d(true);
290 }
291 }
292 }
293 #endif
272 } 294 }
273 295
274 void PluginObject::DeleteRenderer() { 296 void PluginObject::DeleteRenderer() {
275 if (renderer_) { 297 if (renderer_) {
276 delete renderer_; 298 delete renderer_;
277 renderer_ = NULL; 299 renderer_ = NULL;
278 } 300 }
279 } 301 }
280 302
281 303
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 PluginObject *plugin_object = static_cast<PluginObject *>(npp->pdata); 1220 PluginObject *plugin_object = static_cast<PluginObject *>(npp->pdata);
1199 if (plugin_object) { // May not be initialized yet. 1221 if (plugin_object) { // May not be initialized yet.
1200 return plugin_object->client()->ProfileToString(); 1222 return plugin_object->client()->ProfileToString();
1201 } else { 1223 } else {
1202 return ""; 1224 return "";
1203 } 1225 }
1204 } 1226 }
1205 1227
1206 } // namespace globals 1228 } // namespace globals
1207 } // namespace glue 1229 } // namespace glue
OLDNEW
« no previous file with comments | « core/cross/renderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698