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

Side by Side Diff: components/gles2/command_buffer_driver.h

Issue 1150093003: Move GLES2, GPU & Surfaces into the ViewManager directory. This does not merge the applications, th… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 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 | « components/gles2/OWNERS ('k') | components/gles2/command_buffer_driver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_
6 #define COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/single_thread_task_runner.h"
13 #include "base/timer/timer.h"
14 #include "components/gpu/public/interfaces/command_buffer.mojom.h"
15 #include "ui/gfx/geometry/size.h"
16 #include "ui/gfx/native_widget_types.h"
17
18 namespace gpu {
19 class CommandBufferService;
20 class GpuScheduler;
21 class GpuControlService;
22 class SyncPointManager;
23 namespace gles2 {
24 class GLES2Decoder;
25 class MailboxManager;
26 }
27 }
28
29 namespace gfx {
30 class GLContext;
31 class GLShareGroup;
32 class GLSurface;
33 }
34
35 namespace gles2 {
36
37 // This class receives CommandBuffer messages on the same thread as the native
38 // viewport. It is usually destructed on that thread, however if the native
39 // viewport app is destroyed before CommandBufferImpl, then the latter's failed
40 // PostTask will end up deleting this class on the control thread.
41 class CommandBufferDriver {
42 public:
43 class Client {
44 public:
45 virtual ~Client();
46 virtual void UpdateVSyncParameters(base::TimeTicks timebase,
47 base::TimeDelta interval) = 0;
48 virtual void DidLoseContext() = 0;
49 };
50 // Offscreen.
51 CommandBufferDriver(gfx::GLShareGroup* share_group,
52 gpu::gles2::MailboxManager* mailbox_manager,
53 gpu::SyncPointManager* sync_point_manager);
54 // Onscreen.
55 CommandBufferDriver(
56 gfx::AcceleratedWidget widget,
57 gfx::GLShareGroup* share_group,
58 gpu::gles2::MailboxManager* mailbox_manager,
59 gpu::SyncPointManager* sync_point_manager,
60 const base::Callback<void(CommandBufferDriver*)>& destruct_callback);
61 ~CommandBufferDriver();
62
63 void set_client(scoped_ptr<Client> client) { client_ = client.Pass(); }
64
65 void Initialize(mojo::CommandBufferSyncClientPtr sync_client,
66 mojo::CommandBufferLostContextObserverPtr loss_observer,
67 mojo::ScopedSharedBufferHandle shared_state);
68 void SetGetBuffer(int32_t buffer);
69 void Flush(int32_t put_offset);
70 void MakeProgress(int32_t last_get_offset);
71 void RegisterTransferBuffer(int32_t id,
72 mojo::ScopedSharedBufferHandle transfer_buffer,
73 uint32_t size);
74 void DestroyTransferBuffer(int32_t id);
75 void Echo(const mojo::Callback<void()>& callback);
76
77 // Called at shutdown to destroy the X window. This is needed when the parent
78 // window is being destroyed. Otherwise X calls for this window will fail.
79 void DestroyWindow();
80
81 private:
82 bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state);
83 void OnResize(gfx::Size size, float scale_factor);
84 bool OnWaitSyncPoint(uint32_t sync_point);
85 void OnSyncPointRetired();
86 void OnParseError();
87 void OnContextLost(uint32_t reason);
88 void OnUpdateVSyncParameters(const base::TimeTicks timebase,
89 const base::TimeDelta interval);
90 void DestroyDecoder();
91
92 scoped_ptr<Client> client_;
93 mojo::CommandBufferSyncClientPtr sync_client_;
94 mojo::CommandBufferLostContextObserverPtr loss_observer_;
95 gfx::AcceleratedWidget widget_;
96 scoped_ptr<gpu::CommandBufferService> command_buffer_;
97 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
98 scoped_ptr<gpu::GpuScheduler> scheduler_;
99 scoped_refptr<gfx::GLContext> context_;
100 scoped_refptr<gfx::GLSurface> surface_;
101 scoped_refptr<gfx::GLShareGroup> share_group_;
102 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
103 scoped_refptr<gpu::SyncPointManager> sync_point_manager_;
104
105 scoped_refptr<base::SingleThreadTaskRunner> context_lost_task_runner_;
106 base::Callback<void(int32_t)> context_lost_callback_;
107
108 base::Callback<void(CommandBufferDriver*)> destruct_callback_;
109
110 base::WeakPtrFactory<CommandBufferDriver> weak_factory_;
111
112 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver);
113 };
114
115 } // namespace gles2
116
117 #endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_
OLDNEW
« no previous file with comments | « components/gles2/OWNERS ('k') | components/gles2/command_buffer_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698