Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 module blamer.mojom; | |
| 6 | |
| 7 // TODO(chrisha): This isn't needed here, and should be moved somewhere else! | |
| 8 // This is the list of object types that are stored in a | |
| 9 // blamer::SharedMemoryHeap. They allow thread-safe runtime introspection of | |
| 10 // remote process blamer state. | |
| 11 enum DataType { | |
| 12 // A node is the fundamental unit in the DAG describing relationships between | |
| 13 // logical components at runtime. Internally, nodes have a type (all types | |
| 14 // are known at compile time and known by all processes) and an ID (known at | |
| 15 // runtime, but guaranteed to be unique, consistent and persistent across all | |
| 16 // processes). The DAG has a single root node, which is effectively the | |
| 17 // "browser". | |
| 18 NODE, | |
| 19 | |
| 20 // A path is from the "browser" root node to any node in the DAG of logical | |
| 21 // components. Since the graph is a indeed a DAG and not a tree (nodes can | |
| 22 // have multiple parents), the path to a node is not implicit. Many paths are | |
| 23 // possible, but not all paths are encoded; only those that have been actually | |
| 24 // walked in the DAG at runtime, and for which resource usage measurements | |
| 25 // have been explicitly taken in this context. | |
| 26 PATH, | |
| 27 | |
| 28 // A measurements object holds resource consumption data that can be | |
| 29 // attributed to a given path in the DAG. | |
| 30 MEASUREMENTS, | |
| 31 }; | |
| 32 | |
| 33 // A slab is a contiguous range of bytes owned by a heap. These are created in | |
| 34 // the process that owns the heap, and shared with the service. | |
| 35 struct SharedMemoryHeapSlab { | |
| 36 // Shared buffer handle holding the heap slab. | |
| 37 handle<shared_buffer> buffer; | |
| 38 | |
| 39 // The size of the heap slab, in bytes. | |
| 40 uint32 size; | |
|
Sami
2017/05/19 13:44:04
This is set by the client, i.e., renderer, right?
chrisha
2017/05/25 18:05:07
Good point. We could invert the logic and have the
| |
| 41 | |
| 42 // The ID of the slab. | |
| 43 uint32 id; | |
| 44 }; | |
| 45 | |
| 46 // A shared memory heap is fundamentally owned (and written to) by one process, | |
| 47 // but is able to be read from any other process. The blamer service maintains | |
| 48 // a list of all of these heaps across all process types, and is able to inspect | |
| 49 // them in a thread-safe manner at runtime, coalescing their data to get a | |
| 50 // global cross-process view of resource consumption. | |
| 51 interface SharedMemoryHeapRegistry { | |
| 52 // Registers a new slab of memory with the blamer service. | |
| 53 RegisterSlab(SharedMemoryHeapSlab slab); | |
| 54 }; | |
| OLD | NEW |