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

Unified Diff: dm/DMSrcSink.cpp

Issue 847273005: More natural way to serialize GPU tasks and tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: always stack-scope GrContextFactories Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/DMSrcSink.h ('k') | gyp/dm.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 2eb327eaa0342965db7d8750d19dda49b36f772b..affb844bc6aa39f76d5c2b5150f6c8954ea5fe94 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -141,22 +141,16 @@ GPUSink::GPUSink(GrContextFactory::GLContextType ct,
, fThreaded(threaded) {}
int GPUSink::enclave() const {
- return fThreaded ? kAnyThread_Enclave : kGPUSink_Enclave;
+ return fThreaded ? kAnyThread_Enclave : kGPU_Enclave;
}
Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*) const {
- GrContextFactory* factory = GetThreadLocalGrContextFactory();
- if (FLAGS_abandonGpuContext) {
- factory->abandonContexts();
- }
- if (FLAGS_resetGpuContext || FLAGS_abandonGpuContext) {
- factory->destroyContexts();
- }
+ GrContextFactory factory;
const SkISize size = src.size();
const SkImageInfo info =
SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul_SkAlphaType);
SkAutoTUnref<SkSurface> surface(
- NewGpuSurface(factory, fContextType, fGpuAPI, info, fSampleCount, fUseDFText));
+ NewGpuSurface(&factory, fContextType, fGpuAPI, info, fSampleCount, fUseDFText));
if (!surface) {
return "Could not create a surface.";
}
@@ -168,6 +162,9 @@ Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*) const {
canvas->flush();
dst->allocPixels(info);
canvas->readPixels(dst, 0,0);
+ if (FLAGS_abandonGpuContext) {
+ factory.abandonContexts();
+ }
return "";
}
« no previous file with comments | « dm/DMSrcSink.h ('k') | gyp/dm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698