| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 272 |
| 273 void RenderWidgetHostViewAura::SetTooltipText(const string16& tooltip_text) { | 273 void RenderWidgetHostViewAura::SetTooltipText(const string16& tooltip_text) { |
| 274 tooltip_ = tooltip_text; | 274 tooltip_ = tooltip_text; |
| 275 } | 275 } |
| 276 | 276 |
| 277 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( | 277 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( |
| 278 const gfx::Size& size) { | 278 const gfx::Size& size) { |
| 279 return new BackingStoreSkia(host_, size); | 279 return new BackingStoreSkia(host_, size); |
| 280 } | 280 } |
| 281 | 281 |
| 282 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
| 283 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 284 int gpu_host_id) { |
| 285 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 286 window_->layer()->SetExternalTexture( |
| 287 accelerated_surface_containers_[params.surface_id]->GetTexture()); |
| 288 glFlush(); |
| 289 |
| 290 if (!window_->layer()->GetCompositor()) { |
| 291 // We have no compositor, so we have no way to display the surface |
| 292 // Must still send the ACK. |
| 293 AcknowledgeSwapBuffers(params.route_id, gpu_host_id); |
| 294 } else { |
| 295 window_->layer()->ScheduleDraw(); |
| 296 |
| 297 // Add sending an ACK to the list of things to do OnCompositingEnded |
| 298 on_compositing_ended_callbacks_.push_back( |
| 299 base::Bind(AcknowledgeSwapBuffers, params.route_id, gpu_host_id)); |
| 300 ui::Compositor* compositor = window_->layer()->GetCompositor(); |
| 301 if (!compositor->HasObserver(this)) |
| 302 compositor->AddObserver(this); |
| 303 } |
| 304 #else |
| 305 NOTREACHED(); |
| 306 #endif |
| 307 } |
| 308 |
| 282 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 309 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 283 void RenderWidgetHostViewAura::AcceleratedSurfaceNew( | 310 void RenderWidgetHostViewAura::AcceleratedSurfaceNew( |
| 284 int32 width, | 311 int32 width, |
| 285 int32 height, | 312 int32 height, |
| 286 uint64* surface_id, | 313 uint64* surface_id, |
| 287 TransportDIB::Handle* surface_handle) { | 314 TransportDIB::Handle* surface_handle) { |
| 288 scoped_refptr<AcceleratedSurfaceContainerLinux> surface( | 315 scoped_refptr<AcceleratedSurfaceContainerLinux> surface( |
| 289 AcceleratedSurfaceContainerLinux::Create(gfx::Size(width, height))); | 316 AcceleratedSurfaceContainerLinux::Create(gfx::Size(width, height))); |
| 290 if (!surface->Initialize(surface_id)) { | 317 if (!surface->Initialize(surface_id)) { |
| 291 LOG(ERROR) << "Failed to create AcceleratedSurfaceContainer"; | 318 LOG(ERROR) << "Failed to create AcceleratedSurfaceContainer"; |
| 292 return; | 319 return; |
| 293 } | 320 } |
| 294 *surface_handle = surface->Handle(); | 321 *surface_handle = surface->Handle(); |
| 295 | 322 |
| 296 accelerated_surface_containers_[*surface_id] = surface; | 323 accelerated_surface_containers_[*surface_id] = surface; |
| 297 } | 324 } |
| 298 | 325 |
| 299 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | |
| 300 uint64 surface_id, | |
| 301 int32 route_id, | |
| 302 int gpu_host_id) { | |
| 303 window_->layer()->SetExternalTexture( | |
| 304 accelerated_surface_containers_[surface_id]->GetTexture()); | |
| 305 glFlush(); | |
| 306 | |
| 307 if (!window_->layer()->GetCompositor()) { | |
| 308 // We have no compositor, so we have no way to display the surface | |
| 309 AcknowledgeSwapBuffers(route_id, gpu_host_id); // Must still send the ACK | |
| 310 } else { | |
| 311 window_->layer()->ScheduleDraw(); | |
| 312 | |
| 313 // Add sending an ACK to the list of things to do OnCompositingEnded | |
| 314 on_compositing_ended_callbacks_.push_back( | |
| 315 base::Bind(AcknowledgeSwapBuffers, route_id, gpu_host_id)); | |
| 316 ui::Compositor* compositor = window_->layer()->GetCompositor(); | |
| 317 if (!compositor->HasObserver(this)) | |
| 318 compositor->AddObserver(this); | |
| 319 } | |
| 320 } | |
| 321 | |
| 322 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease(uint64 surface_id) { | 326 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease(uint64 surface_id) { |
| 323 accelerated_surface_containers_.erase(surface_id); | 327 accelerated_surface_containers_.erase(surface_id); |
| 324 } | 328 } |
| 325 #endif | 329 #endif |
| 326 | 330 |
| 327 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { | 331 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { |
| 328 RenderWidgetHostView::SetBackground(background); | 332 RenderWidgetHostView::SetBackground(background); |
| 329 host_->SetBackground(background); | 333 host_->SetBackground(background); |
| 330 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 334 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 331 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque()); | 335 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque()); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 aura::Desktop* desktop = aura::Desktop::GetInstance(); | 542 aura::Desktop* desktop = aura::Desktop::GetInstance(); |
| 539 if (desktop->GetEventHandlerForPoint(screen_point) != window_) | 543 if (desktop->GetEventHandlerForPoint(screen_point) != window_) |
| 540 return; | 544 return; |
| 541 | 545 |
| 542 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); | 546 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); |
| 543 if (is_loading_ && cursor == aura::kCursorPointer) | 547 if (is_loading_ && cursor == aura::kCursorPointer) |
| 544 cursor = aura::kCursorProgress; | 548 cursor = aura::kCursorProgress; |
| 545 | 549 |
| 546 aura::Desktop::GetInstance()->SetCursor(cursor); | 550 aura::Desktop::GetInstance()->SetCursor(cursor); |
| 547 } | 551 } |
| OLD | NEW |