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

Side by Side Diff: blimp/client/compositor/blimp_context_provider.cc

Issue 1570943002: [Blimp client] Move client code into blimp::client namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
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 "blimp/client/compositor/blimp_context_provider.h" 5 #include "blimp/client/compositor/blimp_context_provider.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/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "gpu/command_buffer/client/gl_in_process_context.h" 10 #include "gpu/command_buffer/client/gl_in_process_context.h"
11 #include "gpu/command_buffer/client/gles2_implementation.h" 11 #include "gpu/command_buffer/client/gles2_implementation.h"
12 #include "gpu/command_buffer/client/gles2_lib.h" 12 #include "gpu/command_buffer/client/gles2_lib.h"
13 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" 13 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
14 #include "third_party/skia/include/gpu/GrContext.h" 14 #include "third_party/skia/include/gpu/GrContext.h"
15 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" 15 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
16 16
17 namespace blimp {
18 namespace client {
17 namespace { 19 namespace {
18 20
19 // Singleton used to initialize and terminate the gles2 library. 21 // Singleton used to initialize and terminate the gles2 library.
20 class GLES2Initializer { 22 class GLES2Initializer {
21 public: 23 public:
22 GLES2Initializer() { gles2::Initialize(); } 24 GLES2Initializer() { gles2::Initialize(); }
23 25
24 ~GLES2Initializer() { gles2::Terminate(); } 26 ~GLES2Initializer() { gles2::Terminate(); }
25 27
26 private: 28 private:
27 DISALLOW_COPY_AND_ASSIGN(GLES2Initializer); 29 DISALLOW_COPY_AND_ASSIGN(GLES2Initializer);
28 }; 30 };
29 31
30 base::LazyInstance<GLES2Initializer> g_gles2_initializer = 32 base::LazyInstance<GLES2Initializer> g_gles2_initializer =
31 LAZY_INSTANCE_INITIALIZER; 33 LAZY_INSTANCE_INITIALIZER;
32 34
33 static void BindGrContextCallback(const GrGLInterface* interface) { 35 static void BindGrContextCallback(const GrGLInterface* interface) {
34 blimp::BlimpContextProvider* context_provider = 36 BlimpContextProvider* context_provider =
35 reinterpret_cast<blimp::BlimpContextProvider*>(interface->fCallbackData); 37 reinterpret_cast<BlimpContextProvider*>(interface->fCallbackData);
36 38
37 gles2::SetGLContext(context_provider->ContextGL()); 39 gles2::SetGLContext(context_provider->ContextGL());
38 } 40 }
39 41
40 } // namespace 42 } // namespace
41 43
42 namespace blimp {
43
44 // static 44 // static
45 scoped_refptr<BlimpContextProvider> BlimpContextProvider::Create( 45 scoped_refptr<BlimpContextProvider> BlimpContextProvider::Create(
46 gfx::AcceleratedWidget widget) { 46 gfx::AcceleratedWidget widget) {
47 return new BlimpContextProvider(widget); 47 return new BlimpContextProvider(widget);
48 } 48 }
49 49
50 BlimpContextProvider::BlimpContextProvider(gfx::AcceleratedWidget widget) { 50 BlimpContextProvider::BlimpContextProvider(gfx::AcceleratedWidget widget) {
51 context_thread_checker_.DetachFromThread(); 51 context_thread_checker_.DetachFromThread();
52 52
53 gpu::gles2::ContextCreationAttribHelper attribs_for_gles2; 53 gpu::gles2::ContextCreationAttribHelper attribs_for_gles2;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 154
155 void BlimpContextProvider::OnLostContext() { 155 void BlimpContextProvider::OnLostContext() {
156 DCHECK(context_thread_checker_.CalledOnValidThread()); 156 DCHECK(context_thread_checker_.CalledOnValidThread());
157 if (!lost_context_callback_.is_null()) 157 if (!lost_context_callback_.is_null())
158 base::ResetAndReturn(&lost_context_callback_).Run(); 158 base::ResetAndReturn(&lost_context_callback_).Run();
159 if (gr_context_) 159 if (gr_context_)
160 gr_context_->abandonContext(); 160 gr_context_->abandonContext();
161 } 161 }
162 162
163 } // namespace client
163 } // namespace blimp 164 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/compositor/blimp_context_provider.h ('k') | blimp/client/compositor/blimp_layer_tree_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698