summaryrefslogtreecommitdiffstats
path: root/o3d/core
diff options
context:
space:
mode:
authormaf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 23:33:21 +0000
committermaf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 23:33:21 +0000
commitf44ea0d6f8a6da9b98ecfe3fc30235ef65e28635 (patch)
tree438d764fb3ab89a93ee91d3764c053abf701ade0 /o3d/core
parent26cd5c815ddc94fe643cb7acf23731d2a2d80915 (diff)
downloadchromium_src-f44ea0d6f8a6da9b98ecfe3fc30235ef65e28635.zip
chromium_src-f44ea0d6f8a6da9b98ecfe3fc30235ef65e28635.tar.gz
chromium_src-f44ea0d6f8a6da9b98ecfe3fc30235ef65e28635.tar.bz2
Add a boolean parameter to Client::RenderClient() to choose whether to
make the javascript render callback or not. Generally you want to pass true, but if the render is happening in non-windowed mode (eg on a Mac) and is in response to an update event rather than a timer, it can be useful to pass false to prevent the javascript code triggering another update and causing an infinite calback loop. Case in point is the custom camera example, which modifies some HTML form text fields on render callback, which on Firefox causes a plugin invalidation and round and round we would go. Review URL: http://codereview.chromium.org/159181 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r--o3d/core/cross/client.cc5
-rw-r--r--o3d/core/cross/client.h12
2 files changed, 13 insertions, 4 deletions
diff --git a/o3d/core/cross/client.cc b/o3d/core/cross/client.cc
index b6b103c..ed5fea3 100644
--- a/o3d/core/cross/client.cc
+++ b/o3d/core/cross/client.cc
@@ -210,7 +210,7 @@ void Client::ClearLostResourcesCallback() {
}
}
-void Client::RenderClient() {
+void Client::RenderClient(bool send_callback) {
ElapsedTimeTimer timer;
rendering_ = true;
render_tree_called_ = false;
@@ -223,7 +223,8 @@ void Client::RenderClient() {
counter_manager_.AdvanceRenderFrameCounters(1.0f);
profiler_->ProfileStart("Render callback");
- render_callback_manager_.Run(render_event_);
+ if (send_callback)
+ render_callback_manager_.Run(render_event_);
profiler_->ProfileStop("Render callback");
if (!render_tree_called_) {
diff --git a/o3d/core/cross/client.h b/o3d/core/cross/client.h
index 0f20172..16ffbf4 100644
--- a/o3d/core/cross/client.h
+++ b/o3d/core/cross/client.h
@@ -248,8 +248,16 @@ class Client {
// This is the function anything hosting the client, like a plugin, should
// call to render.
// Parameters:
- // None
- void RenderClient();
+ // send_callback : whether to make the javascript render callback.
+ // Generally you want to pass true, but if the render is happening
+ // in non-windowed mode (eg on a Mac) and is in response to an update
+ // event rather than a timer, it can be useful to pass false to prevent
+ // the javascript code triggering another update and causing an infinite
+ // calback loop. Case in point is the custom camera example, which
+ // modifies some HTML form text fields on render callback, which on
+ // Firefox causes a plugin invalidation and round and round we would
+ // go.
+ void RenderClient(bool send_callback);
// Sets the texture to use when a Texture or Sampler is missing while
// rendering. If you set it to NULL you'll get an error if you try to render