| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 : host_(RenderWidgetHostImpl::From(host)), | 625 : host_(RenderWidgetHostImpl::From(host)), |
| 626 window_(new aura::Window(this)), | 626 window_(new aura::Window(this)), |
| 627 in_shutdown_(false), | 627 in_shutdown_(false), |
| 628 is_fullscreen_(false), | 628 is_fullscreen_(false), |
| 629 popup_parent_host_view_(NULL), | 629 popup_parent_host_view_(NULL), |
| 630 popup_child_host_view_(NULL), | 630 popup_child_host_view_(NULL), |
| 631 is_loading_(false), | 631 is_loading_(false), |
| 632 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 632 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 633 can_compose_inline_(true), | 633 can_compose_inline_(true), |
| 634 has_composition_text_(false), | 634 has_composition_text_(false), |
| 635 last_swapped_surface_scale_factor_(1.f), |
| 635 paint_canvas_(NULL), | 636 paint_canvas_(NULL), |
| 636 synthetic_move_sent_(false), | 637 synthetic_move_sent_(false), |
| 637 accelerated_compositing_state_changed_(false), | 638 accelerated_compositing_state_changed_(false), |
| 638 can_lock_compositor_(YES), | 639 can_lock_compositor_(YES), |
| 639 cursor_visibility_state_in_renderer_(UNKNOWN), | 640 cursor_visibility_state_in_renderer_(UNKNOWN), |
| 640 paint_observer_(NULL), | 641 paint_observer_(NULL), |
| 641 touch_editing_client_(NULL) { | 642 touch_editing_client_(NULL) { |
| 642 host_->SetView(this); | 643 host_->SetView(this); |
| 643 window_observer_.reset(new WindowObserver(this)); | 644 window_observer_.reset(new WindowObserver(this)); |
| 644 aura::client::SetTooltipText(window_, &tooltip_); | 645 aura::client::SetTooltipText(window_, &tooltip_); |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 AsWeakPtr(), | 1192 AsWeakPtr(), |
| 1192 output, | 1193 output, |
| 1193 callback); | 1194 callback); |
| 1194 ++pending_thumbnail_tasks_; | 1195 ++pending_thumbnail_tasks_; |
| 1195 | 1196 |
| 1196 // Convert |src_subrect| from the views coordinate (upper-left origin) into | 1197 // Convert |src_subrect| from the views coordinate (upper-left origin) into |
| 1197 // the OpenGL coordinate (lower-left origin). | 1198 // the OpenGL coordinate (lower-left origin). |
| 1198 gfx::Rect src_subrect_in_gl = src_subrect; | 1199 gfx::Rect src_subrect_in_gl = src_subrect; |
| 1199 src_subrect_in_gl.set_y(GetViewBounds().height() - src_subrect.bottom()); | 1200 src_subrect_in_gl.set_y(GetViewBounds().height() - src_subrect.bottom()); |
| 1200 | 1201 |
| 1201 gfx::Rect src_subrect_in_pixel = ConvertRectToPixel(this, src_subrect_in_gl); | 1202 gfx::Rect src_subrect_in_pixel = |
| 1203 ConvertRectToPixel(current_surface_->device_scale_factor(), |
| 1204 src_subrect_in_gl); |
| 1202 gl_helper->CropScaleReadbackAndCleanTexture( | 1205 gl_helper->CropScaleReadbackAndCleanTexture( |
| 1203 current_surface_->PrepareTexture(), | 1206 current_surface_->PrepareTexture(), |
| 1204 current_surface_->size(), | 1207 current_surface_->size(), |
| 1205 src_subrect_in_pixel, | 1208 src_subrect_in_pixel, |
| 1206 dst_size_in_pixel, | 1209 dst_size_in_pixel, |
| 1207 addr, | 1210 addr, |
| 1208 wrapper_callback); | 1211 wrapper_callback); |
| 1209 } | 1212 } |
| 1210 | 1213 |
| 1211 void RenderWidgetHostViewAura::CopyFromCompositingSurface( | 1214 void RenderWidgetHostViewAura::CopyFromCompositingSurface( |
| 1212 const gfx::Rect& src_subrect, | 1215 const gfx::Rect& src_subrect, |
| 1213 const gfx::Size& dst_size, | 1216 const gfx::Size& dst_size, |
| 1214 const base::Callback<void(bool, const SkBitmap&)>& callback) { | 1217 const base::Callback<void(bool, const SkBitmap&)>& callback) { |
| 1215 if (!current_surface_) { | 1218 if (!current_surface_) { |
| 1216 callback.Run(false, SkBitmap()); | 1219 callback.Run(false, SkBitmap()); |
| 1217 return; | 1220 return; |
| 1218 } | 1221 } |
| 1219 | 1222 |
| 1220 CopyFromCompositingSurfaceHelper(src_subrect, | 1223 CopyFromCompositingSurfaceHelper(src_subrect, |
| 1221 ConvertSizeToPixel(this, dst_size), | 1224 ConvertViewSizeToPixel(this, dst_size), |
| 1222 callback); | 1225 callback); |
| 1223 } | 1226 } |
| 1224 | 1227 |
| 1225 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame( | 1228 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame( |
| 1226 const gfx::Rect& src_subrect, | 1229 const gfx::Rect& src_subrect, |
| 1227 const scoped_refptr<media::VideoFrame>& target, | 1230 const scoped_refptr<media::VideoFrame>& target, |
| 1228 const base::Callback<void(bool)>& callback) { | 1231 const base::Callback<void(bool)>& callback) { |
| 1229 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 1232 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
| 1230 | 1233 |
| 1231 if (!current_surface_) | 1234 if (!current_surface_) |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 void RenderWidgetHostViewAura::UpdateExternalTexture() { | 1315 void RenderWidgetHostViewAura::UpdateExternalTexture() { |
| 1313 // Delay processing accelerated compositing state change till here where we | 1316 // Delay processing accelerated compositing state change till here where we |
| 1314 // act upon the state change. (Clear the external texture if switching to | 1317 // act upon the state change. (Clear the external texture if switching to |
| 1315 // software mode or set the external texture if going to accelerated mode). | 1318 // software mode or set the external texture if going to accelerated mode). |
| 1316 if (accelerated_compositing_state_changed_) | 1319 if (accelerated_compositing_state_changed_) |
| 1317 accelerated_compositing_state_changed_ = false; | 1320 accelerated_compositing_state_changed_ = false; |
| 1318 | 1321 |
| 1319 bool is_compositing_active = host_->is_accelerated_compositing_active(); | 1322 bool is_compositing_active = host_->is_accelerated_compositing_active(); |
| 1320 if (is_compositing_active && current_surface_) { | 1323 if (is_compositing_active && current_surface_) { |
| 1321 window_->SetExternalTexture(current_surface_.get()); | 1324 window_->SetExternalTexture(current_surface_.get()); |
| 1322 current_frame_size_ = ConvertSizeToDIP(this, current_surface_->size()); | 1325 current_frame_size_ = ConvertSizeToDIP( |
| 1326 current_surface_->device_scale_factor(), current_surface_->size()); |
| 1323 CheckResizeLock(); | 1327 CheckResizeLock(); |
| 1324 } else if (is_compositing_active && current_dib_) { | 1328 } else if (is_compositing_active && current_dib_) { |
| 1325 window_->SetExternalTexture(NULL); | 1329 window_->SetExternalTexture(NULL); |
| 1326 current_frame_size_ = ConvertSizeToDIP(this, last_swapped_surface_size_); | 1330 current_frame_size_ = ConvertSizeToDIP(last_swapped_surface_scale_factor_, |
| 1331 last_swapped_surface_size_); |
| 1327 CheckResizeLock(); | 1332 CheckResizeLock(); |
| 1328 } else { | 1333 } else { |
| 1329 window_->SetExternalTexture(NULL); | 1334 window_->SetExternalTexture(NULL); |
| 1330 resize_lock_.reset(); | 1335 resize_lock_.reset(); |
| 1331 host_->WasResized(); | 1336 host_->WasResized(); |
| 1332 } | 1337 } |
| 1333 } | 1338 } |
| 1334 | 1339 |
| 1335 bool RenderWidgetHostViewAura::SwapBuffersPrepare( | 1340 bool RenderWidgetHostViewAura::SwapBuffersPrepare( |
| 1336 const gfx::Rect& surface_rect, | 1341 const gfx::Rect& surface_rect, |
| 1342 float surface_scale_factor, |
| 1337 const gfx::Rect& damage_rect, | 1343 const gfx::Rect& damage_rect, |
| 1338 const std::string& mailbox_name, | 1344 const std::string& mailbox_name, |
| 1339 const BufferPresentedCallback& ack_callback) { | 1345 const BufferPresentedCallback& ack_callback) { |
| 1340 if (last_swapped_surface_size_ != surface_rect.size()) { | 1346 if (last_swapped_surface_size_ != surface_rect.size()) { |
| 1341 // The surface could have shrunk since we skipped an update, in which | 1347 // The surface could have shrunk since we skipped an update, in which |
| 1342 // case we can expect a full update. | 1348 // case we can expect a full update. |
| 1343 DLOG_IF(ERROR, damage_rect != surface_rect) << "Expected full damage rect"; | 1349 DLOG_IF(ERROR, damage_rect != surface_rect) << "Expected full damage rect"; |
| 1344 skipped_damage_.setEmpty(); | 1350 skipped_damage_.setEmpty(); |
| 1345 last_swapped_surface_size_ = surface_rect.size(); | 1351 last_swapped_surface_size_ = surface_rect.size(); |
| 1352 last_swapped_surface_scale_factor_ = surface_scale_factor; |
| 1346 } | 1353 } |
| 1347 | 1354 |
| 1348 if (ShouldSkipFrame(ConvertSizeToDIP(this, surface_rect.size())) || | 1355 if (ShouldSkipFrame(ConvertSizeToDIP(surface_scale_factor, |
| 1356 surface_rect.size())) || |
| 1349 mailbox_name.empty()) { | 1357 mailbox_name.empty()) { |
| 1350 skipped_damage_.op(RectToSkIRect(damage_rect), SkRegion::kUnion_Op); | 1358 skipped_damage_.op(RectToSkIRect(damage_rect), SkRegion::kUnion_Op); |
| 1351 ack_callback.Run(true, scoped_refptr<ui::Texture>()); | 1359 ack_callback.Run(true, scoped_refptr<ui::Texture>()); |
| 1352 return false; | 1360 return false; |
| 1353 } | 1361 } |
| 1354 | 1362 |
| 1355 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 1363 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 1356 current_surface_ = | 1364 current_surface_ = |
| 1357 factory->CreateTransportClient(current_device_scale_factor_); | 1365 factory->CreateTransportClient(surface_scale_factor); |
| 1358 if (!current_surface_) { | 1366 if (!current_surface_) { |
| 1359 LOG(ERROR) << "Failed to create ImageTransport texture"; | 1367 LOG(ERROR) << "Failed to create ImageTransport texture"; |
| 1360 ack_callback.Run(true, scoped_refptr<ui::Texture>()); | 1368 ack_callback.Run(true, scoped_refptr<ui::Texture>()); |
| 1361 return false; | 1369 return false; |
| 1362 } | 1370 } |
| 1363 | 1371 |
| 1364 current_surface_->Consume(mailbox_name, surface_rect.size()); | 1372 current_surface_->Consume(mailbox_name, surface_rect.size()); |
| 1365 released_front_lock_ = NULL; | 1373 released_front_lock_ = NULL; |
| 1366 UpdateExternalTexture(); | 1374 UpdateExternalTexture(); |
| 1367 | 1375 |
| 1368 return true; | 1376 return true; |
| 1369 } | 1377 } |
| 1370 | 1378 |
| 1371 void RenderWidgetHostViewAura::SwapBuffersCompleted( | 1379 void RenderWidgetHostViewAura::SwapBuffersCompleted( |
| 1372 const BufferPresentedCallback& ack_callback, | 1380 const BufferPresentedCallback& ack_callback, |
| 1373 const scoped_refptr<ui::Texture>& texture_to_return) { | 1381 const scoped_refptr<ui::Texture>& texture_to_return) { |
| 1374 ui::Compositor* compositor = GetCompositor(); | 1382 ui::Compositor* compositor = GetCompositor(); |
| 1375 | 1383 |
| 1376 if (frame_subscriber() && current_surface_ != NULL) { | 1384 if (frame_subscriber() && current_surface_ != NULL) { |
| 1377 const base::Time present_time = base::Time::Now(); | 1385 const base::Time present_time = base::Time::Now(); |
| 1378 scoped_refptr<media::VideoFrame> frame; | 1386 scoped_refptr<media::VideoFrame> frame; |
| 1379 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; | 1387 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; |
| 1380 if (frame_subscriber()->ShouldCaptureFrame(present_time, | 1388 if (frame_subscriber()->ShouldCaptureFrame(present_time, |
| 1381 &frame, &callback)) { | 1389 &frame, &callback)) { |
| 1382 CopyFromCompositingSurfaceToVideoFrame( | 1390 CopyFromCompositingSurfaceToVideoFrame( |
| 1383 gfx::Rect(ConvertSizeToDIP(this, current_surface_->size())), | 1391 gfx::Rect(ConvertSizeToDIP(current_surface_->device_scale_factor(), |
| 1392 current_surface_->size())), |
| 1384 frame, | 1393 frame, |
| 1385 base::Bind(callback, present_time)); | 1394 base::Bind(callback, present_time)); |
| 1386 } | 1395 } |
| 1387 } | 1396 } |
| 1388 | 1397 |
| 1389 if (!compositor) { | 1398 if (!compositor) { |
| 1390 ack_callback.Run(false, texture_to_return); | 1399 ack_callback.Run(false, texture_to_return); |
| 1391 } else { | 1400 } else { |
| 1392 AddOnCommitCallbackAndDisableLocks( | 1401 AddOnCommitCallbackAndDisableLocks( |
| 1393 base::Bind(ack_callback, false, texture_to_return)); | 1402 base::Bind(ack_callback, false, texture_to_return)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 | 1434 |
| 1426 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | 1435 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
| 1427 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, | 1436 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, |
| 1428 int gpu_host_id) { | 1437 int gpu_host_id) { |
| 1429 BufferPresentedCallback ack_callback = base::Bind( | 1438 BufferPresentedCallback ack_callback = base::Bind( |
| 1430 &AcknowledgeBufferForGpu, | 1439 &AcknowledgeBufferForGpu, |
| 1431 params_in_pixel.route_id, | 1440 params_in_pixel.route_id, |
| 1432 gpu_host_id, | 1441 gpu_host_id, |
| 1433 params_in_pixel.mailbox_name); | 1442 params_in_pixel.mailbox_name); |
| 1434 BuffersSwapped( | 1443 BuffersSwapped( |
| 1435 params_in_pixel.size, params_in_pixel.mailbox_name, ack_callback); | 1444 params_in_pixel.size, params_in_pixel.scale_factor, |
| 1445 params_in_pixel.mailbox_name, ack_callback); |
| 1436 } | 1446 } |
| 1437 | 1447 |
| 1438 void RenderWidgetHostViewAura::SwapDelegatedFrame( | 1448 void RenderWidgetHostViewAura::SwapDelegatedFrame( |
| 1439 scoped_ptr<cc::DelegatedFrameData> frame_data, | 1449 scoped_ptr<cc::DelegatedFrameData> frame_data, |
| 1440 float frame_device_scale_factor) { | 1450 float frame_device_scale_factor) { |
| 1441 gfx::Size frame_size_in_dip; | 1451 gfx::Size frame_size_in_dip; |
| 1442 if (!frame_data->render_pass_list.empty()) { | 1452 if (!frame_data->render_pass_list.empty()) { |
| 1443 frame_size_in_dip = gfx::ToFlooredSize(gfx::ScaleSize( | 1453 frame_size_in_dip = gfx::ToFlooredSize(gfx::ScaleSize( |
| 1444 frame_data->render_pass_list.back()->output_rect.size(), | 1454 frame_data->render_pass_list.back()->output_rect.size(), |
| 1445 1.f/frame_device_scale_factor)); | 1455 1.f/frame_device_scale_factor)); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 | 1503 |
| 1494 if (last_swapped_surface_size_ != frame_size) { | 1504 if (last_swapped_surface_size_ != frame_size) { |
| 1495 DLOG_IF(ERROR, damage_rect != gfx::Rect(frame_size)) | 1505 DLOG_IF(ERROR, damage_rect != gfx::Rect(frame_size)) |
| 1496 << "Expected full damage rect"; | 1506 << "Expected full damage rect"; |
| 1497 } | 1507 } |
| 1498 | 1508 |
| 1499 TransportDIB::Id last_dib_id = current_dib_id_; | 1509 TransportDIB::Id last_dib_id = current_dib_id_; |
| 1500 current_dib_.reset(dib.release()); | 1510 current_dib_.reset(dib.release()); |
| 1501 current_dib_id_ = dib_id; | 1511 current_dib_id_ = dib_id; |
| 1502 last_swapped_surface_size_ = frame_size; | 1512 last_swapped_surface_size_ = frame_size; |
| 1513 last_swapped_surface_scale_factor_ = frame_device_scale_factor; |
| 1503 | 1514 |
| 1504 ui::Compositor* compositor = GetCompositor(); | 1515 ui::Compositor* compositor = GetCompositor(); |
| 1505 if (!compositor) { | 1516 if (!compositor) { |
| 1506 SendSoftwareFrameAck(last_dib_id); | 1517 SendSoftwareFrameAck(last_dib_id); |
| 1507 return; | 1518 return; |
| 1508 } | 1519 } |
| 1509 | 1520 |
| 1510 gfx::Size frame_size_in_dip = gfx::ToFlooredSize( | 1521 gfx::Size frame_size_in_dip = |
| 1511 gfx::ScaleSize(frame_size, 1.0f / frame_device_scale_factor)); | 1522 ConvertSizeToDIP(frame_device_scale_factor, frame_size); |
| 1512 if (ShouldSkipFrame(frame_size_in_dip)) { | 1523 if (ShouldSkipFrame(frame_size_in_dip)) { |
| 1513 can_lock_compositor_ = NO_PENDING_COMMIT; | 1524 can_lock_compositor_ = NO_PENDING_COMMIT; |
| 1514 SendSoftwareFrameAck(last_dib_id); | 1525 SendSoftwareFrameAck(last_dib_id); |
| 1515 } else { | 1526 } else { |
| 1516 AddOnCommitCallbackAndDisableLocks( | 1527 AddOnCommitCallbackAndDisableLocks( |
| 1517 base::Bind(&RenderWidgetHostViewAura::SendSoftwareFrameAck, | 1528 base::Bind(&RenderWidgetHostViewAura::SendSoftwareFrameAck, |
| 1518 AsWeakPtr(), last_dib_id)); | 1529 AsWeakPtr(), last_dib_id)); |
| 1519 } | 1530 } |
| 1520 | 1531 |
| 1521 current_frame_size_ = frame_size_in_dip; | 1532 current_frame_size_ = frame_size_in_dip; |
| 1522 CheckResizeLock(); | 1533 CheckResizeLock(); |
| 1523 released_front_lock_ = NULL; | 1534 released_front_lock_ = NULL; |
| 1524 window_->SetExternalTexture(NULL); | 1535 window_->SetExternalTexture(NULL); |
| 1525 window_->SchedulePaintInRect(ConvertRectToDIP(this, damage_rect)); | 1536 window_->SchedulePaintInRect( |
| 1537 ConvertRectToDIP(frame_device_scale_factor, damage_rect)); |
| 1526 | 1538 |
| 1527 if (paint_observer_) | 1539 if (paint_observer_) |
| 1528 paint_observer_->OnUpdateCompositorContent(); | 1540 paint_observer_->OnUpdateCompositorContent(); |
| 1529 } | 1541 } |
| 1530 | 1542 |
| 1531 void RenderWidgetHostViewAura::SendSoftwareFrameAck( | 1543 void RenderWidgetHostViewAura::SendSoftwareFrameAck( |
| 1532 const TransportDIB::Id& id) { | 1544 const TransportDIB::Id& id) { |
| 1533 cc::CompositorFrameAck ack; | 1545 cc::CompositorFrameAck ack; |
| 1534 ack.last_dib_id = id; | 1546 ack.last_dib_id = id; |
| 1535 RenderWidgetHostImpl::SendSwapCompositorFrameAck( | 1547 RenderWidgetHostImpl::SendSwapCompositorFrameAck( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1564 return; | 1576 return; |
| 1565 } | 1577 } |
| 1566 | 1578 |
| 1567 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 1579 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 1568 factory->WaitSyncPoint(frame->gl_frame_data->sync_point); | 1580 factory->WaitSyncPoint(frame->gl_frame_data->sync_point); |
| 1569 | 1581 |
| 1570 std::string mailbox_name( | 1582 std::string mailbox_name( |
| 1571 reinterpret_cast<const char*>(frame->gl_frame_data->mailbox.name), | 1583 reinterpret_cast<const char*>(frame->gl_frame_data->mailbox.name), |
| 1572 sizeof(frame->gl_frame_data->mailbox.name)); | 1584 sizeof(frame->gl_frame_data->mailbox.name)); |
| 1573 BuffersSwapped( | 1585 BuffersSwapped( |
| 1574 frame->gl_frame_data->size, mailbox_name, ack_callback); | 1586 frame->gl_frame_data->size, frame->metadata.device_scale_factor, |
| 1587 mailbox_name, ack_callback); |
| 1575 } | 1588 } |
| 1576 | 1589 |
| 1577 #if defined(OS_WIN) | 1590 #if defined(OS_WIN) |
| 1578 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( | 1591 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( |
| 1579 gfx::NativeViewAccessible accessible_parent) { | 1592 gfx::NativeViewAccessible accessible_parent) { |
| 1580 if (GetBrowserAccessibilityManager()) { | 1593 if (GetBrowserAccessibilityManager()) { |
| 1581 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin() | 1594 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin() |
| 1582 ->set_parent_iaccessible(accessible_parent); | 1595 ->set_parent_iaccessible(accessible_parent); |
| 1583 } | 1596 } |
| 1584 } | 1597 } |
| 1585 #endif | 1598 #endif |
| 1586 | 1599 |
| 1587 void RenderWidgetHostViewAura::BuffersSwapped( | 1600 void RenderWidgetHostViewAura::BuffersSwapped( |
| 1588 const gfx::Size& size, | 1601 const gfx::Size& size, |
| 1602 float surface_scale_factor, |
| 1589 const std::string& mailbox_name, | 1603 const std::string& mailbox_name, |
| 1590 const BufferPresentedCallback& ack_callback) { | 1604 const BufferPresentedCallback& ack_callback) { |
| 1591 scoped_refptr<ui::Texture> texture_to_return(current_surface_); | 1605 scoped_refptr<ui::Texture> texture_to_return(current_surface_); |
| 1592 const gfx::Rect surface_rect = gfx::Rect(size); | 1606 const gfx::Rect surface_rect = gfx::Rect(size); |
| 1593 if (!SwapBuffersPrepare( | 1607 if (!SwapBuffersPrepare(surface_rect, surface_scale_factor, surface_rect, |
| 1594 surface_rect, surface_rect, mailbox_name, ack_callback)) { | 1608 mailbox_name, ack_callback)) { |
| 1595 return; | 1609 return; |
| 1596 } | 1610 } |
| 1597 | 1611 |
| 1598 previous_damage_.setRect(RectToSkIRect(surface_rect)); | 1612 previous_damage_.setRect(RectToSkIRect(surface_rect)); |
| 1599 skipped_damage_.setEmpty(); | 1613 skipped_damage_.setEmpty(); |
| 1600 | 1614 |
| 1601 ui::Compositor* compositor = GetCompositor(); | 1615 ui::Compositor* compositor = GetCompositor(); |
| 1602 if (compositor) { | 1616 if (compositor) { |
| 1603 gfx::Size surface_size = ConvertSizeToDIP(this, size); | 1617 gfx::Size surface_size = ConvertSizeToDIP(surface_scale_factor, size); |
| 1604 window_->SchedulePaintInRect(gfx::Rect(surface_size)); | 1618 window_->SchedulePaintInRect(gfx::Rect(surface_size)); |
| 1605 } | 1619 } |
| 1606 | 1620 |
| 1607 if (paint_observer_) | 1621 if (paint_observer_) |
| 1608 paint_observer_->OnUpdateCompositorContent(); | 1622 paint_observer_->OnUpdateCompositorContent(); |
| 1609 | 1623 |
| 1610 SwapBuffersCompleted(ack_callback, texture_to_return); | 1624 SwapBuffersCompleted(ack_callback, texture_to_return); |
| 1611 } | 1625 } |
| 1612 | 1626 |
| 1613 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( | 1627 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( |
| 1614 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, | 1628 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, |
| 1615 int gpu_host_id) { | 1629 int gpu_host_id) { |
| 1616 scoped_refptr<ui::Texture> previous_texture(current_surface_); | 1630 scoped_refptr<ui::Texture> previous_texture(current_surface_); |
| 1617 const gfx::Rect surface_rect = | 1631 const gfx::Rect surface_rect = |
| 1618 gfx::Rect(params_in_pixel.surface_size); | 1632 gfx::Rect(params_in_pixel.surface_size); |
| 1619 gfx::Rect damage_rect(params_in_pixel.x, | 1633 gfx::Rect damage_rect(params_in_pixel.x, |
| 1620 params_in_pixel.y, | 1634 params_in_pixel.y, |
| 1621 params_in_pixel.width, | 1635 params_in_pixel.width, |
| 1622 params_in_pixel.height); | 1636 params_in_pixel.height); |
| 1623 BufferPresentedCallback ack_callback = base::Bind( | 1637 BufferPresentedCallback ack_callback = base::Bind( |
| 1624 &AcknowledgeBufferForGpu, params_in_pixel.route_id, gpu_host_id, | 1638 &AcknowledgeBufferForGpu, params_in_pixel.route_id, gpu_host_id, |
| 1625 params_in_pixel.mailbox_name); | 1639 params_in_pixel.mailbox_name); |
| 1626 | 1640 |
| 1627 if (!SwapBuffersPrepare( | 1641 if (!SwapBuffersPrepare( |
| 1628 surface_rect, damage_rect, params_in_pixel.mailbox_name, ack_callback)) { | 1642 surface_rect, params_in_pixel.surface_scale_factor, damage_rect, |
| 1643 params_in_pixel.mailbox_name, ack_callback)) { |
| 1629 return; | 1644 return; |
| 1630 } | 1645 } |
| 1631 | 1646 |
| 1632 SkRegion damage(RectToSkIRect(damage_rect)); | 1647 SkRegion damage(RectToSkIRect(damage_rect)); |
| 1633 if (!skipped_damage_.isEmpty()) { | 1648 if (!skipped_damage_.isEmpty()) { |
| 1634 damage.op(skipped_damage_, SkRegion::kUnion_Op); | 1649 damage.op(skipped_damage_, SkRegion::kUnion_Op); |
| 1635 skipped_damage_.setEmpty(); | 1650 skipped_damage_.setEmpty(); |
| 1636 } | 1651 } |
| 1637 | 1652 |
| 1638 DCHECK(surface_rect.Contains(SkIRectToRect(damage.getBounds()))); | 1653 DCHECK(surface_rect.Contains(SkIRectToRect(damage.getBounds()))); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1652 previous_texture->PrepareTexture(), | 1667 previous_texture->PrepareTexture(), |
| 1653 damage, | 1668 damage, |
| 1654 previous_damage_); | 1669 previous_damage_); |
| 1655 } | 1670 } |
| 1656 previous_damage_ = damage; | 1671 previous_damage_ = damage; |
| 1657 | 1672 |
| 1658 ui::Compositor* compositor = GetCompositor(); | 1673 ui::Compositor* compositor = GetCompositor(); |
| 1659 if (compositor) { | 1674 if (compositor) { |
| 1660 // Co-ordinates come in OpenGL co-ordinate space. | 1675 // Co-ordinates come in OpenGL co-ordinate space. |
| 1661 // We need to convert to layer space. | 1676 // We need to convert to layer space. |
| 1662 gfx::Rect rect_to_paint = ConvertRectToDIP(this, gfx::Rect( | 1677 gfx::Rect rect_to_paint = ConvertRectToDIP( |
| 1663 params_in_pixel.x, | 1678 params_in_pixel.surface_scale_factor, |
| 1664 surface_size_in_pixel.height() - params_in_pixel.y - | 1679 gfx::Rect(params_in_pixel.x, |
| 1665 params_in_pixel.height, | 1680 surface_size_in_pixel.height() - params_in_pixel.y - |
| 1666 params_in_pixel.width, | 1681 params_in_pixel.height, |
| 1667 params_in_pixel.height)); | 1682 params_in_pixel.width, |
| 1683 params_in_pixel.height)); |
| 1668 | 1684 |
| 1669 // Damage may not have been DIP aligned, so inflate damage to compensate | 1685 // Damage may not have been DIP aligned, so inflate damage to compensate |
| 1670 // for any round-off error. | 1686 // for any round-off error. |
| 1671 rect_to_paint.Inset(-1, -1); | 1687 rect_to_paint.Inset(-1, -1); |
| 1672 rect_to_paint.Intersect(window_->bounds()); | 1688 rect_to_paint.Intersect(window_->bounds()); |
| 1673 | 1689 |
| 1674 if (paint_observer_) | 1690 if (paint_observer_) |
| 1675 paint_observer_->OnUpdateCompositorContent(); | 1691 paint_observer_->OnUpdateCompositorContent(); |
| 1676 window_->SchedulePaintInRect(rect_to_paint); | 1692 window_->SchedulePaintInRect(rect_to_paint); |
| 1677 } | 1693 } |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2234 return scoped_refptr<ui::Texture>(); | 2250 return scoped_refptr<ui::Texture>(); |
| 2235 | 2251 |
| 2236 WebKit::WebGLId texture_id = | 2252 WebKit::WebGLId texture_id = |
| 2237 gl_helper->CopyTexture(current_surface_->PrepareTexture(), | 2253 gl_helper->CopyTexture(current_surface_->PrepareTexture(), |
| 2238 current_surface_->size()); | 2254 current_surface_->size()); |
| 2239 if (!texture_id) | 2255 if (!texture_id) |
| 2240 return scoped_refptr<ui::Texture>(); | 2256 return scoped_refptr<ui::Texture>(); |
| 2241 | 2257 |
| 2242 return scoped_refptr<ui::Texture>( | 2258 return scoped_refptr<ui::Texture>( |
| 2243 factory->CreateOwnedTexture( | 2259 factory->CreateOwnedTexture( |
| 2244 current_surface_->size(), current_device_scale_factor_, texture_id)); | 2260 current_surface_->size(), |
| 2261 current_surface_->device_scale_factor(), texture_id)); |
| 2245 } | 2262 } |
| 2246 | 2263 |
| 2247 //////////////////////////////////////////////////////////////////////////////// | 2264 //////////////////////////////////////////////////////////////////////////////// |
| 2248 // RenderWidgetHostViewAura, ui::EventHandler implementation: | 2265 // RenderWidgetHostViewAura, ui::EventHandler implementation: |
| 2249 | 2266 |
| 2250 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { | 2267 void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { |
| 2251 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); | 2268 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); |
| 2252 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) | 2269 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) |
| 2253 return; | 2270 return; |
| 2254 | 2271 |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2969 RenderWidgetHost* widget) { | 2986 RenderWidgetHost* widget) { |
| 2970 return new RenderWidgetHostViewAura(widget); | 2987 return new RenderWidgetHostViewAura(widget); |
| 2971 } | 2988 } |
| 2972 | 2989 |
| 2973 // static | 2990 // static |
| 2974 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 2991 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2975 GetScreenInfoForWindow(results, NULL); | 2992 GetScreenInfoForWindow(results, NULL); |
| 2976 } | 2993 } |
| 2977 | 2994 |
| 2978 } // namespace content | 2995 } // namespace content |
| OLD | NEW |