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

Side by Side Diff: tests/GrContextFactoryTest.cpp

Issue 1555053003: Revert of Make SkGLContext lifetime more well-defined (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « tests/EGLImageTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTypes.h" 8 #include "SkTypes.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 28 matching lines...) Expand all
39 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext Type)i; 39 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext Type)i;
40 GrContext* context = testFactory.get(glCtxType); 40 GrContext* context = testFactory.get(glCtxType);
41 if (context) { 41 if (context) {
42 REPORTER_ASSERT( 42 REPORTER_ASSERT(
43 reporter, 43 reporter,
44 !context->caps()->shaderCaps()->pathRenderingSupport()); 44 !context->caps()->shaderCaps()->pathRenderingSupport());
45 } 45 }
46 } 46 }
47 } 47 }
48 48
49 DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) {
50 GrContextFactory testFactory;
51 for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
52 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext Type) i;
53 GrContextFactory::ContextInfo info1 =
54 testFactory.getContextInfo(glCtxType);
55 REPORTER_ASSERT(reporter, info1.fGrContext);
56 REPORTER_ASSERT(reporter, info1.fGLContext);
57 // Ref for comparison. The API does not explicitly say that this stays alive.
58 info1.fGrContext->ref();
59 testFactory.abandonContexts();
60
61 // Test that we get different context after abandon.
62 GrContextFactory::ContextInfo info2 =
63 testFactory.getContextInfo(glCtxType);
64 REPORTER_ASSERT(reporter, info2.fGrContext);
65 REPORTER_ASSERT(reporter, info2.fGLContext);
66 REPORTER_ASSERT(reporter, info1.fGrContext != info2.fGrContext);
67 // fGLContext should also change, but it also could get the same address .
68
69 info1.fGrContext->unref();
70 }
71 }
72
73 #endif 49 #endif
OLDNEW
« no previous file with comments | « tests/EGLImageTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698