1c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)// found in the LICENSE file.
4c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)
5c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)/**
6c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) * @constructor
7c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) */
8c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)WebInspector.ProfileTypeRegistry = function()
9c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles){
10c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    this._profileTypes = [];
11c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)
12c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    this.cpuProfileType = new WebInspector.CPUProfileType();
13c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    this._addProfileType(this.cpuProfileType);
14c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    this.heapSnapshotProfileType = new WebInspector.HeapSnapshotProfileType();
15c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    this._addProfileType(this.heapSnapshotProfileType);
16c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    this.trackingHeapSnapshotProfileType = new WebInspector.TrackingHeapSnapshotProfileType();
17c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    this._addProfileType(this.trackingHeapSnapshotProfileType);
18c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)
197242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    if (!WebInspector.isWorkerFrontend() && Runtime.experiments.isEnabled("canvasInspection")) {
20c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)        this.canvasProfileType = new WebInspector.CanvasProfileType();
21c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)        this._addProfileType(this.canvasProfileType);
22c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    }
23c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)}
24c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)
25c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)WebInspector.ProfileTypeRegistry.prototype = {
26c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    /**
27c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)     * @param {!WebInspector.ProfileType} profileType
28c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)     */
29c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    _addProfileType: function(profileType)
30c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    {
31c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)        this._profileTypes.push(profileType);
32c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    },
33c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)
34c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    /**
35c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)     * @return {!Array.<!WebInspector.ProfileType>}
36c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)     */
37c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    profileTypes: function()
38c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    {
39c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)        return this._profileTypes;
40c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    }
41c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)}
42c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)
43c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)WebInspector.ProfileTypeRegistry.instance = new WebInspector.ProfileTypeRegistry();
44