OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 // Returns the GpuControl class that services out-of-band messages. | 48 // Returns the GpuControl class that services out-of-band messages. |
49 gpu::GpuControl* GetGpuControl(); | 49 gpu::GpuControl* GetGpuControl(); |
50 | 50 |
51 // If the command buffer is routed in the GPU channel, return the route id. | 51 // If the command buffer is routed in the GPU channel, return the route id. |
52 // Otherwise return 0. | 52 // Otherwise return 0. |
53 int GetCommandBufferRouteId(); | 53 int GetCommandBufferRouteId(); |
54 | 54 |
55 // Set an optional callback that will be invoked when the context is lost | 55 // Set an optional callback that will be invoked when the context is lost |
56 // (e.g. gpu process crash). Takes ownership of the callback. | 56 // (e.g. gpu process crash). Takes ownership of the callback. |
57 typedef base::Callback<void(const std::string&, int)> | 57 typedef base::Callback<void(const std::string&, int)> ConsoleMessageCallback; |
58 ConsoleMessageCallback; | |
59 void SetContextLostCallback(const base::Closure& callback); | 58 void SetContextLostCallback(const base::Closure& callback); |
60 | 59 |
61 // Set an optional callback that will be invoked when the GPU process | 60 // Set an optional callback that will be invoked when the GPU process |
62 // sends a console message. | 61 // sends a console message. |
63 void SetOnConsoleMessageCallback(const ConsoleMessageCallback& callback); | 62 void SetOnConsoleMessageCallback(const ConsoleMessageCallback& callback); |
64 | 63 |
65 // Run the callback once the channel has been flushed. | 64 // Run the callback once the channel has been flushed. |
66 void Echo(const base::Closure& task); | 65 void Echo(const base::Closure& task); |
67 | 66 |
68 private: | 67 private: |
69 bool InitRaw(); | 68 bool InitRaw(); |
70 void OnContextLost(); | 69 void OnContextLost(); |
71 void OnConsoleMessage(const std::string& msg, int id); | 70 void OnConsoleMessage(const std::string& msg, int id); |
72 | 71 |
73 scoped_refptr<GpuChannelHost> channel_; | 72 scoped_refptr<GpuChannelHost> channel_; |
74 gpu::Mailbox mailbox_; | 73 gpu::Mailbox mailbox_; |
75 uint32 sync_point_; | 74 uint32 sync_point_; |
76 bool has_alpha_; | 75 bool has_alpha_; |
77 CommandBufferProxyImpl* command_buffer_; | 76 CommandBufferProxyImpl* command_buffer_; |
78 base::Closure context_lost_callback_; | 77 base::Closure context_lost_callback_; |
79 ConsoleMessageCallback console_message_callback_; | 78 ConsoleMessageCallback console_message_callback_; |
80 base::WeakPtrFactory<PlatformContext3D> weak_ptr_factory_; | 79 base::WeakPtrFactory<PlatformContext3D> weak_ptr_factory_; |
81 }; | 80 }; |
82 | 81 |
83 } // namespace content | 82 } // namespace content |
84 | 83 |
85 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_H_ | 84 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_CONTEXT_3D_H_ |
OLD | NEW |