| 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 uint32 output_surface_id, | 316 uint32 output_surface_id, |
| 317 int renderer_host_id, | 317 int renderer_host_id, |
| 318 const gpu::Mailbox& received_mailbox, | 318 const gpu::Mailbox& received_mailbox, |
| 319 const gfx::Size& received_size, | 319 const gfx::Size& received_size, |
| 320 bool skip_frame, | 320 bool skip_frame, |
| 321 const scoped_refptr<ui::Texture>& texture_to_produce) { | 321 const scoped_refptr<ui::Texture>& texture_to_produce) { |
| 322 cc::CompositorFrameAck ack; | 322 cc::CompositorFrameAck ack; |
| 323 ack.gl_frame_data.reset(new cc::GLFrameData()); | 323 ack.gl_frame_data.reset(new cc::GLFrameData()); |
| 324 DCHECK(!texture_to_produce.get() || !skip_frame); | 324 DCHECK(!texture_to_produce.get() || !skip_frame); |
| 325 if (texture_to_produce.get()) { | 325 if (texture_to_produce.get()) { |
| 326 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
| 326 std::string mailbox_name = texture_to_produce->Produce(); | 327 std::string mailbox_name = texture_to_produce->Produce(); |
| 327 std::copy(mailbox_name.data(), | 328 std::copy(mailbox_name.data(), |
| 328 mailbox_name.data() + mailbox_name.length(), | 329 mailbox_name.data() + mailbox_name.length(), |
| 329 reinterpret_cast<char*>(ack.gl_frame_data->mailbox.name)); | 330 reinterpret_cast<char*>(ack.gl_frame_data->mailbox.name)); |
| 330 ack.gl_frame_data->size = texture_to_produce->size(); | 331 ack.gl_frame_data->size = texture_to_produce->size(); |
| 331 ack.gl_frame_data->sync_point = | 332 ack.gl_frame_data->sync_point = |
| 332 content::ImageTransportFactory::GetInstance()->InsertSyncPoint(); | 333 gl_helper ? gl_helper->InsertSyncPoint() : 0; |
| 333 } else if (skip_frame) { | 334 } else if (skip_frame) { |
| 334 // Skip the frame, i.e. tell the producer to reuse the same buffer that | 335 // Skip the frame, i.e. tell the producer to reuse the same buffer that |
| 335 // we just received. | 336 // we just received. |
| 336 ack.gl_frame_data->size = received_size; | 337 ack.gl_frame_data->size = received_size; |
| 337 ack.gl_frame_data->mailbox = received_mailbox; | 338 ack.gl_frame_data->mailbox = received_mailbox; |
| 338 } | 339 } |
| 339 | 340 |
| 340 RenderWidgetHostImpl::SendSwapCompositorFrameAck( | 341 RenderWidgetHostImpl::SendSwapCompositorFrameAck( |
| 341 route_id, output_surface_id, renderer_host_id, ack); | 342 route_id, output_surface_id, renderer_host_id, ack); |
| 342 } | 343 } |
| 343 | 344 |
| 344 void AcknowledgeBufferForGpu( | 345 void AcknowledgeBufferForGpu( |
| 345 int32 route_id, | 346 int32 route_id, |
| 346 int gpu_host_id, | 347 int gpu_host_id, |
| 347 const std::string& received_mailbox, | 348 const std::string& received_mailbox, |
| 348 bool skip_frame, | 349 bool skip_frame, |
| 349 const scoped_refptr<ui::Texture>& texture_to_produce) { | 350 const scoped_refptr<ui::Texture>& texture_to_produce) { |
| 350 AcceleratedSurfaceMsg_BufferPresented_Params ack; | 351 AcceleratedSurfaceMsg_BufferPresented_Params ack; |
| 351 uint32 sync_point = 0; | 352 uint32 sync_point = 0; |
| 352 DCHECK(!texture_to_produce.get() || !skip_frame); | 353 DCHECK(!texture_to_produce.get() || !skip_frame); |
| 353 if (texture_to_produce.get()) { | 354 if (texture_to_produce.get()) { |
| 355 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
| 354 ack.mailbox_name = texture_to_produce->Produce(); | 356 ack.mailbox_name = texture_to_produce->Produce(); |
| 355 sync_point = | 357 sync_point = gl_helper ? gl_helper->InsertSyncPoint() : 0; |
| 356 content::ImageTransportFactory::GetInstance()->InsertSyncPoint(); | |
| 357 } else if (skip_frame) { | 358 } else if (skip_frame) { |
| 358 ack.mailbox_name = received_mailbox; | 359 ack.mailbox_name = received_mailbox; |
| 359 ack.sync_point = 0; | 360 ack.sync_point = 0; |
| 360 } | 361 } |
| 361 | 362 |
| 362 ack.sync_point = sync_point; | 363 ack.sync_point = sync_point; |
| 363 RenderWidgetHostImpl::AcknowledgeBufferPresent( | 364 RenderWidgetHostImpl::AcknowledgeBufferPresent( |
| 364 route_id, gpu_host_id, ack); | 365 route_id, gpu_host_id, ack); |
| 365 } | 366 } |
| 366 | 367 |
| (...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 &SendCompositorFrameAck, | 1632 &SendCompositorFrameAck, |
| 1632 host_->GetRoutingID(), output_surface_id, host_->GetProcess()->GetID(), | 1633 host_->GetRoutingID(), output_surface_id, host_->GetProcess()->GetID(), |
| 1633 frame->gl_frame_data->mailbox, frame->gl_frame_data->size); | 1634 frame->gl_frame_data->mailbox, frame->gl_frame_data->size); |
| 1634 | 1635 |
| 1635 if (!frame->gl_frame_data->sync_point) { | 1636 if (!frame->gl_frame_data->sync_point) { |
| 1636 LOG(ERROR) << "CompositorFrame without sync point. Skipping frame..."; | 1637 LOG(ERROR) << "CompositorFrame without sync point. Skipping frame..."; |
| 1637 ack_callback.Run(true, scoped_refptr<ui::Texture>()); | 1638 ack_callback.Run(true, scoped_refptr<ui::Texture>()); |
| 1638 return; | 1639 return; |
| 1639 } | 1640 } |
| 1640 | 1641 |
| 1641 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 1642 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
| 1642 factory->WaitSyncPoint(frame->gl_frame_data->sync_point); | 1643 gl_helper->WaitSyncPoint(frame->gl_frame_data->sync_point); |
| 1643 | 1644 |
| 1644 std::string mailbox_name( | 1645 std::string mailbox_name( |
| 1645 reinterpret_cast<const char*>(frame->gl_frame_data->mailbox.name), | 1646 reinterpret_cast<const char*>(frame->gl_frame_data->mailbox.name), |
| 1646 sizeof(frame->gl_frame_data->mailbox.name)); | 1647 sizeof(frame->gl_frame_data->mailbox.name)); |
| 1647 BuffersSwapped(frame->gl_frame_data->size, | 1648 BuffersSwapped(frame->gl_frame_data->size, |
| 1648 frame->gl_frame_data->sub_buffer_rect, | 1649 frame->gl_frame_data->sub_buffer_rect, |
| 1649 frame->metadata.device_scale_factor, | 1650 frame->metadata.device_scale_factor, |
| 1650 mailbox_name, | 1651 mailbox_name, |
| 1651 frame->metadata.latency_info, | 1652 frame->metadata.latency_info, |
| 1652 ack_callback); | 1653 ack_callback); |
| (...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3501 RenderWidgetHost* widget) { | 3502 RenderWidgetHost* widget) { |
| 3502 return new RenderWidgetHostViewAura(widget); | 3503 return new RenderWidgetHostViewAura(widget); |
| 3503 } | 3504 } |
| 3504 | 3505 |
| 3505 // static | 3506 // static |
| 3506 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3507 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3507 GetScreenInfoForWindow(results, NULL); | 3508 GetScreenInfoForWindow(results, NULL); |
| 3508 } | 3509 } |
| 3509 | 3510 |
| 3510 } // namespace content | 3511 } // namespace content |
| OLD | NEW |