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

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

Issue 132233041: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ff7262fa Rebase. Created 6 years, 10 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 using gfx::SkIRectToRect; 93 using gfx::SkIRectToRect;
94 94
95 using blink::WebScreenInfo; 95 using blink::WebScreenInfo;
96 using blink::WebTouchEvent; 96 using blink::WebTouchEvent;
97 97
98 namespace content { 98 namespace content {
99 99
100 namespace { 100 namespace {
101 101
102 void MailboxReleaseCallback(scoped_ptr<base::SharedMemory> shared_memory, 102 void MailboxReleaseCallback(scoped_ptr<base::SharedMemory> shared_memory,
103 unsigned sync_point, bool lost_resource) { 103 uint32 sync_point,
104 bool lost_resource) {
104 // NOTE: shared_memory will get released when we go out of scope. 105 // NOTE: shared_memory will get released when we go out of scope.
105 } 106 }
106 107
107 // In mouse lock mode, we need to prevent the (invisible) cursor from hitting 108 // In mouse lock mode, we need to prevent the (invisible) cursor from hitting
108 // the border of the view, in order to get valid movement information. However, 109 // the border of the view, in order to get valid movement information. However,
109 // forcing the cursor back to the center of the view after each mouse move 110 // forcing the cursor back to the center of the view after each mouse move
110 // doesn't work well. It reduces the frequency of useful mouse move messages 111 // doesn't work well. It reduces the frequency of useful mouse move messages
111 // significantly. Therefore, we move the cursor to the center of the view only 112 // significantly. Therefore, we move the cursor to the center of the view only
112 // if it approaches the border. |kMouseLockBorderPercentage| specifies the width 113 // if it approaches the border. |kMouseLockBorderPercentage| specifies the width
113 // of the border area, in percentage of the corresponding dimension. 114 // of the border area, in percentage of the corresponding dimension.
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 &RenderWidgetHostViewAura:: 1143 &RenderWidgetHostViewAura::
1143 CopyFromCompositingSurfaceHasResultForVideo, 1144 CopyFromCompositingSurfaceHasResultForVideo,
1144 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class. 1145 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class.
1145 subscriber_texture, 1146 subscriber_texture,
1146 target, 1147 target,
1147 callback)); 1148 callback));
1148 gfx::Rect src_subrect_in_pixel = 1149 gfx::Rect src_subrect_in_pixel =
1149 ConvertRectToPixel(current_device_scale_factor_, src_subrect); 1150 ConvertRectToPixel(current_device_scale_factor_, src_subrect);
1150 request->set_area(src_subrect_in_pixel); 1151 request->set_area(src_subrect_in_pixel);
1151 if (subscriber_texture.get()) { 1152 if (subscriber_texture.get()) {
1152 request->SetTextureMailbox(cc::TextureMailbox( 1153 request->SetTextureMailbox(
1153 subscriber_texture->mailbox(), subscriber_texture->sync_point())); 1154 cc::TextureMailbox(subscriber_texture->mailbox(),
1155 subscriber_texture->target(),
1156 subscriber_texture->sync_point()));
1154 } 1157 }
1155 RequestCopyOfOutput(request.Pass()); 1158 RequestCopyOfOutput(request.Pass());
1156 } 1159 }
1157 1160
1158 bool RenderWidgetHostViewAura::CanCopyToBitmap() const { 1161 bool RenderWidgetHostViewAura::CanCopyToBitmap() const {
1159 return GetCompositor() && window_->layer()->has_external_content(); 1162 return GetCompositor() && window_->layer()->has_external_content();
1160 } 1163 }
1161 1164
1162 bool RenderWidgetHostViewAura::CanCopyToVideoFrame() const { 1165 bool RenderWidgetHostViewAura::CanCopyToVideoFrame() const {
1163 return GetCompositor() && 1166 return GetCompositor() &&
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 cc::TextureMailbox texture_mailbox; 1905 cc::TextureMailbox texture_mailbox;
1903 scoped_ptr<cc::SingleReleaseCallback> release_callback; 1906 scoped_ptr<cc::SingleReleaseCallback> release_callback;
1904 result->TakeTexture(&texture_mailbox, &release_callback); 1907 result->TakeTexture(&texture_mailbox, &release_callback);
1905 DCHECK(texture_mailbox.IsTexture()); 1908 DCHECK(texture_mailbox.IsTexture());
1906 if (!texture_mailbox.IsTexture()) 1909 if (!texture_mailbox.IsTexture())
1907 return; 1910 return;
1908 1911
1909 ignore_result(scoped_callback_runner.Release()); 1912 ignore_result(scoped_callback_runner.Release());
1910 1913
1911 gl_helper->CropScaleReadbackAndCleanMailbox( 1914 gl_helper->CropScaleReadbackAndCleanMailbox(
1912 texture_mailbox.name(), 1915 texture_mailbox.mailbox(),
1913 texture_mailbox.sync_point(), 1916 texture_mailbox.sync_point(),
1914 result->size(), 1917 result->size(),
1915 gfx::Rect(result->size()), 1918 gfx::Rect(result->size()),
1916 dst_size_in_pixel, 1919 dst_size_in_pixel,
1917 pixels, 1920 pixels,
1918 config, 1921 config,
1919 base::Bind(&CopyFromCompositingSurfaceFinished, 1922 base::Bind(&CopyFromCompositingSurfaceFinished,
1920 callback, 1923 callback,
1921 base::Passed(&release_callback), 1924 base::Passed(&release_callback),
1922 base::Passed(&bitmap), 1925 base::Passed(&bitmap),
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 } 2106 }
2104 2107
2105 ignore_result(scoped_callback_runner.Release()); 2108 ignore_result(scoped_callback_runner.Release());
2106 ignore_result(scoped_return_subscriber_texture.Release()); 2109 ignore_result(scoped_return_subscriber_texture.Release());
2107 base::Callback<void(bool result)> finished_callback = base::Bind( 2110 base::Callback<void(bool result)> finished_callback = base::Bind(
2108 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinishedForVideo, 2111 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinishedForVideo,
2109 rwhva->AsWeakPtr(), 2112 rwhva->AsWeakPtr(),
2110 callback, 2113 callback,
2111 subscriber_texture, 2114 subscriber_texture,
2112 base::Passed(&release_callback)); 2115 base::Passed(&release_callback));
2113 yuv_readback_pipeline->ReadbackYUV( 2116 yuv_readback_pipeline->ReadbackYUV(texture_mailbox.mailbox(),
2114 texture_mailbox.name(), 2117 texture_mailbox.sync_point(),
2115 texture_mailbox.sync_point(), 2118 video_frame.get(),
2116 video_frame.get(), 2119 finished_callback);
2117 finished_callback);
2118 } 2120 }
2119 2121
2120 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { 2122 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) {
2121 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); 2123 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL);
2122 } 2124 }
2123 2125
2124 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { 2126 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() {
2125 #if defined(OS_WIN) 2127 #if defined(OS_WIN)
2126 // aura::Window::GetBoundsInScreen doesn't take non-client area into 2128 // aura::Window::GetBoundsInScreen doesn't take non-client area into
2127 // account. 2129 // account.
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
3568 RenderWidgetHost* widget) { 3570 RenderWidgetHost* widget) {
3569 return new RenderWidgetHostViewAura(widget); 3571 return new RenderWidgetHostViewAura(widget);
3570 } 3572 }
3571 3573
3572 // static 3574 // static
3573 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3575 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3574 GetScreenInfoForWindow(results, NULL); 3576 GetScreenInfoForWindow(results, NULL);
3575 } 3577 }
3576 3578
3577 } // namespace content 3579 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698