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

Unified Diff: src/gpu/gl/GrGLContext.cpp

Issue 140843003: Make GrGLContextInfo have private ptr to GrGLInterface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tot Created 6 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 | « src/gpu/gl/GrGLContext.h ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLContext.cpp
diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp
index 2eb4893019e487ab96ddb193f7758d721bc61fa2..d95fe1cb3c5e445abd9a2e152da43c8ac44aef70 100644
--- a/src/gpu/gl/GrGLContext.cpp
+++ b/src/gpu/gl/GrGLContext.cpp
@@ -8,16 +8,17 @@
#include "GrGLContext.h"
////////////////////////////////////////////////////////////////////////////////
-GrGLContextInfo& GrGLContextInfo::operator= (const GrGLContextInfo& ctxInfo) {
- fStandard = ctxInfo.fStandard;
- fGLVersion = ctxInfo.fGLVersion;
- fGLSLGeneration = ctxInfo.fGLSLGeneration;
- fVendor = ctxInfo.fVendor;
- fRenderer = ctxInfo.fRenderer;
- fExtensions = ctxInfo.fExtensions;
- fIsMesa = ctxInfo.fIsMesa;
- fIsChromium = ctxInfo.fIsChromium;
- *fGLCaps = *ctxInfo.fGLCaps.get();
+
+GrGLContextInfo& GrGLContextInfo::operator= (const GrGLContextInfo& that) {
+ fInterface.reset(SkSafeRef(that.fInterface.get()));
+ fGLVersion = that.fGLVersion;
+ fGLSLGeneration = that.fGLSLGeneration;
+ fVendor = that.fVendor;
+ fRenderer = that.fRenderer;
+ fExtensions = that.fExtensions;
+ fIsMesa = that.fIsMesa;
+ fIsChromium = that.fIsChromium;
+ *fGLCaps = *that.fGLCaps.get();
return *this;
}
@@ -48,8 +49,8 @@ bool GrGLContextInfo::initialize(const GrGLInterface* interface) {
fIsChromium = GrGLIsChromiumFromRendererString(renderer);
- // This must be done before calling GrGLCaps::init()
- fStandard = interface->fStandard;
+ // This must occur before caps init.
+ fInterface.reset(SkRef(interface));
fGLCaps->init(*this, interface);
@@ -60,11 +61,11 @@ bool GrGLContextInfo::initialize(const GrGLInterface* interface) {
}
bool GrGLContextInfo::isInitialized() const {
- return kNone_GrGLStandard != fStandard;
+ return NULL != fInterface.get();
}
void GrGLContextInfo::reset() {
- fStandard = kNone_GrGLStandard;
+ fInterface.reset(NULL);
fGLVersion = GR_GL_VER(0, 0);
fGLSLGeneration = static_cast<GrGLSLGeneration>(0);
fVendor = kOther_GrGLVendor;
@@ -74,34 +75,3 @@ void GrGLContextInfo::reset() {
fExtensions.reset();
fGLCaps->reset();
}
-
-////////////////////////////////////////////////////////////////////////////////
-GrGLContext::GrGLContext(const GrGLInterface* interface) {
- fInterface = NULL;
- this->initialize(interface);
-}
-
-GrGLContext::GrGLContext(const GrGLContext& ctx) {
- fInterface = NULL;
- *this = ctx;
-}
-
-GrGLContext& GrGLContext::operator = (const GrGLContext& ctx) {
- SkRefCnt_SafeAssign(fInterface, ctx.fInterface);
- fInfo = ctx.fInfo;
- return *this;
-}
-
-void GrGLContext::reset() {
- SkSafeSetNull(fInterface);
- fInfo.reset();
-}
-
-bool GrGLContext::initialize(const GrGLInterface* interface) {
- if (fInfo.initialize(interface)) {
- fInterface = interface;
- interface->ref();
- return true;
- }
- return false;
-}
« no previous file with comments | « src/gpu/gl/GrGLContext.h ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698