From 3641c12115cf63d6b3941d473b1bc3534463989e Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 28 May 2015 07:37:42 -0700 Subject: [PATCH] Bug 1024774 - Part 7: Add HeapSnapshot WebIDL interface; r=bholley --- dom/bindings/Bindings.conf | 6 +++++- dom/webidl/ChromeUtils.webidl | 8 ++++++++ dom/webidl/HeapSnapshot.webidl | 12 ++++++++++++ dom/webidl/moz.build | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 dom/webidl/HeapSnapshot.webidl diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 3b7505625130..e29deacf0e2c 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -271,7 +271,7 @@ DOMInterfaces = { # collection of static methods, so we have this `concrete: False` hack. 'concrete': False, 'nativeType': 'mozilla::devtools::ChromeUtils', - 'implicitJSContext': ['saveHeapSnapshot'] + 'implicitJSContext': ['readHeapSnapshot', 'saveHeapSnapshot'] }, 'ChromeWindow': { @@ -509,6 +509,10 @@ DOMInterfaces = { 'headerFile': 'nsGeolocation.h' }, +'HeapSnapshot': { + 'nativeType': 'mozilla::devtools::HeapSnapshot' +}, + 'History': { 'headerFile': 'nsHistory.h', 'nativeType': 'nsHistory' diff --git a/dom/webidl/ChromeUtils.webidl b/dom/webidl/ChromeUtils.webidl index 43ab2b7dd9f4..db373fea98ae 100644 --- a/dom/webidl/ChromeUtils.webidl +++ b/dom/webidl/ChromeUtils.webidl @@ -20,6 +20,14 @@ interface ChromeUtils { [Throws] static void saveHeapSnapshot(DOMString filePath, optional HeapSnapshotBoundaries boundaries); + + /** + * Deserialize a core dump into a HeapSnapshot. + * + * @param filePath The file path to read the core dump from. + */ + [Throws, NewObject] + static HeapSnapshot readHeapSnapshot(DOMString filePath); }; /** diff --git a/dom/webidl/HeapSnapshot.webidl b/dom/webidl/HeapSnapshot.webidl new file mode 100644 index 000000000000..4b4068318c9f --- /dev/null +++ b/dom/webidl/HeapSnapshot.webidl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** + * A HeapSnapshot represents a snapshot of the heap graph + */ +[ChromeOnly, Exposed=(Window,System)] +interface HeapSnapshot { +}; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 25e64bb765e0..2472a43c3418 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -162,6 +162,7 @@ WEBIDL_FILES = [ 'GetUserMediaRequest.webidl', 'HDMIInputPort.webidl', 'Headers.webidl', + 'HeapSnapshot.webidl', 'History.webidl', 'HTMLAllCollection.webidl', 'HTMLAnchorElement.webidl',