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) { | |
jonathan.backer
2011/11/03 23:09:07
Bad merge? Diff shows edit in place below. Can we
| |
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 #endif | |
305 } | |
306 | |
282 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 307 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
283 void RenderWidgetHostViewAura::AcceleratedSurfaceNew( | 308 void RenderWidgetHostViewAura::AcceleratedSurfaceNew( |
284 int32 width, | 309 int32 width, |
285 int32 height, | 310 int32 height, |
286 uint64* surface_id, | 311 uint64* surface_id, |
287 TransportDIB::Handle* surface_handle) { | 312 TransportDIB::Handle* surface_handle) { |
288 scoped_refptr<AcceleratedSurfaceContainerLinux> surface( | 313 scoped_refptr<AcceleratedSurfaceContainerLinux> surface( |
289 AcceleratedSurfaceContainerLinux::Create(gfx::Size(width, height))); | 314 AcceleratedSurfaceContainerLinux::Create(gfx::Size(width, height))); |
290 if (!surface->Initialize(surface_id)) { | 315 if (!surface->Initialize(surface_id)) { |
291 LOG(ERROR) << "Failed to create AcceleratedSurfaceContainer"; | 316 LOG(ERROR) << "Failed to create AcceleratedSurfaceContainer"; |
292 return; | 317 return; |
293 } | 318 } |
294 *surface_handle = surface->Handle(); | 319 *surface_handle = surface->Handle(); |
295 | 320 |
296 accelerated_surface_containers_[*surface_id] = surface; | 321 accelerated_surface_containers_[*surface_id] = surface; |
297 } | 322 } |
298 | 323 |
299 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | 324 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
300 uint64 surface_id, | 325 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
301 int32 route_id, | |
302 int gpu_host_id) { | 326 int gpu_host_id) { |
303 window_->layer()->SetExternalTexture( | 327 window_->layer()->SetExternalTexture( |
304 accelerated_surface_containers_[surface_id]->GetTexture()); | 328 accelerated_surface_containers_[params.surface_id]->GetTexture()); |
305 glFlush(); | 329 glFlush(); |
306 | 330 |
307 if (!window_->layer()->GetCompositor()) { | 331 if (!window_->layer()->GetCompositor()) { |
308 // We have no compositor, so we have no way to display the surface | 332 // 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 | 333 // Must still send the ACK. |
334 AcknowledgeSwapBuffers(params.route_id, gpu_host_id); | |
310 } else { | 335 } else { |
311 window_->layer()->ScheduleDraw(); | 336 window_->layer()->ScheduleDraw(); |
312 | 337 |
313 // Add sending an ACK to the list of things to do OnCompositingEnded | 338 // Add sending an ACK to the list of things to do OnCompositingEnded |
314 on_compositing_ended_callbacks_.push_back( | 339 on_compositing_ended_callbacks_.push_back( |
315 base::Bind(AcknowledgeSwapBuffers, route_id, gpu_host_id)); | 340 base::Bind(AcknowledgeSwapBuffers, params.route_id, gpu_host_id)); |
316 ui::Compositor* compositor = window_->layer()->GetCompositor(); | 341 ui::Compositor* compositor = window_->layer()->GetCompositor(); |
317 if (!compositor->HasObserver(this)) | 342 if (!compositor->HasObserver(this)) |
318 compositor->AddObserver(this); | 343 compositor->AddObserver(this); |
319 } | 344 } |
320 } | 345 } |
321 | 346 |
322 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease(uint64 surface_id) { | 347 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease(uint64 surface_id) { |
323 accelerated_surface_containers_.erase(surface_id); | 348 accelerated_surface_containers_.erase(surface_id); |
324 } | 349 } |
325 #endif | 350 #endif |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
538 aura::Desktop* desktop = aura::Desktop::GetInstance(); | 563 aura::Desktop* desktop = aura::Desktop::GetInstance(); |
539 if (desktop->GetEventHandlerForPoint(screen_point) != window_) | 564 if (desktop->GetEventHandlerForPoint(screen_point) != window_) |
540 return; | 565 return; |
541 | 566 |
542 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); | 567 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); |
543 if (is_loading_ && cursor == aura::kCursorPointer) | 568 if (is_loading_ && cursor == aura::kCursorPointer) |
544 cursor = aura::kCursorProgress; | 569 cursor = aura::kCursorProgress; |
545 | 570 |
546 aura::Desktop::GetInstance()->SetCursor(cursor); | 571 aura::Desktop::GetInstance()->SetCursor(cursor); |
547 } | 572 } |
OLD | NEW |