| 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 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1983 cc::TextureMailbox texture_mailbox; | 1983 cc::TextureMailbox texture_mailbox; |
| 1984 scoped_ptr<cc::SingleReleaseCallback> release_callback; | 1984 scoped_ptr<cc::SingleReleaseCallback> release_callback; |
| 1985 result->TakeTexture(&texture_mailbox, &release_callback); | 1985 result->TakeTexture(&texture_mailbox, &release_callback); |
| 1986 DCHECK(texture_mailbox.IsTexture()); | 1986 DCHECK(texture_mailbox.IsTexture()); |
| 1987 if (!texture_mailbox.IsTexture()) | 1987 if (!texture_mailbox.IsTexture()) |
| 1988 return; | 1988 return; |
| 1989 | 1989 |
| 1990 ignore_result(scoped_callback_runner.Release()); | 1990 ignore_result(scoped_callback_runner.Release()); |
| 1991 | 1991 |
| 1992 gl_helper->CropScaleReadbackAndCleanMailbox( | 1992 gl_helper->CropScaleReadbackAndCleanMailbox( |
| 1993 texture_mailbox.mailbox(), | 1993 texture_mailbox.mailbox(), texture_mailbox.sync_token(), result->size(), |
| 1994 texture_mailbox.sync_point(), | 1994 gfx::Rect(result->size()), output_size_in_pixel, pixels, color_type, |
| 1995 result->size(), | 1995 base::Bind(&CopyFromCompositingSurfaceFinished, callback, |
| 1996 gfx::Rect(result->size()), | 1996 base::Passed(&release_callback), base::Passed(&bitmap), |
| 1997 output_size_in_pixel, | 1997 start_time, base::Passed(&bitmap_pixels_lock)), |
| 1998 pixels, | |
| 1999 color_type, | |
| 2000 base::Bind(&CopyFromCompositingSurfaceFinished, | |
| 2001 callback, | |
| 2002 base::Passed(&release_callback), | |
| 2003 base::Passed(&bitmap), | |
| 2004 start_time, | |
| 2005 base::Passed(&bitmap_pixels_lock)), | |
| 2006 GLHelper::SCALER_QUALITY_GOOD); | 1998 GLHelper::SCALER_QUALITY_GOOD); |
| 2007 } | 1999 } |
| 2008 | 2000 |
| 2009 void RenderWidgetHostViewAndroid::OnStylusSelectBegin(float x0, | 2001 void RenderWidgetHostViewAndroid::OnStylusSelectBegin(float x0, |
| 2010 float y0, | 2002 float y0, |
| 2011 float x1, | 2003 float x1, |
| 2012 float y1) { | 2004 float y1) { |
| 2013 SelectBetweenCoordinates(gfx::PointF(x0, y0), gfx::PointF(x1, y1)); | 2005 SelectBetweenCoordinates(gfx::PointF(x0, y0), gfx::PointF(x1, y1)); |
| 2014 } | 2006 } |
| 2015 | 2007 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2045 results->orientationAngle = display.RotationAsDegree(); | 2037 results->orientationAngle = display.RotationAsDegree(); |
| 2046 results->orientationType = | 2038 results->orientationType = |
| 2047 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2039 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2048 gfx::DeviceDisplayInfo info; | 2040 gfx::DeviceDisplayInfo info; |
| 2049 results->depth = info.GetBitsPerPixel(); | 2041 results->depth = info.GetBitsPerPixel(); |
| 2050 results->depthPerComponent = info.GetBitsPerComponent(); | 2042 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2051 results->isMonochrome = (results->depthPerComponent == 0); | 2043 results->isMonochrome = (results->depthPerComponent == 0); |
| 2052 } | 2044 } |
| 2053 | 2045 |
| 2054 } // namespace content | 2046 } // namespace content |
| OLD | NEW |