Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 105743004: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 7694f236 const-ify ReleaseMailboxCB Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 using gfx::SkIRectToRect; 92 using gfx::SkIRectToRect;
93 93
94 using blink::WebScreenInfo; 94 using blink::WebScreenInfo;
95 using blink::WebTouchEvent; 95 using blink::WebTouchEvent;
96 96
97 namespace content { 97 namespace content {
98 98
99 namespace { 99 namespace {
100 100
101 void MailboxReleaseCallback(scoped_ptr<base::SharedMemory> shared_memory, 101 void MailboxReleaseCallback(scoped_ptr<base::SharedMemory> shared_memory,
102 unsigned sync_point, bool lost_resource) { 102 uint32 sync_point,
103 bool lost_resource) {
103 // NOTE: shared_memory will get released when we go out of scope. 104 // NOTE: shared_memory will get released when we go out of scope.
104 } 105 }
105 106
106 // In mouse lock mode, we need to prevent the (invisible) cursor from hitting 107 // In mouse lock mode, we need to prevent the (invisible) cursor from hitting
107 // the border of the view, in order to get valid movement information. However, 108 // the border of the view, in order to get valid movement information. However,
108 // forcing the cursor back to the center of the view after each mouse move 109 // forcing the cursor back to the center of the view after each mouse move
109 // doesn't work well. It reduces the frequency of useful mouse move messages 110 // doesn't work well. It reduces the frequency of useful mouse move messages
110 // significantly. Therefore, we move the cursor to the center of the view only 111 // significantly. Therefore, we move the cursor to the center of the view only
111 // if it approaches the border. |kMouseLockBorderPercentage| specifies the width 112 // if it approaches the border. |kMouseLockBorderPercentage| specifies the width
112 // of the border area, in percentage of the corresponding dimension. 113 // of the border area, in percentage of the corresponding dimension.
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 &RenderWidgetHostViewAura:: 1084 &RenderWidgetHostViewAura::
1084 CopyFromCompositingSurfaceHasResultForVideo, 1085 CopyFromCompositingSurfaceHasResultForVideo,
1085 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class. 1086 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class.
1086 subscriber_texture, 1087 subscriber_texture,
1087 target, 1088 target,
1088 callback)); 1089 callback));
1089 gfx::Rect src_subrect_in_pixel = 1090 gfx::Rect src_subrect_in_pixel =
1090 ConvertRectToPixel(current_device_scale_factor_, src_subrect); 1091 ConvertRectToPixel(current_device_scale_factor_, src_subrect);
1091 request->set_area(src_subrect_in_pixel); 1092 request->set_area(src_subrect_in_pixel);
1092 if (subscriber_texture) { 1093 if (subscriber_texture) {
1093 request->SetTextureMailbox(cc::TextureMailbox( 1094 request->SetTextureMailbox(
1094 subscriber_texture->mailbox(), subscriber_texture->sync_point())); 1095 cc::TextureMailbox(subscriber_texture->mailbox(),
1096 subscriber_texture->target(),
1097 subscriber_texture->sync_point()));
1095 } 1098 }
1096 window_->layer()->RequestCopyOfOutput(request.Pass()); 1099 window_->layer()->RequestCopyOfOutput(request.Pass());
1097 } 1100 }
1098 1101
1099 bool RenderWidgetHostViewAura::CanCopyToBitmap() const { 1102 bool RenderWidgetHostViewAura::CanCopyToBitmap() const {
1100 return GetCompositor() && window_->layer()->has_external_content(); 1103 return GetCompositor() && window_->layer()->has_external_content();
1101 } 1104 }
1102 1105
1103 bool RenderWidgetHostViewAura::CanCopyToVideoFrame() const { 1106 bool RenderWidgetHostViewAura::CanCopyToVideoFrame() const {
1104 return GetCompositor() && 1107 return GetCompositor() &&
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 cc::TextureMailbox texture_mailbox; 1851 cc::TextureMailbox texture_mailbox;
1849 scoped_ptr<cc::SingleReleaseCallback> release_callback; 1852 scoped_ptr<cc::SingleReleaseCallback> release_callback;
1850 result->TakeTexture(&texture_mailbox, &release_callback); 1853 result->TakeTexture(&texture_mailbox, &release_callback);
1851 DCHECK(texture_mailbox.IsTexture()); 1854 DCHECK(texture_mailbox.IsTexture());
1852 if (!texture_mailbox.IsTexture()) 1855 if (!texture_mailbox.IsTexture())
1853 return; 1856 return;
1854 1857
1855 ignore_result(scoped_callback_runner.Release()); 1858 ignore_result(scoped_callback_runner.Release());
1856 1859
1857 gl_helper->CropScaleReadbackAndCleanMailbox( 1860 gl_helper->CropScaleReadbackAndCleanMailbox(
1858 texture_mailbox.name(), 1861 texture_mailbox.mailbox(),
1859 texture_mailbox.sync_point(), 1862 texture_mailbox.sync_point(),
1860 result->size(), 1863 result->size(),
1861 gfx::Rect(result->size()), 1864 gfx::Rect(result->size()),
1862 dst_size_in_pixel, 1865 dst_size_in_pixel,
1863 pixels, 1866 pixels,
1864 base::Bind(&CopyFromCompositingSurfaceFinished, 1867 base::Bind(&CopyFromCompositingSurfaceFinished,
1865 callback, 1868 callback,
1866 base::Passed(&release_callback), 1869 base::Passed(&release_callback),
1867 base::Passed(&bitmap), 1870 base::Passed(&bitmap),
1868 base::Passed(&bitmap_pixels_lock))); 1871 base::Passed(&bitmap_pixels_lock)));
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 yuv_readback_pipeline = rwhva->yuv_readback_pipeline_.get(); 2033 yuv_readback_pipeline = rwhva->yuv_readback_pipeline_.get();
2031 } 2034 }
2032 2035
2033 ignore_result(scoped_callback_runner.Release()); 2036 ignore_result(scoped_callback_runner.Release());
2034 base::Callback<void(bool result)> finished_callback = base::Bind( 2037 base::Callback<void(bool result)> finished_callback = base::Bind(
2035 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinishedForVideo, 2038 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinishedForVideo,
2036 rwhva->AsWeakPtr(), 2039 rwhva->AsWeakPtr(),
2037 callback, 2040 callback,
2038 subscriber_texture, 2041 subscriber_texture,
2039 base::Passed(&release_callback)); 2042 base::Passed(&release_callback));
2040 yuv_readback_pipeline->ReadbackYUV( 2043 yuv_readback_pipeline->ReadbackYUV(texture_mailbox.mailbox(),
2041 texture_mailbox.name(), 2044 texture_mailbox.sync_point(),
2042 texture_mailbox.sync_point(), 2045 video_frame.get(),
2043 video_frame.get(), 2046 finished_callback);
2044 finished_callback);
2045 } 2047 }
2046 2048
2047 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { 2049 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) {
2048 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); 2050 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL);
2049 } 2051 }
2050 2052
2051 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { 2053 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() {
2052 #if defined(OS_WIN) 2054 #if defined(OS_WIN)
2053 // aura::Window::GetBoundsInScreen doesn't take non-client area into 2055 // aura::Window::GetBoundsInScreen doesn't take non-client area into
2054 // account. 2056 // account.
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after
3491 RenderWidgetHost* widget) { 3493 RenderWidgetHost* widget) {
3492 return new RenderWidgetHostViewAura(widget); 3494 return new RenderWidgetHostViewAura(widget);
3493 } 3495 }
3494 3496
3495 // static 3497 // static
3496 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3498 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3497 GetScreenInfoForWindow(results, NULL); 3499 GetScreenInfoForWindow(results, NULL);
3498 } 3500 }
3499 3501
3500 } // namespace content 3502 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698