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_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 void CopyFromCompositingSurfaceFinished( | 236 void CopyFromCompositingSurfaceFinished( |
237 const ReadbackRequestCallback& callback, | 237 const ReadbackRequestCallback& callback, |
238 scoped_ptr<cc::SingleReleaseCallback> release_callback, | 238 scoped_ptr<cc::SingleReleaseCallback> release_callback, |
239 scoped_ptr<SkBitmap> bitmap, | 239 scoped_ptr<SkBitmap> bitmap, |
240 const base::TimeTicks& start_time, | 240 const base::TimeTicks& start_time, |
241 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, | 241 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, |
242 bool result) { | 242 bool result) { |
243 TRACE_EVENT0( | 243 TRACE_EVENT0( |
244 "cc", "RenderWidgetHostViewAndroid::CopyFromCompositingSurfaceFinished"); | 244 "cc", "RenderWidgetHostViewAndroid::CopyFromCompositingSurfaceFinished"); |
245 bitmap_pixels_lock.reset(); | 245 bitmap_pixels_lock.reset(); |
246 uint32 sync_point = 0; | 246 gpu::SyncToken sync_token; |
247 if (result) { | 247 if (result) { |
248 GLHelper* gl_helper = GetPostReadbackGLHelper(); | 248 GLHelper* gl_helper = GetPostReadbackGLHelper(); |
249 if (gl_helper) | 249 if (gl_helper) |
250 sync_point = gl_helper->InsertSyncPoint(); | 250 sync_token = gpu::SyncToken(gl_helper->InsertSyncPoint()); |
251 } | 251 } |
252 bool lost_resource = sync_point == 0; | 252 const bool lost_resource = !sync_token.HasData(); |
253 release_callback->Run(sync_point, lost_resource); | 253 release_callback->Run(sync_token, lost_resource); |
254 UMA_HISTOGRAM_TIMES(kAsyncReadBackString, | 254 UMA_HISTOGRAM_TIMES(kAsyncReadBackString, |
255 base::TimeTicks::Now() - start_time); | 255 base::TimeTicks::Now() - start_time); |
256 ReadbackResponse response = result ? READBACK_SUCCESS : READBACK_FAILED; | 256 ReadbackResponse response = result ? READBACK_SUCCESS : READBACK_FAILED; |
257 callback.Run(*bitmap, response); | 257 callback.Run(*bitmap, response); |
258 } | 258 } |
259 | 259 |
260 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( | 260 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( |
261 ui::TouchSelectionControllerClient* client, | 261 ui::TouchSelectionControllerClient* client, |
262 ContentViewCore* content_view_core) { | 262 ContentViewCore* content_view_core) { |
263 DCHECK(client); | 263 DCHECK(client); |
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1981 cc::TextureMailbox texture_mailbox; | 1981 cc::TextureMailbox texture_mailbox; |
1982 scoped_ptr<cc::SingleReleaseCallback> release_callback; | 1982 scoped_ptr<cc::SingleReleaseCallback> release_callback; |
1983 result->TakeTexture(&texture_mailbox, &release_callback); | 1983 result->TakeTexture(&texture_mailbox, &release_callback); |
1984 DCHECK(texture_mailbox.IsTexture()); | 1984 DCHECK(texture_mailbox.IsTexture()); |
1985 if (!texture_mailbox.IsTexture()) | 1985 if (!texture_mailbox.IsTexture()) |
1986 return; | 1986 return; |
1987 | 1987 |
1988 ignore_result(scoped_callback_runner.Release()); | 1988 ignore_result(scoped_callback_runner.Release()); |
1989 | 1989 |
1990 gl_helper->CropScaleReadbackAndCleanMailbox( | 1990 gl_helper->CropScaleReadbackAndCleanMailbox( |
1991 texture_mailbox.mailbox(), | 1991 texture_mailbox.mailbox(), texture_mailbox.sync_token(), result->size(), |
1992 texture_mailbox.sync_point(), | 1992 gfx::Rect(result->size()), output_size_in_pixel, pixels, color_type, |
1993 result->size(), | 1993 base::Bind(&CopyFromCompositingSurfaceFinished, callback, |
1994 gfx::Rect(result->size()), | 1994 base::Passed(&release_callback), base::Passed(&bitmap), |
1995 output_size_in_pixel, | 1995 start_time, base::Passed(&bitmap_pixels_lock)), |
1996 pixels, | |
1997 color_type, | |
1998 base::Bind(&CopyFromCompositingSurfaceFinished, | |
1999 callback, | |
2000 base::Passed(&release_callback), | |
2001 base::Passed(&bitmap), | |
2002 start_time, | |
2003 base::Passed(&bitmap_pixels_lock)), | |
2004 GLHelper::SCALER_QUALITY_GOOD); | 1996 GLHelper::SCALER_QUALITY_GOOD); |
2005 } | 1997 } |
2006 | 1998 |
2007 void RenderWidgetHostViewAndroid::OnStylusSelectBegin(float x0, | 1999 void RenderWidgetHostViewAndroid::OnStylusSelectBegin(float x0, |
2008 float y0, | 2000 float y0, |
2009 float x1, | 2001 float x1, |
2010 float y1) { | 2002 float y1) { |
2011 SelectBetweenCoordinates(gfx::PointF(x0, y0), gfx::PointF(x1, y1)); | 2003 SelectBetweenCoordinates(gfx::PointF(x0, y0), gfx::PointF(x1, y1)); |
2012 } | 2004 } |
2013 | 2005 |
(...skipping 29 matching lines...) Expand all Loading... |
2043 results->orientationAngle = display.RotationAsDegree(); | 2035 results->orientationAngle = display.RotationAsDegree(); |
2044 results->orientationType = | 2036 results->orientationType = |
2045 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2037 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
2046 gfx::DeviceDisplayInfo info; | 2038 gfx::DeviceDisplayInfo info; |
2047 results->depth = info.GetBitsPerPixel(); | 2039 results->depth = info.GetBitsPerPixel(); |
2048 results->depthPerComponent = info.GetBitsPerComponent(); | 2040 results->depthPerComponent = info.GetBitsPerComponent(); |
2049 results->isMonochrome = (results->depthPerComponent == 0); | 2041 results->isMonochrome = (results->depthPerComponent == 0); |
2050 } | 2042 } |
2051 | 2043 |
2052 } // namespace content | 2044 } // namespace content |
OLD | NEW |