OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MOJO_GPU_GL_CONTEXT_H_ | 5 #ifndef MOJO_GPU_GL_CONTEXT_H_ |
6 #define MOJO_GPU_GL_CONTEXT_H_ | 6 #define MOJO_GPU_GL_CONTEXT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 protected: | 26 protected: |
27 virtual ~Observer(); | 27 virtual ~Observer(); |
28 }; | 28 }; |
29 | 29 |
30 // Creates an offscreen GL context. | 30 // Creates an offscreen GL context. |
31 static base::WeakPtr<GLContext> CreateOffscreen( | 31 static base::WeakPtr<GLContext> CreateOffscreen( |
32 ApplicationConnector* connector); | 32 ApplicationConnector* connector); |
33 | 33 |
34 // Creates a GL context from a command buffer. | 34 // Creates a GL context from a command buffer. |
35 static base::WeakPtr<GLContext> CreateFromCommandBuffer( | 35 static base::WeakPtr<GLContext> CreateFromCommandBuffer( |
36 CommandBufferPtr command_buffer); | 36 InterfaceHandle<CommandBuffer> command_buffer); |
37 | 37 |
38 void MakeCurrent(); | 38 void MakeCurrent(); |
39 bool IsCurrent(); | 39 bool IsCurrent(); |
40 void Destroy(); | 40 void Destroy(); |
41 | 41 |
42 void AddObserver(Observer* observer); | 42 void AddObserver(Observer* observer); |
43 void RemoveObserver(Observer* observer); | 43 void RemoveObserver(Observer* observer); |
44 | 44 |
45 private: | 45 private: |
46 explicit GLContext(CommandBufferPtr command_buffer); | 46 explicit GLContext(InterfaceHandle<CommandBuffer> command_buffer); |
47 ~GLContext(); | 47 ~GLContext(); |
48 | 48 |
49 static void ContextLostThunk(void* self); | 49 static void ContextLostThunk(void* self); |
50 void OnContextLost(); | 50 void OnContextLost(); |
51 | 51 |
52 MGLContext context_; | 52 MGLContext context_; |
53 | 53 |
54 base::ObserverList<Observer> observers_; | 54 base::ObserverList<Observer> observers_; |
55 base::WeakPtrFactory<GLContext> weak_factory_; | 55 base::WeakPtrFactory<GLContext> weak_factory_; |
56 | 56 |
57 DISALLOW_COPY_AND_ASSIGN(GLContext); | 57 DISALLOW_COPY_AND_ASSIGN(GLContext); |
58 }; | 58 }; |
59 | 59 |
60 } // namespace mojo | 60 } // namespace mojo |
61 | 61 |
62 #endif // MOJO_GPU_GL_CONTEXT_H_ | 62 #endif // MOJO_GPU_GL_CONTEXT_H_ |
OLD | NEW |