OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/compositor/surface_utils.h" | 5 #include "content/browser/compositor/surface_utils.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 #if defined(OS_ANDROID) | 172 #if defined(OS_ANDROID) |
173 return ContextProviderFactoryImpl::GetInstance()->GetSurfaceManager(); | 173 return ContextProviderFactoryImpl::GetInstance()->GetSurfaceManager(); |
174 #else | 174 #else |
175 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 175 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
176 if (factory == NULL) | 176 if (factory == NULL) |
177 return nullptr; | 177 return nullptr; |
178 return factory->GetContextFactoryPrivate()->GetSurfaceManager(); | 178 return factory->GetContextFactoryPrivate()->GetSurfaceManager(); |
179 #endif | 179 #endif |
180 } | 180 } |
181 | 181 |
| 182 cc::FrameSinkManager* GetFrameSinkManager() { |
| 183 #if defined(OS_ANDROID) |
| 184 return ContextProviderFactoryImpl::GetInstance()->GetFrameSinkManager(); |
| 185 #else |
| 186 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 187 if (factory == NULL) |
| 188 return nullptr; |
| 189 return factory->GetContextFactoryPrivate()->GetFrameSinkManager(); |
| 190 #endif |
| 191 } |
| 192 |
182 void CopyFromCompositingSurfaceHasResult( | 193 void CopyFromCompositingSurfaceHasResult( |
183 const gfx::Size& dst_size_in_pixel, | 194 const gfx::Size& dst_size_in_pixel, |
184 const SkColorType color_type, | 195 const SkColorType color_type, |
185 const ReadbackRequestCallback& callback, | 196 const ReadbackRequestCallback& callback, |
186 std::unique_ptr<cc::CopyOutputResult> result) { | 197 std::unique_ptr<cc::CopyOutputResult> result) { |
187 if (result->IsEmpty() || result->size().IsEmpty()) { | 198 if (result->IsEmpty() || result->size().IsEmpty()) { |
188 callback.Run(SkBitmap(), READBACK_FAILED); | 199 callback.Run(SkBitmap(), READBACK_FAILED); |
189 return; | 200 return; |
190 } | 201 } |
191 | 202 |
(...skipping 10 matching lines...) Expand all Loading... |
202 return; | 213 return; |
203 } | 214 } |
204 | 215 |
205 DCHECK(result->HasBitmap()); | 216 DCHECK(result->HasBitmap()); |
206 // Software path | 217 // Software path |
207 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, | 218 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, |
208 std::move(result)); | 219 std::move(result)); |
209 } | 220 } |
210 | 221 |
211 } // namespace content | 222 } // namespace content |
OLD | NEW |