Bug 1169132 - Fix imports in FlameGraph.js, r=jsantell, a=sledru
authorVictor Porof <vporof@mozilla.com>
Thu, 28 May 2015 00:30:41 -0400
changeset 274915 0b54cd80c13e6e5f0be3d9843f8b474cf5b7d4df
parent 274914 ea651e839495890a4e187f7f88e9fb81f1cb3a3c
child 274916 cb1c1359fdc40779459076578823120ca2ecef75
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjsantell, sledru
bugs1169132
milestone40.0a2
Bug 1169132 - Fix imports in FlameGraph.js, r=jsantell, a=sledru
browser/devtools/shared/widgets/FlameGraph.js
--- a/browser/devtools/shared/widgets/FlameGraph.js
+++ b/browser/devtools/shared/widgets/FlameGraph.js
@@ -1,26 +1,39 @@
 /* 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/. */
 "use strict";
 
+const { Task } = require("resource://gre/modules/Task.jsm");
 const { ViewHelpers } = require("resource:///modules/devtools/ViewHelpers.jsm");
-const { AbstractCanvasGraph, GraphArea, GraphAreaDragger } = require("resource:///modules/devtools/Graphs.jsm");
-const { Promise } = require("resource://gre/modules/Promise.jsm");
-const { Task } = require("resource://gre/modules/Task.jsm");
-const { getColor } = require("devtools/shared/theme");
-const EventEmitter = require("devtools/toolkit/event-emitter");
-const FrameUtils = require("devtools/performance/frame-utils");
+const { setNamedTimeout, clearNamedTimeout } = require("resource:///modules/devtools/ViewHelpers.jsm");
+
+loader.lazyRequireGetter(this, "promise");
+loader.lazyRequireGetter(this, "EventEmitter",
+  "devtools/toolkit/event-emitter");
+
+loader.lazyRequireGetter(this, "getColor",
+  "devtools/shared/theme", true);
 
 loader.lazyRequireGetter(this, "CATEGORY_MAPPINGS",
   "devtools/performance/global", true);
+loader.lazyRequireGetter(this, "FrameUtils",
+  "devtools/performance/frame-utils");
+
+loader.lazyImporter(this, "AbstractCanvasGraph",
+  "resource:///modules/devtools/Graphs.jsm");
+loader.lazyImporter(this, "GraphArea",
+  "resource:///modules/devtools/Graphs.jsm");
+loader.lazyImporter(this, "GraphAreaDragger",
+  "resource:///modules/devtools/Graphs.jsm");
 
 const HTML_NS = "http://www.w3.org/1999/xhtml";
 const GRAPH_SRC = "chrome://browser/content/devtools/graphs-frame.xhtml";
+
 const L10N = new ViewHelpers.L10N();
 
 const GRAPH_RESIZE_EVENTS_DRAIN = 100; // ms
 
 const GRAPH_WHEEL_ZOOM_SENSITIVITY = 0.00035;
 const GRAPH_WHEEL_SCROLL_SENSITIVITY = 0.5;
 const GRAPH_MIN_SELECTION_WIDTH = 0.001; // ms
 
@@ -107,17 +120,17 @@ const COLOR_PALLETTE = Array.from(Array(
  *        The parent node holding the graph.
  * @param number sharpness [optional]
  *        Defaults to the current device pixel ratio.
  */
 function FlameGraph(parent, sharpness) {
   EventEmitter.decorate(this);
 
   this._parent = parent;
-  this._ready = Promise.defer();
+  this._ready = promise.defer();
 
   this.setTheme();
 
   AbstractCanvasGraph.createIframe(GRAPH_SRC, parent, iframe => {
     this._iframe = iframe;
     this._window = iframe.contentWindow;
     this._document = iframe.contentDocument;
     this._pixelRatio = sharpness || this._window.devicePixelRatio;