diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-19 23:21:19 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-19 23:21:19 +0000 |
commit | 3723b75614a6af7d941c6db60d8a614dfe914664 (patch) | |
tree | bb63a5f652541098f8b7012a165661f9555589cb /o3d | |
parent | 7e8d231820546f985729d5c44b7a7da13ab02cd4 (diff) | |
download | chromium_src-3723b75614a6af7d941c6db60d8a614dfe914664.zip chromium_src-3723b75614a6af7d941c6db60d8a614dfe914664.tar.gz chromium_src-3723b75614a6af7d941c6db60d8a614dfe914664.tar.bz2 |
Removed workaround for Chrome 1.0 from o3djs library.
Fix big causing Canvas sample to crash.
Review URL: http://codereview.chromium.org/303008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29477 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/build/common.gypi | 2 | ||||
-rw-r--r-- | o3d/core/cross/canvas.cc | 2 | ||||
-rw-r--r-- | o3d/core/cross/canvas.h | 4 | ||||
-rw-r--r-- | o3d/core/cross/canvas_paint.cc | 12 | ||||
-rw-r--r-- | o3d/core/cross/canvas_paint.h | 2 | ||||
-rw-r--r-- | o3d/core/cross/canvas_shader.cc | 4 | ||||
-rw-r--r-- | o3d/core/cross/canvas_shader.h | 4 | ||||
-rw-r--r-- | o3d/core/cross/canvas_utils.h | 2 | ||||
-rw-r--r-- | o3d/samples/multiple-clients.html | 13 | ||||
-rw-r--r-- | o3d/samples/o3djs/base.js | 8 | ||||
-rw-r--r-- | o3d/samples/o3djs/util.js | 149 |
11 files changed, 81 insertions, 121 deletions
diff --git a/o3d/build/common.gypi b/o3d/build/common.gypi index 7b1476e..2a22c54 100644 --- a/o3d/build/common.gypi +++ b/o3d/build/common.gypi @@ -6,7 +6,6 @@ 'variables': { 'antlrdir': 'third_party/antlr3', 'breakpaddir': 'breakpad/src', - 'cb_service%': 'none', 'fcolladadir': 'third_party/fcollada/files', 'glewdir': 'third_party/glew/files', 'gtestdir': 'testing/gtest/include', @@ -28,6 +27,7 @@ 'o3d_developer%': '<!(python <(DEPTH)/o3d/build/file_exists.py ' '<(DEPTH)/o3d/o3d_assets/samples/convert_assets/teapot.zip)', 'selenium_screenshots%': 0, + 'cb_service%': 'none', 'conditions' : [ # These have to come first because GYP doesn't like it when # they're part of the same conditional as a conditions clause that diff --git a/o3d/core/cross/canvas.cc b/o3d/core/cross/canvas.cc index 7e8f975..07bb4a5 100644 --- a/o3d/core/cross/canvas.cc +++ b/o3d/core/cross/canvas.cc @@ -39,7 +39,7 @@ #include "core/cross/error.h" #include "core/cross/features.h" -#include "third_party/skia/include/core/SkPath.h" +#include "SkPath.h" namespace o3d { diff --git a/o3d/core/cross/canvas.h b/o3d/core/cross/canvas.h index 0c86be9..44691fb 100644 --- a/o3d/core/cross/canvas.h +++ b/o3d/core/cross/canvas.h @@ -41,8 +41,8 @@ #include "core/cross/param.h" #include "core/cross/texture.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "third_party/skia/include/core/SkCanvas.h" +#include "SkBitmap.h" +#include "SkCanvas.h" namespace o3d { diff --git a/o3d/core/cross/canvas_paint.cc b/o3d/core/cross/canvas_paint.cc index fc7e55e..08c5c2e 100644 --- a/o3d/core/cross/canvas_paint.cc +++ b/o3d/core/cross/canvas_paint.cc @@ -36,12 +36,12 @@ #include "core/cross/canvas_utils.h" #include "core/cross/client.h" -#include "third_party/skia/include/core/SkCanvas.h" -#include "third_party/skia/include/core/SkColor.h" -#include "third_party/skia/include/core/SkDrawLooper.h" -#include "third_party/skia/include/core/SkPaint.h" -#include "third_party/skia/include/core/SkTypeface.h" -#include "third_party/skia/include/effects/SkBlurDrawLooper.h" +#include "SkCanvas.h" +#include "SkColor.h" +#include "SkDrawLooper.h" +#include "SkPaint.h" +#include "SkTypeface.h" +#include "SkBlurDrawLooper.h" namespace o3d { diff --git a/o3d/core/cross/canvas_paint.h b/o3d/core/cross/canvas_paint.h index aaec72a..8475f93 100644 --- a/o3d/core/cross/canvas_paint.h +++ b/o3d/core/cross/canvas_paint.h @@ -39,7 +39,7 @@ #include "core/cross/param.h" #include "core/cross/canvas_shader.h" -#include "third_party/skia/include/core/SkPaint.h" +#include "SkPaint.h" namespace o3d { diff --git a/o3d/core/cross/canvas_shader.cc b/o3d/core/cross/canvas_shader.cc index a102e28..dc05e5f 100644 --- a/o3d/core/cross/canvas_shader.cc +++ b/o3d/core/cross/canvas_shader.cc @@ -37,8 +37,8 @@ #include "core/cross/canvas_utils.h" #include "core/cross/error.h" -#include "third_party/skia/include/core/SkShader.h" -#include "third_party/skia/include/effects/SkGradientShader.h" +#include "SkShader.h" +#include "SkGradientShader.h" namespace o3d { diff --git a/o3d/core/cross/canvas_shader.h b/o3d/core/cross/canvas_shader.h index cf9fd0b..fbc689e 100644 --- a/o3d/core/cross/canvas_shader.h +++ b/o3d/core/cross/canvas_shader.h @@ -40,8 +40,8 @@ #include "core/cross/param_object.h" #include "core/cross/param.h" -#include "third_party/skia/include/core/SkColor.h" -#include "third_party/skia/include/core/SkPoint.h" +#include "SkColor.h" +#include "SkPoint.h" class SkShader; diff --git a/o3d/core/cross/canvas_utils.h b/o3d/core/cross/canvas_utils.h index 87ce013..c43d1ea 100644 --- a/o3d/core/cross/canvas_utils.h +++ b/o3d/core/cross/canvas_utils.h @@ -34,7 +34,7 @@ #define O3D_CORE_CROSS_CANVAS_UTILS_H_ #include "core/cross/float_n.h" -#include "third_party/skia/include/core/SkColor.h" +#include "SkColor.h" // Helper function to convert from Float4 to an SkColor static SkColor Float4ToSkColor(const o3d::Float4& color) { diff --git a/o3d/samples/multiple-clients.html b/o3d/samples/multiple-clients.html index 94a2129..a8993e78 100644 --- a/o3d/samples/multiple-clients.html +++ b/o3d/samples/multiple-clients.html @@ -94,23 +94,10 @@ function init() { } g_num_clients = ii; - var chromeWorkaround = o3djs.base.IsChrome10(); // wait for the browser to settle down. var clearId = window.setInterval(function() { var element = document.o3d0 if (!element.o3d) { - if (chromeWorkaround) { - if (element.style.width != '60px') { - element.style.width = '60px'; - } else { - element.style.width = '1px'; - } - } - return; - } - if (chromeWorkaround && element.style.width != '60px') { - // The plugin has loaded but it may not be the right size yet. - element.style.width = '60px'; return; } window.clearInterval(clearId); diff --git a/o3d/samples/o3djs/base.js b/o3d/samples/o3djs/base.js index 30657bb..e7765c4 100644 --- a/o3d/samples/o3djs/base.js +++ b/o3d/samples/o3djs/base.js @@ -793,11 +793,3 @@ o3djs.base.IsMSIE = function() { var msie = /msie/.test(ua) && !/opera/.test(ua); return msie; }; -/** - * Returns true if the user's browser is Chrome 1.0, that requires a workaround - * to create the plugin. - * @return {boolean} true if the user's browser is Chrome 1.0. - */ -o3djs.base.IsChrome10 = function() { - return navigator.userAgent.indexOf('Chrome/1.0') >= 0; -}; diff --git a/o3d/samples/o3djs/util.js b/o3d/samples/o3djs/util.js index 88f797b..2c9ad61 100644 --- a/o3d/samples/o3djs/util.js +++ b/o3d/samples/o3djs/util.js @@ -927,95 +927,76 @@ o3djs.util.makeClients = function(callback, } } - // Chrome 1.0 sometimes doesn't create the plugin instance. To work - // around this, force a re-layout by changing the plugin size until it - // is loaded. We toggle between 1 pixel and 100% until the plugin has - // loaded. - var chromeWorkaround = o3djs.base.IsChrome10(); - { - // Wait for the browser to initialize the clients. - var clearId = window.setInterval(function() { - var initStatus = 0; - var error = ''; - var o3d; + // Wait for the browser to initialize the clients. + var clearId = window.setInterval(function() { + var initStatus = 0; + var error = ''; + var o3d; + for (var cc = 0; cc < clientElements.length; ++cc) { + var element = clientElements[cc]; + o3d = element.o3d; + var ready = o3d && + element.client && + element.client.rendererInitStatus > + o3djs.util.rendererInitStatus.UNINITIALIZED; + if (!ready) { + return; + } + var status = clientElements[cc].client.rendererInitStatus; + // keep the highest status. This is the worst status. + if (status > initStatus) { + initStatus = status; + error = clientElements[cc].client.lastError; + } + } + + window.clearInterval(clearId); + + // If the plugin could not initialize the graphics delete all of + // the plugin objects + if (initStatus > 0 && initStatus != o3d.Renderer.SUCCESS) { for (var cc = 0; cc < clientElements.length; ++cc) { - var element = clientElements[cc]; - o3d = element.o3d; - var ready = o3d && - element.client && - element.client.rendererInitStatus > - o3djs.util.rendererInitStatus.UNINITIALIZED; - if (!ready) { - if (chromeWorkaround) { - if (element.style.width != '100%') { - element.style.width = '100%'; - } else { - element.style.width = '1px'; - } - } - return; - } - if (chromeWorkaround && element.style.width != '100%') { - // The plugin has loaded but it may not be the right size yet. - element.style.width = '100%'; - return; - } - var status = clientElements[cc].client.rendererInitStatus; - // keep the highest status. This is the worst status. - if (status > initStatus) { - initStatus = status; - error = clientElements[cc].client.lastError; - } + var clientElement = clientElements[cc]; + clientElement.parentNode.removeChild(clientElement); } + opt_failureCallback(initStatus, error, opt_id, opt_tag); + } else { + o3djs.base.snapshotProvidedNamespaces(); - window.clearInterval(clearId); + // TODO: Is this needed with the new event code? + for (var cc = 0; cc < clientElements.length; ++cc) { + o3djs.base.initV8(clientElements[cc]); + o3djs.event.startKeyboardEventSynthesis(clientElements[cc]); + o3djs.error.setDefaultErrorHandler(clientElements[cc].client); + } + o3djs.base.init(clientElements[0]); + + switch (o3djs.util.mainEngine_) { + case o3djs.util.Engine.BROWSER: + callback(clientElements); + break; + case o3djs.util.Engine.V8: + if (!mainClientElement) { + throw 'V8 engine was requested but there is no element with' + + ' the id "o3d"'; + } - // If the plugin could not initialize the graphics delete all of - // the plugin objects - if (initStatus > 0 && initStatus != o3d.Renderer.SUCCESS) { - for (var cc = 0; cc < clientElements.length; ++cc) { - var clientElement = clientElements[cc]; - clientElement.parentNode.removeChild(clientElement); - } - opt_failureCallback(initStatus, error, opt_id, opt_tag); - } else { - o3djs.base.snapshotProvidedNamespaces(); - - // TODO: Is this needed with the new event code? - for (var cc = 0; cc < clientElements.length; ++cc) { - o3djs.base.initV8(clientElements[cc]); - o3djs.event.startKeyboardEventSynthesis(clientElements[cc]); - o3djs.error.setDefaultErrorHandler(clientElements[cc].client); - } - o3djs.base.init(clientElements[0]); - - switch (o3djs.util.mainEngine_) { - case o3djs.util.Engine.BROWSER: - callback(clientElements); - break; - case o3djs.util.Engine.V8: - if (!mainClientElement) { - throw 'V8 engine was requested but there is no element with' + - ' the id "o3d"'; - } - - // Retreive the code from the script tags and eval it in V8 to - // duplicate the browser environment. - var scriptTagText = o3djs.util.getScriptTagText_(); - mainClientElement.eval(scriptTagText); - - // Invoke the vallback in V8. - o3djs.util.callV8(mainClientElement, - callback, - o3djs.global, - [clientElements]); - break; - default: - throw 'Unknown engine ' + o3djs.util.mainEngine_; - } + // Retreive the code from the script tags and eval it in V8 to + // duplicate the browser environment. + var scriptTagText = o3djs.util.getScriptTagText_(); + mainClientElement.eval(scriptTagText); + + // Invoke the vallback in V8. + o3djs.util.callV8(mainClientElement, + callback, + o3djs.global, + [clientElements]); + break; + default: + throw 'Unknown engine ' + o3djs.util.mainEngine_; } - }, 10); - } + } + }, 10); } }; |