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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore"); | 741 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore"); |
742 gfx::Rect copy_rect = src_subrect.IsEmpty() ? | 742 gfx::Rect copy_rect = src_subrect.IsEmpty() ? |
743 gfx::Rect(backing_store->size()) : src_subrect; | 743 gfx::Rect(backing_store->size()) : src_subrect; |
744 // When the result size is equal to the backing store size, copy from the | 744 // When the result size is equal to the backing store size, copy from the |
745 // backing store directly to the output canvas. | 745 // backing store directly to the output canvas. |
746 skia::PlatformBitmap output; | 746 skia::PlatformBitmap output; |
747 bool result = backing_store->CopyFromBackingStore(copy_rect, &output); | 747 bool result = backing_store->CopyFromBackingStore(copy_rect, &output); |
748 callback.Run(result, output.GetBitmap()); | 748 callback.Run(result, output.GetBitmap()); |
749 } | 749 } |
750 | 750 |
| 751 bool RenderWidgetHostImpl::CanCopyFromBackingStore() { |
| 752 if (view_) |
| 753 return view_->IsSurfaceAvailableForCopy(); |
| 754 return false; |
| 755 } |
| 756 |
| 757 #if defined(OS_ANDROID) |
| 758 void RenderWidgetHostImpl::LockForCopyFromBackingStore() { |
| 759 if (view_) |
| 760 view_->LockSurfaceForCopy(); |
| 761 } |
| 762 |
| 763 void RenderWidgetHostImpl::UnlockForCopyFromBackingStore() { |
| 764 if (view_) |
| 765 view_->UnlockSurfaceForCopy(); |
| 766 } |
| 767 #endif |
| 768 |
751 #if defined(TOOLKIT_GTK) | 769 #if defined(TOOLKIT_GTK) |
752 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow( | 770 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow( |
753 const gfx::Rect& dest_rect, GdkWindow* target) { | 771 const gfx::Rect& dest_rect, GdkWindow* target) { |
754 BackingStore* backing_store = GetBackingStore(false); | 772 BackingStore* backing_store = GetBackingStore(false); |
755 if (!backing_store) | 773 if (!backing_store) |
756 return false; | 774 return false; |
757 (static_cast<BackingStoreGtk*>(backing_store))->PaintToRect( | 775 (static_cast<BackingStoreGtk*>(backing_store))->PaintToRect( |
758 dest_rect, target); | 776 dest_rect, target); |
759 return true; | 777 return true; |
760 } | 778 } |
(...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2542 } | 2560 } |
2543 } | 2561 } |
2544 | 2562 |
2545 // Add newly generated components into the latency info | 2563 // Add newly generated components into the latency info |
2546 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { | 2564 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { |
2547 latency_info->latency_components[lc->first] = lc->second; | 2565 latency_info->latency_components[lc->first] = lc->second; |
2548 } | 2566 } |
2549 } | 2567 } |
2550 | 2568 |
2551 } // namespace content | 2569 } // namespace content |
OLD | NEW |