| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 selection_end_rect_ = end_rect; | 417 selection_end_rect_ = end_rect; |
| 418 | 418 |
| 419 GetInputMethod()->OnCaretBoundsChanged(this); | 419 GetInputMethod()->OnCaretBoundsChanged(this); |
| 420 } | 420 } |
| 421 | 421 |
| 422 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( | 422 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( |
| 423 const gfx::Size& size) { | 423 const gfx::Size& size) { |
| 424 return new BackingStoreSkia(host_, size); | 424 return new BackingStoreSkia(host_, size); |
| 425 } | 425 } |
| 426 | 426 |
| 427 bool RenderWidgetHostViewAura::CopyFromCompositingSurface( | 427 void RenderWidgetHostViewAura::CopyFromCompositingSurface( |
| 428 const gfx::Size& size, | |
| 429 skia::PlatformCanvas* output) { | |
| 430 ui::Compositor* compositor = GetCompositor(); | |
| 431 if (!compositor) | |
| 432 return false; | |
| 433 | |
| 434 ImageTransportClient* container = image_transport_clients_[current_surface_]; | |
| 435 if (!container) | |
| 436 return false; | |
| 437 | |
| 438 if (!output->initialize(size.width(), size.height(), true)) | |
| 439 return false; | |
| 440 | |
| 441 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | |
| 442 content::GLHelper* gl_helper = factory->GetGLHelper(compositor); | |
| 443 if (!gl_helper) | |
| 444 return false; | |
| 445 | |
| 446 unsigned char* addr = static_cast<unsigned char*>( | |
| 447 output->getTopDevice()->accessBitmap(true).getPixels()); | |
| 448 return gl_helper->CopyTextureTo(container->texture_id(), | |
| 449 container->size(), | |
| 450 size, | |
| 451 addr); | |
| 452 } | |
| 453 | |
| 454 void RenderWidgetHostViewAura::AsyncCopyFromCompositingSurface( | |
| 455 const gfx::Size& size, | 428 const gfx::Size& size, |
| 456 skia::PlatformCanvas* output, | 429 skia::PlatformCanvas* output, |
| 457 base::Callback<void(bool)> callback) { | 430 base::Callback<void(bool)> callback) { |
| 458 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 431 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
| 459 ui::Compositor* compositor = GetCompositor(); | 432 ui::Compositor* compositor = GetCompositor(); |
| 460 if (!compositor) | 433 if (!compositor) |
| 461 return; | 434 return; |
| 462 | 435 |
| 463 ImageTransportClient* container = image_transport_clients_[current_surface_]; | 436 ImageTransportClient* container = image_transport_clients_[current_surface_]; |
| 464 if (!container) | 437 if (!container) |
| 465 return; | 438 return; |
| 466 | 439 |
| 467 if (!output->initialize(size.width(), size.height(), true)) | 440 if (!output->initialize(size.width(), size.height(), true)) |
| 468 return; | 441 return; |
| 469 | 442 |
| 470 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 443 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 471 content::GLHelper* gl_helper = factory->GetGLHelper(compositor); | 444 content::GLHelper* gl_helper = factory->GetGLHelper(compositor); |
| 472 if (!gl_helper) | 445 if (!gl_helper) |
| 473 return; | 446 return; |
| 474 | 447 |
| 475 scoped_callback_runner.Release(); | |
| 476 unsigned char* addr = static_cast<unsigned char*>( | 448 unsigned char* addr = static_cast<unsigned char*>( |
| 477 output->getTopDevice()->accessBitmap(true).getPixels()); | 449 output->getTopDevice()->accessBitmap(true).getPixels()); |
| 450 scoped_callback_runner.Release(); |
| 478 gl_helper->AsyncCopyTextureTo(container->texture_id(), | 451 gl_helper->AsyncCopyTextureTo(container->texture_id(), |
| 479 container->size(), | 452 container->size(), |
| 480 size, | 453 size, |
| 481 addr, | 454 addr, |
| 482 callback); | 455 callback); |
| 483 } | 456 } |
| 484 | 457 |
| 485 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { | 458 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { |
| 486 // Delay UpdateExternalTexture until we actually got a software frame. | 459 // Delay UpdateExternalTexture until we actually got a software frame. |
| 487 // Sometimes (e.g. on a page load) the renderer will spuriously disable then | 460 // Sometimes (e.g. on a page load) the renderer will spuriously disable then |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | 1274 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( |
| 1302 RenderWidgetHost* widget) { | 1275 RenderWidgetHost* widget) { |
| 1303 return new RenderWidgetHostViewAura(widget); | 1276 return new RenderWidgetHostViewAura(widget); |
| 1304 } | 1277 } |
| 1305 | 1278 |
| 1306 // static | 1279 // static |
| 1307 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( | 1280 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
| 1308 WebKit::WebScreenInfo* results) { | 1281 WebKit::WebScreenInfo* results) { |
| 1309 GetScreenInfoForWindow(results, NULL); | 1282 GetScreenInfoForWindow(results, NULL); |
| 1310 } | 1283 } |
| OLD | NEW |