| 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/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/renderer_host/backing_store_skia.h" | 8 #include "content/browser/renderer_host/backing_store_skia.h" |
| 9 #include "content/browser/renderer_host/render_widget_host.h" | 9 #include "content/browser/renderer_host/render_widget_host.h" |
| 10 #include "content/browser/renderer_host/web_input_event_aura.h" | 10 #include "content/browser/renderer_host/web_input_event_aura.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( | 271 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( |
| 272 const gfx::Size& size) { | 272 const gfx::Size& size) { |
| 273 return new BackingStoreSkia(host_, size); | 273 return new BackingStoreSkia(host_, size); |
| 274 } | 274 } |
| 275 | 275 |
| 276 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { | 276 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { |
| 277 } | 277 } |
| 278 | 278 |
| 279 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | 279 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
| 280 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 280 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 281 int gpu_host_id) { | 281 int gpu_host_id) { |
| 282 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 282 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 283 window_->layer()->SetExternalTexture( | 283 window_->layer()->SetExternalTexture( |
| 284 accelerated_surface_containers_[params.surface_id]->GetTexture()); | 284 accelerated_surface_containers_[params.surface_id]->GetTexture()); |
| 285 glFlush(); | 285 glFlush(); |
| 286 | 286 |
| 287 if (!window_->layer()->GetCompositor()) { | 287 if (!window_->layer()->GetCompositor()) { |
| 288 // We have no compositor, so we have no way to display the surface. | 288 // We have no compositor, so we have no way to display the surface. |
| 289 // Must still send the ACK. | 289 // Must still send the ACK. |
| 290 host_->AcknowledgeSwapBuffers(params.route_id, gpu_host_id); | 290 RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id); |
| 291 } else { | 291 } else { |
| 292 window_->layer()->ScheduleDraw(); | 292 window_->layer()->ScheduleDraw(); |
| 293 | 293 |
| 294 // Add sending an ACK to the list of things to do OnCompositingEnded | 294 // Add sending an ACK to the list of things to do OnCompositingEnded |
| 295 on_compositing_ended_callbacks_.push_back( | 295 on_compositing_ended_callbacks_.push_back( |
| 296 base::Bind(&RenderWidgetHost::AcknowledgeSwapBuffers, | 296 base::Bind(&RenderWidgetHost::AcknowledgeSwapBuffers, |
| 297 base::Unretained(host_), params.route_id, gpu_host_id)); | 297 params.route_id, gpu_host_id)); |
| 298 ui::Compositor* compositor = window_->layer()->GetCompositor(); | 298 ui::Compositor* compositor = window_->layer()->GetCompositor(); |
| 299 if (!compositor->HasObserver(this)) | 299 if (!compositor->HasObserver(this)) |
| 300 compositor->AddObserver(this); | 300 compositor->AddObserver(this); |
| 301 } |
| 302 #else |
| 303 NOTREACHED(); |
| 304 #endif |
| 305 } |
| 306 |
| 307 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( |
| 308 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
| 309 int gpu_host_id) { |
| 310 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 311 window_->layer()->SetExternalTexture( |
| 312 accelerated_surface_containers_[params.surface_id]->GetTexture()); |
| 313 glFlush(); |
| 314 |
| 315 if (!window_->layer()->GetCompositor()) { |
| 316 // We have no compositor, so we have no way to display the surface |
| 317 // Must still send the ACK |
| 318 RenderWidgetHost::AcknowledgePostSubBuffer(params.route_id, gpu_host_id); |
| 319 } else { |
| 320 // TODO(backer): Plumb the damage rect to the ui compositor so that we |
| 321 // can do a partial swap to display. |
| 322 window_->layer()->ScheduleDraw(); |
| 323 |
| 324 // Add sending an ACK to the list of things to do OnCompositingEnded |
| 325 on_compositing_ended_callbacks_.push_back( |
| 326 base::Bind(&RenderWidgetHost::AcknowledgePostSubBuffer, |
| 327 params.route_id, gpu_host_id)); |
| 328 ui::Compositor* compositor = window_->layer()->GetCompositor(); |
| 329 if (!compositor->HasObserver(this)) |
| 330 compositor->AddObserver(this); |
| 301 } | 331 } |
| 302 #else | 332 #else |
| 303 NOTREACHED(); | 333 NOTREACHED(); |
| 304 #endif | 334 #endif |
| 305 } | 335 } |
| 306 | 336 |
| 307 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 337 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 308 void RenderWidgetHostViewAura::AcceleratedSurfaceNew( | 338 void RenderWidgetHostViewAura::AcceleratedSurfaceNew( |
| 309 int32 width, | 339 int32 width, |
| 310 int32 height, | 340 int32 height, |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 // static | 570 // static |
| 541 void RenderWidgetHostView::GetDefaultScreenInfo( | 571 void RenderWidgetHostView::GetDefaultScreenInfo( |
| 542 WebKit::WebScreenInfo* results) { | 572 WebKit::WebScreenInfo* results) { |
| 543 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); | 573 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); |
| 544 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); | 574 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
| 545 results->availableRect = results->rect; | 575 results->availableRect = results->rect; |
| 546 // TODO(derat): Don't hardcode this? | 576 // TODO(derat): Don't hardcode this? |
| 547 results->depth = 24; | 577 results->depth = 24; |
| 548 results->depthPerComponent = 8; | 578 results->depthPerComponent = 8; |
| 549 } | 579 } |
| OLD | NEW |