| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 handling_input_event_(false), | 81 handling_input_event_(false), |
| 82 closing_(false), | 82 closing_(false), |
| 83 is_swapped_out_(false), | 83 is_swapped_out_(false), |
| 84 input_method_is_active_(false), | 84 input_method_is_active_(false), |
| 85 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 85 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 86 can_compose_inline_(true), | 86 can_compose_inline_(true), |
| 87 popup_type_(popup_type), | 87 popup_type_(popup_type), |
| 88 pending_window_rect_count_(0), | 88 pending_window_rect_count_(0), |
| 89 suppress_next_char_events_(false), | 89 suppress_next_char_events_(false), |
| 90 is_accelerated_compositing_active_(false), | 90 is_accelerated_compositing_active_(false), |
| 91 compositing_surface_(gfx::kNullPluginWindow), | |
| 92 animation_update_pending_(false), | 91 animation_update_pending_(false), |
| 93 animation_task_posted_(false), | 92 animation_task_posted_(false), |
| 94 invalidation_task_posted_(false) { | 93 invalidation_task_posted_(false) { |
| 95 RenderProcess::current()->AddRefProcess(); | 94 RenderProcess::current()->AddRefProcess(); |
| 96 DCHECK(render_thread_); | 95 DCHECK(render_thread_); |
| 97 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( | 96 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( |
| 98 switches::kDisableGpuVsync); | 97 switches::kDisableGpuVsync); |
| 99 } | 98 } |
| 100 | 99 |
| 101 RenderWidget::~RenderWidget() { | 100 RenderWidget::~RenderWidget() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // when we receive ViewMsg_Close. | 156 // when we receive ViewMsg_Close. |
| 158 AddRef(); | 157 AddRef(); |
| 159 } else { | 158 } else { |
| 160 DCHECK(false); | 159 DCHECK(false); |
| 161 } | 160 } |
| 162 } | 161 } |
| 163 | 162 |
| 164 // This is used to complete pending inits and non-pending inits. For non- | 163 // This is used to complete pending inits and non-pending inits. For non- |
| 165 // pending cases, the parent will be the same as the current parent. This | 164 // pending cases, the parent will be the same as the current parent. This |
| 166 // indicates we do not need to reparent or anything. | 165 // indicates we do not need to reparent or anything. |
| 167 void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd, | 166 void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd) { |
| 168 gfx::PluginWindowHandle compositing_surface) { | |
| 169 DCHECK(routing_id_ != MSG_ROUTING_NONE); | 167 DCHECK(routing_id_ != MSG_ROUTING_NONE); |
| 170 | 168 |
| 171 host_window_ = parent_hwnd; | 169 host_window_ = parent_hwnd; |
| 172 compositing_surface_ = compositing_surface; | |
| 173 | 170 |
| 174 Send(new ViewHostMsg_RenderViewReady(routing_id_)); | 171 Send(new ViewHostMsg_RenderViewReady(routing_id_)); |
| 175 } | 172 } |
| 176 | 173 |
| 177 void RenderWidget::SetSwappedOut(bool is_swapped_out) { | 174 void RenderWidget::SetSwappedOut(bool is_swapped_out) { |
| 178 // We should only toggle between states. | 175 // We should only toggle between states. |
| 179 DCHECK(is_swapped_out_ != is_swapped_out); | 176 DCHECK(is_swapped_out_ != is_swapped_out); |
| 180 is_swapped_out_ = is_swapped_out; | 177 is_swapped_out_ = is_swapped_out; |
| 181 | 178 |
| 182 // If we are swapping out, we will call ReleaseProcess, allowing the process | 179 // If we are swapping out, we will call ReleaseProcess, allowing the process |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // If given a messsage without a routing ID, then assign our routing ID. | 224 // If given a messsage without a routing ID, then assign our routing ID. |
| 228 if (message->routing_id() == MSG_ROUTING_NONE) | 225 if (message->routing_id() == MSG_ROUTING_NONE) |
| 229 message->set_routing_id(routing_id_); | 226 message->set_routing_id(routing_id_); |
| 230 | 227 |
| 231 return render_thread_->Send(message); | 228 return render_thread_->Send(message); |
| 232 } | 229 } |
| 233 | 230 |
| 234 // Got a response from the browser after the renderer decided to create a new | 231 // Got a response from the browser after the renderer decided to create a new |
| 235 // view. | 232 // view. |
| 236 void RenderWidget::OnCreatingNewAck( | 233 void RenderWidget::OnCreatingNewAck( |
| 237 gfx::NativeViewId parent, | 234 gfx::NativeViewId parent) { |
| 238 gfx::PluginWindowHandle compositing_surface) { | |
| 239 DCHECK(routing_id_ != MSG_ROUTING_NONE); | 235 DCHECK(routing_id_ != MSG_ROUTING_NONE); |
| 240 | 236 |
| 241 CompleteInit(parent, compositing_surface); | 237 CompleteInit(parent); |
| 242 } | 238 } |
| 243 | 239 |
| 244 void RenderWidget::OnClose() { | 240 void RenderWidget::OnClose() { |
| 245 if (closing_) | 241 if (closing_) |
| 246 return; | 242 return; |
| 247 closing_ = true; | 243 closing_ = true; |
| 248 | 244 |
| 249 // Browser correspondence is no longer needed at this point. | 245 // Browser correspondence is no longer needed at this point. |
| 250 if (routing_id_ != MSG_ROUTING_NONE) { | 246 if (routing_id_ != MSG_ROUTING_NONE) { |
| 251 render_thread_->RemoveRoute(routing_id_); | 247 render_thread_->RemoveRoute(routing_id_); |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 | 1369 |
| 1374 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { | 1370 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { |
| 1375 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); | 1371 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); |
| 1376 i != plugin_window_moves_.end(); ++i) { | 1372 i != plugin_window_moves_.end(); ++i) { |
| 1377 if (i->window == window) { | 1373 if (i->window == window) { |
| 1378 plugin_window_moves_.erase(i); | 1374 plugin_window_moves_.erase(i); |
| 1379 break; | 1375 break; |
| 1380 } | 1376 } |
| 1381 } | 1377 } |
| 1382 } | 1378 } |
| OLD | NEW |