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

Side by Side Diff: content/browser/compositor/surface_utils.cc

Issue 2789753002: Convert offscreen canvas to use FrameSinkManagerHost. (Closed)
Patch Set: Lower similarity. Created 3 years, 8 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
OLDNEW
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 #if defined(OS_ANDROID) 171 #if defined(OS_ANDROID)
172 return CompositorImpl::GetSurfaceManager(); 172 return CompositorImpl::GetSurfaceManager();
173 #else 173 #else
174 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 174 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
175 if (factory == NULL) 175 if (factory == NULL)
176 return nullptr; 176 return nullptr;
177 return factory->GetContextFactoryPrivate()->GetSurfaceManager(); 177 return factory->GetContextFactoryPrivate()->GetSurfaceManager();
178 #endif 178 #endif
179 } 179 }
180 180
181 cc::mojom::DisplayCompositor* GetDisplayCompositor() {
182 #if defined(OS_ANDROID)
183 return CompositorImpl::GetDisplayCompositor();
184 #else
185 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
186 if (!factory)
187 return nullptr;
188 return factory->GetContextFactoryPrivate()->GetDisplayCompositor();
189 #endif
190 }
191
181 void CopyFromCompositingSurfaceHasResult( 192 void CopyFromCompositingSurfaceHasResult(
182 const gfx::Size& dst_size_in_pixel, 193 const gfx::Size& dst_size_in_pixel,
183 const SkColorType color_type, 194 const SkColorType color_type,
184 const ReadbackRequestCallback& callback, 195 const ReadbackRequestCallback& callback,
185 std::unique_ptr<cc::CopyOutputResult> result) { 196 std::unique_ptr<cc::CopyOutputResult> result) {
186 if (result->IsEmpty() || result->size().IsEmpty()) { 197 if (result->IsEmpty() || result->size().IsEmpty()) {
187 callback.Run(SkBitmap(), READBACK_FAILED); 198 callback.Run(SkBitmap(), READBACK_FAILED);
188 return; 199 return;
189 } 200 }
190 201
(...skipping 10 matching lines...) Expand all
201 return; 212 return;
202 } 213 }
203 214
204 DCHECK(result->HasBitmap()); 215 DCHECK(result->HasBitmap());
205 // Software path 216 // Software path
206 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, 217 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback,
207 std::move(result)); 218 std::move(result));
208 } 219 }
209 220
210 } // namespace content 221 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698