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

Side by Side Diff: samples/o3djs/util.js

Issue 155716: o3djs.utils.makeClients checks that Renderer has been initialized.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 5 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 | « no previous file | 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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 var chromeWorkaround = o3djs.base.IsChrome10(); 846 var chromeWorkaround = o3djs.base.IsChrome10();
847 { 847 {
848 // Wait for the browser to initialize the clients. 848 // Wait for the browser to initialize the clients.
849 var clearId = window.setInterval(function() { 849 var clearId = window.setInterval(function() {
850 var initStatus = 0; 850 var initStatus = 0;
851 var error = ''; 851 var error = '';
852 var o3d; 852 var o3d;
853 for (var cc = 0; cc < clientElements.length; ++cc) { 853 for (var cc = 0; cc < clientElements.length; ++cc) {
854 var element = clientElements[cc]; 854 var element = clientElements[cc];
855 o3d = element.o3d; 855 o3d = element.o3d;
856 if (!o3d) { 856 var status = element.client && element.client.rendererInitStatus;
857 var ready = o3d && status >
858 o3djs.util.rendererInitStatus.UNINITIALIZED;
859 if (!ready) {
857 if (chromeWorkaround) { 860 if (chromeWorkaround) {
858 if (element.style.width != '100%') { 861 if (element.style.width != '100%') {
859 element.style.width = '100%'; 862 element.style.width = '100%';
860 } else { 863 } else {
861 element.style.width = '1px'; 864 element.style.width = '1px';
862 } 865 }
863 } 866 }
864 return; 867 return;
865 } 868 }
866 if (chromeWorkaround && element.style.width != '100%') { 869 if (chromeWorkaround && element.style.width != '100%') {
867 // The plugin has loaded but it may not be the right size yet. 870 // The plugin has loaded but it may not be the right size yet.
868 element.style.width = '100%'; 871 element.style.width = '100%';
869 return; 872 return;
870 } 873 }
871 var status = clientElements[cc].client.rendererInitStatus;
872 // keep the highest status. This is the worst status. 874 // keep the highest status. This is the worst status.
873 if (status > initStatus) { 875 if (status > initStatus) {
874 initStatus = status; 876 initStatus = status;
875 error = clientElements[cc].client.lastError; 877 error = clientElements[cc].client.lastError;
876 } 878 }
877 } 879 }
878 880
879 window.clearInterval(clearId); 881 window.clearInterval(clearId);
880 882
881 // If the plugin could not initialize the graphics delete all of 883 // If the plugin could not initialize the graphics delete all of
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 break; 922 break;
921 default: 923 default:
922 throw 'Unknown engine ' + o3djs.util.mainEngine_; 924 throw 'Unknown engine ' + o3djs.util.mainEngine_;
923 } 925 }
924 } 926 }
925 }, 10); 927 }, 10);
926 } 928 }
927 } 929 }
928 }; 930 };
929 931
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698