| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/renderer_host/render_widget_host.h" | 5 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 Send(new ViewMsg_Repaint(routing_id_, current_size_)); | 384 Send(new ViewMsg_Repaint(routing_id_, current_size_)); |
| 385 } | 385 } |
| 386 | 386 |
| 387 // When we have asked the RenderWidget to resize, and we are still waiting on | 387 // When we have asked the RenderWidget to resize, and we are still waiting on |
| 388 // a response, block for a little while to see if we can't get a response | 388 // a response, block for a little while to see if we can't get a response |
| 389 // before returning the old (incorrectly sized) backing store. | 389 // before returning the old (incorrectly sized) backing store. |
| 390 if (resize_ack_pending_ || !backing_store) { | 390 if (resize_ack_pending_ || !backing_store) { |
| 391 IPC::Message msg; | 391 IPC::Message msg; |
| 392 TimeDelta max_delay = TimeDelta::FromMilliseconds(kPaintMsgTimeoutMS); | 392 TimeDelta max_delay = TimeDelta::FromMilliseconds(kPaintMsgTimeoutMS); |
| 393 if (process_->WaitForUpdateMsg(routing_id_, max_delay, &msg)) { | 393 if (process_->WaitForUpdateMsg(routing_id_, max_delay, &msg)) { |
| 394 ViewHostMsg_UpdateRect::Dispatch( | 394 OnMessageReceived(msg); |
| 395 &msg, this, &RenderWidgetHost::OnMsgUpdateRect); | |
| 396 backing_store = BackingStoreManager::GetBackingStore(this, current_size_); | 395 backing_store = BackingStoreManager::GetBackingStore(this, current_size_); |
| 397 } | 396 } |
| 398 } | 397 } |
| 399 | 398 |
| 400 return backing_store; | 399 return backing_store; |
| 401 } | 400 } |
| 402 | 401 |
| 403 BackingStore* RenderWidgetHost::AllocBackingStore(const gfx::Size& size) { | 402 BackingStore* RenderWidgetHost::AllocBackingStore(const gfx::Size& size) { |
| 404 if (!view_) | 403 if (!view_) |
| 405 return NULL; | 404 return NULL; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 420 repaint_start_time_ = TimeTicks::Now(); | 419 repaint_start_time_ = TimeTicks::Now(); |
| 421 repaint_ack_pending_ = true; | 420 repaint_ack_pending_ = true; |
| 422 Send(new ViewMsg_Repaint(routing_id_, current_size_)); | 421 Send(new ViewMsg_Repaint(routing_id_, current_size_)); |
| 423 } | 422 } |
| 424 | 423 |
| 425 // When we have asked the RenderWidget to resize, and we are still waiting on | 424 // When we have asked the RenderWidget to resize, and we are still waiting on |
| 426 // a response, block for a little while to see if we can't get a response. | 425 // a response, block for a little while to see if we can't get a response. |
| 427 // We always block on response because we do not have a backing store. | 426 // We always block on response because we do not have a backing store. |
| 428 IPC::Message msg; | 427 IPC::Message msg; |
| 429 TimeDelta max_delay = TimeDelta::FromMilliseconds(kPaintMsgTimeoutMS); | 428 TimeDelta max_delay = TimeDelta::FromMilliseconds(kPaintMsgTimeoutMS); |
| 430 if (process_->WaitForUpdateMsg(routing_id_, max_delay, &msg)) { | 429 if (process_->WaitForUpdateMsg(routing_id_, max_delay, &msg)) |
| 431 ViewHostMsg_UpdateRect::Dispatch( | 430 OnMessageReceived(msg); |
| 432 &msg, this, &RenderWidgetHost::OnMsgUpdateRect); | |
| 433 } | |
| 434 } | 431 } |
| 435 | 432 |
| 436 void RenderWidgetHost::StartHangMonitorTimeout(TimeDelta delay) { | 433 void RenderWidgetHost::StartHangMonitorTimeout(TimeDelta delay) { |
| 437 if (CommandLine::ForCurrentProcess()->HasSwitch( | 434 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 438 switches::kDisableHangMonitor)) { | 435 switches::kDisableHangMonitor)) { |
| 439 return; | 436 return; |
| 440 } | 437 } |
| 441 | 438 |
| 442 // If we already have a timer that will expire at or before the given delay, | 439 // If we already have a timer that will expire at or before the given delay, |
| 443 // then we have nothing more to do now. If we have set our end time to null | 440 // then we have nothing more to do now. If we have set our end time to null |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 return; | 1238 return; |
| 1242 | 1239 |
| 1243 for (int i = 0; i < static_cast<int>(deferred_plugin_handles_.size()); i++) { | 1240 for (int i = 0; i < static_cast<int>(deferred_plugin_handles_.size()); i++) { |
| 1244 #if defined(TOOLKIT_USES_GTK) | 1241 #if defined(TOOLKIT_USES_GTK) |
| 1245 view_->CreatePluginContainer(deferred_plugin_handles_[i]); | 1242 view_->CreatePluginContainer(deferred_plugin_handles_[i]); |
| 1246 #endif | 1243 #endif |
| 1247 } | 1244 } |
| 1248 | 1245 |
| 1249 deferred_plugin_handles_.clear(); | 1246 deferred_plugin_handles_.clear(); |
| 1250 } | 1247 } |
| OLD | NEW |