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

Side by Side Diff: cc/test/test_context_provider.cc

Issue 1869753003: Replace many skia::RefPtr with sk_sp<> in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Florin's nits Created 4 years, 7 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 | « cc/test/test_context_provider.h ('k') | cc/test/test_in_process_context_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/test/test_context_provider.h" 5 #include "cc/test/test_context_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return &support_; 104 return &support_;
105 } 105 }
106 106
107 class GrContext* TestContextProvider::GrContext() { 107 class GrContext* TestContextProvider::GrContext() {
108 DCHECK(bound_); 108 DCHECK(bound_);
109 DCHECK(context_thread_checker_.CalledOnValidThread()); 109 DCHECK(context_thread_checker_.CalledOnValidThread());
110 110
111 if (gr_context_) 111 if (gr_context_)
112 return gr_context_.get(); 112 return gr_context_.get();
113 113
114 skia::RefPtr<const GrGLInterface> gl_interface = 114 sk_sp<const GrGLInterface> gl_interface(GrGLCreateNullInterface());
115 skia::AdoptRef(GrGLCreateNullInterface()); 115 gr_context_ = sk_sp<::GrContext>(GrContext::Create(
116 gr_context_ = skia::AdoptRef(GrContext::Create(
117 kOpenGL_GrBackend, 116 kOpenGL_GrBackend,
118 reinterpret_cast<GrBackendContext>(gl_interface.get()))); 117 reinterpret_cast<GrBackendContext>(gl_interface.get())));
119 118
120 // If GlContext is already lost, also abandon the new GrContext. 119 // If GlContext is already lost, also abandon the new GrContext.
121 if (ContextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR) 120 if (ContextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR)
122 gr_context_->abandonContext(); 121 gr_context_->abandonContext();
123 122
124 return gr_context_.get(); 123 return gr_context_.get();
125 } 124 }
126 125
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 161 }
163 162
164 void TestContextProvider::SetLostContextCallback( 163 void TestContextProvider::SetLostContextCallback(
165 const LostContextCallback& cb) { 164 const LostContextCallback& cb) {
166 DCHECK(context_thread_checker_.CalledOnValidThread()); 165 DCHECK(context_thread_checker_.CalledOnValidThread());
167 DCHECK(lost_context_callback_.is_null() || cb.is_null()); 166 DCHECK(lost_context_callback_.is_null() || cb.is_null());
168 lost_context_callback_ = cb; 167 lost_context_callback_ = cb;
169 } 168 }
170 169
171 } // namespace cc 170 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_context_provider.h ('k') | cc/test/test_in_process_context_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698