[Media Router] Add integration tests and e2e tests for media router and presentation...
[chromium-blink-merge.git] / components / view_manager / gles2 / gpu_state.h
blob77e3fe2bd1df9c3ada8cafda4d54d5e8f2463cda
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_VIEW_MANAGER_GLES2_GPU_STATE_H_
6 #define COMPONENTS_VIEW_MANAGER_GLES2_GPU_STATE_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread.h"
11 #include "gpu/command_buffer/service/mailbox_manager_impl.h"
12 #include "gpu/command_buffer/service/sync_point_manager.h"
13 #include "ui/gl/gl_share_group.h"
15 namespace gles2 {
17 // We need to share these across all CommandBuffer instances so that contexts
18 // they create can share resources with each other via mailboxes.
19 class GpuState : public base::RefCounted<GpuState> {
20 public:
21 GpuState();
23 // We run the CommandBufferImpl on the control_task_runner, which forwards
24 // most method class to the CommandBufferDriver, which runs on the "driver",
25 // thread (i.e., the thread on which GpuImpl instances are created).
26 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner() {
27 return control_thread_.task_runner();
30 // These objects are intended to be used on the "driver" thread (i.e., the
31 // thread on which GpuImpl instances are created).
32 gfx::GLShareGroup* share_group() const { return share_group_.get(); }
33 gpu::gles2::MailboxManager* mailbox_manager() const {
34 return mailbox_manager_.get();
36 gpu::SyncPointManager* sync_point_manager() const {
37 return sync_point_manager_.get();
40 private:
41 friend class base::RefCounted<GpuState>;
42 ~GpuState();
44 base::Thread control_thread_;
45 scoped_refptr<gpu::SyncPointManager> sync_point_manager_;
46 scoped_refptr<gfx::GLShareGroup> share_group_;
47 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
50 } // namespace gles2
52 #endif // COMPONENTS_VIEW_MANAGER_GLES2_GPU_STATE_H_