OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "content/renderer/browser_plugin/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/browser_plugin.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 BrowserPlugin::BrowserPlugin( | 69 BrowserPlugin::BrowserPlugin( |
70 RenderViewImpl* render_view, | 70 RenderViewImpl* render_view, |
71 WebKit::WebFrame* frame, | 71 WebKit::WebFrame* frame, |
72 const WebPluginParams& params) | 72 const WebPluginParams& params) |
73 : guest_instance_id_(browser_plugin::kInstanceIDNone), | 73 : guest_instance_id_(browser_plugin::kInstanceIDNone), |
74 attached_(false), | 74 attached_(false), |
75 render_view_(render_view->AsWeakPtr()), | 75 render_view_(render_view->AsWeakPtr()), |
76 render_view_routing_id_(render_view->GetRoutingID()), | 76 render_view_routing_id_(render_view->GetRoutingID()), |
77 container_(NULL), | 77 container_(NULL), |
78 damage_buffer_sequence_id_(0), | 78 damage_buffer_sequence_id_(0), |
79 resize_ack_received_(true), | 79 paint_ack_received_(true), |
80 last_device_scale_factor_(1.0f), | 80 last_device_scale_factor_(1.0f), |
81 sad_guest_(NULL), | 81 sad_guest_(NULL), |
82 guest_crashed_(false), | 82 guest_crashed_(false), |
83 auto_size_ack_pending_(false), | 83 is_auto_size_state_dirty_(false), |
84 persist_storage_(false), | 84 persist_storage_(false), |
85 valid_partition_id_(true), | 85 valid_partition_id_(true), |
86 content_window_routing_id_(MSG_ROUTING_NONE), | 86 content_window_routing_id_(MSG_ROUTING_NONE), |
87 plugin_focused_(false), | 87 plugin_focused_(false), |
88 visible_(true), | 88 visible_(true), |
89 before_first_navigation_(true), | 89 before_first_navigation_(true), |
90 mouse_locked_(false), | 90 mouse_locked_(false), |
91 browser_plugin_manager_(render_view->GetBrowserPluginManager()), | 91 browser_plugin_manager_(render_view->GetBrowserPluginManager()), |
92 compositing_enabled_(false), | 92 compositing_enabled_(false), |
93 weak_ptr_factory_(this) { | 93 weak_ptr_factory_(this) { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 288 } |
289 | 289 |
290 browser_plugin_manager()->Send( | 290 browser_plugin_manager()->Send( |
291 new BrowserPluginHostMsg_NavigateGuest(render_view_routing_id_, | 291 new BrowserPluginHostMsg_NavigateGuest(render_view_routing_id_, |
292 guest_instance_id_, | 292 guest_instance_id_, |
293 src)); | 293 src)); |
294 return true; | 294 return true; |
295 } | 295 } |
296 | 296 |
297 void BrowserPlugin::ParseAutoSizeAttribute() { | 297 void BrowserPlugin::ParseAutoSizeAttribute() { |
298 auto_size_ack_pending_ = true; | 298 is_auto_size_state_dirty_ = true; |
299 last_view_size_ = plugin_rect_.size(); | 299 last_view_size_ = plugin_rect_.size(); |
300 UpdateGuestAutoSizeState(GetAutoSizeAttribute()); | 300 UpdateGuestAutoSizeState(GetAutoSizeAttribute()); |
301 } | 301 } |
302 | 302 |
303 void BrowserPlugin::PopulateAutoSizeParameters( | 303 void BrowserPlugin::PopulateAutoSizeParameters( |
304 BrowserPluginHostMsg_AutoSize_Params* params, bool current_auto_size) { | 304 BrowserPluginHostMsg_AutoSize_Params* params, bool auto_size_enabled) { |
305 params->enable = current_auto_size; | 305 params->enable = auto_size_enabled; |
306 // No need to populate the params if autosize is off. | 306 // No need to populate the params if autosize is off. |
307 if (current_auto_size) { | 307 if (auto_size_enabled) { |
308 params->max_size = gfx::Size(GetAdjustedMaxWidth(), GetAdjustedMaxHeight()); | 308 params->max_size = gfx::Size(GetAdjustedMaxWidth(), GetAdjustedMaxHeight()); |
309 params->min_size = gfx::Size(GetAdjustedMinWidth(), GetAdjustedMinHeight()); | 309 params->min_size = gfx::Size(GetAdjustedMinWidth(), GetAdjustedMinHeight()); |
| 310 |
| 311 if (max_auto_size_ != params->max_size) |
| 312 is_auto_size_state_dirty_ = true; |
| 313 |
| 314 max_auto_size_ = params->max_size; |
| 315 } else { |
| 316 max_auto_size_ = gfx::Size(); |
310 } | 317 } |
311 } | 318 } |
312 | 319 |
313 void BrowserPlugin::UpdateGuestAutoSizeState(bool current_auto_size) { | 320 void BrowserPlugin::UpdateGuestAutoSizeState(bool auto_size_enabled) { |
314 // If we haven't yet heard back from the guest about the last resize request, | 321 // If we haven't yet heard back from the guest about the last resize request, |
315 // then we don't issue another request until we do in | 322 // then we don't issue another request until we do in |
316 // BrowserPlugin::UpdateRect. | 323 // BrowserPlugin::UpdateRect. |
317 if (!HasGuestInstanceID() || !resize_ack_received_) | 324 if (!HasGuestInstanceID() || !paint_ack_received_) |
318 return; | 325 return; |
319 BrowserPluginHostMsg_AutoSize_Params auto_size_params; | 326 BrowserPluginHostMsg_AutoSize_Params auto_size_params; |
320 BrowserPluginHostMsg_ResizeGuest_Params resize_guest_params; | 327 BrowserPluginHostMsg_ResizeGuest_Params resize_guest_params; |
321 if (current_auto_size) { | 328 if (auto_size_enabled) { |
322 GetDamageBufferWithSizeParams(&auto_size_params, &resize_guest_params); | 329 GetDamageBufferWithSizeParams(&auto_size_params, |
| 330 &resize_guest_params, |
| 331 true); |
323 } else { | 332 } else { |
324 GetDamageBufferWithSizeParams(NULL, &resize_guest_params); | 333 GetDamageBufferWithSizeParams(NULL, &resize_guest_params, true); |
325 } | 334 } |
326 resize_ack_received_ = false; | 335 paint_ack_received_ = false; |
327 browser_plugin_manager()->Send( | 336 browser_plugin_manager()->Send( |
328 new BrowserPluginHostMsg_SetAutoSize(render_view_routing_id_, | 337 new BrowserPluginHostMsg_SetAutoSize(render_view_routing_id_, |
329 guest_instance_id_, | 338 guest_instance_id_, |
330 auto_size_params, | 339 auto_size_params, |
331 resize_guest_params)); | 340 resize_guest_params)); |
332 } | 341 } |
333 | 342 |
334 // static | 343 // static |
335 bool BrowserPlugin::UsesDamageBuffer( | 344 bool BrowserPlugin::UsesDamageBuffer( |
336 const BrowserPluginMsg_UpdateRect_Params& params) { | 345 const BrowserPluginMsg_UpdateRect_Params& params) { |
(...skipping 21 matching lines...) Expand all Loading... |
358 | 367 |
359 void BrowserPlugin::Attach(scoped_ptr<base::DictionaryValue> extra_params) { | 368 void BrowserPlugin::Attach(scoped_ptr<base::DictionaryValue> extra_params) { |
360 BrowserPluginHostMsg_Attach_Params attach_params; | 369 BrowserPluginHostMsg_Attach_Params attach_params; |
361 attach_params.focused = ShouldGuestBeFocused(); | 370 attach_params.focused = ShouldGuestBeFocused(); |
362 attach_params.visible = visible_; | 371 attach_params.visible = visible_; |
363 attach_params.name = GetNameAttribute(); | 372 attach_params.name = GetNameAttribute(); |
364 attach_params.storage_partition_id = storage_partition_id_; | 373 attach_params.storage_partition_id = storage_partition_id_; |
365 attach_params.persist_storage = persist_storage_; | 374 attach_params.persist_storage = persist_storage_; |
366 attach_params.src = GetSrcAttribute(); | 375 attach_params.src = GetSrcAttribute(); |
367 GetDamageBufferWithSizeParams(&attach_params.auto_size_params, | 376 GetDamageBufferWithSizeParams(&attach_params.auto_size_params, |
368 &attach_params.resize_guest_params); | 377 &attach_params.resize_guest_params, |
| 378 false); |
369 | 379 |
370 browser_plugin_manager()->Send( | 380 browser_plugin_manager()->Send( |
371 new BrowserPluginHostMsg_Attach(render_view_routing_id_, | 381 new BrowserPluginHostMsg_Attach(render_view_routing_id_, |
372 guest_instance_id_, attach_params, | 382 guest_instance_id_, attach_params, |
373 *extra_params)); | 383 *extra_params)); |
374 } | 384 } |
375 | 385 |
376 void BrowserPlugin::DidCommitCompositorFrame() { | 386 void BrowserPlugin::DidCommitCompositorFrame() { |
377 if (compositing_helper_.get()) | 387 if (compositing_helper_.get()) |
378 compositing_helper_->DidCommitCompositorFrame(); | 388 compositing_helper_->DidCommitCompositorFrame(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 // damage buffer then we know the guest will no longer use the current | 501 // damage buffer then we know the guest will no longer use the current |
492 // damage buffer. At this point, we drop the current damage buffer, and | 502 // damage buffer. At this point, we drop the current damage buffer, and |
493 // mark the pending damage buffer as the current damage buffer. | 503 // mark the pending damage buffer as the current damage buffer. |
494 if (UsesPendingDamageBuffer(params)) { | 504 if (UsesPendingDamageBuffer(params)) { |
495 SwapDamageBuffers(); | 505 SwapDamageBuffers(); |
496 use_new_damage_buffer = true; | 506 use_new_damage_buffer = true; |
497 } | 507 } |
498 | 508 |
499 bool auto_size = GetAutoSizeAttribute(); | 509 bool auto_size = GetAutoSizeAttribute(); |
500 // We receive a resize ACK in regular mode, but not in autosize. | 510 // We receive a resize ACK in regular mode, but not in autosize. |
501 // In SW, |resize_ack_received_| is reset in SwapDamageBuffers(). | 511 // In SW, |paint_ack_received_| is reset in SwapDamageBuffers(). |
502 // In HW mode, we need to do it here so we can continue sending | 512 // In HW mode, we need to do it here so we can continue sending |
503 // resize messages when needed. | 513 // resize messages when needed. |
504 if (params.is_resize_ack || | 514 if (params.is_resize_ack || |
505 (!params.needs_ack && (auto_size || auto_size_ack_pending_))) { | 515 (!params.needs_ack && (auto_size || is_auto_size_state_dirty_))) { |
506 resize_ack_received_ = true; | 516 paint_ack_received_ = true; |
507 } | 517 } |
508 | 518 |
509 auto_size_ack_pending_ = false; | 519 bool was_auto_size_state_dirty = auto_size && is_auto_size_state_dirty_; |
| 520 is_auto_size_state_dirty_ = false; |
510 | 521 |
511 if ((!auto_size && (width() != params.view_size.width() || | 522 if ((!auto_size && (width() != params.view_size.width() || |
512 height() != params.view_size.height())) || | 523 height() != params.view_size.height())) || |
513 (auto_size && (!InAutoSizeBounds(params.view_size))) || | 524 (auto_size && was_auto_size_state_dirty) || |
514 GetDeviceScaleFactor() != params.scale_factor) { | 525 GetDeviceScaleFactor() != params.scale_factor) { |
515 // We are HW accelerated, render widget does not expect an ack, | 526 // We are HW accelerated, render widget does not expect an ack, |
516 // but we still need to update the size. | 527 // but we still need to update the size. |
517 if (!params.needs_ack) { | 528 if (!params.needs_ack) { |
518 UpdateGuestAutoSizeState(auto_size); | 529 UpdateGuestAutoSizeState(auto_size); |
519 return; | 530 return; |
520 } | 531 } |
521 | 532 |
522 if (!resize_ack_received_) { | 533 if (!paint_ack_received_) { |
523 // The guest has not yet responded to the last resize request, and | 534 // The guest has not yet responded to the last resize request, and |
524 // so we don't want to do anything at this point other than ACK the guest. | 535 // so we don't want to do anything at this point other than ACK the guest. |
525 if (auto_size) | 536 if (auto_size) |
526 PopulateAutoSizeParameters(&auto_size_params, auto_size); | 537 PopulateAutoSizeParameters(&auto_size_params, auto_size); |
527 } else { | 538 } else { |
528 // If we have no pending damage buffer, then the guest has not caught up | 539 // If we have no pending damage buffer, then the guest has not caught up |
529 // with the BrowserPlugin container. We now tell the guest about the new | 540 // with the BrowserPlugin container. We now tell the guest about the new |
530 // container size. | 541 // container size. |
531 if (auto_size) { | 542 if (auto_size) { |
532 GetDamageBufferWithSizeParams(&auto_size_params, | 543 GetDamageBufferWithSizeParams(&auto_size_params, |
533 &resize_guest_params); | 544 &resize_guest_params, |
| 545 was_auto_size_state_dirty); |
534 } else { | 546 } else { |
535 GetDamageBufferWithSizeParams(NULL, &resize_guest_params); | 547 GetDamageBufferWithSizeParams(NULL, |
| 548 &resize_guest_params, |
| 549 was_auto_size_state_dirty); |
536 } | 550 } |
537 } | 551 } |
538 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UpdateRect_ACK( | 552 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UpdateRect_ACK( |
539 render_view_routing_id_, | 553 render_view_routing_id_, |
540 guest_instance_id_, | 554 guest_instance_id_, |
541 true, | 555 true, |
542 auto_size_params, | 556 auto_size_params, |
543 resize_guest_params)); | 557 resize_guest_params)); |
544 return; | 558 return; |
545 } | 559 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 ParseSrcAttribute(&error); | 754 ParseSrcAttribute(&error); |
741 } | 755 } |
742 | 756 |
743 float BrowserPlugin::GetDeviceScaleFactor() const { | 757 float BrowserPlugin::GetDeviceScaleFactor() const { |
744 if (!render_view_.get()) | 758 if (!render_view_.get()) |
745 return 1.0f; | 759 return 1.0f; |
746 return render_view_->GetWebView()->deviceScaleFactor(); | 760 return render_view_->GetWebView()->deviceScaleFactor(); |
747 } | 761 } |
748 | 762 |
749 void BrowserPlugin::UpdateDeviceScaleFactor(float device_scale_factor) { | 763 void BrowserPlugin::UpdateDeviceScaleFactor(float device_scale_factor) { |
750 if (last_device_scale_factor_ == device_scale_factor || !resize_ack_received_) | 764 if (last_device_scale_factor_ == device_scale_factor || !paint_ack_received_) |
751 return; | 765 return; |
752 | 766 |
753 BrowserPluginHostMsg_ResizeGuest_Params params; | 767 BrowserPluginHostMsg_ResizeGuest_Params params; |
754 PopulateResizeGuestParameters(¶ms, plugin_rect()); | 768 PopulateResizeGuestParameters(¶ms, plugin_rect(), false); |
755 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( | 769 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( |
756 render_view_routing_id_, | 770 render_view_routing_id_, |
757 guest_instance_id_, | 771 guest_instance_id_, |
758 params)); | 772 params)); |
759 } | 773 } |
760 | 774 |
761 void BrowserPlugin::TriggerEvent(const std::string& event_name, | 775 void BrowserPlugin::TriggerEvent(const std::string& event_name, |
762 std::map<std::string, base::Value*>* props) { | 776 std::map<std::string, base::Value*>* props) { |
763 if (!container()) | 777 if (!container()) |
764 return; | 778 return; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 compositing_helper_ = | 867 compositing_helper_ = |
854 new BrowserPluginCompositingHelper(container_, | 868 new BrowserPluginCompositingHelper(container_, |
855 browser_plugin_manager(), | 869 browser_plugin_manager(), |
856 guest_instance_id_, | 870 guest_instance_id_, |
857 render_view_routing_id_); | 871 render_view_routing_id_); |
858 } | 872 } |
859 } else { | 873 } else { |
860 // We're switching back to the software path. We create a new damage | 874 // We're switching back to the software path. We create a new damage |
861 // buffer that can accommodate the current size of the container. | 875 // buffer that can accommodate the current size of the container. |
862 BrowserPluginHostMsg_ResizeGuest_Params params; | 876 BrowserPluginHostMsg_ResizeGuest_Params params; |
863 PopulateResizeGuestParameters(¶ms, plugin_rect()); | |
864 // Request a full repaint from the guest even if its size is not actually | 877 // Request a full repaint from the guest even if its size is not actually |
865 // changing. | 878 // changing. |
866 params.repaint = true; | 879 PopulateResizeGuestParameters(¶ms, |
867 resize_ack_received_ = false; | 880 plugin_rect(), |
| 881 true /* needs_repaint */); |
| 882 paint_ack_received_ = false; |
868 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( | 883 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( |
869 render_view_routing_id_, | 884 render_view_routing_id_, |
870 guest_instance_id_, | 885 guest_instance_id_, |
871 params)); | 886 params)); |
872 } | 887 } |
873 compositing_helper_->EnableCompositing(enable); | 888 compositing_helper_->EnableCompositing(enable); |
874 } | 889 } |
875 | 890 |
876 void BrowserPlugin::destroy() { | 891 void BrowserPlugin::destroy() { |
877 // If the plugin was initialized then it has a valid |npp_| identifier, and | 892 // If the plugin was initialized then it has a valid |npp_| identifier, and |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 const WebRect& clip_rect, | 1016 const WebRect& clip_rect, |
1002 const WebVector<WebRect>& cut_outs_rects, | 1017 const WebVector<WebRect>& cut_outs_rects, |
1003 bool is_visible) { | 1018 bool is_visible) { |
1004 int old_width = width(); | 1019 int old_width = width(); |
1005 int old_height = height(); | 1020 int old_height = height(); |
1006 plugin_rect_ = window_rect; | 1021 plugin_rect_ = window_rect; |
1007 if (!attached()) | 1022 if (!attached()) |
1008 return; | 1023 return; |
1009 | 1024 |
1010 // In AutoSize mode, guests don't care when the BrowserPlugin container is | 1025 // In AutoSize mode, guests don't care when the BrowserPlugin container is |
1011 // resized. If |!resize_ack_received_|, then we are still waiting on a | 1026 // resized. If |!paint_ack_received_|, then we are still waiting on a |
1012 // previous resize to be ACK'ed and so we don't issue additional resizes | 1027 // previous resize to be ACK'ed and so we don't issue additional resizes |
1013 // until the previous one is ACK'ed. | 1028 // until the previous one is ACK'ed. |
1014 // TODO(mthiesse): Assess the performance of calling GetAutoSizeAttribute() on | 1029 // TODO(mthiesse): Assess the performance of calling GetAutoSizeAttribute() on |
1015 // resize. | 1030 // resize. |
1016 if (!resize_ack_received_ || | 1031 if (!paint_ack_received_ || |
1017 (old_width == window_rect.width && old_height == window_rect.height) || | 1032 (old_width == window_rect.width && old_height == window_rect.height) || |
1018 GetAutoSizeAttribute()) { | 1033 GetAutoSizeAttribute()) { |
1019 // Let the browser know about the updated view rect. | 1034 // Let the browser know about the updated view rect. |
1020 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UpdateGeometry( | 1035 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UpdateGeometry( |
1021 render_view_routing_id_, guest_instance_id_, plugin_rect_)); | 1036 render_view_routing_id_, guest_instance_id_, plugin_rect_)); |
1022 return; | 1037 return; |
1023 } | 1038 } |
1024 | 1039 |
1025 BrowserPluginHostMsg_ResizeGuest_Params params; | 1040 BrowserPluginHostMsg_ResizeGuest_Params params; |
1026 PopulateResizeGuestParameters(¶ms, plugin_rect()); | 1041 PopulateResizeGuestParameters(¶ms, plugin_rect(), false); |
1027 resize_ack_received_ = false; | 1042 paint_ack_received_ = false; |
1028 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( | 1043 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( |
1029 render_view_routing_id_, | 1044 render_view_routing_id_, |
1030 guest_instance_id_, | 1045 guest_instance_id_, |
1031 params)); | 1046 params)); |
1032 } | 1047 } |
1033 | 1048 |
1034 void BrowserPlugin::SwapDamageBuffers() { | 1049 void BrowserPlugin::SwapDamageBuffers() { |
1035 current_damage_buffer_.reset(pending_damage_buffer_.release()); | 1050 current_damage_buffer_.reset(pending_damage_buffer_.release()); |
1036 resize_ack_received_ = true; | 1051 paint_ack_received_ = true; |
1037 } | 1052 } |
1038 | 1053 |
1039 void BrowserPlugin::PopulateResizeGuestParameters( | 1054 void BrowserPlugin::PopulateResizeGuestParameters( |
1040 BrowserPluginHostMsg_ResizeGuest_Params* params, | 1055 BrowserPluginHostMsg_ResizeGuest_Params* params, |
1041 const gfx::Rect& view_rect) { | 1056 const gfx::Rect& view_rect, |
| 1057 bool needs_repaint) { |
1042 params->size_changed = true; | 1058 params->size_changed = true; |
1043 params->view_rect = view_rect; | 1059 params->view_rect = view_rect; |
| 1060 params->repaint = needs_repaint; |
1044 params->scale_factor = GetDeviceScaleFactor(); | 1061 params->scale_factor = GetDeviceScaleFactor(); |
1045 if (last_device_scale_factor_ != params->scale_factor){ | 1062 if (last_device_scale_factor_ != params->scale_factor){ |
1046 params->repaint = true; | 1063 params->repaint = true; |
1047 last_device_scale_factor_ = params->scale_factor; | 1064 last_device_scale_factor_ = params->scale_factor; |
1048 } | 1065 } |
1049 | 1066 |
1050 // In HW compositing mode, we do not need a damage buffer. | 1067 // In HW compositing mode, we do not need a damage buffer. |
1051 if (compositing_enabled_) | 1068 if (compositing_enabled_) |
1052 return; | 1069 return; |
1053 | 1070 |
(...skipping 10 matching lines...) Expand all Loading... |
1064 params->damage_buffer_size = size; | 1081 params->damage_buffer_size = size; |
1065 pending_damage_buffer_.reset( | 1082 pending_damage_buffer_.reset( |
1066 CreateDamageBuffer(size, ¶ms->damage_buffer_handle)); | 1083 CreateDamageBuffer(size, ¶ms->damage_buffer_handle)); |
1067 if (!pending_damage_buffer_) | 1084 if (!pending_damage_buffer_) |
1068 NOTREACHED(); | 1085 NOTREACHED(); |
1069 params->damage_buffer_sequence_id = ++damage_buffer_sequence_id_; | 1086 params->damage_buffer_sequence_id = ++damage_buffer_sequence_id_; |
1070 } | 1087 } |
1071 | 1088 |
1072 void BrowserPlugin::GetDamageBufferWithSizeParams( | 1089 void BrowserPlugin::GetDamageBufferWithSizeParams( |
1073 BrowserPluginHostMsg_AutoSize_Params* auto_size_params, | 1090 BrowserPluginHostMsg_AutoSize_Params* auto_size_params, |
1074 BrowserPluginHostMsg_ResizeGuest_Params* resize_guest_params) { | 1091 BrowserPluginHostMsg_ResizeGuest_Params* resize_guest_params, |
1075 if (auto_size_params) | 1092 bool needs_repaint) { |
| 1093 if (auto_size_params) { |
1076 PopulateAutoSizeParameters(auto_size_params, GetAutoSizeAttribute()); | 1094 PopulateAutoSizeParameters(auto_size_params, GetAutoSizeAttribute()); |
| 1095 } else { |
| 1096 max_auto_size_ = gfx::Size(); |
| 1097 } |
1077 gfx::Size view_size = (auto_size_params && auto_size_params->enable) ? | 1098 gfx::Size view_size = (auto_size_params && auto_size_params->enable) ? |
1078 auto_size_params->max_size : gfx::Size(width(), height()); | 1099 auto_size_params->max_size : gfx::Size(width(), height()); |
1079 if (view_size.IsEmpty()) | 1100 if (view_size.IsEmpty()) |
1080 return; | 1101 return; |
1081 resize_ack_received_ = false; | 1102 paint_ack_received_ = false; |
1082 gfx::Rect view_rect = gfx::Rect(plugin_rect_.origin(), view_size); | 1103 gfx::Rect view_rect = gfx::Rect(plugin_rect_.origin(), view_size); |
1083 PopulateResizeGuestParameters(resize_guest_params, view_rect); | 1104 PopulateResizeGuestParameters(resize_guest_params, view_rect, needs_repaint); |
1084 } | 1105 } |
1085 | 1106 |
1086 #if defined(OS_POSIX) | 1107 #if defined(OS_POSIX) |
1087 base::SharedMemory* BrowserPlugin::CreateDamageBuffer( | 1108 base::SharedMemory* BrowserPlugin::CreateDamageBuffer( |
1088 const size_t size, | 1109 const size_t size, |
1089 base::SharedMemoryHandle* damage_buffer_handle) { | 1110 base::SharedMemoryHandle* damage_buffer_handle) { |
1090 scoped_ptr<base::SharedMemory> shared_buf( | 1111 scoped_ptr<base::SharedMemory> shared_buf( |
1091 content::RenderThread::Get()->HostAllocateSharedMemoryBuffer( | 1112 content::RenderThread::Get()->HostAllocateSharedMemoryBuffer( |
1092 size).release()); | 1113 size).release()); |
1093 | 1114 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 const WebKit::WebMouseEvent& event) { | 1300 const WebKit::WebMouseEvent& event) { |
1280 browser_plugin_manager()->Send( | 1301 browser_plugin_manager()->Send( |
1281 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, | 1302 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, |
1282 guest_instance_id_, | 1303 guest_instance_id_, |
1283 plugin_rect_, | 1304 plugin_rect_, |
1284 &event)); | 1305 &event)); |
1285 return true; | 1306 return true; |
1286 } | 1307 } |
1287 | 1308 |
1288 } // namespace content | 1309 } // namespace content |
OLD | NEW |