OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 [DartPackage="mojo_services"] |
| 6 module mojo.flog; |
| 7 |
| 8 // TODO(dalesat): Move out of media to somewhere more generic. |
| 9 |
| 10 // Exposed by the log service to enable creation and consumption of logs. |
| 11 [ServiceName="mojo::flog::FlogService"] |
| 12 interface FlogService { |
| 13 // Creates a new logger. |
| 14 CreateLogger(FlogLogger& logger, string label); |
| 15 |
| 16 // Gets the descriptions of all logs. |
| 17 GetLogDescriptions() => (array<FlogDescription> descriptions); |
| 18 |
| 19 // Gets a reader for the specified log. |
| 20 CreateReader(FlogReader& reader, uint32 log_id); |
| 21 }; |
| 22 |
| 23 // A logger that logs messages regarding multiple channels. |
| 24 interface FlogLogger { |
| 25 // Logs the creation of a channel. |
| 26 LogChannelCreation(int64 time_us, uint32 channel_id, string type_name); |
| 27 |
| 28 // Logs a message sent to an existing channel. |
| 29 LogChannelMessage(int64 time_us, uint32 channel_id, array<uint8> data); |
| 30 |
| 31 // Logs the deletion of a channel. |
| 32 LogChannelDeletion(int64 time_us, uint32 channel_id); |
| 33 }; |
| 34 |
| 35 // A reader that reads messages from one or more logs. |
| 36 interface FlogReader { |
| 37 // Gets entries from the log starting and the specified index (entries are |
| 38 // indexed starting at 0). If the log is open, the callback will be called |
| 39 // when max_count entries are avaiable starting at start_index. If the log |
| 40 // is closed, the callback will be called immediately with as many entries |
| 41 // as are available starting at start_index and not exceeding max_count |
| 42 // entries. entry_count and open refer to the entire log at the time the |
| 43 // callback occurred. |
| 44 GetEntries(uint32 start_index, uint32 max_count) => |
| 45 (array<FlogEntry> entries, uint32 entry_count, bool open); |
| 46 }; |
| 47 |
| 48 struct FlogDescription { |
| 49 string label; |
| 50 uint32 log_id; |
| 51 uint32 entry_count; |
| 52 int64 start_time_us; |
| 53 int64 stop_time_us; |
| 54 bool open; |
| 55 }; |
| 56 |
| 57 struct FlogEntry { |
| 58 int64 time_us; |
| 59 uint32 log_id; |
| 60 uint32 channel_id; |
| 61 FlogEntryDetails? details; |
| 62 }; |
| 63 |
| 64 union FlogEntryDetails { |
| 65 FlogChannelCreationEntryDetails channel_creation; |
| 66 FlogChannelMessageEntryDetails channel_message; |
| 67 }; |
| 68 |
| 69 struct FlogChannelCreationEntryDetails { |
| 70 string type_name; |
| 71 }; |
| 72 |
| 73 struct FlogChannelMessageEntryDetails { |
| 74 array<uint8> data; |
| 75 }; |
OLD | NEW |