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

Side by Side Diff: core/cross/client.cc

Issue 2451002: Prevent Client::Tick() from causing reentrancy in the plugin on Mac OS X.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/o3d/
Patch Set: '' Created 10 years, 6 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/client.h ('k') | plugin/mac/plugin_mac.mm » ('j') | 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 counter_manager_(service_locator), 75 counter_manager_(service_locator),
76 transformation_context_(service_locator), 76 transformation_context_(service_locator),
77 semantic_manager_(service_locator), 77 semantic_manager_(service_locator),
78 profiler_(service_locator), 78 profiler_(service_locator),
79 renderer_(service_locator), 79 renderer_(service_locator),
80 evaluation_counter_(service_locator), 80 evaluation_counter_(service_locator),
81 render_tree_called_(false), 81 render_tree_called_(false),
82 render_mode_(RENDERMODE_CONTINUOUS), 82 render_mode_(RENDERMODE_CONTINUOUS),
83 texture_on_hold_(false), 83 texture_on_hold_(false),
84 event_manager_(), 84 event_manager_(),
85 is_ticking_(false),
85 last_tick_time_(0), 86 last_tick_time_(0),
86 root_(NULL), 87 root_(NULL),
87 #ifdef OS_WIN 88 #ifdef OS_WIN
88 calls_(0), 89 calls_(0),
89 #endif 90 #endif
90 rendergraph_root_(NULL), 91 rendergraph_root_(NULL),
91 id_(IdManager::CreateId()) { 92 id_(IdManager::CreateId()) {
92 // Create and initialize the message queue to allow external code to 93 // Create and initialize the message queue to allow external code to
93 // communicate with the Client via RPC calls. 94 // communicate with the Client via RPC calls.
94 message_queue_.reset(new MessageQueue(service_locator_)); 95 message_queue_.reset(new MessageQueue(service_locator_));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 void Client::SetTickCallback( 169 void Client::SetTickCallback(
169 TickCallback* tick_callback) { 170 TickCallback* tick_callback) {
170 tick_callback_manager_.Set(tick_callback); 171 tick_callback_manager_.Set(tick_callback);
171 } 172 }
172 173
173 void Client::ClearTickCallback() { 174 void Client::ClearTickCallback() {
174 tick_callback_manager_.Clear(); 175 tick_callback_manager_.Clear();
175 } 176 }
176 177
177 bool Client::Tick() { 178 bool Client::Tick() {
179 is_ticking_ = true;
178 ElapsedTimeTimer timer; 180 ElapsedTimeTimer timer;
179 float seconds_elapsed = tick_elapsed_time_timer_.GetElapsedTimeAndReset(); 181 float seconds_elapsed = tick_elapsed_time_timer_.GetElapsedTimeAndReset();
180 tick_event_.set_elapsed_time(seconds_elapsed); 182 tick_event_.set_elapsed_time(seconds_elapsed);
181 profiler_->ProfileStart("Tick callback"); 183 profiler_->ProfileStart("Tick callback");
182 tick_callback_manager_.Run(tick_event_); 184 tick_callback_manager_.Run(tick_event_);
183 profiler_->ProfileStop("Tick callback"); 185 profiler_->ProfileStop("Tick callback");
184 186
185 evaluation_counter_->InvalidateAllParameters(); 187 evaluation_counter_->InvalidateAllParameters();
186 188
187 counter_manager_.AdvanceCounters(1.0f, seconds_elapsed); 189 counter_manager_.AdvanceCounters(1.0f, seconds_elapsed);
(...skipping 21 matching lines...) Expand all
209 int max_fps = renderer_->max_fps(); 211 int max_fps = renderer_->max_fps();
210 if (max_fps > 0 && 212 if (max_fps > 0 &&
211 render_mode() == RENDERMODE_ON_DEMAND && 213 render_mode() == RENDERMODE_ON_DEMAND &&
212 render_elapsed_time_timer_.GetElapsedTimeWithoutClearing() 214 render_elapsed_time_timer_.GetElapsedTimeWithoutClearing()
213 > 1.0/max_fps) { 215 > 1.0/max_fps) {
214 renderer_->set_need_to_render(true); 216 renderer_->set_need_to_render(true);
215 texture_on_hold_ = false; 217 texture_on_hold_ = false;
216 } 218 }
217 } 219 }
218 220
221 is_ticking_ = false;
219 return message_check_ok; 222 return message_check_ok;
220 } 223 }
221 224
222 // Render Methods -------------------------------------------------------------- 225 // Render Methods --------------------------------------------------------------
223 226
224 void Client::SetLostResourcesCallback(LostResourcesCallback* callback) { 227 void Client::SetLostResourcesCallback(LostResourcesCallback* callback) {
225 if (!renderer_.IsAvailable()) { 228 if (!renderer_.IsAvailable()) {
226 O3D_ERROR(service_locator_) << "No Renderer"; 229 O3D_ERROR(service_locator_) << "No Renderer";
227 } else { 230 } else {
228 renderer_->SetLostResourcesCallback(callback); 231 renderer_->SetLostResourcesCallback(callback);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 580 }
578 581
579 String Client::ProfileToString() { 582 String Client::ProfileToString() {
580 StringWriter string_writer(StringWriter::LF); 583 StringWriter string_writer(StringWriter::LF);
581 JsonWriter json_writer(&string_writer, 2); 584 JsonWriter json_writer(&string_writer, 2);
582 profiler_->Write(&json_writer); 585 profiler_->Write(&json_writer);
583 json_writer.Close(); 586 json_writer.Close();
584 return string_writer.ToString(); 587 return string_writer.ToString();
585 } 588 }
586 } // namespace o3d 589 } // namespace o3d
OLDNEW
« no previous file with comments | « core/cross/client.h ('k') | plugin/mac/plugin_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698