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

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

Issue 1139673003: Make Mandoline shut down cleanly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix X errors on Linux 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_ 5 #ifndef COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_
6 #define COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_ 6 #define COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
11 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
12 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
13 #include "components/gpu/public/interfaces/command_buffer.mojom.h" 14 #include "components/gpu/public/interfaces/command_buffer.mojom.h"
14 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
15 #include "ui/gfx/native_widget_types.h" 16 #include "ui/gfx/native_widget_types.h"
16 17
17 namespace gpu { 18 namespace gpu {
18 class CommandBufferService; 19 class CommandBufferService;
19 class GpuScheduler; 20 class GpuScheduler;
20 class GpuControlService; 21 class GpuControlService;
(...skipping 19 matching lines...) Expand all
40 virtual ~Client(); 41 virtual ~Client();
41 virtual void UpdateVSyncParameters(base::TimeTicks timebase, 42 virtual void UpdateVSyncParameters(base::TimeTicks timebase,
42 base::TimeDelta interval) = 0; 43 base::TimeDelta interval) = 0;
43 virtual void DidLoseContext() = 0; 44 virtual void DidLoseContext() = 0;
44 }; 45 };
45 // Offscreen. 46 // Offscreen.
46 CommandBufferDriver(gfx::GLShareGroup* share_group, 47 CommandBufferDriver(gfx::GLShareGroup* share_group,
47 gpu::gles2::MailboxManager* mailbox_manager, 48 gpu::gles2::MailboxManager* mailbox_manager,
48 gpu::SyncPointManager* sync_point_manager); 49 gpu::SyncPointManager* sync_point_manager);
49 // Onscreen. 50 // Onscreen.
50 CommandBufferDriver(gfx::AcceleratedWidget widget, 51 CommandBufferDriver(
51 gfx::GLShareGroup* share_group, 52 gfx::AcceleratedWidget widget,
52 gpu::gles2::MailboxManager* mailbox_manager, 53 gfx::GLShareGroup* share_group,
53 gpu::SyncPointManager* sync_point_manager); 54 gpu::gles2::MailboxManager* mailbox_manager,
55 gpu::SyncPointManager* sync_point_manager,
56 const base::Callback<void(CommandBufferDriver*)>& destruct_callback);
54 ~CommandBufferDriver(); 57 ~CommandBufferDriver();
55 58
56 void set_client(scoped_ptr<Client> client) { client_ = client.Pass(); } 59 void set_client(scoped_ptr<Client> client) { client_ = client.Pass(); }
57 60
58 void Initialize(mojo::CommandBufferSyncClientPtr sync_client, 61 void Initialize(mojo::CommandBufferSyncClientPtr sync_client,
59 mojo::CommandBufferLostContextObserverPtr loss_observer, 62 mojo::CommandBufferLostContextObserverPtr loss_observer,
60 mojo::ScopedSharedBufferHandle shared_state); 63 mojo::ScopedSharedBufferHandle shared_state);
61 void SetGetBuffer(int32_t buffer); 64 void SetGetBuffer(int32_t buffer);
62 void Flush(int32_t put_offset); 65 void Flush(int32_t put_offset);
63 void MakeProgress(int32_t last_get_offset); 66 void MakeProgress(int32_t last_get_offset);
64 void RegisterTransferBuffer(int32_t id, 67 void RegisterTransferBuffer(int32_t id,
65 mojo::ScopedSharedBufferHandle transfer_buffer, 68 mojo::ScopedSharedBufferHandle transfer_buffer,
66 uint32_t size); 69 uint32_t size);
67 void DestroyTransferBuffer(int32_t id); 70 void DestroyTransferBuffer(int32_t id);
68 void Echo(const mojo::Callback<void()>& callback); 71 void Echo(const mojo::Callback<void()>& callback);
69 72
73 // Called at shutdown to destroy the X window. This is needed when the parent
74 // window is being destroyed. Otherwise X calls for this window will fail.
75 void DestroyWindow();
76
70 private: 77 private:
71 bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state); 78 bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state);
72 void OnResize(gfx::Size size, float scale_factor); 79 void OnResize(gfx::Size size, float scale_factor);
73 bool OnWaitSyncPoint(uint32_t sync_point); 80 bool OnWaitSyncPoint(uint32_t sync_point);
74 void OnSyncPointRetired(); 81 void OnSyncPointRetired();
75 void OnParseError(); 82 void OnParseError();
76 void OnContextLost(uint32_t reason); 83 void OnContextLost(uint32_t reason);
77 void OnUpdateVSyncParameters(const base::TimeTicks timebase, 84 void OnUpdateVSyncParameters(const base::TimeTicks timebase,
78 const base::TimeDelta interval); 85 const base::TimeDelta interval);
86 void DestroyDecoder();
79 87
80 scoped_ptr<Client> client_; 88 scoped_ptr<Client> client_;
81 mojo::CommandBufferSyncClientPtr sync_client_; 89 mojo::CommandBufferSyncClientPtr sync_client_;
82 mojo::CommandBufferLostContextObserverPtr loss_observer_; 90 mojo::CommandBufferLostContextObserverPtr loss_observer_;
83 gfx::AcceleratedWidget widget_; 91 gfx::AcceleratedWidget widget_;
84 scoped_ptr<gpu::CommandBufferService> command_buffer_; 92 scoped_ptr<gpu::CommandBufferService> command_buffer_;
85 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; 93 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
86 scoped_ptr<gpu::GpuScheduler> scheduler_; 94 scoped_ptr<gpu::GpuScheduler> scheduler_;
87 scoped_refptr<gfx::GLContext> context_; 95 scoped_refptr<gfx::GLContext> context_;
88 scoped_refptr<gfx::GLSurface> surface_; 96 scoped_refptr<gfx::GLSurface> surface_;
89 scoped_refptr<gfx::GLShareGroup> share_group_; 97 scoped_refptr<gfx::GLShareGroup> share_group_;
90 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 98 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
91 scoped_refptr<gpu::SyncPointManager> sync_point_manager_; 99 scoped_refptr<gpu::SyncPointManager> sync_point_manager_;
92 100
93 scoped_refptr<base::SingleThreadTaskRunner> context_lost_task_runner_; 101 scoped_refptr<base::SingleThreadTaskRunner> context_lost_task_runner_;
94 base::Callback<void(int32_t)> context_lost_callback_; 102 base::Callback<void(int32_t)> context_lost_callback_;
95 103
104 base::Callback<void(CommandBufferDriver*)> destruct_callback_;
105
96 base::WeakPtrFactory<CommandBufferDriver> weak_factory_; 106 base::WeakPtrFactory<CommandBufferDriver> weak_factory_;
97 107
98 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver); 108 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver);
99 }; 109 };
100 110
101 } // namespace gles2 111 } // namespace gles2
102 112
103 #endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_ 113 #endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_
OLDNEW
« no previous file with comments | « no previous file | components/gles2/command_buffer_driver.cc » ('j') | components/native_viewport/native_viewport_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698