blob: 143906f8e009ba737799b6aa975826db29ce229e [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/base/base.html">
<link rel="import" href="/base/extension_registry.html">
<script>
'use strict';
/**
* @fileoverview Base class for trace data importers.
*/
tr.exportTo('tr.importer', function() {
function Importer() { }
Importer.prototype = {
__proto__: Object.prototype,
/**
* Called by the Model to check whether the importer type stores the actual
* trace data or just holds it as container for further extraction.
*/
isTraceDataContainer: function() {
return false;
},
/**
* Called by the Model to extract one or more subtraces from the event data.
*/
extractSubtraces: function() {
return [];
},
/**
* Called to import events into the Model.
*/
importEvents: function() {
},
/**
* Called to import sample data into the Model.
*/
importSampleData: function() {
},
/**
* Called by the Model after all other importers have imported their
* events.
*/
finalizeImport: function() {
},
/**
* Called by the Model to join references between objects, after final
* model bounds have been computed.
*/
joinRefs: function() {
}
};
var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
options.defaultMetadata = {};
options.mandatoryBaseClass = Importer;
tr.b.decorateExtensionRegistry(Importer, options);
Importer.findImporterFor = function(eventData) {
var typeInfo = Importer.findTypeInfoMatching(function(ti) {
return ti.constructor.canImport(eventData);
});
if (typeInfo)
return typeInfo.constructor;
return undefined;
};
return {
Importer: Importer
};
});
</script>