| 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 module mojo { | 5 module mojo { |
| 6 | 6 |
| 7 struct CommandBufferState { | 7 struct CommandBufferState { |
| 8 int32 num_entries; | 8 int32 num_entries; |
| 9 int32 get_offset; | 9 int32 get_offset; |
| 10 int32 put_offset; | 10 int32 put_offset; |
| 11 int32 token; | 11 int32 token; |
| 12 int32 error; // TODO(piman): enum | 12 int32 error; // TODO(piman): enum |
| 13 int32 context_lost_reason; // TODO(piman): enum | 13 int32 context_lost_reason; // TODO(piman): enum |
| 14 uint32 generation; | 14 uint32 generation; |
| 15 }; | 15 }; |
| 16 | 16 |
| 17 // TODO(piman): we need to support proper SHM handles, or refactor command | |
| 18 // buffers to sit on top of mojo primitives (e.g. DataPipe, etc.). | |
| 19 struct ShmHandle { | |
| 20 uint64 handle_hack; | |
| 21 }; | |
| 22 | |
| 23 interface CommandBufferSyncClient { | 17 interface CommandBufferSyncClient { |
| 24 DidInitialize(bool success); | 18 DidInitialize(bool success); |
| 25 DidMakeProgress(CommandBufferState state); | 19 DidMakeProgress(CommandBufferState state); |
| 26 }; | 20 }; |
| 27 | 21 |
| 28 [Peer=CommandBufferClient] | 22 [Peer=CommandBufferClient] |
| 29 interface CommandBuffer { | 23 interface CommandBuffer { |
| 30 Initialize(CommandBufferSyncClient sync_client, | 24 Initialize(CommandBufferSyncClient sync_client, |
| 31 ShmHandle shared_state); | 25 handle<shared_buffer> shared_state); |
| 32 SetGetBuffer(int32 buffer); | 26 SetGetBuffer(int32 buffer); |
| 33 Flush(int32 put_offset); | 27 Flush(int32 put_offset); |
| 34 MakeProgress(int32 last_get_offset); | 28 MakeProgress(int32 last_get_offset); |
| 35 RegisterTransferBuffer(int32 id, ShmHandle transfer_buffer, uint32 size); | 29 RegisterTransferBuffer( |
| 30 int32 id, handle<shared_buffer> transfer_buffer, uint32 size); |
| 36 DestroyTransferBuffer(int32 id); | 31 DestroyTransferBuffer(int32 id); |
| 37 Echo() => (); | 32 Echo() => (); |
| 38 | 33 |
| 39 // TODO(piman): move to somewhere else (native_viewport?). | 34 // TODO(piman): move to somewhere else (native_viewport?). |
| 40 RequestAnimationFrames(); | 35 RequestAnimationFrames(); |
| 41 CancelAnimationFrames(); | 36 CancelAnimationFrames(); |
| 42 | 37 |
| 43 // TODO(piman): sync points | 38 // TODO(piman): sync points |
| 44 }; | 39 }; |
| 45 | 40 |
| 46 [Peer=CommandBuffer] | 41 [Peer=CommandBuffer] |
| 47 interface CommandBufferClient { | 42 interface CommandBufferClient { |
| 48 DidDestroy(); | 43 DidDestroy(); |
| 49 LostContext(int32 lost_reason); // TODO(piman): enum | 44 LostContext(int32 lost_reason); // TODO(piman): enum |
| 50 | 45 |
| 51 // TODO(piman): move to somewhere else (native_viewport?). | 46 // TODO(piman): move to somewhere else (native_viewport?). |
| 52 DrawAnimationFrame(); | 47 DrawAnimationFrame(); |
| 53 }; | 48 }; |
| 54 | 49 |
| 55 } | 50 } |
| 56 | 51 |
| OLD | NEW |