Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 resource_coordinator.tracing.mojom; | 5 module tracing.mojom; |
| 6 | 6 |
| 7 import "mojo/common/time.mojom"; | 7 import "mojo/common/time.mojom"; |
| 8 import "mojo/common/values.mojom"; | 8 import "mojo/common/values.mojom"; |
| 9 | 9 |
| 10 // The JSON type of data coming from a tracing agents. | 10 // The JSON type of data coming from a tracing agents. |
| 11 // | 11 // |
| 12 // - All agents with the same label should have the same type. | 12 // - All agents with the same label should have the same type. |
| 13 // - There can be multiple agents with the same label, if their data type is | 13 // - There can be multiple agents with the same label, if their data type is |
| 14 // ARRAY. Their data will be concatenated together and separated by commas. | 14 // ARRAY. Their data will be concatenated together and separated by commas. |
| 15 // - There can be only one agent with data type STRING. | 15 // - There can be only one agent with data type STRING. |
| 16 enum TraceDataType { | 16 enum TraceDataType { |
| 17 ARRAY, | 17 ARRAY, |
| 18 STRING | 18 STRING |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 // Tracing agents, like |chrome|, |etw|, |battor|, and |cros|, use this | 21 // Tracing agents, like |chrome|, |etw|, |battor|, and |cros|, use this |
| 22 // interface to register themselves to the tracing service. | 22 // interface to register themselves to the tracing service. |
| 23 interface Factory { | 23 // |
| 24 RegisterAgent(Agent agent, string name, string label, TraceDataType type, | 24 // This is a separate interface from |Coordinator| for security and privacy |
| 25 // reasones: although we want to let almost every process be able to send | |
|
kenrb
2017/05/17 21:24:02
nit: s/reasones/reasons
chiniforooshan
2017/05/17 21:33:17
Done.
| |
| 26 // tracing data to the service, we do not want to let an untrusted child process | |
| 27 // be able to collect traces from other processes using the |Coordinator| | |
| 28 // interface. | |
| 29 interface AgentRegistry { | |
| 30 RegisterAgent(Agent agent, string label, TraceDataType type, | |
| 25 bool supports_explicit_clock_sync_); | 31 bool supports_explicit_clock_sync_); |
| 26 }; | 32 }; |
| 27 | 33 |
| 28 // There should be at most one implementation of this interface per process. | |
| 29 // When the tracing service calls |StopAndFlush| on an agent, the agent begins | 34 // When the tracing service calls |StopAndFlush| on an agent, the agent begins |
| 30 // serializing data into the recorder that was given in the |StartTracing| call. | 35 // serializing data into the recorder that was given in the |StartTracing| call. |
| 31 // When finished, the agent should close the recorder connection to signal the | 36 // When finished, the agent should close the recorder connection to signal the |
| 32 // tracing service that no more data will be sent. | 37 // tracing service that no more data will be sent. |
| 33 interface Agent { | 38 interface Agent { |
| 34 StartTracing(string categories, Recorder recorder); | 39 StartTracing(string config, Recorder recorder) => (); |
| 35 StopAndFlush(); | 40 StopAndFlush(); |
| 36 RequestClockSyncMarker() => (mojo.common.mojom.TimeTicks issue_ts, | 41 RequestClockSyncMarker(string sync_id) => ( |
| 37 mojo.common.mojom.TimeTicks issue_end_ts); | 42 mojo.common.mojom.TimeTicks issue_ts, |
| 43 mojo.common.mojom.TimeTicks issue_end_ts); | |
| 38 RequestBufferStatus() => (uint32 capacity, uint32 count); | 44 RequestBufferStatus() => (uint32 capacity, uint32 count); |
| 45 GetCategories() => (string categories); | |
| 39 }; | 46 }; |
| 40 | 47 |
| 41 // An agent can make several calls to |AddChunk|. Chunks will be concatenated | 48 // An agent can make several calls to |AddChunk|. Chunks will be concatenated |
| 42 // with no separator (type STRING) or using comma as the separator (type ARRAY). | 49 // with no separator (type STRING) or using comma as the separator (type ARRAY). |
| 43 // There should be only one agent of type STRING per agent label; otherwise | 50 // There should be only one agent of type STRING per agent label; otherwise |
| 44 // their trace data would be mixed up. | 51 // their trace data would be mixed up. |
| 45 interface Recorder { | 52 interface Recorder { |
| 46 AddChunk(string chunk); | 53 AddChunk(string chunk); |
| 47 AddMetadata(mojo.common.mojom.DictionaryValue metadata); | 54 AddMetadata(mojo.common.mojom.DictionaryValue metadata); |
| 48 }; | 55 }; |
| 49 | 56 |
| 50 // A tracing controller uses this interface to coordinate trace data collection | 57 // A tracing controller uses this interface to coordinate trace data collection |
| 51 // from all registered agents. At any given time, there should be at most one | 58 // from all registered agents. At any given time, there should be at most one |
| 52 // connected controller. | 59 // connected controller. |
| 53 interface Coordinator { | 60 interface Coordinator { |
|
kenrb
2017/05/17 21:24:02
How do you prevent renderer processes from being a
chiniforooshan
2017/05/17 21:33:17
Isn't it enough that we don't "provide" the Coordi
kenrb
2017/05/18 02:19:52
Yes, thanks, this is right, sorry about my confusi
chiniforooshan
2017/05/18 15:23:49
Acknowledged.
| |
| 54 StartTracing(handle<data_pipe_producer> stream, string categories); | 61 StartTracing(handle<data_pipe_producer> stream, string config); |
| 55 StopAndFlush(); | 62 StopAndFlush(); |
| 56 IsTracing() => (bool is_tracing); | 63 IsTracing() => (bool is_tracing); |
| 57 RequestBufferUsage() => (float percent_full, uint32 approximate_count); | 64 RequestBufferUsage() => (bool success, float percent_full, |
| 65 uint32 approximate_count); | |
| 66 GetCategories() => (string categories); | |
| 58 }; | 67 }; |
| OLD | NEW |