From 91df9dbb13e9b79b2b78d8dcca1f0a2bdba8de3e Mon Sep 17 00:00:00 2001 From: Jordan Santell Date: Tue, 9 Jun 2015 20:34:51 -0700 Subject: [PATCH 01/59] Bug 1152992 - If markers do not have a definition, classify them as "Unknown" in the perftools. r=vp --- .../performance/modules/logic/marker-utils.js | 45 ++++++++-- .../modules/logic/recording-utils.js | 50 ----------- .../modules/logic/waterfall-utils.js | 14 ++- .../devtools/performance/modules/markers.js | 12 ++- .../performance/modules/widgets/graphs.js | 15 ++-- .../modules/widgets/marker-details.js | 2 - .../modules/widgets/marker-view.js | 36 +++----- .../modules/widgets/markers-overview.js | 66 +++++++++----- .../performance/performance-controller.js | 10 --- browser/devtools/performance/test/browser.ini | 2 - .../performance/test/browser_marker-utils.js | 70 --------------- .../test/browser_timeline-blueprint.js | 34 ------- .../test/browser_timeline-filters.js | 36 +++++++- browser/devtools/performance/test/head.js | 1 + .../devtools/performance/test/unit/head.js | 3 + .../test/unit/test_marker-blueprint.js | 29 ++++++ .../test/unit/test_marker-utils.js | 88 +++++++++++++++++++ .../performance/test/unit/xpcshell.ini | 4 +- .../performance/views/details-waterfall.js | 9 +- .../devtools/performance/views/overview.js | 6 +- .../browser/devtools/timeline.properties | 1 + 21 files changed, 284 insertions(+), 249 deletions(-) delete mode 100644 browser/devtools/performance/test/browser_marker-utils.js delete mode 100644 browser/devtools/performance/test/browser_timeline-blueprint.js create mode 100644 browser/devtools/performance/test/unit/test_marker-blueprint.js create mode 100644 browser/devtools/performance/test/unit/test_marker-utils.js diff --git a/browser/devtools/performance/modules/logic/marker-utils.js b/browser/devtools/performance/modules/logic/marker-utils.js index 43608eaac9df..55a4edbe20cf 100644 --- a/browser/devtools/performance/modules/logic/marker-utils.js +++ b/browser/devtools/performance/modules/logic/marker-utils.js @@ -8,7 +8,7 @@ * and parsing out the blueprint to generate correct values for markers. */ -const { Ci } = require("chrome"); +const { Cu, Ci } = require("chrome"); loader.lazyRequireGetter(this, "L10N", "devtools/performance/global", true); @@ -22,6 +22,18 @@ loader.lazyRequireGetter(this, "WebConsoleUtils", // String used to fill in platform data when it should be hidden. const GECKO_SYMBOL = "(Gecko)"; +/** + * Takes a marker, blueprint, and filter list and + * determines if this marker should be filtered or not. + */ +function isMarkerValid (marker, filter) { + let isUnknown = !(marker.name in TIMELINE_BLUEPRINT); + if (isUnknown) { + return filter.indexOf("UNKNOWN") === -1; + } + return filter.indexOf(marker.name) === -1; +} + /** * Returns the correct label to display for passed in marker, based * off of the blueprints. @@ -30,7 +42,7 @@ const GECKO_SYMBOL = "(Gecko)"; * @return {string} */ function getMarkerLabel (marker) { - let blueprint = TIMELINE_BLUEPRINT[marker.name]; + let blueprint = getBlueprintFor(marker); // Either use the label function in the blueprint, or use it directly // as a string. return typeof blueprint.label === "function" ? blueprint.label(marker) : blueprint.label; @@ -44,7 +56,7 @@ function getMarkerLabel (marker) { * @return {string} */ function getMarkerClassName (type) { - let blueprint = TIMELINE_BLUEPRINT[type]; + let blueprint = getBlueprintFor({ name: type }); // Either use the label function in the blueprint, or use it directly // as a string. let className = typeof blueprint.label === "function" ? blueprint.label() : blueprint.label; @@ -72,7 +84,7 @@ function getMarkerClassName (type) { * @return {Array} */ function getMarkerFields (marker) { - let blueprint = TIMELINE_BLUEPRINT[marker.name]; + let blueprint = getBlueprintFor(marker); // If blueprint.fields is a function, use that if (typeof blueprint.fields === "function") { @@ -111,7 +123,7 @@ const DOM = { * @return {Array} */ buildFields: function (doc, marker) { - let blueprint = TIMELINE_BLUEPRINT[marker.name]; + let blueprint = getBlueprintFor(marker); let fields = getMarkerFields(marker); return fields.map(({ label, value }) => DOM.buildNameValueLabel(doc, label, value)); @@ -125,7 +137,7 @@ const DOM = { * @return {Element} */ buildTitle: function (doc, marker) { - let blueprint = TIMELINE_BLUEPRINT[marker.name]; + let blueprint = getBlueprintFor(marker); let hbox = doc.createElement("hbox"); hbox.setAttribute("align", "center"); @@ -377,6 +389,14 @@ const JS_MARKER_MAP = { * A series of formatters used by the blueprint. */ const Formatters = { + /** + * Uses the marker name as the label for markers that do not have + * a blueprint entry. Uses "Other" in the marker filter menu. + */ + UnknownLabel: function (marker={}) { + return marker.name || L10N.getStr("timeline.label.unknown"); + }, + GCLabel: function (marker={}) { let label = L10N.getStr("timeline.label.garbageCollection"); // Only if a `nonincrementalReason` exists, do we want to label @@ -444,9 +464,22 @@ const Formatters = { }, }; +/** + * Takes a marker and returns the definition for that marker type, + * falling back to the UNKNOWN definition if undefined. + * + * @param {Marker} marker + * @return {object} + */ +function getBlueprintFor (marker) { + return TIMELINE_BLUEPRINT[marker.name] || TIMELINE_BLUEPRINT.UNKNOWN; +} + +exports.isMarkerValid = isMarkerValid; exports.getMarkerLabel = getMarkerLabel; exports.getMarkerClassName = getMarkerClassName; exports.getMarkerFields = getMarkerFields; exports.DOM = DOM; exports.CollapseFunctions = CollapseFunctions; exports.Formatters = Formatters; +exports.getBlueprintFor = getBlueprintFor; diff --git a/browser/devtools/performance/modules/logic/recording-utils.js b/browser/devtools/performance/modules/logic/recording-utils.js index af7f7fc3d563..5569d99b0750 100644 --- a/browser/devtools/performance/modules/logic/recording-utils.js +++ b/browser/devtools/performance/modules/logic/recording-utils.js @@ -196,55 +196,6 @@ function getProfileThreadFromAllocations(allocations) { return thread; } -/** - * Gets the current timeline blueprint without the hidden markers. - * - * @param blueprint - * The default timeline blueprint. - * @param array hiddenMarkers - * A list of hidden markers' names. - * @return object - * The filtered timeline blueprint. - */ -function getFilteredBlueprint({ blueprint, hiddenMarkers }) { - // Clone functions here just to prevent an error, as the blueprint - // contains functions (even though we do not use them). - let filteredBlueprint = Cu.cloneInto(blueprint, {}, { cloneFunctions: true }); - let maybeRemovedGroups = new Set(); - let removedGroups = new Set(); - - // 1. Remove hidden markers from the blueprint. - - for (let hiddenMarkerName of hiddenMarkers) { - maybeRemovedGroups.add(filteredBlueprint[hiddenMarkerName].group); - delete filteredBlueprint[hiddenMarkerName]; - } - - // 2. Get a list of all the groups that will be removed. - - for (let maybeRemovedGroup of maybeRemovedGroups) { - let markerNames = Object.keys(filteredBlueprint); - let isGroupRemoved = markerNames.every(e => filteredBlueprint[e].group != maybeRemovedGroup); - if (isGroupRemoved) { - removedGroups.add(maybeRemovedGroup); - } - } - - // 3. Offset groups so that their indices are consecutive. - - for (let removedGroup of removedGroups) { - let markerNames = Object.keys(filteredBlueprint); - for (let markerName of markerNames) { - let markerDetails = filteredBlueprint[markerName]; - if (markerDetails.group > removedGroup) { - markerDetails.group--; - } - } - } - - return filteredBlueprint; -}; - /** * Deduplicates a profile by deduplicating stacks, frames, and strings. * @@ -571,7 +522,6 @@ exports.offsetSampleTimes = offsetSampleTimes; exports.offsetMarkerTimes = offsetMarkerTimes; exports.offsetAndScaleTimestamps = offsetAndScaleTimestamps; exports.getProfileThreadFromAllocations = getProfileThreadFromAllocations; -exports.getFilteredBlueprint = getFilteredBlueprint; exports.deflateProfile = deflateProfile; exports.deflateThread = deflateThread; exports.UniqueStrings = UniqueStrings; diff --git a/browser/devtools/performance/modules/logic/waterfall-utils.js b/browser/devtools/performance/modules/logic/waterfall-utils.js index d2228fb43061..b1bf06f654dd 100644 --- a/browser/devtools/performance/modules/logic/waterfall-utils.js +++ b/browser/devtools/performance/modules/logic/waterfall-utils.js @@ -7,27 +7,25 @@ * Utility functions for collapsing markers into a waterfall. */ -loader.lazyRequireGetter(this, "TIMELINE_BLUEPRINT", - "devtools/performance/markers", true); +loader.lazyRequireGetter(this, "getBlueprintFor", + "devtools/performance/marker-utils", true); /** * Collapses markers into a tree-like structure. * @param object markerNode * @param array markersList - * @param ?object blueprint */ -function collapseMarkersIntoNode({ markerNode, markersList, blueprint }) { +function collapseMarkersIntoNode({ markerNode, markersList }) { let { getCurrentParentNode, collapseMarker, addParentNode, popParentNode } = createParentNodeFactory(markerNode); - blueprint = blueprint || TIMELINE_BLUEPRINT; for (let i = 0, len = markersList.length; i < len; i++) { let curr = markersList[i]; let parentNode = getCurrentParentNode(); - let def = blueprint[curr.name]; - let collapse = def.collapseFunc || (() => null); + let blueprint = getBlueprintFor(curr); + + let collapse = blueprint.collapseFunc || (() => null); let peek = distance => markersList[i + distance]; - let foundParent = false; let collapseInfo = collapse(parentNode, curr, peek); if (collapseInfo) { diff --git a/browser/devtools/performance/modules/markers.js b/browser/devtools/performance/modules/markers.js index 984eb4aa79bc..177a4d4fb6f0 100644 --- a/browser/devtools/performance/modules/markers.js +++ b/browser/devtools/performance/modules/markers.js @@ -55,6 +55,16 @@ const { Formatters, CollapseFunctions: collapse } = require("devtools/performanc * updated as well. */ const TIMELINE_BLUEPRINT = { + /* Default definition used for markers that occur but + * are not defined here. Should ultimately be defined, but this gives + * us room to work on the front end separately from the platform. */ + "UNKNOWN": { + group: 2, + colorName: "graphs-grey", + collapseFunc: collapse.child, + label: Formatters.UnknownLabel + }, + /* Group 0 - Reflow and Rendering pipeline */ "Styles": { group: 0, @@ -131,7 +141,7 @@ const TIMELINE_BLUEPRINT = { /* Group 2 - User Controlled */ "ConsoleTime": { group: 2, - colorName: "graphs-grey", + colorName: "graphs-blue", label: sublabelForProperty(L10N.getStr("timeline.label.consoleTime"), "causeName"), fields: [{ property: "causeName", diff --git a/browser/devtools/performance/modules/widgets/graphs.js b/browser/devtools/performance/modules/widgets/graphs.js index 468ab8dd7e49..bb5b50b126fe 100644 --- a/browser/devtools/performance/modules/widgets/graphs.js +++ b/browser/devtools/performance/modules/widgets/graphs.js @@ -135,8 +135,8 @@ MemoryGraph.prototype = Heritage.extend(PerformanceGraph.prototype, { } }); -function TimelineGraph(parent, blueprint) { - MarkersOverview.call(this, parent, blueprint); +function TimelineGraph(parent, filter) { + MarkersOverview.call(this, parent, filter); } TimelineGraph.prototype = Heritage.extend(MarkersOverview.prototype, { @@ -163,7 +163,6 @@ const GRAPH_DEFINITIONS = { timeline: { constructor: TimelineGraph, selector: "#markers-overview", - needsBlueprints: true, primaryLink: true } }; @@ -174,15 +173,15 @@ const GRAPH_DEFINITIONS = { * * @param {object} definition * @param {DOMElement} root - * @param {function} getBlueprint + * @param {function} getFilter * @param {function} getTheme */ -function GraphsController ({ definition, root, getBlueprint, getTheme }) { +function GraphsController ({ definition, root, getFilter, getTheme }) { this._graphs = {}; this._enabled = new Set(); this._definition = definition || GRAPH_DEFINITIONS; this._root = root; - this._getBlueprint = getBlueprint; + this._getFilter = getFilter; this._getTheme = getTheme; this._primaryLink = Object.keys(this._definition).filter(name => this._definition[name].primaryLink)[0]; this.$ = root.ownerDocument.querySelector.bind(root.ownerDocument); @@ -369,8 +368,8 @@ GraphsController.prototype = { _construct: Task.async(function *(graphName) { let def = this._definition[graphName]; let el = this.$(def.selector); - let blueprint = def.needsBlueprints ? this._getBlueprint() : void 0; - let graph = this._graphs[graphName] = new def.constructor(el, blueprint); + let filter = this._getFilter(); + let graph = this._graphs[graphName] = new def.constructor(el, filter); graph.graphName = graphName; yield graph.ready(); diff --git a/browser/devtools/performance/modules/widgets/marker-details.js b/browser/devtools/performance/modules/widgets/marker-details.js index 5772ace46882..12780ea2a346 100644 --- a/browser/devtools/performance/modules/widgets/marker-details.js +++ b/browser/devtools/performance/modules/widgets/marker-details.js @@ -13,8 +13,6 @@ loader.lazyRequireGetter(this, "EventEmitter", "devtools/toolkit/event-emitter"); loader.lazyRequireGetter(this, "L10N", "devtools/performance/global", true); -loader.lazyRequireGetter(this, "TIMELINE_BLUEPRINT", - "devtools/performance/markers", true); loader.lazyRequireGetter(this, "MarkerUtils", "devtools/performance/marker-utils"); diff --git a/browser/devtools/performance/modules/widgets/marker-view.js b/browser/devtools/performance/modules/widgets/marker-view.js index 7a33eecafd69..4f8d1058ce52 100644 --- a/browser/devtools/performance/modules/widgets/marker-view.js +++ b/browser/devtools/performance/modules/widgets/marker-view.js @@ -11,11 +11,10 @@ const { Cc, Ci, Cu, Cr } = require("chrome"); const { Heritage } = require("resource:///modules/devtools/ViewHelpers.jsm"); const { AbstractTreeItem } = require("resource:///modules/devtools/AbstractTreeItem.jsm"); -const { TIMELINE_BLUEPRINT: ORIGINAL_BP } = require("devtools/performance/markers"); - loader.lazyRequireGetter(this, "MarkerUtils", "devtools/performance/marker-utils"); + const HTML_NS = "http://www.w3.org/1999/xhtml"; const LEVEL_INDENT = 10; // px @@ -60,15 +59,14 @@ MarkerView.prototype = Heritage.extend(AbstractTreeItem.prototype, { }, /** - * Sets a list of names and colors used to paint markers. - * @see TIMELINE_BLUEPRINT in timeline/widgets/global.js - * @param object blueprint + * Sets a list of marker types to be filtered out of this view. + * @param Array filter */ - set blueprint(blueprint) { - this.root._blueprint = blueprint; + set filter(filter) { + this.root._filter = filter; }, - get blueprint() { - return this.root._blueprint; + get filter() { + return this.root._filter; }, /** @@ -139,7 +137,6 @@ MarkerView.prototype = Heritage.extend(AbstractTreeItem.prototype, { if (!submarkers || !submarkers.length) { return; } - let blueprint = this.root._blueprint; let startTime = this.root._interval.startTime; let endTime = this.root._interval.endTime; let newLevel = this.level + 1; @@ -147,17 +144,15 @@ MarkerView.prototype = Heritage.extend(AbstractTreeItem.prototype, { for (let i = 0, len = submarkers.length; i < len; i++) { let marker = submarkers[i]; - // If this marker isn't in the global timeline blueprint, don't display - // it, but dump a warning message to the console. - if (!(marker.name in blueprint)) { - if (!(marker.name in ORIGINAL_BP)) { - console.warn(`Marker not found in timeline blueprint: ${marker.name}.`); - } + // Skip filtered markers + if (!MarkerUtils.isMarkerValid(marker, this.filter)) { continue; } + if (!isMarkerInRange(marker, startTime|0, endTime|0)) { continue; } + children.push(new MarkerView({ owner: this, marker: marker, @@ -175,15 +170,12 @@ MarkerView.prototype = Heritage.extend(AbstractTreeItem.prototype, { */ _buildMarkerCells: function(doc, targetNode, arrowNode) { let marker = this.marker; - let style = this.root._blueprint[marker.name]; + let blueprint = MarkerUtils.getBlueprintFor(marker); let startTime = this.root._interval.startTime; let endTime = this.root._interval.endTime; - let sidebarCell = this._buildMarkerSidebar( - doc, style, marker); - - let timebarCell = this._buildMarkerTimebar( - doc, style, marker, startTime, endTime, arrowNode); + let sidebarCell = this._buildMarkerSidebar(doc, blueprint, marker); + let timebarCell = this._buildMarkerTimebar(doc, blueprint, marker, startTime, endTime, arrowNode); targetNode.appendChild(sidebarCell); targetNode.appendChild(timebarCell); diff --git a/browser/devtools/performance/modules/widgets/markers-overview.js b/browser/devtools/performance/modules/widgets/markers-overview.js index 3d75a5569640..53bfbf2ad1b2 100644 --- a/browser/devtools/performance/modules/widgets/markers-overview.js +++ b/browser/devtools/performance/modules/widgets/markers-overview.js @@ -21,6 +21,10 @@ loader.lazyRequireGetter(this, "L10N", "devtools/performance/global", true); loader.lazyRequireGetter(this, "TickUtils", "devtools/performance/waterfall-ticks", true); +loader.lazyRequireGetter(this, "MarkerUtils", + "devtools/performance/marker-utils"); +loader.lazyRequireGetter(this, "TIMELINE_BLUEPRINT", + "devtools/performance/markers", true); const OVERVIEW_HEADER_HEIGHT = 14; // px const OVERVIEW_ROW_HEIGHT = 11; // px @@ -28,14 +32,12 @@ const OVERVIEW_ROW_HEIGHT = 11; // px const OVERVIEW_SELECTION_LINE_COLOR = "#666"; const OVERVIEW_CLIPHEAD_LINE_COLOR = "#555"; -const FIND_OPTIMAL_TICK_INTERVAL_MAX_ITERS = 100; const OVERVIEW_HEADER_TICKS_MULTIPLE = 100; // ms const OVERVIEW_HEADER_TICKS_SPACING_MIN = 75; // px const OVERVIEW_HEADER_TEXT_FONT_SIZE = 9; // px const OVERVIEW_HEADER_TEXT_FONT_FAMILY = "sans-serif"; const OVERVIEW_HEADER_TEXT_PADDING_LEFT = 6; // px const OVERVIEW_HEADER_TEXT_PADDING_TOP = 1; // px -const OVERVIEW_MARKERS_COLOR_STOPS = [0, 0.1, 0.75, 1]; const OVERVIEW_MARKER_WIDTH_MIN = 4; // px const OVERVIEW_GROUP_VERTICAL_PADDING = 5; // px @@ -44,13 +46,13 @@ const OVERVIEW_GROUP_VERTICAL_PADDING = 5; // px * * @param nsIDOMNode parent * The parent node holding the overview. - * @param Object blueprint - * List of names and colors defining markers. + * @param Array filter + * List of names of marker types that should not be shown. */ -function MarkersOverview(parent, blueprint, ...args) { +function MarkersOverview(parent, filter=[], ...args) { AbstractCanvasGraph.apply(this, [parent, "markers-overview", ...args]); this.setTheme(); - this.setBlueprint(blueprint); + this.setFilter(filter); } MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, { @@ -64,21 +66,36 @@ MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, { * Compute the height of the overview. */ get fixedHeight() { - return this.headerHeight + this.rowHeight * (this._lastGroup + 1); + return this.headerHeight + this.rowHeight * this._numberOfGroups; }, /** - * List of names and colors used to paint this overview. - * @see TIMELINE_BLUEPRINT in timeline/widgets/global.js + * List of marker types that should not be shown in the graph. */ - setBlueprint: function(blueprint) { + setFilter: function (filter) { this._paintBatches = new Map(); - this._lastGroup = 0; + this._filter = filter; + this._groupMap = Object.create(null); - for (let type in blueprint) { - this._paintBatches.set(type, { style: blueprint[type], batch: [] }); - this._lastGroup = Math.max(this._lastGroup, blueprint[type].group || 0); + let observedGroups = new Set(); + + for (let type in TIMELINE_BLUEPRINT) { + if (filter.indexOf(type) !== -1) { + continue; + } + this._paintBatches.set(type, { definition: TIMELINE_BLUEPRINT[type], batch: [] }); + observedGroups.add(TIMELINE_BLUEPRINT[type].group); } + + // Take our set of observed groups and order them and map + // the group numbers to fill in the holes via `_groupMap`. + // This normalizes our rows by removing rows that aren't used + // if filters are enabled. + let actualPosition = 0; + for (let groupNumber of Array.from(observedGroups).sort()) { + this._groupMap[groupNumber] = actualPosition++; + } + this._numberOfGroups = Object.keys(this._groupMap).length; }, /** @@ -103,17 +120,19 @@ MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, { // Group markers into separate paint batches. This is necessary to // draw all markers sharing the same style at once. - for (let marker of markers) { - let markerType = this._paintBatches.get(marker.name); - if (markerType) { - markerType.batch.push(marker); + // Again skip over markers that we're filtering -- we don't want them + // to be labeled as "Unknown" + if (!MarkerUtils.isMarkerValid(marker, this._filter)) { + continue; } + + let markerType = this._paintBatches.get(marker.name) || this._paintBatches.get("UNKNOWN"); + markerType.batch.push(marker); } // Calculate each row's height, and the time-based scaling. - let totalGroups = this._lastGroup + 1; let groupHeight = this.rowHeight * this._pixelRatio; let groupPadding = this.groupPadding * this._pixelRatio; let headerHeight = this.headerHeight * this._pixelRatio; @@ -132,7 +151,7 @@ MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, { ctx.fillStyle = this.alternatingBackgroundColor; ctx.beginPath(); - for (let i = 0; i < totalGroups; i += 2) { + for (let i = 0; i < this._numberOfGroups; i += 2) { let top = headerHeight + i * groupHeight; ctx.rect(0, top, canvasWidth, groupHeight); } @@ -172,11 +191,12 @@ MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, { // Draw the timeline markers. - for (let [, { style, batch }] of this._paintBatches) { - let top = headerHeight + style.group * groupHeight + groupPadding / 2; + for (let [, { definition, batch }] of this._paintBatches) { + let group = this._groupMap[definition.group]; + let top = headerHeight + group * groupHeight + groupPadding / 2; let height = groupHeight - groupPadding; - let color = getColor(style.colorName, this.theme); + let color = getColor(definition.colorName, this.theme); ctx.fillStyle = color; ctx.beginPath(); diff --git a/browser/devtools/performance/performance-controller.js b/browser/devtools/performance/performance-controller.js index f43f9dfa78df..4fbc1e758007 100644 --- a/browser/devtools/performance/performance-controller.js +++ b/browser/devtools/performance/performance-controller.js @@ -398,16 +398,6 @@ let PerformanceController = { return null; }, - /** - * Gets the current timeline blueprint without the hidden markers. - * @return object - */ - getTimelineBlueprint: function() { - let blueprint = TIMELINE_BLUEPRINT; - let hiddenMarkers = this.getPref("hidden-markers"); - return RecordingUtils.getFilteredBlueprint({ blueprint, hiddenMarkers }); - }, - /** * Fired from RecordingsView, we listen on the PerformanceController so we can * set it here and re-emit on the controller, where all views can listen. diff --git a/browser/devtools/performance/test/browser.ini b/browser/devtools/performance/test/browser.ini index b296a57dd350..825586de938e 100644 --- a/browser/devtools/performance/test/browser.ini +++ b/browser/devtools/performance/test/browser.ini @@ -13,7 +13,6 @@ support-files = # that need to be moved over to performance tool [browser_aaa-run-first-leaktest.js] -[browser_marker-utils.js] [browser_markers-cycle-collection.js] [browser_markers-gc.js] [browser_markers-parse-html.js] @@ -137,7 +136,6 @@ support-files = [browser_profiler_tree-view-08.js] [browser_profiler_tree-view-09.js] [browser_profiler_tree-view-10.js] -[browser_timeline-blueprint.js] [browser_timeline-filters.js] [browser_timeline-waterfall-background.js] [browser_timeline-waterfall-generic.js] diff --git a/browser/devtools/performance/test/browser_marker-utils.js b/browser/devtools/performance/test/browser_marker-utils.js deleted file mode 100644 index 86f7e5d89c05..000000000000 --- a/browser/devtools/performance/test/browser_marker-utils.js +++ /dev/null @@ -1,70 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Tests the marker utils methods. - */ - -function* spawnTest() { - let { TIMELINE_BLUEPRINT } = devtools.require("devtools/performance/markers"); - let Utils = devtools.require("devtools/performance/marker-utils"); - - Services.prefs.setBoolPref(PLATFORM_DATA_PREF, false); - - is(Utils.getMarkerLabel({ name: "DOMEvent" }), "DOM Event", - "getMarkerLabel() returns a simple label"); - is(Utils.getMarkerLabel({ name: "Javascript", causeName: "setTimeout handler" }), "setTimeout", - "getMarkerLabel() returns a label defined via function"); - - ok(Utils.getMarkerFields({ name: "Paint" }).length === 0, - "getMarkerFields() returns an empty array when no fields defined"); - - let fields = Utils.getMarkerFields({ name: "ConsoleTime", causeName: "snowstorm" }); - is(fields[0].label, "Timer Name:", "getMarkerFields() returns an array with proper label"); - is(fields[0].value, "snowstorm", "getMarkerFields() returns an array with proper value"); - - fields = Utils.getMarkerFields({ name: "DOMEvent", type: "mouseclick" }); - is(fields.length, 1, "getMarkerFields() ignores fields that are not found on marker"); - is(fields[0].label, "Event Type:", "getMarkerFields() returns an array with proper label"); - is(fields[0].value, "mouseclick", "getMarkerFields() returns an array with proper value"); - - fields = Utils.getMarkerFields({ name: "DOMEvent", eventPhase: Ci.nsIDOMEvent.AT_TARGET, type: "mouseclick" }); - is(fields.length, 2, "getMarkerFields() returns multiple fields when using a fields function"); - is(fields[0].label, "Event Type:", "getMarkerFields() correctly returns fields via function (1)"); - is(fields[0].value, "mouseclick", "getMarkerFields() correctly returns fields via function (2)"); - is(fields[1].label, "Phase:", "getMarkerFields() correctly returns fields via function (3)"); - is(fields[1].value, "Target", "getMarkerFields() correctly returns fields via function (4)"); - - is(Utils.getMarkerFields({ name: "Javascript", causeName: "Some Platform Field" })[0].value, "(Gecko)", - "Correctly obfuscates JS markers when platform data is off."); - Services.prefs.setBoolPref(PLATFORM_DATA_PREF, true); - is(Utils.getMarkerFields({ name: "Javascript", causeName: "Some Platform Field" })[0].value, "Some Platform Field", - "Correctly deobfuscates JS markers when platform data is on."); - - is(Utils.getMarkerClassName("Javascript"), "Function Call", - "getMarkerClassName() returns correct string when defined via function"); - is(Utils.getMarkerClassName("GarbageCollection"), "GC Event", - "getMarkerClassName() returns correct string when defined via function"); - is(Utils.getMarkerClassName("Reflow"), "Layout", - "getMarkerClassName() returns correct string when defined via string"); - - TIMELINE_BLUEPRINT["fakemarker"] = { group: 0 }; - try { - Utils.getMarkerClassName("fakemarker"); - ok(false, "getMarkerClassName() should throw when no label on blueprint."); - } catch (e) { - ok(true, "getMarkerClassName() should throw when no label on blueprint."); - } - - TIMELINE_BLUEPRINT["fakemarker"] = { group: 0, label: () => void 0}; - try { - Utils.getMarkerClassName("fakemarker"); - ok(false, "getMarkerClassName() should throw when label function returnd undefined."); - } catch (e) { - ok(true, "getMarkerClassName() should throw when label function returnd undefined."); - } - - delete TIMELINE_BLUEPRINT["fakemarker"]; - - finish(); -} diff --git a/browser/devtools/performance/test/browser_timeline-blueprint.js b/browser/devtools/performance/test/browser_timeline-blueprint.js deleted file mode 100644 index 5336e6bdd256..000000000000 --- a/browser/devtools/performance/test/browser_timeline-blueprint.js +++ /dev/null @@ -1,34 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Tests if the timeline blueprint has a correct structure. - */ - -function* spawnTest() { - let { TIMELINE_BLUEPRINT } = devtools.require("devtools/performance/markers"); - - ok(TIMELINE_BLUEPRINT, - "A timeline blueprint should be available."); - - ok(Object.keys(TIMELINE_BLUEPRINT).length, - "The timeline blueprint has at least one entry."); - - for (let [key, value] of Iterator(TIMELINE_BLUEPRINT)) { - if (key.startsWith("meta::")) { - ok(!("group" in value), - "No meta entry in the timeline blueprint can contain a `group` key."); - ok("colorName" in value, - "Each meta entry in the timeline blueprint contains a `colorName` key."); - ok("label" in value, - "Each meta entry in the timeline blueprint contains a `label` key."); - } else { - ok("group" in value, - "Each entry in the timeline blueprint contains a `group` key."); - ok("colorName" in value, - "Each entry in the timeline blueprint contains a `colorName` key."); - ok("label" in value, - "Each entry in the timeline blueprint contains a `label` key."); - } - } -} diff --git a/browser/devtools/performance/test/browser_timeline-filters.js b/browser/devtools/performance/test/browser_timeline-filters.js index 7f61a968a408..e09efb164d02 100644 --- a/browser/devtools/performance/test/browser_timeline-filters.js +++ b/browser/devtools/performance/test/browser_timeline-filters.js @@ -5,6 +5,8 @@ * Tests markers filtering mechanism. */ +const EPSILON = 0.00000001; + function* spawnTest() { let { panel } = yield initPerformance(SIMPLE_URL); let { $, $$, EVENTS, PerformanceController, OverviewView, WaterfallView } = panel.panelWin; @@ -24,20 +26,34 @@ function* spawnTest() { yield stopRecording(panel); + // Push some fake markers of a type we do not have a blueprint for + let markers = PerformanceController.getCurrentRecording().getMarkers(); + let endTime = markers[markers.length - 1].end; + markers.push({ name: "CustomMarker", start: endTime + EPSILON, end: endTime + (EPSILON * 2) }); + markers.push({ name: "CustomMarker", start: endTime + (EPSILON * 3), end: endTime + (EPSILON * 4) }); + + // Invalidate marker cache + WaterfallView._cache.delete(markers); + // Select everything - OverviewView.setTimeInterval({ startTime: 0, endTime: Number.MAX_VALUE }) + let waterfallRendered = WaterfallView.once(EVENTS.WATERFALL_RENDERED); + OverviewView.setTimeInterval({ startTime: 0, endTime: Number.MAX_VALUE }); $("#filter-button").click(); let menuItem1 = $("menuitem[marker-type=Styles]"); let menuItem2 = $("menuitem[marker-type=Reflow]"); let menuItem3 = $("menuitem[marker-type=Paint]"); + let menuItem4 = $("menuitem[marker-type=UNKNOWN]"); let overview = OverviewView.graphs.get("timeline"); let originalHeight = overview.fixedHeight; + yield waterfallRendered; + ok($(".waterfall-marker-bar[type=Styles]"), "Found at least one 'Styles' marker (1)"); ok($(".waterfall-marker-bar[type=Reflow]"), "Found at least one 'Reflow' marker (1)"); ok($(".waterfall-marker-bar[type=Paint]"), "Found at least one 'Paint' marker (1)"); + ok($(".waterfall-marker-bar[type=CustomMarker]"), "Found at least one 'Unknown' marker (1)"); let heightBefore = overview.fixedHeight; EventUtils.synthesizeMouseAtCenter(menuItem1, {type: "mouseup"}, panel.panelWin); @@ -47,6 +63,7 @@ function* spawnTest() { ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (2)"); ok($(".waterfall-marker-bar[type=Reflow]"), "Found at least one 'Reflow' marker (2)"); ok($(".waterfall-marker-bar[type=Paint]"), "Found at least one 'Paint' marker (2)"); + ok($(".waterfall-marker-bar[type=CustomMarker]"), "Found at least one 'Unknown' marker (2)"); heightBefore = overview.fixedHeight; EventUtils.synthesizeMouseAtCenter(menuItem2, {type: "mouseup"}, panel.panelWin); @@ -56,6 +73,7 @@ function* spawnTest() { ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (3)"); ok(!$(".waterfall-marker-bar[type=Reflow]"), "No 'Reflow' marker (3)"); ok($(".waterfall-marker-bar[type=Paint]"), "Found at least one 'Paint' marker (3)"); + ok($(".waterfall-marker-bar[type=CustomMarker]"), "Found at least one 'Unknown' marker (3)"); heightBefore = overview.fixedHeight; EventUtils.synthesizeMouseAtCenter(menuItem3, {type: "mouseup"}, panel.panelWin); @@ -65,15 +83,25 @@ function* spawnTest() { ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (4)"); ok(!$(".waterfall-marker-bar[type=Reflow]"), "No 'Reflow' marker (4)"); ok(!$(".waterfall-marker-bar[type=Paint]"), "No 'Paint' marker (4)"); + ok($(".waterfall-marker-bar[type=CustomMarker]"), "Found at least one 'Unknown' marker (4)"); + + EventUtils.synthesizeMouseAtCenter(menuItem4, {type: "mouseup"}, panel.panelWin); + yield waitForOverviewAndCommand(overview, menuItem4); + + ok(!$(".waterfall-marker-bar[type=Styles]"), "No 'Styles' marker (5)"); + ok(!$(".waterfall-marker-bar[type=Reflow]"), "No 'Reflow' marker (5)"); + ok(!$(".waterfall-marker-bar[type=Paint]"), "No 'Paint' marker (5)"); + ok(!$(".waterfall-marker-bar[type=CustomMarker]"), "No 'Unknown' marker (5)"); for (let item of [menuItem1, menuItem2, menuItem3]) { EventUtils.synthesizeMouseAtCenter(item, {type: "mouseup"}, panel.panelWin); yield waitForOverviewAndCommand(overview, item); } - ok($(".waterfall-marker-bar[type=Styles]"), "Found at least one 'Styles' marker (5)"); - ok($(".waterfall-marker-bar[type=Reflow]"), "Found at least one 'Reflow' marker (5)"); - ok($(".waterfall-marker-bar[type=Paint]"), "Found at least one 'Paint' marker (5)"); + ok($(".waterfall-marker-bar[type=Styles]"), "Found at least one 'Styles' marker (6)"); + ok($(".waterfall-marker-bar[type=Reflow]"), "Found at least one 'Reflow' marker (6)"); + ok($(".waterfall-marker-bar[type=Paint]"), "Found at least one 'Paint' marker (6)"); + ok(!$(".waterfall-marker-bar[type=CustomMarker]"), "No 'Unknown' marker (6)"); is(overview.fixedHeight, originalHeight, "Overview restored"); diff --git a/browser/devtools/performance/test/head.js b/browser/devtools/performance/test/head.js index 9e39e58683e8..7f2eb057304c 100644 --- a/browser/devtools/performance/test/head.js +++ b/browser/devtools/performance/test/head.js @@ -61,6 +61,7 @@ let DEFAULT_PREFS = [ "devtools.performance.profiler.buffer-size", "devtools.performance.profiler.sample-frequency-khz", "devtools.performance.ui.experimental", + "devtools.performance.timeline.hidden-markers", ].reduce((prefs, pref) => { prefs[pref] = Preferences.get(pref); return prefs; diff --git a/browser/devtools/performance/test/unit/head.js b/browser/devtools/performance/test/unit/head.js index de1ac9b2daad..14d39eef80cd 100644 --- a/browser/devtools/performance/test/unit/head.js +++ b/browser/devtools/performance/test/unit/head.js @@ -5,8 +5,11 @@ const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); +let { Services } = Cu.import("resource://gre/modules/Services.jsm", {}); const RecordingUtils = devtools.require("devtools/performance/recording-utils"); +const PLATFORM_DATA_PREF = "devtools.performance.ui.show-platform-data"; + /** * Get a path in a FrameNode call tree. */ diff --git a/browser/devtools/performance/test/unit/test_marker-blueprint.js b/browser/devtools/performance/test/unit/test_marker-blueprint.js new file mode 100644 index 000000000000..bd93e3036de2 --- /dev/null +++ b/browser/devtools/performance/test/unit/test_marker-blueprint.js @@ -0,0 +1,29 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests if the timeline blueprint has a correct structure. + */ + +function run_test() { + run_next_test(); +} + +add_task(function () { + let { TIMELINE_BLUEPRINT } = devtools.require("devtools/performance/markers"); + + ok(TIMELINE_BLUEPRINT, + "A timeline blueprint should be available."); + + ok(Object.keys(TIMELINE_BLUEPRINT).length, + "The timeline blueprint has at least one entry."); + + for (let [key, value] of Iterator(TIMELINE_BLUEPRINT)) { + ok("group" in value, + "Each entry in the timeline blueprint contains a `group` key."); + ok("colorName" in value, + "Each entry in the timeline blueprint contains a `colorName` key."); + ok("label" in value, + "Each entry in the timeline blueprint contains a `label` key."); + } +}); diff --git a/browser/devtools/performance/test/unit/test_marker-utils.js b/browser/devtools/performance/test/unit/test_marker-utils.js new file mode 100644 index 000000000000..f9e3d1efbc33 --- /dev/null +++ b/browser/devtools/performance/test/unit/test_marker-utils.js @@ -0,0 +1,88 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests the marker utils methods. + */ + +function run_test() { + run_next_test(); +} + +add_task(function () { + let { TIMELINE_BLUEPRINT } = devtools.require("devtools/performance/markers"); + let Utils = devtools.require("devtools/performance/marker-utils"); + + Services.prefs.setBoolPref(PLATFORM_DATA_PREF, false); + + equal(Utils.getMarkerLabel({ name: "DOMEvent" }), "DOM Event", + "getMarkerLabel() returns a simple label"); + equal(Utils.getMarkerLabel({ name: "Javascript", causeName: "setTimeout handler" }), "setTimeout", + "getMarkerLabel() returns a label defined via function"); + + ok(Utils.getMarkerFields({ name: "Paint" }).length === 0, + "getMarkerFields() returns an empty array when no fields defined"); + + let fields = Utils.getMarkerFields({ name: "ConsoleTime", causeName: "snowstorm" }); + equal(fields[0].label, "Timer Name:", "getMarkerFields() returns an array with proper label"); + equal(fields[0].value, "snowstorm", "getMarkerFields() returns an array with proper value"); + + fields = Utils.getMarkerFields({ name: "DOMEvent", type: "mouseclick" }); + equal(fields.length, 1, "getMarkerFields() ignores fields that are not found on marker"); + equal(fields[0].label, "Event Type:", "getMarkerFields() returns an array with proper label"); + equal(fields[0].value, "mouseclick", "getMarkerFields() returns an array with proper value"); + + fields = Utils.getMarkerFields({ name: "DOMEvent", eventPhase: Ci.nsIDOMEvent.AT_TARGET, type: "mouseclick" }); + equal(fields.length, 2, "getMarkerFields() returns multiple fields when using a fields function"); + equal(fields[0].label, "Event Type:", "getMarkerFields() correctly returns fields via function (1)"); + equal(fields[0].value, "mouseclick", "getMarkerFields() correctly returns fields via function (2)"); + equal(fields[1].label, "Phase:", "getMarkerFields() correctly returns fields via function (3)"); + equal(fields[1].value, "Target", "getMarkerFields() correctly returns fields via function (4)"); + + equal(Utils.getMarkerFields({ name: "Javascript", causeName: "Some Platform Field" })[0].value, "(Gecko)", + "Correctly obfuscates JS markers when platform data is off."); + Services.prefs.setBoolPref(PLATFORM_DATA_PREF, true); + equal(Utils.getMarkerFields({ name: "Javascript", causeName: "Some Platform Field" })[0].value, "Some Platform Field", + "Correctly deobfuscates JS markers when platform data is on."); + + equal(Utils.getMarkerClassName("Javascript"), "Function Call", + "getMarkerClassName() returns correct string when defined via function"); + equal(Utils.getMarkerClassName("GarbageCollection"), "GC Event", + "getMarkerClassName() returns correct string when defined via function"); + equal(Utils.getMarkerClassName("Reflow"), "Layout", + "getMarkerClassName() returns correct string when defined via string"); + + TIMELINE_BLUEPRINT["fakemarker"] = { group: 0 }; + try { + Utils.getMarkerClassName("fakemarker"); + ok(false, "getMarkerClassName() should throw when no label on blueprint."); + } catch (e) { + ok(true, "getMarkerClassName() should throw when no label on blueprint."); + } + + TIMELINE_BLUEPRINT["fakemarker"] = { group: 0, label: () => void 0}; + try { + Utils.getMarkerClassName("fakemarker"); + ok(false, "getMarkerClassName() should throw when label function returnd undefined."); + } catch (e) { + ok(true, "getMarkerClassName() should throw when label function returnd undefined."); + } + + delete TIMELINE_BLUEPRINT["fakemarker"]; + + let customBlueprint = { + UNKNOWN: { + group: 1, + label: "MyDefault" + }, + custom: { + group: 0, + label: "MyCustom" + } + }; + + equal(Utils.getBlueprintFor({ name: "Reflow" }).label, "Layout", + "Utils.getBlueprintFor() should return marker def for passed in marker."); + equal(Utils.getBlueprintFor({ name: "Not sure!" }).label(), "Unknown", + "Utils.getBlueprintFor() should return a default marker def if the marker is undefined."); +}); diff --git a/browser/devtools/performance/test/unit/xpcshell.ini b/browser/devtools/performance/test/unit/xpcshell.ini index b84740d0f699..acefb997ea97 100644 --- a/browser/devtools/performance/test/unit/xpcshell.ini +++ b/browser/devtools/performance/test/unit/xpcshell.ini @@ -5,9 +5,11 @@ tail = firefox-appdir = browser skip-if = toolkit == 'android' || toolkit == 'gonk' -[test_profiler-categories.js] [test_frame-utils-01.js] [test_frame-utils-02.js] +[test_marker-blueprint.js] +[test_marker-utils.js] +[test_profiler-categories.js] [test_tree-model-01.js] [test_tree-model-02.js] [test_tree-model-03.js] diff --git a/browser/devtools/performance/views/details-waterfall.js b/browser/devtools/performance/views/details-waterfall.js index eb26fc4affca..0896b7b111d4 100644 --- a/browser/devtools/performance/views/details-waterfall.js +++ b/browser/devtools/performance/views/details-waterfall.js @@ -32,6 +32,7 @@ let WaterfallView = Heritage.extend(DetailsSubview, { this._onMarkerSelected = this._onMarkerSelected.bind(this); this._onResize = this._onResize.bind(this); this._onViewSource = this._onViewSource.bind(this); + this._hiddenMarkers = PerformanceController.getPref("hidden-markers"); this.headerContainer = $("#waterfall-header"); this.breakdownContainer = $("#waterfall-breakdown"); @@ -111,8 +112,7 @@ let WaterfallView = Heritage.extend(DetailsSubview, { * Called whenever an observed pref is changed. */ _onObservedPrefChange: function(_, prefName) { - let blueprint = PerformanceController.getTimelineBlueprint(); - this._markersRoot.blueprint = blueprint; + this._hiddenMarkers = PerformanceController.getPref("hidden-markers"); }, /** @@ -136,7 +136,7 @@ let WaterfallView = Heritage.extend(DetailsSubview, { WaterfallUtils.collapseMarkersIntoNode({ markerNode: rootMarkerNode, - markersList: markers + markersList: markers, }); this._cache.set(markers, rootMarkerNode); @@ -160,8 +160,7 @@ let WaterfallView = Heritage.extend(DetailsSubview, { this._markersRoot = root; this._waterfallHeader = header; - let blueprint = PerformanceController.getTimelineBlueprint(); - root.blueprint = blueprint; + root.filter = this._hiddenMarkers; root.interval = interval; root.on("selected", this._onMarkerSelected); root.on("unselected", this._onMarkerSelected); diff --git a/browser/devtools/performance/views/overview.js b/browser/devtools/performance/views/overview.js index 1f05eaf9b487..5f017f7e008c 100644 --- a/browser/devtools/performance/views/overview.js +++ b/browser/devtools/performance/views/overview.js @@ -42,7 +42,7 @@ let OverviewView = { initialize: function () { this.graphs = new GraphsController({ root: $("#overview-pane"), - getBlueprint: () => PerformanceController.getTimelineBlueprint(), + getFilter: () => PerformanceController.getPref("hidden-markers"), getTheme: () => PerformanceController.getTheme(), }); @@ -331,8 +331,8 @@ let OverviewView = { case "hidden-markers": { let graph; if (graph = yield this.graphs.isAvailable("timeline")) { - let blueprint = PerformanceController.getTimelineBlueprint(); - graph.setBlueprint(blueprint); + let filter = PerformanceController.getPref("hidden-markers"); + graph.setFilter(filter); graph.refresh({ force: true }); } break; diff --git a/browser/locales/en-US/chrome/browser/devtools/timeline.properties b/browser/locales/en-US/chrome/browser/devtools/timeline.properties index 77b745b39c15..774be3add109 100644 --- a/browser/locales/en-US/chrome/browser/devtools/timeline.properties +++ b/browser/locales/en-US/chrome/browser/devtools/timeline.properties @@ -46,6 +46,7 @@ timeline.label.domevent=DOM Event timeline.label.consoleTime=Console timeline.label.garbageCollection=GC Event timeline.label.timestamp=Timestamp +timeline.label.unknown=Unknown # LOCALIZATION NOTE (graphs.memory): # This string is displayed in the memory graph of the Performance tool, From 98693e4d13492739941d4d322e1cd67fa1ff5515 Mon Sep 17 00:00:00 2001 From: Alessio Placitelli Date: Fri, 12 Jun 2015 03:10:00 +0200 Subject: [PATCH 02/59] Bug 1174111 - |test_sendTimeout| in test_TelemetryControllerShutdown.js must not wait on ping submission. r=gfritzsche --- .../telemetry/tests/unit/test_TelemetryControllerShutdown.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js b/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js index c6754c19b4b7..37817af920b7 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js @@ -61,11 +61,13 @@ add_task(function* test_sendTimeout() { yield TelemetryController.setup(); TelemetrySend.setServer("http://localhost:" + httpServer.identity.primaryPort); - yield TelemetryController.submitExternalPing("test-ping-type", {}); + let submissionPromise = TelemetryController.submitExternalPing("test-ping-type", {}); // Trigger the AsyncShutdown phase TelemetryController hangs off. AsyncShutdown.profileBeforeChange._trigger(); AsyncShutdown.sendTelemetry._trigger(); + // Now wait for the ping submission. + yield submissionPromise; // If we get here, we didn't time out in the shutdown routines. Assert.ok(true, "Didn't time out on shutdown."); From 61d2710314df595722cf7d0b782b0ac676ac74a3 Mon Sep 17 00:00:00 2001 From: Alessio Placitelli Date: Wed, 3 Jun 2015 04:41:00 +0200 Subject: [PATCH 03/59] Bug 1169159 - Make xpcshells run_test_in_child() and do_await_remote_message() return promises. r=ted,gfritzsche --- testing/xpcshell/head.js | 78 +++++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 29 deletions(-) diff --git a/testing/xpcshell/head.js b/testing/xpcshell/head.js index 829bc1134345..b80bae4ca441 100644 --- a/testing/xpcshell/head.js +++ b/testing/xpcshell/head.js @@ -1232,54 +1232,74 @@ function do_load_child_test_harness() * Runs an entire xpcshell unit test in a child process (rather than in chrome, * which is the default). * - * This function returns immediately, before the test has completed. + * This function returns immediately, before the test has completed. * * @param testFile * The name of the script to run. Path format same as load(). * @param optionalCallback. * Optional function to be called (in parent) when test on child is * complete. If provided, the function must call do_test_finished(); + * @return Promise Resolved when the test in the child is complete. */ -function run_test_in_child(testFile, optionalCallback) +function run_test_in_child(testFile, optionalCallback) { - var callback = (typeof optionalCallback == 'undefined') ? - do_test_finished : optionalCallback; + return new Promise((resolve) => { + var callback = () => { + resolve(); + if (typeof optionalCallback == 'undefined') { + do_test_finished(); + } else { + optionalCallback(); + } + }; - do_load_child_test_harness(); + do_load_child_test_harness(); - var testPath = do_get_file(testFile).path.replace(/\\/g, "/"); - do_test_pending("run in child"); - sendCommand("_testLogger.info('CHILD-TEST-STARTED'); " - + "const _TEST_FILE=['" + testPath + "']; " - + "_execute_test(); " - + "_testLogger.info('CHILD-TEST-COMPLETED');", - callback); + var testPath = do_get_file(testFile).path.replace(/\\/g, "/"); + do_test_pending("run in child"); + sendCommand("_testLogger.info('CHILD-TEST-STARTED'); " + + "const _TEST_FILE=['" + testPath + "']; " + + "_execute_test(); " + + "_testLogger.info('CHILD-TEST-COMPLETED');", + callback); + }); } /** * Execute a given function as soon as a particular cross-process message is received. * Must be paired with do_send_remote_message or equivalent ProcessMessageManager calls. + * + * @param optionalCallback + * Optional callback that is invoked when the message is received. If provided, + * the function must call do_test_finished(). + * @return Promise Promise that is resolved when the message is received. */ -function do_await_remote_message(name, callback) +function do_await_remote_message(name, optionalCallback) { - var listener = { - receiveMessage: function(message) { - if (message.name == name) { - mm.removeMessageListener(name, listener); - callback(); - do_test_finished(); + return new Promise((resolve) => { + var listener = { + receiveMessage: function(message) { + if (message.name == name) { + mm.removeMessageListener(name, listener); + resolve(); + if (optionalCallback) { + optionalCallback(); + } else { + do_test_finished(); + } + } } - } - }; + }; - var mm; - if (runningInParent) { - mm = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIMessageBroadcaster); - } else { - mm = Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsISyncMessageSender); - } - do_test_pending(); - mm.addMessageListener(name, listener); + var mm; + if (runningInParent) { + mm = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIMessageBroadcaster); + } else { + mm = Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsISyncMessageSender); + } + do_test_pending(); + mm.addMessageListener(name, listener); + }); } /** From 5e87aa2a8abfd7a086f1e2a29996216ec5e7662b Mon Sep 17 00:00:00 2001 From: Alessio Placitelli Date: Mon, 8 Jun 2015 00:12:00 +0200 Subject: [PATCH 04/59] Bug 1169159 - Add basic test coverage for Telemetry child payloads. r=gfritzsche --- .../unit/test_geolocation_reset_accuracy.js | 1 + .../telemetry/TelemetryController.jsm | 31 +++++-- .../components/telemetry/TelemetrySession.jsm | 19 ++-- .../components/telemetry/tests/unit/head.js | 12 +-- .../tests/unit/test_ChildHistograms.js | 89 +++++++++++++++++++ .../telemetry/tests/unit/xpcshell.ini | 2 + 6 files changed, 132 insertions(+), 22 deletions(-) create mode 100644 toolkit/components/telemetry/tests/unit/test_ChildHistograms.js diff --git a/dom/tests/unit/test_geolocation_reset_accuracy.js b/dom/tests/unit/test_geolocation_reset_accuracy.js index 75272ab7a04e..abeee6e03518 100644 --- a/dom/tests/unit/test_geolocation_reset_accuracy.js +++ b/dom/tests/unit/test_geolocation_reset_accuracy.js @@ -97,6 +97,7 @@ function run_test() function stop_high_accuracy_watch() { geolocation.clearWatch(watchID2); check_results(); + do_test_finished(); } function check_results() diff --git a/toolkit/components/telemetry/TelemetryController.jsm b/toolkit/components/telemetry/TelemetryController.jsm index 750fbae6e928..fd9055383c6d 100644 --- a/toolkit/components/telemetry/TelemetryController.jsm +++ b/toolkit/components/telemetry/TelemetryController.jsm @@ -155,6 +155,13 @@ this.TelemetryController = Object.freeze({ return Impl.setupTelemetry(true); }, + /** + * Used only for testing purposes. + */ + setupContent: function() { + return Impl.setupContentTelemetry(true); + }, + /** * Send a notification. */ @@ -689,6 +696,21 @@ let Impl = { return this._delayedInitTaskDeferred.promise; }, + /** + * This triggers basic telemetry initialization for content processes. + * @param {Boolean} [testing=false] True if we are in test mode, false otherwise. + */ + setupContentTelemetry: function (testing = false) { + this._testMode = testing; + + // We call |enableTelemetryRecording| here to make sure that Telemetry.canRecord* flags + // are in sync between chrome and content processes. + if (!this.enableTelemetryRecording()) { + this._log.trace("setupContentTelemetry - Content process recording disabled."); + return; + } + }, + // Do proper shutdown waiting and cleanup. _cleanupOnShutdown: Task.async(function*() { if (!this._initialized) { @@ -760,13 +782,8 @@ let Impl = { // profile-after-change is only registered for chrome processes. return this.setupTelemetry(); case "app-startup": - // app-startup is only registered for content processes. We call - // |enableTelemetryRecording| here to make sure that Telemetry.canRecord* flags - // are in sync between chrome and content processes. - if (!this.enableTelemetryRecording()) { - this._log.trace("observe - Content process recording disabled."); - return; - } + // app-startup is only registered for content processes. + return this.setupContentTelemetry(); break; } }, diff --git a/toolkit/components/telemetry/TelemetrySession.jsm b/toolkit/components/telemetry/TelemetrySession.jsm index d4a16cd2aaa5..e66640452f32 100644 --- a/toolkit/components/telemetry/TelemetrySession.jsm +++ b/toolkit/components/telemetry/TelemetrySession.jsm @@ -58,7 +58,7 @@ const MIN_SUBSESSION_LENGTH_MS = 10 * 60 * 1000; #expand const HISTOGRAMS_FILE_VERSION = "__HISTOGRAMS_FILE_VERSION__"; const LOGGER_NAME = "Toolkit.Telemetry"; -const LOGGER_PREFIX = "TelemetrySession::"; +const LOGGER_PREFIX = "TelemetrySession" + (IS_CONTENT_PROCESS ? "#content::" : "::"); const PREF_BRANCH = "toolkit.telemetry."; const PREF_PREVIOUS_BUILDID = PREF_BRANCH + "previousBuildID"; @@ -775,7 +775,7 @@ this.TelemetrySession = Object.freeze({ let Impl = { _histograms: {}, _initialized: false, - _log: null, + _logger: null, _prevValues: {}, // Regex that matches histograms we care about during startup. // Keep this in sync with gen-histogram-bucket-ranges.py. @@ -817,6 +817,13 @@ let Impl = { // Used to serialize session state writes to disk. _stateSaveSerializer: new SaveSerializer(), + get _log() { + if (!this._logger) { + this._logger = Log.repository.getLoggerWithMessagePrefix(LOGGER_NAME, LOGGER_PREFIX); + } + return this._logger; + }, + /** * Gets a series of simple measurements (counters). At the moment, this * only returns startup data from nsIAppStartup.getStartupInfo(). @@ -1415,10 +1422,6 @@ let Impl = { */ setupChromeProcess: function setupChromeProcess(testing) { this._initStarted = true; - if (testing && !this._log) { - this._log = Log.repository.getLoggerWithMessagePrefix(LOGGER_NAME, LOGGER_PREFIX); - } - this._log.trace("setupChromeProcess"); if (this._delayedInitTask) { @@ -1718,10 +1721,6 @@ let Impl = { * This observer drives telemetry. */ observe: function (aSubject, aTopic, aData) { - if (!this._log) { - this._log = Log.repository.getLoggerWithMessagePrefix(LOGGER_NAME, LOGGER_PREFIX); - } - // Prevent the cycle collector begin topic from cluttering the log. if (aTopic != TOPIC_CYCLE_COLLECTOR_BEGIN) { this._log.trace("observe - " + aTopic + " notified."); diff --git a/toolkit/components/telemetry/tests/unit/head.js b/toolkit/components/telemetry/tests/unit/head.js index ec315b83d286..e2a353d2229c 100644 --- a/toolkit/components/telemetry/tests/unit/head.js +++ b/toolkit/components/telemetry/tests/unit/head.js @@ -186,12 +186,14 @@ function promiseRejects(promise) { return promise.then(() => false, () => true); } -// Set logging preferences for all the tests. -Services.prefs.setCharPref("toolkit.telemetry.log.level", "Trace"); -TelemetryController.initLogging(); +if (runningInParent) { + // Set logging preferences for all the tests. + Services.prefs.setCharPref("toolkit.telemetry.log.level", "Trace"); + // Telemetry archiving should be on. + Services.prefs.setBoolPref("toolkit.telemetry.archive.enabled", true); +} -// Telemetry archiving should be on. -Services.prefs.setBoolPref("toolkit.telemetry.archive.enabled", true); +TelemetryController.initLogging(); // Avoid timers interrupting test behavior. fakeSchedulerTimer(() => {}, () => {}); diff --git a/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js b/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js new file mode 100644 index 000000000000..2c29c567bf0f --- /dev/null +++ b/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js @@ -0,0 +1,89 @@ + +Cu.import("resource://gre/modules/TelemetryController.jsm", this); +Cu.import("resource://gre/modules/TelemetrySession.jsm", this); +Cu.import("resource://gre/modules/PromiseUtils.jsm", this); + +const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry); + +const MESSAGE_TELEMETRY_PAYLOAD = "Telemetry:Payload"; + +const PLATFORM_VERSION = "1.9.2"; +const APP_VERSION = "1"; +const APP_ID = "xpcshell@tests.mozilla.org"; +const APP_NAME = "XPCShell"; + +function run_child_test() { + // Setup histograms with some fixed values. + let flagHist = Telemetry.getHistogramById("TELEMETRY_TEST_FLAG"); + flagHist.add(1); + let countHist = Telemetry.getHistogramById("TELEMETRY_TEST_COUNT"); + countHist.add(); + countHist.add(); + + let flagKeyed = Telemetry.getKeyedHistogramById("TELEMETRY_TEST_KEYED_FLAG"); + flagKeyed.add("a", 1); + flagKeyed.add("b", 1); + let countKeyed = Telemetry.getKeyedHistogramById("TELEMETRY_TEST_KEYED_COUNT"); + countKeyed.add("a"); + countKeyed.add("b"); + countKeyed.add("b"); + + // Check payload values. + const payload = TelemetrySession.getPayload("test-ping"); + check_histogram_values(payload); +} + +function check_histogram_values(payload) { + const hs = payload.histograms; + Assert.ok("TELEMETRY_TEST_COUNT" in hs, "Should have count test histogram."); + Assert.ok("TELEMETRY_TEST_FLAG" in hs, "Should have flag test histogram."); + Assert.equal(hs["TELEMETRY_TEST_COUNT"].sum, 2, + "Count test histogram should have the right value."); + Assert.equal(hs["TELEMETRY_TEST_FLAG"].sum, 1, + "Flag test histogram should have the right value."); + + const kh = payload.keyedHistograms; + Assert.ok("TELEMETRY_TEST_KEYED_COUNT" in kh, "Should have keyed count test histogram."); + Assert.ok("TELEMETRY_TEST_KEYED_FLAG" in kh, "Should have keyed flag test histogram."); + Assert.equal(kh["TELEMETRY_TEST_KEYED_COUNT"]["a"].sum, 1, + "Keyed count test histogram should have the right value."); + Assert.equal(kh["TELEMETRY_TEST_KEYED_COUNT"]["b"].sum, 2, + "Keyed count test histogram should have the right value."); + Assert.equal(kh["TELEMETRY_TEST_KEYED_FLAG"]["a"].sum, 1, + "Keyed flag test histogram should have the right value."); + Assert.equal(kh["TELEMETRY_TEST_KEYED_FLAG"]["b"].sum, 1, + "Keyed flag test histogram should have the right value."); +} + +add_task(function*() { + if (!runningInParent) { + TelemetryController.setupContent(); + run_child_test(); + return; + } + + // Setup. + do_get_profile(true); + loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION); + Services.prefs.setBoolPref("toolkit.telemetry.enabled", true); + yield TelemetryController.setup(); + yield TelemetrySession.setup(); + + // Run test in child and wait until it is finished. + yield run_test_in_child("test_ChildHistograms.js"); + + // Gather payload from child. + let promiseMessage = do_await_remote_message(MESSAGE_TELEMETRY_PAYLOAD); + TelemetrySession.requestChildPayloads(); + yield promiseMessage; + + // Check child payload. + const payload = TelemetrySession.getPayload("test-ping"); + Assert.ok("childPayloads" in payload, "Should have child payloads."); + Assert.equal(payload.childPayloads.length, 1, "Should have received one child payload so far."); + Assert.ok("histograms" in payload.childPayloads[0], "Child payload should have histograms."); + Assert.ok("keyedHistograms" in payload.childPayloads[0], "Child payload should have keyed histograms."); + check_histogram_values(payload.childPayloads[0]); + + do_test_finished(); +}); diff --git a/toolkit/components/telemetry/tests/unit/xpcshell.ini b/toolkit/components/telemetry/tests/unit/xpcshell.ini index 03ad74a8b0ae..219cda4ab2c3 100644 --- a/toolkit/components/telemetry/tests/unit/xpcshell.ini +++ b/toolkit/components/telemetry/tests/unit/xpcshell.ini @@ -50,3 +50,5 @@ skip-if = os == "android" # Disabled due to intermittent orange on Android skip-if = android_version == "18" [test_ThreadHangStats.js] run-sequentially = Bug 1046307, test can fail intermittently when CPU load is high +[test_ChildHistograms.js] +skip-if = os == "android" From 5560e83bc3f1e0f07da044e1c54c87384b64b65d Mon Sep 17 00:00:00 2001 From: Alessio Placitelli Date: Fri, 12 Jun 2015 06:09:00 +0200 Subject: [PATCH 05/59] Bug 1169159 - Refactor the |enableTelemetryRecording| logic in TelemetryController.jsm. r=gfritzsche --- .../telemetry/TelemetryController.jsm | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/toolkit/components/telemetry/TelemetryController.jsm b/toolkit/components/telemetry/TelemetryController.jsm index fd9055383c6d..deb3d9b1508a 100644 --- a/toolkit/components/telemetry/TelemetryController.jsm +++ b/toolkit/components/telemetry/TelemetryController.jsm @@ -594,21 +594,20 @@ let Impl = { Telemetry.canRecordBase = enabled || IS_UNIFIED_TELEMETRY; #ifdef MOZILLA_OFFICIAL - if (!Telemetry.isOfficialTelemetry && !this._testMode) { - // We can't send data; no point in initializing observers etc. - // Only do this for official builds so that e.g. developer builds - // still enable Telemetry based on prefs. - Telemetry.canRecordExtended = false; - this._log.config("enableTelemetryRecording - Can't send data, disabling extended Telemetry recording."); - } + // Enable extended telemetry if: + // * the telemetry preference is set and + // * this is an official build or we are in test-mode + // We only do the latter check for official builds so that e.g. developer builds + // still enable Telemetry based on prefs. + Telemetry.canRecordExtended = enabled && (Telemetry.isOfficialTelemetry || this._testMode); +#else + // Turn off extended telemetry recording if disabled by preferences or if base/telemetry + // telemetry recording is off. + Telemetry.canRecordExtended = enabled; #endif - if (!enabled || !Telemetry.canRecordBase) { - // Turn off extended telemetry recording if disabled by preferences or if base/telemetry - // telemetry recording is off. - Telemetry.canRecordExtended = false; - this._log.config("enableTelemetryRecording - Disabling extended Telemetry recording."); - } + this._log.config("enableTelemetryRecording - canRecordBase:" + Telemetry.canRecordBase + + ", canRecordExtended: " + Telemetry.canRecordExtended); return Telemetry.canRecordBase; }, From 14464863a6c68dc73d3b830c5a065043ce7ee741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eddy=20Bru=C3=ABl?= Date: Mon, 15 Jun 2015 12:18:35 +0200 Subject: [PATCH 06/59] Bug 1164564 - Implement WorkerActor.attachThread;r=jlong --- browser/devtools/debugger/test/browser.ini | 4 + .../test/browser_dbg_WorkerActor.attach.js | 1 - .../browser_dbg_WorkerActor.attachThread.js | 89 +++++++++++++++++++ .../code_WorkerActor.attachThread-worker.js | 16 ++++ .../debugger/test/code_frame-script.js | 12 +++ .../doc_WorkerActor.attachThread-tab.html | 8 ++ browser/devtools/debugger/test/head.js | 64 ++++++++++++- toolkit/devtools/client/dbg-client.jsm | 32 +++++-- toolkit/devtools/server/actors/script.js | 9 +- .../server/actors/utils/TabSources.js | 2 +- toolkit/devtools/server/actors/worker.js | 43 ++++++++- toolkit/devtools/server/main.js | 86 +++++++++++++++++- toolkit/devtools/server/moz.build | 1 + toolkit/devtools/server/worker.js | 66 ++++++++++++++ toolkit/devtools/worker-loader.js | 6 +- 15 files changed, 421 insertions(+), 18 deletions(-) create mode 100644 browser/devtools/debugger/test/browser_dbg_WorkerActor.attachThread.js create mode 100644 browser/devtools/debugger/test/code_WorkerActor.attachThread-worker.js create mode 100644 browser/devtools/debugger/test/doc_WorkerActor.attachThread-tab.html create mode 100644 toolkit/devtools/server/worker.js diff --git a/browser/devtools/debugger/test/browser.ini b/browser/devtools/debugger/test/browser.ini index e9ef792bdfae..6243c7831151 100644 --- a/browser/devtools/debugger/test/browser.ini +++ b/browser/devtools/debugger/test/browser.ini @@ -45,6 +45,7 @@ support-files = code_ugly-8^headers^ code_WorkerActor.attach-worker1.js code_WorkerActor.attach-worker2.js + code_WorkerActor.attachThread-worker.js doc_auto-pretty-print-01.html doc_auto-pretty-print-02.html doc_binary_search.html @@ -107,6 +108,7 @@ support-files = doc_with-frame.html doc_WorkerActor.attach-tab1.html doc_WorkerActor.attach-tab2.html + doc_WorkerActor.attachThread-tab.html head.js sjs_random-javascript.sjs testactors.js @@ -566,3 +568,5 @@ skip-if = e10s && debug skip-if = e10s && debug [browser_dbg_WorkerActor.attach.js] skip-if = e10s && debug +[browser_dbg_WorkerActor.attachThread.js] +skip-if = e10s && debug diff --git a/browser/devtools/debugger/test/browser_dbg_WorkerActor.attach.js b/browser/devtools/debugger/test/browser_dbg_WorkerActor.attach.js index fe0d839518c5..a9ca7a91544d 100644 --- a/browser/devtools/debugger/test/browser_dbg_WorkerActor.attach.js +++ b/browser/devtools/debugger/test/browser_dbg_WorkerActor.attach.js @@ -27,7 +27,6 @@ function test() { // registered. Instead, we have to wait for the promise returned by // createWorker in the tab to be resolved. yield createWorkerInTab(tab, WORKER1_URL); - let { workers } = yield listWorkers(tabClient); let [, workerClient1] = yield attachWorker(tabClient, findWorker(workers, WORKER1_URL)); diff --git a/browser/devtools/debugger/test/browser_dbg_WorkerActor.attachThread.js b/browser/devtools/debugger/test/browser_dbg_WorkerActor.attachThread.js new file mode 100644 index 000000000000..fd7f1e839223 --- /dev/null +++ b/browser/devtools/debugger/test/browser_dbg_WorkerActor.attachThread.js @@ -0,0 +1,89 @@ +let TAB_URL = EXAMPLE_URL + "doc_WorkerActor.attachThread-tab.html"; +let WORKER_URL = "code_WorkerActor.attachThread-worker.js"; + +function test() { + Task.spawn(function* () { + DebuggerServer.init(); + DebuggerServer.addBrowserActors(); + + let client1 = new DebuggerClient(DebuggerServer.connectPipe()); + yield connect(client1); + let client2 = new DebuggerClient(DebuggerServer.connectPipe()); + yield connect(client2); + + let tab = yield addTab(TAB_URL); + let { tabs: tabs1 } = yield listTabs(client1); + let [, tabClient1] = yield attachTab(client1, findTab(tabs1, TAB_URL)); + let { tabs: tabs2 } = yield listTabs(client2); + let [, tabClient2] = yield attachTab(client2, findTab(tabs2, TAB_URL)); + + yield listWorkers(tabClient1); + yield listWorkers(tabClient2); + yield createWorkerInTab(tab, WORKER_URL); + let { workers: workers1 } = yield listWorkers(tabClient1); + let [, workerClient1] = yield attachWorker(tabClient1, + findWorker(workers1, WORKER_URL)); + let { workers: workers2 } = yield listWorkers(tabClient2); + let [, workerClient2] = yield attachWorker(tabClient2, + findWorker(workers2, WORKER_URL)); + + let location = { line: 5 }; + + let [, threadClient1] = yield attachThread(workerClient1); + let sources1 = yield getSources(threadClient1); + let sourceClient1 = threadClient1.source(findSource(sources1, + EXAMPLE_URL + WORKER_URL)); + let [, breakpointClient1] = yield setBreakpoint(sourceClient1, location); + yield resume(threadClient1); + + let [, threadClient2] = yield attachThread(workerClient2); + let sources2 = yield getSources(threadClient2); + let sourceClient2 = threadClient2.source(findSource(sources2, + EXAMPLE_URL + WORKER_URL)); + let [, breakpointClient2] = yield setBreakpoint(sourceClient2, location); + yield resume(threadClient2); + + postMessageToWorkerInTab(tab, WORKER_URL, "ping"); + yield Promise.all([ + waitForPause(threadClient1).then((packet) => { + is(packet.type, "paused"); + let why = packet.why; + is(why.type, "breakpoint"); + is(why.actors.length, 1); + is(why.actors[0], breakpointClient1.actor); + let frame = packet.frame; + let where = frame.where; + is(where.source.actor, sourceClient1.actor); + is(where.line, location.line); + let variables = frame.environment.bindings.variables; + is(variables.a.value, 1); + is(variables.b.value.type, "undefined"); + is(variables.c.value.type, "undefined"); + return resume(threadClient1); + }), + waitForPause(threadClient2).then((packet) => { + is(packet.type, "paused"); + let why = packet.why; + is(why.type, "breakpoint"); + is(why.actors.length, 1); + is(why.actors[0], breakpointClient2.actor); + let frame = packet.frame; + let where = frame.where; + is(where.source.actor, sourceClient2.actor); + is(where.line, location.line); + let variables = frame.environment.bindings.variables; + is(variables.a.value, 1); + is(variables.b.value.type, "undefined"); + is(variables.c.value.type, "undefined"); + return resume(threadClient2); + }), + ]); + + terminateWorkerInTab(tab, WORKER_URL); + yield waitForWorkerClose(workerClient1); + yield waitForWorkerClose(workerClient2); + yield close(client1); + yield close(client2); + finish(); + }); +} diff --git a/browser/devtools/debugger/test/code_WorkerActor.attachThread-worker.js b/browser/devtools/debugger/test/code_WorkerActor.attachThread-worker.js new file mode 100644 index 000000000000..4c115749dfe8 --- /dev/null +++ b/browser/devtools/debugger/test/code_WorkerActor.attachThread-worker.js @@ -0,0 +1,16 @@ +"use strict"; + +function f() { + var a = 1; + var b = 2; + var c = 3; +} + +self.onmessage = function (event) { + if (event.data == "ping") { + f() + postMessage("pong"); + } +}; + +postMessage("load"); diff --git a/browser/devtools/debugger/test/code_frame-script.js b/browser/devtools/debugger/test/code_frame-script.js index 529328cbd0f2..eb9a85cf6da4 100644 --- a/browser/devtools/debugger/test/code_frame-script.js +++ b/browser/devtools/debugger/test/code_frame-script.js @@ -83,3 +83,15 @@ addMessageListener("jsonrpc", function ({ data: { method, params, id } }) { }); }); }); + +addMessageListener("test:postMessageToWorker", function (message) { + dump("Posting message '" + message.data.message + "' to worker with url '" + + message.data.url + "'.\n"); + + let worker = workers[message.data.url]; + worker.postMessage(message.data.message); + worker.addEventListener("message", function listener() { + worker.removeEventListener("message", listener); + sendAsyncMessage("test:postMessageToWorker"); + }); +}); diff --git a/browser/devtools/debugger/test/doc_WorkerActor.attachThread-tab.html b/browser/devtools/debugger/test/doc_WorkerActor.attachThread-tab.html new file mode 100644 index 000000000000..62ab9be7d2e8 --- /dev/null +++ b/browser/devtools/debugger/test/doc_WorkerActor.attachThread-tab.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/browser/devtools/debugger/test/head.js b/browser/devtools/debugger/test/head.js index 1002c36717c6..857b844a189f 100644 --- a/browser/devtools/debugger/test/head.js +++ b/browser/devtools/debugger/test/head.js @@ -512,9 +512,13 @@ function getTab(aTarget, aWindow) { } function getSources(aClient) { + info("Getting sources."); + let deferred = promise.defer(); - aClient.getSources(({sources}) => deferred.resolve(sources)); + aClient.getSources((packet) => { + deferred.resolve(packet.sources); + }); return deferred.promise; } @@ -1129,6 +1133,15 @@ function waitForWorkerListChanged(tabClient) { }); } +function attachThread(workerClient, options) { + info("Attaching to thread."); + return new Promise(function(resolve, reject) { + workerClient.attachThread(options, function (response, threadClient) { + resolve([response, threadClient]); + }); + }); +} + function waitForWorkerClose(workerClient) { info("Waiting for worker to close."); return new Promise(function (resolve) { @@ -1156,3 +1169,52 @@ function waitForWorkerThaw(workerClient) { }); }); } + +function resume(threadClient) { + info("Resuming thread."); + return rdpInvoke(threadClient, threadClient.resume); +} + +function findSource(sources, url) { + info("Finding source with url '" + url + "'.\n"); + for (let source of sources) { + if (source.url === url) { + return source; + } + } + return null; +} + +function setBreakpoint(sourceClient, location) { + info("Setting breakpoint.\n"); + return new Promise(function (resolve) { + sourceClient.setBreakpoint(location, function (response, breakpointClient) { + resolve([response, breakpointClient]); + }); + }); +} + +function waitForEvent(client, type, predicate) { + return new Promise(function (resolve) { + function listener(type, packet) { + if (!predicate(packet)) { + return; + } + client.removeListener(listener); + resolve(packet); + } + + if (predicate) { + client.addListener(type, listener); + } else { + client.addOneTimeListener(type, function (type, packet) { + resolve(packet); + }); + } + }); +} + +function waitForPause(threadClient) { + info("Waiting for pause.\n"); + return waitForEvent(threadClient, "paused"); +} diff --git a/toolkit/devtools/client/dbg-client.jsm b/toolkit/devtools/client/dbg-client.jsm index 2f1f0b59eb3e..833e26a5b136 100644 --- a/toolkit/devtools/client/dbg-client.jsm +++ b/toolkit/devtools/client/dbg-client.jsm @@ -1360,7 +1360,7 @@ TabClient.prototype = { eventSource(TabClient.prototype); function WorkerClient(aClient, aForm) { - this._client = aClient; + this.client = aClient; this._actor = aForm.from; this._isClosed = false; this._isFrozen = aForm.isFrozen; @@ -1376,11 +1376,11 @@ function WorkerClient(aClient, aForm) { WorkerClient.prototype = { get _transport() { - return this._client._transport; + return this.client._transport; }, get request() { - return this._client.request; + return this.client.request; }, get actor() { @@ -1397,19 +1397,41 @@ WorkerClient.prototype = { detach: DebuggerClient.requester({ type: "detach" }, { after: function (aResponse) { - this._client.unregisterClient(this); + this.client.unregisterClient(this); return aResponse; }, telemetry: "WORKERDETACH" }), + attachThread: function(aOptions = {}, aOnResponse = noop) { + if (this.thread) { + DevToolsUtils.executeSoon(() => aOnResponse({ + type: "connected", + threadActor: this.thread._actor, + }, this.thread)); + return; + } + + this.request({ + to: this._actor, + type: "connect", + options: aOptions, + }, (aResponse) => { + if (!aResponse.error) { + this.thread = new ThreadClient(this, aResponse.threadActor); + this.client.registerClient(this.thread); + } + aOnResponse(aResponse, this.thread); + }); + }, + _onClose: function () { this.removeListener("close", this._onClose); this.removeListener("freeze", this._onFreeze); this.removeListener("thaw", this._onThaw); - this._client.unregisterClient(this); + this.client.unregisterClient(this); this._closed = true; }, diff --git a/toolkit/devtools/server/actors/script.js b/toolkit/devtools/server/actors/script.js index 0c861ffae160..04779a87aed3 100644 --- a/toolkit/devtools/server/actors/script.js +++ b/toolkit/devtools/server/actors/script.js @@ -15,6 +15,7 @@ const DevToolsUtils = require("devtools/toolkit/DevToolsUtils"); const { dbg_assert, dumpn, update, fetch } = DevToolsUtils; const { dirname, joinURI } = require("devtools/toolkit/path"); const promise = require("promise"); +const PromiseDebugging = require("PromiseDebugging"); const xpcInspector = require("xpcInspector"); const ScriptStore = require("./utils/ScriptStore"); const {DevToolsWorker} = require("devtools/toolkit/shared/worker.js"); @@ -1494,7 +1495,7 @@ ThreadActor.prototype = { // Clear DOM event breakpoints. // XPCShell tests don't use actual DOM windows for globals and cause // removeListenerForAllEvents to throw. - if (this.global && !this.global.toString().includes("Sandbox")) { + if (!isWorker && this.global && !this.global.toString().includes("Sandbox")) { let els = Cc["@mozilla.org/eventlistenerservice;1"] .getService(Ci.nsIEventListenerService); els.removeListenerForAllEvents(this.global, this._allEventsListener, true); @@ -1933,7 +1934,7 @@ ThreadActor.prototype = { } if (promises.length > 0) { - this.synchronize(Promise.all(promises)); + this.synchronize(promise.all(promises)); } return true; @@ -2870,10 +2871,10 @@ SourceActor.prototype = { actor, GeneratedLocation.fromOriginalLocation(originalLocation) )) { - return Promise.resolve(null); + return promise.resolve(null); } - return Promise.resolve(originalLocation); + return promise.resolve(originalLocation); } else { return this.sources.getAllGeneratedLocations(originalLocation) .then((generatedLocations) => { diff --git a/toolkit/devtools/server/actors/utils/TabSources.js b/toolkit/devtools/server/actors/utils/TabSources.js index 1368a6218bb7..d03022ab375f 100644 --- a/toolkit/devtools/server/actors/utils/TabSources.js +++ b/toolkit/devtools/server/actors/utils/TabSources.js @@ -10,7 +10,7 @@ const DevToolsUtils = require("devtools/toolkit/DevToolsUtils"); const { dbg_assert, fetch } = DevToolsUtils; const EventEmitter = require("devtools/toolkit/event-emitter"); const { OriginalLocation, GeneratedLocation, getOffsetColumn } = require("devtools/server/actors/common"); -const { resolve } = Promise; +const { resolve } = require("promise"); loader.lazyRequireGetter(this, "SourceActor", "devtools/server/actors/script", true); loader.lazyRequireGetter(this, "isEvalSource", "devtools/server/actors/script", true); diff --git a/toolkit/devtools/server/actors/worker.js b/toolkit/devtools/server/actors/worker.js index 8f87fc79c721..5d32e633d305 100644 --- a/toolkit/devtools/server/actors/worker.js +++ b/toolkit/devtools/server/actors/worker.js @@ -1,6 +1,7 @@ "use strict"; let { Ci, Cu } = require("chrome"); +let { DebuggerServer } = require("devtools/server/main"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); @@ -28,6 +29,8 @@ function matchWorkerDebugger(dbg, options) { function WorkerActor(dbg) { this._dbg = dbg; this._isAttached = false; + this._threadActor = null; + this._transport = null; } WorkerActor.prototype = { @@ -66,6 +69,33 @@ WorkerActor.prototype = { return { type: "detached" }; }, + onConnect: function (request) { + if (!this._isAttached) { + return { error: "wrongState" }; + } + + if (this._threadActor !== null) { + return { + type: "connected", + threadActor: this._threadActor + }; + } + + return DebuggerServer.connectToWorker( + this.conn, this._dbg, this.actorID, request.options + ).then(({ threadActor, transport }) => { + this._threadActor = threadActor; + this._transport = transport; + + return { + type: "connected", + threadActor: this._threadActor + }; + }, (error) => { + return { error: error.toString() }; + }); + }, + onClose: function () { if (this._isAttached) { this._detach(); @@ -74,6 +104,10 @@ WorkerActor.prototype = { this.conn.sendActorEvent(this.actorID, "close"); }, + onError: function (filename, lineno, message) { + reportError("ERROR:" + filename + ":" + lineno + ":" + message + "\n"); + }, + onFreeze: function () { this.conn.sendActorEvent(this.actorID, "freeze"); }, @@ -83,6 +117,12 @@ WorkerActor.prototype = { }, _detach: function () { + if (this._threadActor !== null) { + this._transport.close(); + this._transport = null; + this._threadActor = null; + } + this._dbg.removeListener(this); this._isAttached = false; } @@ -90,7 +130,8 @@ WorkerActor.prototype = { WorkerActor.prototype.requestTypes = { "attach": WorkerActor.prototype.onAttach, - "detach": WorkerActor.prototype.onDetach + "detach": WorkerActor.prototype.onDetach, + "connect": WorkerActor.prototype.onConnect }; exports.WorkerActor = WorkerActor; diff --git a/toolkit/devtools/server/main.js b/toolkit/devtools/server/main.js index 0b8f902caf5c..9c6c3738e6ba 100644 --- a/toolkit/devtools/server/main.js +++ b/toolkit/devtools/server/main.js @@ -14,7 +14,7 @@ let { Ci, Cc, CC, Cu, Cr } = require("chrome"); let Services = require("Services"); let { ActorPool, OriginalLocation, RegisteredActorFactory, ObservedActorFactory } = require("devtools/server/actors/common"); -let { LocalDebuggerTransport, ChildDebuggerTransport } = +let { LocalDebuggerTransport, ChildDebuggerTransport, WorkerDebuggerTransport } = require("devtools/toolkit/transport/transport"); let DevToolsUtils = require("devtools/toolkit/DevToolsUtils"); let { dumpn, dumpv, dbg_assert } = DevToolsUtils; @@ -685,10 +685,13 @@ var DebuggerServer = { * "debug::packet", and all its actors will have names * beginning with "/". */ - connectToParent: function(aPrefix, aMessageManager) { + connectToParent: function(aPrefix, aScopeOrManager) { this._checkInit(); - let transport = new ChildDebuggerTransport(aMessageManager, aPrefix); + let transport = isWorker ? + new WorkerDebuggerTransport(aScopeOrManager, aPrefix) : + new ChildDebuggerTransport(aScopeOrManager, aPrefix); + return this._onConnection(transport, aPrefix, true); }, @@ -755,6 +758,83 @@ var DebuggerServer = { return deferred.promise; }, + connectToWorker: function (aConnection, aDbg, aId, aOptions) { + return new Promise((resolve, reject) => { + // Step 1: Initialize the worker debugger. + aDbg.initialize("resource://gre/modules/devtools/server/worker.js"); + + // Step 2: Send a connect request to the worker debugger. + aDbg.postMessage(JSON.stringify({ + type: "connect", + id: aId, + options: aOptions + })); + + // Steps 3-5 are performed on the worker thread (see worker.js). + + // Step 6: Wait for a response from the worker debugger. + let listener = { + onClose: () => { + aDbg.removeListener(listener); + + reject("closed"); + }, + + onMessage: (message) => { + let packet = JSON.parse(message); + if (packet.type !== "message" || packet.id !== aId) { + return; + } + + message = packet.message; + if (message.error) { + reject(error); + } + + if (message.type !== "paused") { + return; + } + + aDbg.removeListener(listener); + + // Step 7: Create a transport for the connection to the worker. + let transport = new WorkerDebuggerTransport(aDbg, aId); + transport.ready(); + transport.hooks = { + onClosed: () => { + if (!aDbg.isClosed) { + aDbg.postMessage(JSON.stringify({ + type: "disconnect", + id: aId + })); + } + + aConnection.cancelForwarding(aId); + }, + + onPacket: (packet) => { + // Ensure that any packets received from the server on the worker + // thread are forwarded to the client on the main thread, as if + // they had been sent by the server on the main thread. + aConnection.send(packet); + } + }; + + // Ensure that any packets received from the client on the main thread + // to actors on the worker thread are forwarded to the server on the + // worker thread. + aConnection.setForwarding(aId, transport); + + resolve({ + threadActor: message.from, + transport: transport + }); + } + }; + aDbg.addListener(listener); + }); + }, + /** * Check if the caller is running in a content child process. * diff --git a/toolkit/devtools/server/moz.build b/toolkit/devtools/server/moz.build index 1503896e66da..417b34ddcb98 100644 --- a/toolkit/devtools/server/moz.build +++ b/toolkit/devtools/server/moz.build @@ -51,6 +51,7 @@ EXTRA_JS_MODULES.devtools.server += [ 'content-globals.js', 'main.js', 'protocol.js', + 'worker.js' ] EXTRA_JS_MODULES.devtools.server.actors += [ diff --git a/toolkit/devtools/server/worker.js b/toolkit/devtools/server/worker.js new file mode 100644 index 000000000000..48f414e4828d --- /dev/null +++ b/toolkit/devtools/server/worker.js @@ -0,0 +1,66 @@ +"use strict" + +loadSubScript("resource://gre/modules/devtools/worker-loader.js"); + +let { ActorPool } = worker.require("devtools/server/actors/common"); +let { ThreadActor } = worker.require("devtools/server/actors/script"); +let { TabSources } = worker.require("devtools/server/actors/utils/TabSources"); +let makeDebugger = worker.require("devtools/server/actors/utils/make-debugger"); +let { DebuggerServer } = worker.require("devtools/server/main"); + +DebuggerServer.init(); +DebuggerServer.createRootActor = function () { + throw new Error("Should never get here!"); +}; + +let connections = Object.create(null); + +this.addEventListener("message", function (event) { + let packet = JSON.parse(event.data); + switch (packet.type) { + case "connect": + // Step 3: Create a connection to the parent. + let connection = DebuggerServer.connectToParent(packet.id, this); + connections[packet.id] = connection; + + // Step 4: Create a thread actor for the connection to the parent. + let pool = new ActorPool(connection); + connection.addActorPool(pool); + + let sources = null; + + let actor = new ThreadActor({ + makeDebugger: makeDebugger.bind(null, { + findDebuggees: () => { + return [this.global]; + }, + + shouldAddNewGlobalAsDebuggee: () => { + return true; + }, + }), + + get sources() { + if (sources === null) { + sources = new TabSources(actor); + } + return sources; + } + }, global); + + pool.addActor(actor); + + // Step 5: Attach to the thread actor. + // + // This will cause a packet to be sent over the connection to the parent. + // Because this connection uses WorkerDebuggerTransport internally, this + // packet will be sent using WorkerDebuggerGlobalScope.postMessage, causing + // an onMessage event to be fired on the WorkerDebugger in the main thread. + actor.onAttach({}); + break; + + case "disconnect": + connections[packet.id].close(); + break; + }; +}); diff --git a/toolkit/devtools/worker-loader.js b/toolkit/devtools/worker-loader.js index 6652c38aab3f..f5932a17aae6 100644 --- a/toolkit/devtools/worker-loader.js +++ b/toolkit/devtools/worker-loader.js @@ -435,6 +435,8 @@ let { } else { // Worker thread let requestors = []; + let scope = this; + let xpcInspector = { get lastNestRequestor() { return requestors.length === 0 ? null : requestors[0]; @@ -442,13 +444,13 @@ let { enterNestedEventLoop: function (requestor) { requestors.push(requestor); - this.enterEventLoop(); + scope.enterEventLoop(); return requestors.length; }, exitNestedEventLoop: function () { requestors.pop(); - this.leaveEventLoop(); + scope.leaveEventLoop(); return requestors.length; } }; From cc921d71fa15385c712767a4bf7ac8291574b208 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Mon, 8 Jun 2015 16:56:34 +0100 Subject: [PATCH 07/59] Bug 1172270 - don't cause extra flushes for reader mode, r=margaret,smaug --HG-- rename : browser/base/content/test/general/browser_readerMode.js => browser/base/content/test/general/browser_readerMode_hidden_nodes.js rename : browser/base/content/test/general/readerModeArticle.html => browser/base/content/test/general/readerModeArticleHiddenNodes.html extra : rebase_source : 184f260d55a83e866b20befda517ffe42a704002 extra : histedit_source : 4da59cfad20b681e6af20d53df03d4ed4b1ab2fb --- browser/base/content/tab-content.js | 31 +++++++++++ browser/base/content/test/general/browser.ini | 3 ++ .../browser_readerMode_hidden_nodes.js | 45 ++++++++++++++++ .../general/readerModeArticleHiddenNodes.html | 22 ++++++++ .../BrowserTestUtils/ContentTaskUtils.jsm | 52 ++++++++++++++++++- toolkit/components/reader/ReaderMode.jsm | 11 +--- 6 files changed, 153 insertions(+), 11 deletions(-) create mode 100644 browser/base/content/test/general/browser_readerMode_hidden_nodes.js create mode 100644 browser/base/content/test/general/readerModeArticleHiddenNodes.html diff --git a/browser/base/content/tab-content.js b/browser/base/content/tab-content.js index e67ce7a05cc3..2316b34b4a1e 100644 --- a/browser/base/content/tab-content.js +++ b/browser/base/content/tab-content.js @@ -337,6 +337,7 @@ let AboutReaderListener = { break; case "pagehide": + this.cancelPotentialPendingReadabilityCheck(); sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: false }); break; @@ -353,12 +354,42 @@ let AboutReaderListener = { } }, + + /** + * NB: this function will update the state of the reader button asynchronously + * after the next mozAfterPaint call (assuming reader mode is enabled and + * this is a suitable document). Calling it on things which won't be + * painted is not going to work. + */ updateReaderButton: function(forceNonArticle) { if (!ReaderMode.isEnabledForParseOnLoad || this.isAboutReader || !(content.document instanceof content.HTMLDocument) || content.document.mozSyntheticDocument) { return; } + + this.scheduleReadabilityCheckPostPaint(forceNonArticle); + }, + + cancelPotentialPendingReadabilityCheck: function() { + if (this._pendingReadabilityCheck) { + removeEventListener("MozAfterPaint", this._pendingReadabilityCheck); + delete this._pendingReadabilityCheck; + } + }, + + scheduleReadabilityCheckPostPaint: function(forceNonArticle) { + if (this._pendingReadabilityCheck) { + // We need to stop this check before we re-add one because we don't know + // if forceNonArticle was true or false last time. + this.cancelPotentialPendingReadabilityCheck(); + } + this._pendingReadabilityCheck = this.onPaintWhenWaitedFor.bind(this, forceNonArticle); + addEventListener("MozAfterPaint", this._pendingReadabilityCheck); + }, + + onPaintWhenWaitedFor: function(forceNonArticle) { + this.cancelPotentialPendingReadabilityCheck(); // Only send updates when there are articles; there's no point updating with // |false| all the time. if (ReaderMode.isProbablyReaderable(content.document)) { diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini index cc3598212b25..a7ebc9f3665c 100644 --- a/browser/base/content/test/general/browser.ini +++ b/browser/base/content/test/general/browser.ini @@ -478,6 +478,9 @@ skip-if = e10s # bug 1100687 - test directly manipulates content (content.docume [browser_readerMode.js] support-files = readerModeArticle.html +[browser_readerMode_hidden_nodes.js] +support-files = + readerModeArticleHiddenNodes.html [browser_bug1124271_readerModePinnedTab.js] support-files = readerModeArticle.html diff --git a/browser/base/content/test/general/browser_readerMode_hidden_nodes.js b/browser/base/content/test/general/browser_readerMode_hidden_nodes.js new file mode 100644 index 000000000000..fb791f211d6f --- /dev/null +++ b/browser/base/content/test/general/browser_readerMode_hidden_nodes.js @@ -0,0 +1,45 @@ +/* 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/. */ + +/** + * Test that the reader mode button appears and works properly on + * reader-able content, and that ReadingList button can open and close + * its Sidebar UI. + */ +const TEST_PREFS = [ + ["reader.parse-on-load.enabled", true], + ["browser.reader.detectedFirstArticle", false], +]; + +const TEST_PATH = "http://example.com/browser/browser/base/content/test/general/"; + +let readerButton = document.getElementById("reader-mode-button"); + +add_task(function* test_reader_button() { + registerCleanupFunction(function() { + // Reset test prefs. + TEST_PREFS.forEach(([name, value]) => { + Services.prefs.clearUserPref(name); + }); + while (gBrowser.tabs.length > 1) { + gBrowser.removeCurrentTab(); + } + }); + + // Set required test prefs. + TEST_PREFS.forEach(([name, value]) => { + Services.prefs.setBoolPref(name, value); + }); + + let tab = gBrowser.selectedTab = gBrowser.addTab(); + is_element_hidden(readerButton, "Reader mode button is not present on a new tab"); + // Point tab to a test page that is not reader-able due to hidden nodes. + let url = TEST_PATH + "readerModeArticleHiddenNodes.html"; + yield promiseTabLoadEvent(tab, url); + yield ContentTask.spawn(tab.linkedBrowser, "", function() { + return ContentTaskUtils.waitForEvent(content, "MozAfterPaint"); + }); + + is_element_hidden(readerButton, "Reader mode button is still not present on tab with unreadable content."); +}); diff --git a/browser/base/content/test/general/readerModeArticleHiddenNodes.html b/browser/base/content/test/general/readerModeArticleHiddenNodes.html new file mode 100644 index 000000000000..92441b797807 --- /dev/null +++ b/browser/base/content/test/general/readerModeArticleHiddenNodes.html @@ -0,0 +1,22 @@ + + + +Article title + + + + +
Site header
+
+

Article title

+

by Jane Doe

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.

+

Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.

+

Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.

+

Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.

+

Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.

+
+ + diff --git a/testing/mochitest/BrowserTestUtils/ContentTaskUtils.jsm b/testing/mochitest/BrowserTestUtils/ContentTaskUtils.jsm index 712b00a3a71f..f94cf0250f36 100644 --- a/testing/mochitest/BrowserTestUtils/ContentTaskUtils.jsm +++ b/testing/mochitest/BrowserTestUtils/ContentTaskUtils.jsm @@ -66,5 +66,55 @@ this.ContentTaskUtils = { tries++; }, interval); }); - } + }, + + /** + * Waits for an event to be fired on a specified element. + * + * Usage: + * let promiseEvent = ContentTasKUtils.waitForEvent(element, "eventName"); + * // Do some processing here that will cause the event to be fired + * // ... + * // Now yield until the Promise is fulfilled + * let receivedEvent = yield promiseEvent; + * + * @param {Element} subject + * The element that should receive the event. + * @param {string} eventName + * Name of the event to listen to. + * @param {bool} capture [optional] + * True to use a capturing listener. + * @param {function} checkFn [optional] + * Called with the Event object as argument, should return true if the + * event is the expected one, or false if it should be ignored and + * listening should continue. If not specified, the first event with + * the specified name resolves the returned promise. + * + * @note Because this function is intended for testing, any error in checkFn + * will cause the returned promise to be rejected instead of waiting for + * the next event, since this is probably a bug in the test. + * + * @returns {Promise} + * @resolves The Event object. + */ + waitForEvent(subject, eventName, capture, checkFn) { + return new Promise((resolve, reject) => { + subject.addEventListener(eventName, function listener(event) { + try { + if (checkFn && !checkFn(event)) { + return; + } + subject.removeEventListener(eventName, listener, capture); + resolve(event); + } catch (ex) { + try { + subject.removeEventListener(eventName, listener, capture); + } catch (ex2) { + // Maybe the provided object does not support removeEventListener. + } + reject(ex); + } + }, capture); + }); + }, }; diff --git a/toolkit/components/reader/ReaderMode.jsm b/toolkit/components/reader/ReaderMode.jsm index c5e31e72b29a..960906fbbba8 100644 --- a/toolkit/components/reader/ReaderMode.jsm +++ b/toolkit/components/reader/ReaderMode.jsm @@ -132,20 +132,11 @@ this.ReaderMode = { // We pass in a helper function to determine if a node is visible, because // it uses gecko APIs that the engine-agnostic readability code can't rely // upon. - // NB: we need to do a flush the first time we call this, so we keep track of - // this using a property: - this._needFlushForVisibilityCheck = true; return new Readability(uri, doc).isProbablyReaderable(this.isNodeVisible.bind(this, utils)); }, isNodeVisible: function(utils, node) { - let bounds; - if (this._needFlushForVisibilityCheck) { - bounds = node.getBoundingClientRect(); - this._needFlushForVisibilityCheck = false; - } else { - bounds = utils.getBoundsWithoutFlushing(node); - } + let bounds = utils.getBoundsWithoutFlushing(node); return bounds.height > 0 && bounds.width > 0; }, From 774b49304f9168f69fc3047bc2901be9b47229f5 Mon Sep 17 00:00:00 2001 From: Patrick Brosset Date: Thu, 11 Jun 2015 15:45:57 +0200 Subject: [PATCH 08/59] Bug 1155663 - Show animations as synchronized time blocks in animation inspector; r=bgrins This is the first step towards the animation-inspector UI v3 (bug 1153271). The new UI is still hidden behind a pref, and this change doesn't implement everything that is in the current v2 UI. This introduces a new Timeline graph to represent all currently animated nodes below the currently selected node. v2 used to show them as independent player widgets. With this patch, we now show them as synchronized time blocks on a common time scale. Each animation has a preview of the animated node in the left sidebar, and a time block on the right, the width of which represents its duration. The animation name is also displayed. There's also a time graduations header and background that gives the user information about how long do the animations last. This change does *not* provide a way to know what's the currentTime nor a way to set it yet. This also makes the existing animationinspector tests that still make sense with the new timeline-based UI run with the new UI pref on. --HG-- extra : rebase_source : 65634e8f5e618f15e8d33c36a90217ba07a310f4 --- .../animation-controller.js | 17 +- .../animationinspector/animation-panel.js | 88 +-- .../devtools/animationinspector/components.js | 510 ++++++++++++++---- browser/devtools/animationinspector/moz.build | 1 + ...rowser_animation_empty_on_invalid_nodes.js | 39 +- .../test/browser_animation_panel_exists.js | 9 + ...imation_participate_in_inspector_update.js | 13 +- ...tion_playerWidgets_appear_on_panel_init.js | 11 +- ...er_animation_playerWidgets_target_nodes.js | 23 +- ...er_animation_refresh_on_added_animation.js | 26 +- ..._animation_refresh_on_removed_animation.js | 29 +- .../browser_animation_refresh_when_active.js | 19 +- ...me_nb_of_playerWidgets_and_playerFronts.js | 12 + ...er_animation_shows_player_on_valid_node.js | 14 +- ...owser_animation_target_highlight_select.js | 36 +- ...mation_toggle_button_toggles_animations.js | 2 +- .../test/browser_animation_toolbar_exists.js | 2 +- ..._ui_updates_when_animation_data_changes.js | 60 ++- .../devtools/animationinspector/test/head.js | 87 ++- browser/devtools/animationinspector/utils.js | 135 +++++ .../devtools/animationinspector.properties | 6 + .../shared/devtools/animationinspector.css | 179 +++++- toolkit/devtools/server/actors/animation.js | 129 +++-- 23 files changed, 1206 insertions(+), 241 deletions(-) create mode 100644 browser/devtools/animationinspector/utils.js diff --git a/browser/devtools/animationinspector/animation-controller.js b/browser/devtools/animationinspector/animation-controller.js index bfa01ccc58ae..5fb8911ec812 100644 --- a/browser/devtools/animationinspector/animation-controller.js +++ b/browser/devtools/animationinspector/animation-controller.js @@ -114,6 +114,7 @@ let AnimationsController = { "setPlaybackRate"); this.hasTargetNode = yield target.actorHasMethod("domwalker", "getNodeFromActor"); + this.isNewUI = Services.prefs.getBoolPref("devtools.inspector.animationInspectorV3"); if (this.destroyed) { console.warn("Could not fully initialize the AnimationsController"); @@ -240,11 +241,15 @@ let AnimationsController = { for (let {type, player} of changes) { if (type === "added") { this.animationPlayers.push(player); - player.startAutoRefresh(); + if (!this.isNewUI) { + player.startAutoRefresh(); + } } if (type === "removed") { - player.stopAutoRefresh(); + if (!this.isNewUI) { + player.stopAutoRefresh(); + } yield player.release(); let index = this.animationPlayers.indexOf(player); this.animationPlayers.splice(index, 1); @@ -256,12 +261,20 @@ let AnimationsController = { }), startAllAutoRefresh: function() { + if (this.isNewUI) { + return; + } + for (let front of this.animationPlayers) { front.startAutoRefresh(); } }, stopAllAutoRefresh: function() { + if (this.isNewUI) { + return; + } + for (let front of this.animationPlayers) { front.stopAutoRefresh(); } diff --git a/browser/devtools/animationinspector/animation-panel.js b/browser/devtools/animationinspector/animation-panel.js index 7814612ea3c4..3d6f1a95b9c1 100644 --- a/browser/devtools/animationinspector/animation-panel.js +++ b/browser/devtools/animationinspector/animation-panel.js @@ -3,14 +3,17 @@ /* 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/. */ +/* globals AnimationsController, document, performance, promise, + gToolbox, gInspector, requestAnimationFrame, cancelAnimationFrame, L10N */ "use strict"; +const {createNode} = require("devtools/animationinspector/utils"); const { PlayerMetaDataHeader, PlaybackRateSelector, AnimationTargetNode, - createNode + AnimationsTimeline } = require("devtools/animationinspector/components"); /** @@ -22,7 +25,8 @@ let AnimationsPanel = { initialize: Task.async(function*() { if (AnimationsController.destroyed) { - console.warn("Could not initialize the animation-panel, controller was destroyed"); + console.warn("Could not initialize the animation-panel, controller " + + "was destroyed"); return; } if (this.initialized) { @@ -45,13 +49,18 @@ let AnimationsPanel = { this.togglePicker = hUtils.togglePicker.bind(hUtils); this.onPickerStarted = this.onPickerStarted.bind(this); this.onPickerStopped = this.onPickerStopped.bind(this); - this.createPlayerWidgets = this.createPlayerWidgets.bind(this); + this.refreshAnimations = this.refreshAnimations.bind(this); this.toggleAll = this.toggleAll.bind(this); this.onTabNavigated = this.onTabNavigated.bind(this); this.startListeners(); - yield this.createPlayerWidgets(); + if (AnimationsController.isNewUI) { + this.animationsTimelineComponent = new AnimationsTimeline(gInspector); + this.animationsTimelineComponent.init(this.playersEl); + } + + yield this.refreshAnimations(); this.initialized.resolve(); @@ -69,6 +78,11 @@ let AnimationsPanel = { this.destroyed = promise.defer(); this.stopListeners(); + + if (this.animationsTimelineComponent) { + this.animationsTimelineComponent.destroy(); + this.animationsTimelineComponent = null; + } yield this.destroyPlayerWidgets(); this.playersEl = this.errorMessageEl = null; @@ -79,7 +93,7 @@ let AnimationsPanel = { startListeners: function() { AnimationsController.on(AnimationsController.PLAYERS_UPDATED_EVENT, - this.createPlayerWidgets); + this.refreshAnimations); this.pickerButtonEl.addEventListener("click", this.togglePicker, false); gToolbox.on("picker-started", this.onPickerStarted); @@ -91,7 +105,7 @@ let AnimationsPanel = { stopListeners: function() { AnimationsController.off(AnimationsController.PLAYERS_UPDATED_EVENT, - this.createPlayerWidgets); + this.refreshAnimations); this.pickerButtonEl.removeEventListener("click", this.togglePicker, false); gToolbox.off("picker-started", this.onPickerStarted); @@ -122,16 +136,18 @@ let AnimationsPanel = { toggleAll: Task.async(function*() { let btnClass = this.toggleAllButtonEl.classList; - // Toggling all animations is async and it may be some time before each of - // the current players get their states updated, so toggle locally too, to - // avoid the timelines from jumping back and forth. - if (this.playerWidgets) { - let currentWidgetStateChange = []; - for (let widget of this.playerWidgets) { - currentWidgetStateChange.push(btnClass.contains("paused") - ? widget.play() : widget.pause()); + if (!AnimationsController.isNewUI) { + // Toggling all animations is async and it may be some time before each of + // the current players get their states updated, so toggle locally too, to + // avoid the timelines from jumping back and forth. + if (this.playerWidgets) { + let currentWidgetStateChange = []; + for (let widget of this.playerWidgets) { + currentWidgetStateChange.push(btnClass.contains("paused") + ? widget.play() : widget.pause()); + } + yield promise.all(currentWidgetStateChange).catch(Cu.reportError); } - yield promise.all(currentWidgetStateChange).catch(Cu.reportError); } btnClass.toggle("paused"); @@ -142,14 +158,21 @@ let AnimationsPanel = { this.toggleAllButtonEl.classList.remove("paused"); }, - createPlayerWidgets: Task.async(function*() { + refreshAnimations: Task.async(function*() { let done = gInspector.updating("animationspanel"); // Empty the whole panel first. this.hideErrorMessage(); yield this.destroyPlayerWidgets(); - // If there are no players to show, show the error message instead and return. + // Re-render the timeline component. + if (this.animationsTimelineComponent) { + this.animationsTimelineComponent.render( + AnimationsController.animationPlayers); + } + + // If there are no players to show, show the error message instead and + // return. if (!AnimationsController.animationPlayers.length) { this.displayErrorMessage(); this.emit(this.UI_UPDATED_EVENT); @@ -157,17 +180,21 @@ let AnimationsPanel = { return; } - // Otherwise, create player widgets. - this.playerWidgets = []; - let initPromises = []; + // Otherwise, create player widgets (only when isNewUI is false, the + // timeline has already been re-rendered). + if (!AnimationsController.isNewUI) { + this.playerWidgets = []; + let initPromises = []; - for (let player of AnimationsController.animationPlayers) { - let widget = new PlayerWidget(player, this.playersEl); - initPromises.push(widget.initialize()); - this.playerWidgets.push(widget); + for (let player of AnimationsController.animationPlayers) { + let widget = new PlayerWidget(player, this.playersEl); + initPromises.push(widget.initialize()); + this.playerWidgets.push(widget); + } + + yield initPromises; } - yield initPromises; this.emit(this.UI_UPDATED_EVENT); done(); }), @@ -392,9 +419,8 @@ PlayerWidget.prototype = { onPlayPauseBtnClick: function() { if (this.player.state.playState === "running") { return this.pause(); - } else { - return this.play(); } + return this.play(); }, onRewindBtnClick: function() { @@ -406,7 +432,7 @@ PlayerWidget.prototype = { let time = state.duration; if (state.iterationCount) { - time = state.iterationCount * state.duration; + time = state.iterationCount * state.duration; } this.setCurrentTime(time, true); }, @@ -466,7 +492,8 @@ PlayerWidget.prototype = { */ setCurrentTime: Task.async(function*(time, shouldPause) { if (!AnimationsController.hasSetCurrentTime) { - throw new Error("This server version doesn't support setting animations' currentTime"); + throw new Error("This server version doesn't support setting " + + "animations' currentTime"); } if (shouldPause) { @@ -492,7 +519,8 @@ PlayerWidget.prototype = { */ setPlaybackRate: function(rate) { if (!AnimationsController.hasSetPlaybackRate) { - throw new Error("This server version doesn't support setting animations' playbackRate"); + throw new Error("This server version doesn't support setting " + + "animations' playbackRate"); } return this.player.setPlaybackRate(rate); diff --git a/browser/devtools/animationinspector/components.js b/browser/devtools/animationinspector/components.js index 78ebda5527f3..f2c155a6744e 100644 --- a/browser/devtools/animationinspector/components.js +++ b/browser/devtools/animationinspector/components.js @@ -3,6 +3,7 @@ /* 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/. */ +/* globals ViewHelpers */ "use strict"; @@ -19,11 +20,19 @@ // 4. destroy the component: // c.destroy(); -const {Cu} = require('chrome'); +const {Cu} = require("chrome"); Cu.import("resource:///modules/devtools/ViewHelpers.jsm"); +const { + createNode, + drawGraphElementBackground, + findOptimalTimeInterval +} = require("devtools/animationinspector/utils"); const STRINGS_URI = "chrome://browser/locale/devtools/animationinspector.properties"; const L10N = new ViewHelpers.L10N(STRINGS_URI); +const MILLIS_TIME_FORMAT_MAX_DURATION = 4000; +// The minimum spacing between 2 time graduation headers in the timeline (ms). +const TIME_GRADUATION_MIN_SPACING = 40; /** * UI component responsible for displaying and updating the player meta-data: @@ -75,9 +84,9 @@ PlayerMetaDataHeader.prototype = { // Animation duration. this.durationLabel = createNode({ parent: metaData, - nodeType: "span" + nodeType: "span", + textContent: L10N.getStr("player.animationDurationLabel") }); - this.durationLabel.textContent = L10N.getStr("player.animationDurationLabel"); this.durationValue = createNode({ parent: metaData, @@ -90,9 +99,9 @@ PlayerMetaDataHeader.prototype = { nodeType: "span", attributes: { "style": "display:none;" - } + }, + textContent: L10N.getStr("player.animationDelayLabel") }); - this.delayLabel.textContent = L10N.getStr("player.animationDelayLabel"); this.delayValue = createNode({ parent: metaData, @@ -106,9 +115,9 @@ PlayerMetaDataHeader.prototype = { nodeType: "span", attributes: { "style": "display:none;" - } + }, + textContent: L10N.getStr("player.animationIterationCountLabel") }); - this.iterationLabel.textContent = L10N.getStr("player.animationIterationCountLabel"); this.iterationValue = createNode({ parent: metaData, @@ -224,7 +233,7 @@ PlaybackRateSelector.prototype = { * different from the existing presets. */ getCurrentPresets: function({playbackRate}) { - return [...new Set([...this.PRESETS, playbackRate])].sort((a,b) => a > b); + return [...new Set([...this.PRESETS, playbackRate])].sort((a, b) => a > b); }, render: function(state) { @@ -248,9 +257,9 @@ PlaybackRateSelector.prototype = { nodeType: "option", attributes: { value: preset, - } + }, + textContent: L10N.getFormatStr("player.playbackRateLabel", preset) }); - option.textContent = L10N.getFormatStr("player.playbackRateLabel", preset); if (preset === state.playbackRate) { option.setAttribute("selected", ""); } @@ -261,7 +270,7 @@ PlaybackRateSelector.prototype = { this.currentRate = state.playbackRate; }, - onSelectionChanged: function(e) { + onSelectionChanged: function() { this.emit("rate-changed", parseFloat(this.el.value)); } }; @@ -272,9 +281,13 @@ PlaybackRateSelector.prototype = { * @param {InspectorPanel} inspector Requires a reference to the inspector-panel * to highlight and select the node, as well as refresh it when there are * mutations. + * @param {Object} options Supported properties are: + * - compact {Boolean} Defaults to false. If true, nodes will be previewed like + * tag#id.class instead of */ -function AnimationTargetNode(inspector) { +function AnimationTargetNode(inspector, options={}) { this.inspector = inspector; + this.options = options; this.onPreviewMouseOver = this.onPreviewMouseOver.bind(this); this.onPreviewMouseOut = this.onPreviewMouseOut.bind(this); @@ -313,7 +326,9 @@ AnimationTargetNode.prototype = { nodeType: "span" }); - this.previewEl.appendChild(document.createTextNode("<")); + if (!this.options.compact) { + this.previewEl.appendChild(document.createTextNode("<")); + } // Tag name. this.tagNameEl = createNode({ @@ -330,15 +345,26 @@ AnimationTargetNode.prototype = { nodeType: "span" }); - createNode({ - parent: this.idEl, - nodeType: "span", - attributes: { - "class": "attribute-name theme-fg-color2" - } - }).textContent = "id"; - - this.idEl.appendChild(document.createTextNode("=\"")); + if (!this.options.compact) { + createNode({ + parent: this.idEl, + nodeType: "span", + attributes: { + "class": "attribute-name theme-fg-color2" + }, + textContent: "id" + }); + this.idEl.appendChild(document.createTextNode("=\"")); + } else { + createNode({ + parent: this.idEl, + nodeType: "span", + attributes: { + "class": "theme-fg-color2" + }, + textContent: "#" + }); + } createNode({ parent: this.idEl, @@ -348,7 +374,9 @@ AnimationTargetNode.prototype = { } }); - this.idEl.appendChild(document.createTextNode("\"")); + if (!this.options.compact) { + this.idEl.appendChild(document.createTextNode("\"")); + } // Class attribute container. this.classEl = createNode({ @@ -356,15 +384,26 @@ AnimationTargetNode.prototype = { nodeType: "span" }); - createNode({ - parent: this.classEl, - nodeType: "span", - attributes: { - "class": "attribute-name theme-fg-color2" - } - }).textContent = "class"; - - this.classEl.appendChild(document.createTextNode("=\"")); + if (!this.options.compact) { + createNode({ + parent: this.classEl, + nodeType: "span", + attributes: { + "class": "attribute-name theme-fg-color2" + }, + textContent: "class" + }); + this.classEl.appendChild(document.createTextNode("=\"")); + } else { + createNode({ + parent: this.classEl, + nodeType: "span", + attributes: { + "class": "theme-fg-color6" + }, + textContent: "." + }); + } createNode({ parent: this.classEl, @@ -374,9 +413,10 @@ AnimationTargetNode.prototype = { } }); - this.classEl.appendChild(document.createTextNode("\"")); - - this.previewEl.appendChild(document.createTextNode(">")); + if (!this.options.compact) { + this.classEl.appendChild(document.createTextNode("\"")); + this.previewEl.appendChild(document.createTextNode(">")); + } // Init events for highlighting and selecting the node. this.previewEl.addEventListener("mouseover", this.onPreviewMouseOver); @@ -430,73 +470,357 @@ AnimationTargetNode.prototype = { } }, - render: function(playerFront) { + render: Task.async(function*(playerFront) { this.playerFront = playerFront; - this.inspector.walker.getNodeFromActor(playerFront.actorID, ["node"]).then(nodeFront => { - // We might have been destroyed in the meantime, or the node might not be found. - if (!this.el || !nodeFront) { - return; - } + this.nodeFront = undefined; - this.nodeFront = nodeFront; - let {tagName, attributes} = nodeFront; - - this.tagNameEl.textContent = tagName.toLowerCase(); - - let idIndex = attributes.findIndex(({name}) => name === "id"); - if (idIndex > -1 && attributes[idIndex].value) { - this.idEl.querySelector(".attribute-value").textContent = - attributes[idIndex].value; - this.idEl.style.display = "inline"; - } else { - this.idEl.style.display = "none"; - } - - let classIndex = attributes.findIndex(({name}) => name === "class"); - if (classIndex > -1 && attributes[classIndex].value) { - this.classEl.querySelector(".attribute-value").textContent = - attributes[classIndex].value; - this.classEl.style.display = "inline"; - } else { - this.classEl.style.display = "none"; - } - - this.emit("target-retrieved"); - }, e => { - this.nodeFront = null; + try { + this.nodeFront = yield this.inspector.walker.getNodeFromActor( + playerFront.actorID, ["node"]); + } catch (e) { + // We might have been destroyed in the meantime, or the node might not be + // found. if (!this.el) { - console.warn("Cound't retrieve the animation target node, widget destroyed"); - } else { - console.error(e); + console.warn("Cound't retrieve the animation target node, widget " + + "destroyed"); } - }); + console.error(e); + return; + } + + if (!this.nodeFront || !this.el) { + return; + } + + let {tagName, attributes} = this.nodeFront; + + this.tagNameEl.textContent = tagName.toLowerCase(); + + let idIndex = attributes.findIndex(({name}) => name === "id"); + if (idIndex > -1 && attributes[idIndex].value) { + this.idEl.querySelector(".attribute-value").textContent = + attributes[idIndex].value; + this.idEl.style.display = "inline"; + } else { + this.idEl.style.display = "none"; + } + + let classIndex = attributes.findIndex(({name}) => name === "class"); + if (classIndex > -1 && attributes[classIndex].value) { + let value = attributes[classIndex].value; + if (this.options.compact) { + value = value.split(" ").join("."); + } + + this.classEl.querySelector(".attribute-value").textContent = value; + this.classEl.style.display = "inline"; + } else { + this.classEl.style.display = "none"; + } + + this.emit("target-retrieved"); + }) +}; + +/** + * The TimeScale helper object is used to know which size should something be + * displayed with in the animation panel, depending on the animations that are + * currently displayed. + * If there are 5 animations displayed, and the first one starts at 10000ms and + * the last one ends at 20000ms, then this helper can be used to convert any + * time in this range to a distance in pixels. + * + * For the helper to know how to convert, it needs to know all the animations. + * Whenever a new animation is added to the panel, addAnimation(state) should be + * called. reset() can be called to start over. + */ +let TimeScale = { + minStartTime: Infinity, + maxEndTime: 0, + + /** + * Add a new animation to time scale. + * @param {Object} state A PlayerFront.state object. + */ + addAnimation: function({startTime, delay, duration, iterationCount}) { + this.minStartTime = Math.min(this.minStartTime, startTime); + let length = delay + (duration * (!iterationCount ? 1 : iterationCount)); + this.maxEndTime = Math.max(this.maxEndTime, startTime + length); + }, + + /** + * Reset the current time scale. + */ + reset: function() { + this.minStartTime = Infinity; + this.maxEndTime = 0; + }, + + /** + * Convert a startTime to a distance in pixels, in the current time scale. + * @param {Number} time + * @param {Number} containerWidth The width of the container element. + * @return {Number} + */ + startTimeToDistance: function(time, containerWidth) { + time -= this.minStartTime; + return this.durationToDistance(time, containerWidth); + }, + + /** + * Convert a duration to a distance in pixels, in the current time scale. + * @param {Number} time + * @param {Number} containerWidth The width of the container element. + * @return {Number} + */ + durationToDistance: function(duration, containerWidth) { + return containerWidth * duration / (this.maxEndTime - this.minStartTime); + }, + + /** + * Convert a distance in pixels to a time, in the current time scale. + * @param {Number} distance + * @param {Number} containerWidth The width of the container element. + * @return {Number} + */ + distanceToTime: function(distance, containerWidth) { + return this.minStartTime + + ((this.maxEndTime - this.minStartTime) * distance / containerWidth); + }, + + /** + * Convert a distance in pixels to a time, in the current time scale. + * The time will be relative to the current minimum start time. + * @param {Number} distance + * @param {Number} containerWidth The width of the container element. + * @return {Number} + */ + distanceToRelativeTime: function(distance, containerWidth) { + let time = this.distanceToTime(distance, containerWidth); + return time - this.minStartTime; + }, + + /** + * Depending on the time scale, format the given time as milliseconds or + * seconds. + * @param {Number} time + * @return {String} The formatted time string. + */ + formatTime: function(time) { + let duration = this.maxEndTime - this.minStartTime; + + // Format in milliseconds if the total duration is short enough. + if (duration <= MILLIS_TIME_FORMAT_MAX_DURATION) { + return L10N.getFormatStr("timeline.timeGraduationLabel", time.toFixed(0)); + } + + // Otherwise format in seconds. + return L10N.getFormatStr("player.timeLabel", (time / 1000).toFixed(1)); } }; /** - * DOM node creation helper function. - * @param {Object} Options to customize the node to be created. - * - nodeType {String} Optional, defaults to "div", - * - attributes {Object} Optional attributes object like - * {attrName1:value1, attrName2: value2, ...} - * - parent {DOMNode} Mandatory node to append the newly created node to. - * @return {DOMNode} The newly created node. + * UI component responsible for displaying a timeline for animations. + * The timeline is essentially a graph with time along the x axis and animations + * along the y axis. + * The time is represented with a graduation header at the top and a current + * time play head. + * Animations are organized by lines, with a left margin containing the preview + * of the target DOM element the animation applies to. */ -function createNode(options) { - if (!options.parent) { - throw new Error("Missing parent DOMNode to create new node"); - } +function AnimationsTimeline(inspector) { + this.animations = []; + this.targetNodes = []; + this.inspector = inspector; - let type = options.nodeType || "div"; - let node = options.parent.ownerDocument.createElement(type); - - for (let name in options.attributes || {}) { - let value = options.attributes[name]; - node.setAttribute(name, value); - } - - options.parent.appendChild(node); - return node; + this.onAnimationStateChanged = this.onAnimationStateChanged.bind(this); } -exports.createNode = createNode; +exports.AnimationsTimeline = AnimationsTimeline; + +AnimationsTimeline.prototype = { + init: function(containerEl) { + this.win = containerEl.ownerDocument.defaultView; + + this.rootWrapperEl = createNode({ + parent: containerEl, + attributes: { + "class": "animation-timeline" + } + }); + + this.timeHeaderEl = createNode({ + parent: this.rootWrapperEl, + attributes: { + "class": "time-header" + } + }); + + this.animationsEl = createNode({ + parent: this.rootWrapperEl, + nodeType: "ul", + attributes: { + "class": "animations" + } + }); + }, + + destroy: function() { + this.unrender(); + + this.rootWrapperEl.remove(); + this.animations = []; + + this.rootWrapperEl = null; + this.timeHeaderEl = null; + this.animationsEl = null; + this.win = null; + this.inspector = null; + }, + + destroyTargetNodes: function() { + for (let targetNode of this.targetNodes) { + targetNode.destroy(); + } + this.targetNodes = []; + }, + + unrender: function() { + for (let animation of this.animations) { + animation.off("changed", this.onAnimationStateChanged); + } + + TimeScale.reset(); + this.destroyTargetNodes(); + this.animationsEl.innerHTML = ""; + }, + + render: function(animations) { + this.unrender(); + + this.animations = animations; + if (!this.animations.length) { + return; + } + + // Loop first to set the time scale for all current animations. + for (let {state} of animations) { + TimeScale.addAnimation(state); + } + + this.drawHeaderAndBackground(); + + for (let animation of this.animations) { + animation.on("changed", this.onAnimationStateChanged); + + // Each line contains the target animated node and the animation time + // block. + let animationEl = createNode({ + parent: this.animationsEl, + nodeType: "li", + attributes: { + "class": "animation" + } + }); + + // Left sidebar for the animated node. + let animatedNodeEl = createNode({ + parent: animationEl, + attributes: { + "class": "target" + } + }); + + let timeBlockEl = createNode({ + parent: animationEl, + attributes: { + "class": "time-block" + } + }); + + this.drawTimeBlock(animation, timeBlockEl); + + // Draw the animated node target. + let targetNode = new AnimationTargetNode(this.inspector, {compact: true}); + targetNode.init(animatedNodeEl); + targetNode.render(animation); + + // Save the targetNode so it can be destroyed later. + this.targetNodes.push(targetNode); + } + }, + + onAnimationStateChanged: function() { + // For now, simply re-render the component. The animation front's state has + // already been updated. + this.render(this.animations); + }, + + drawHeaderAndBackground: function() { + let width = this.timeHeaderEl.offsetWidth; + let scale = width / (TimeScale.maxEndTime - TimeScale.minStartTime); + drawGraphElementBackground(this.win.document, "time-graduations", width, scale); + + // And the time graduation header. + this.timeHeaderEl.innerHTML = ""; + let interval = findOptimalTimeInterval(scale, TIME_GRADUATION_MIN_SPACING); + for (let i = 0; i < width; i += interval) { + createNode({ + parent: this.timeHeaderEl, + nodeType: "span", + attributes: { + "class": "time-tick", + "style": `left:${i}px` + }, + textContent: TimeScale.formatTime( + TimeScale.distanceToRelativeTime(i, width)) + }); + } + }, + + drawTimeBlock: function({state}, el) { + let width = el.offsetWidth; + + // Container for all iterations and delay. Positioned at the right start + // time. + let x = TimeScale.startTimeToDistance(state.startTime + (state.delay || 0), + width); + // With the right width (duration*duration). + let count = state.iterationCount || 1; + let w = TimeScale.durationToDistance(state.duration, width); + + let iterations = createNode({ + parent: el, + attributes: { + "class": "iterations" + (state.iterationCount ? "" : " infinite"), + // Individual iterations are represented by setting the size of the + // repeating linear-gradient. + "style": `left:${x}px; + width:${w * count}px; + background-size:${Math.max(w, 2)}px 100%;` + } + }); + + // The animation name is displayed over the iterations. + createNode({ + parent: iterations, + attributes: { + "class": "name" + }, + textContent: state.name + }); + + // Delay. + if (state.delay) { + let delay = TimeScale.durationToDistance(state.delay, width); + createNode({ + parent: iterations, + attributes: { + "class": "delay", + "style": `left:-${delay}px; + width:${delay}px;` + } + }); + } + } +}; diff --git a/browser/devtools/animationinspector/moz.build b/browser/devtools/animationinspector/moz.build index 4b1e70b7a076..b69b5c83d074 100644 --- a/browser/devtools/animationinspector/moz.build +++ b/browser/devtools/animationinspector/moz.build @@ -8,4 +8,5 @@ BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] EXTRA_JS_MODULES.devtools.animationinspector += [ 'components.js', + 'utils.js', ] diff --git a/browser/devtools/animationinspector/test/browser_animation_empty_on_invalid_nodes.js b/browser/devtools/animationinspector/test/browser_animation_empty_on_invalid_nodes.js index 926bf12844df..f8d9be8e510e 100644 --- a/browser/devtools/animationinspector/test/browser_animation_empty_on_invalid_nodes.js +++ b/browser/devtools/animationinspector/test/browser_animation_empty_on_invalid_nodes.js @@ -8,17 +8,44 @@ add_task(function*() { yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); - let {inspector, panel} = yield openAnimationInspector(); + let {inspector, panel} = yield openAnimationInspector(); + yield testEmptyPanel(inspector, panel); + + ({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI(); + yield testEmptyPanel(inspector, panel, true); +}); + +function* testEmptyPanel(inspector, panel, isNewUI=false) { info("Select node .still and check that the panel is empty"); let stillNode = yield getNodeFront(".still", inspector); + let onUpdated = panel.once(panel.UI_UPDATED_EVENT); yield selectNode(stillNode, inspector); - ok(!panel.playerWidgets || !panel.playerWidgets.length, - "No player widgets displayed for a still node"); + yield onUpdated; + + if (isNewUI) { + is(panel.animationsTimelineComponent.animations.length, 0, + "No animation players stored in the timeline component for a still node"); + is(panel.animationsTimelineComponent.animationsEl.childNodes.length, 0, + "No animation displayed in the timeline component for a still node"); + } else { + ok(!panel.playerWidgets || !panel.playerWidgets.length, + "No player widgets displayed for a still node"); + } info("Select the comment text node and check that the panel is empty"); let commentNode = yield inspector.walker.previousSibling(stillNode); + onUpdated = panel.once(panel.UI_UPDATED_EVENT); yield selectNode(commentNode, inspector); - ok(!panel.playerWidgets || !panel.playerWidgets.length, - "No player widgets displayed for a text node"); -}); + yield onUpdated; + + if (isNewUI) { + is(panel.animationsTimelineComponent.animations.length, 0, + "No animation players stored in the timeline component for a text node"); + is(panel.animationsTimelineComponent.animationsEl.childNodes.length, 0, + "No animation displayed in the timeline component for a text node"); + } else { + ok(!panel.playerWidgets || !panel.playerWidgets.length, + "No player widgets displayed for a text node"); + } +} diff --git a/browser/devtools/animationinspector/test/browser_animation_panel_exists.js b/browser/devtools/animationinspector/test/browser_animation_panel_exists.js index 9b8f2c2db2c1..ffd86c72c71e 100644 --- a/browser/devtools/animationinspector/test/browser_animation_panel_exists.js +++ b/browser/devtools/animationinspector/test/browser_animation_panel_exists.js @@ -15,4 +15,13 @@ add_task(function*() { ok(panel, "The animation panel exists"); ok(panel.playersEl, "The animation panel has been initialized"); + + ({panel, controller}) = yield closeAnimationInspectorAndRestartWithNewUI(); + + ok(controller, "The animation controller exists"); + ok(controller.animationsFront, "The animation controller has been initialized"); + + ok(panel, "The animation panel exists"); + ok(panel.playersEl, "The animation panel has been initialized"); + ok(panel.animationsTimelineComponent, "The animation panel has been initialized"); }); diff --git a/browser/devtools/animationinspector/test/browser_animation_participate_in_inspector_update.js b/browser/devtools/animationinspector/test/browser_animation_participate_in_inspector_update.js index c04c06102812..3297f88125ee 100644 --- a/browser/devtools/animationinspector/test/browser_animation_participate_in_inspector_update.js +++ b/browser/devtools/animationinspector/test/browser_animation_participate_in_inspector_update.js @@ -10,8 +10,15 @@ add_task(function*() { yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); - let {inspector, panel, controller} = yield openAnimationInspector(); + let ui = yield openAnimationInspector(); + yield testEventsOrder(ui); + + ui = yield closeAnimationInspectorAndRestartWithNewUI(); + yield testEventsOrder(ui); +}); + +function* testEventsOrder({inspector, panel, controller}) { info("Listen for the players-updated, ui-updated and inspector-updated events"); let receivedEvents = []; controller.once(controller.PLAYERS_UPDATED_EVENT, () => { @@ -19,7 +26,7 @@ add_task(function*() { }); panel.once(panel.UI_UPDATED_EVENT, () => { receivedEvents.push(panel.UI_UPDATED_EVENT); - }) + }); inspector.once("inspector-updated", () => { receivedEvents.push("inspector-updated"); }); @@ -36,4 +43,4 @@ add_task(function*() { "The second event received was the ui-updated event"); is(receivedEvents[2], "inspector-updated", "The third event received was the inspector-updated event"); -}); +} diff --git a/browser/devtools/animationinspector/test/browser_animation_playerWidgets_appear_on_panel_init.js b/browser/devtools/animationinspector/test/browser_animation_playerWidgets_appear_on_panel_init.js index 8bddf258d344..256c742c40dc 100644 --- a/browser/devtools/animationinspector/test/browser_animation_playerWidgets_appear_on_panel_init.js +++ b/browser/devtools/animationinspector/test/browser_animation_playerWidgets_appear_on_panel_init.js @@ -9,7 +9,14 @@ add_task(function*() { yield addTab(TEST_URL_ROOT + "doc_body_animation.html"); - let {panel} = yield openAnimationInspector(); - is(panel.playerWidgets.length, 1, "One animation player is displayed after init"); + let {panel} = yield openAnimationInspector(); + is(panel.playerWidgets.length, 1, + "One animation player is displayed after init"); + + ({panel}) = yield closeAnimationInspectorAndRestartWithNewUI(); + is(panel.animationsTimelineComponent.animations.length, 1, + "One animation is handled by the timeline after init"); + is(panel.animationsTimelineComponent.animationsEl.childNodes.length, 1, + "One animation is displayed after init"); }); diff --git a/browser/devtools/animationinspector/test/browser_animation_playerWidgets_target_nodes.js b/browser/devtools/animationinspector/test/browser_animation_playerWidgets_target_nodes.js index 36d2b54880b0..7480247180f0 100644 --- a/browser/devtools/animationinspector/test/browser_animation_playerWidgets_target_nodes.js +++ b/browser/devtools/animationinspector/test/browser_animation_playerWidgets_target_nodes.js @@ -27,5 +27,26 @@ add_task(function*() { "The target element's content is correct"); let selectorEl = targetEl.querySelector(".node-selector"); - ok(selectorEl, "The icon to select the target element in the inspector exists"); + ok(selectorEl, + "The icon to select the target element in the inspector exists"); + + info("Test again with the new timeline UI"); + ({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI(); + + info("Select the simple animated node"); + yield selectNode(".animated", inspector); + + let targetNodeComponent = panel.animationsTimelineComponent.targetNodes[0]; + // Make sure to wait for the target-retrieved event if the nodeFront hasn't + // yet been retrieved by the TargetNodeComponent. + if (!targetNodeComponent.nodeFront) { + yield targetNodeComponent.once("target-retrieved"); + } + + is(targetNodeComponent.el.textContent, "div#.ball.animated", + "The target element's content is correct"); + + selectorEl = targetNodeComponent.el.querySelector(".node-selector"); + ok(selectorEl, + "The icon to select the target element in the inspector exists"); }); diff --git a/browser/devtools/animationinspector/test/browser_animation_refresh_on_added_animation.js b/browser/devtools/animationinspector/test/browser_animation_refresh_on_added_animation.js index db2765227075..bca5e6f9e171 100644 --- a/browser/devtools/animationinspector/test/browser_animation_refresh_on_added_animation.js +++ b/browser/devtools/animationinspector/test/browser_animation_refresh_on_added_animation.js @@ -8,13 +8,19 @@ add_task(function*() { yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); - let {toolbox, inspector, panel} = yield openAnimationInspector(); + let {inspector, panel} = yield openAnimationInspector(); + yield testRefreshOnNewAnimation(inspector, panel); + + ({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI(); + yield testRefreshOnNewAnimation(inspector, panel); +}); + +function* testRefreshOnNewAnimation(inspector, panel) { info("Select a non animated node"); yield selectNode(".still", inspector); - is(panel.playersEl.querySelectorAll(".player-widget").length, 0, - "There are no player widgets in the panel"); + assertAnimationsDisplayed(panel, 0); info("Listen to the next UI update event"); let onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT); @@ -29,6 +35,14 @@ add_task(function*() { yield onPanelUpdated; ok(true, "The panel update event was fired"); - is(panel.playersEl.querySelectorAll(".player-widget").length, 1, - "There is one player widget in the panel"); -}); + assertAnimationsDisplayed(panel, 1); + + info("Remove the animation class on the node"); + onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT); + yield executeInContent("devtools:test:setAttribute", { + selector: ".ball.animated", + attributeName: "class", + attributeValue: "ball still" + }); + yield onPanelUpdated; +} diff --git a/browser/devtools/animationinspector/test/browser_animation_refresh_on_removed_animation.js b/browser/devtools/animationinspector/test/browser_animation_refresh_on_removed_animation.js index 868c0472fcba..49586206b7c2 100644 --- a/browser/devtools/animationinspector/test/browser_animation_refresh_on_removed_animation.js +++ b/browser/devtools/animationinspector/test/browser_animation_refresh_on_removed_animation.js @@ -8,13 +8,21 @@ add_task(function*() { yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); - let {toolbox, inspector, panel} = yield openAnimationInspector(); + let {inspector, panel} = yield openAnimationInspector(); + yield testRefreshOnRemove(inspector, panel); + yield testAddedAnimationWorks(inspector, panel); + + info("Reload and test again with the new UI"); + ({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI(true); + yield testRefreshOnRemove(inspector, panel, true); +}); + +function* testRefreshOnRemove(inspector, panel) { info("Select a animated node"); yield selectNode(".animated", inspector); - is(panel.playersEl.querySelectorAll(".player-widget").length, 1, - "There is one player widget in the panel"); + assertAnimationsDisplayed(panel, 1); info("Listen to the next UI update event"); let onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT); @@ -29,23 +37,24 @@ add_task(function*() { yield onPanelUpdated; ok(true, "The panel update event was fired"); - is(panel.playersEl.querySelectorAll(".player-widget").length, 0, - "There are no player widgets in the panel anymore"); + assertAnimationsDisplayed(panel, 0); info("Add an finite animation on the node again, and wait for it to appear"); onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT); yield executeInContent("devtools:test:setAttribute", { selector: ".test-node", attributeName: "class", - attributeValue: "ball short" + attributeValue: "ball short test-node" }); yield onPanelUpdated; - is(panel.playersEl.querySelectorAll(".player-widget").length, 1, - "There is one player widget in the panel again"); + assertAnimationsDisplayed(panel, 1); +} + +function* testAddedAnimationWorks(inspector, panel) { info("Now wait until the animation finishes"); let widget = panel.playerWidgets[0]; - yield waitForPlayState(widget.player, "finished") + yield waitForPlayState(widget.player, "finished"); is(panel.playersEl.querySelectorAll(".player-widget").length, 1, "There is still a player widget in the panel after the animation finished"); @@ -59,4 +68,4 @@ add_task(function*() { EventUtils.synthesizeMouseAtCenter(input, {type: "mousedown"}, win); yield onPaused; ok(widget.el.classList.contains("paused"), "The widget is in paused mode"); -}); +} diff --git a/browser/devtools/animationinspector/test/browser_animation_refresh_when_active.js b/browser/devtools/animationinspector/test/browser_animation_refresh_when_active.js index dd203b16df08..567f15f2482d 100644 --- a/browser/devtools/animationinspector/test/browser_animation_refresh_when_active.js +++ b/browser/devtools/animationinspector/test/browser_animation_refresh_when_active.js @@ -8,8 +8,15 @@ add_task(function*() { yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); - let {toolbox, inspector, panel} = yield openAnimationInspector(); + let {inspector, panel} = yield openAnimationInspector(); + yield testRefresh(inspector, panel); + + ({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI(); + yield testRefresh(inspector, panel); +}); + +function* testRefresh(inspector, panel) { info("Select a non animated node"); yield selectNode(".still", inspector); @@ -19,14 +26,14 @@ add_task(function*() { info("Select the animated node now"); yield selectNode(".animated", inspector); - ok(!panel.playerWidgets || !panel.playerWidgets.length, + assertAnimationsDisplayed(panel, 0, "The panel doesn't show the animation data while inactive"); info("Switch to the animation panel"); inspector.sidebar.select("animationinspector"); yield panel.once(panel.UI_UPDATED_EVENT); - is(panel.playerWidgets.length, 1, + assertAnimationsDisplayed(panel, 1, "The panel shows the animation data after selecting it"); info("Switch again to the rule-view"); @@ -35,13 +42,13 @@ add_task(function*() { info("Select the non animated node again"); yield selectNode(".still", inspector); - is(panel.playerWidgets.length, 1, + assertAnimationsDisplayed(panel, 1, "The panel still shows the previous animation data since it is inactive"); info("Switch to the animation panel again"); inspector.sidebar.select("animationinspector"); yield panel.once(panel.UI_UPDATED_EVENT); - ok(!panel.playerWidgets || !panel.playerWidgets.length, + assertAnimationsDisplayed(panel, 0, "The panel is now empty after refreshing"); -}); +} diff --git a/browser/devtools/animationinspector/test/browser_animation_same_nb_of_playerWidgets_and_playerFronts.js b/browser/devtools/animationinspector/test/browser_animation_same_nb_of_playerWidgets_and_playerFronts.js index 24a005796686..4a2453591901 100644 --- a/browser/devtools/animationinspector/test/browser_animation_same_nb_of_playerWidgets_and_playerFronts.js +++ b/browser/devtools/animationinspector/test/browser_animation_same_nb_of_playerWidgets_and_playerFronts.js @@ -22,4 +22,16 @@ add_task(function*() { is(widget.el.parentNode, panel.playersEl, "The player widget has been appended to the panel"); } + + info("Test again with the new UI, making sure the same number of " + + "animation timelines is created"); + ({inspector, panel, controller}) = yield closeAnimationInspectorAndRestartWithNewUI(); + let timeline = panel.animationsTimelineComponent; + + info("Selecting the test animated node again"); + yield selectNode(".multi", inspector); + + is(controller.animationPlayers.length, + timeline.animationsEl.querySelectorAll(".animation").length, + "As many timeline elements were created as there are playerFronts"); }); diff --git a/browser/devtools/animationinspector/test/browser_animation_shows_player_on_valid_node.js b/browser/devtools/animationinspector/test/browser_animation_shows_player_on_valid_node.js index 3227623d2e9e..f92a5a3857e4 100644 --- a/browser/devtools/animationinspector/test/browser_animation_shows_player_on_valid_node.js +++ b/browser/devtools/animationinspector/test/browser_animation_shows_player_on_valid_node.js @@ -9,12 +9,18 @@ add_task(function*() { yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); - let {inspector, panel} = yield openAnimationInspector(); + let {inspector, panel} = yield openAnimationInspector(); + yield testShowsAnimations(inspector, panel); + + ({inspector, panel}) = yield closeAnimationInspectorAndRestartWithNewUI(); + yield testShowsAnimations(inspector, panel); +}); + +function* testShowsAnimations(inspector, panel) { info("Select node .animated and check that the panel is not empty"); let node = yield getNodeFront(".animated", inspector); yield selectNode(node, inspector); - is(panel.playerWidgets.length, 1, - "Exactly 1 player widget is shown for animated node"); -}); + assertAnimationsDisplayed(panel, 1); +} diff --git a/browser/devtools/animationinspector/test/browser_animation_target_highlight_select.js b/browser/devtools/animationinspector/test/browser_animation_target_highlight_select.js index 9660ea612bd6..0759496b3855 100644 --- a/browser/devtools/animationinspector/test/browser_animation_target_highlight_select.js +++ b/browser/devtools/animationinspector/test/browser_animation_target_highlight_select.js @@ -9,14 +9,26 @@ add_task(function*() { yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); - let {toolbox, inspector, panel} = yield openAnimationInspector(); + let ui = yield openAnimationInspector(); + yield testTargetNode(ui); + + ui = yield closeAnimationInspectorAndRestartWithNewUI(); + yield testTargetNode(ui, true); +}); + +function* testTargetNode({toolbox, inspector, panel}, isNewUI) { info("Select the simple animated node"); yield selectNode(".animated", inspector); // Make sure to wait for the target-retrieved event if the nodeFront hasn't // yet been retrieved by the TargetNodeComponent. - let targetNodeComponent = panel.playerWidgets[0].targetNodeComponent; + let targetNodeComponent; + if (isNewUI) { + targetNodeComponent = panel.animationsTimelineComponent.targetNodes[0]; + } else { + targetNodeComponent = panel.playerWidgets[0].targetNodeComponent; + } if (!targetNodeComponent.nodeFront) { yield targetNodeComponent.once("target-retrieved"); } @@ -33,21 +45,29 @@ add_task(function*() { ok(true, "The node-highlight event was fired"); is(targetNodeComponent.nodeFront, nodeFront, "The highlighted node is the one stored on the animation widget"); - is(nodeFront.tagName, "DIV", "The highlighted node has the correct tagName"); - is(nodeFront.attributes[0].name, "class", "The highlighted node has the correct attributes"); - is(nodeFront.attributes[0].value, "ball animated", "The highlighted node has the correct class"); + is(nodeFront.tagName, "DIV", + "The highlighted node has the correct tagName"); + is(nodeFront.attributes[0].name, "class", + "The highlighted node has the correct attributes"); + is(nodeFront.attributes[0].value, "ball animated", + "The highlighted node has the correct class"); info("Select the body node in order to have the list of all animations"); yield selectNode("body", inspector); // Make sure to wait for the target-retrieved event if the nodeFront hasn't // yet been retrieved by the TargetNodeComponent. - targetNodeComponent = panel.playerWidgets[0].targetNodeComponent; + if (isNewUI) { + targetNodeComponent = panel.animationsTimelineComponent.targetNodes[0]; + } else { + targetNodeComponent = panel.playerWidgets[0].targetNodeComponent; + } if (!targetNodeComponent.nodeFront) { yield targetNodeComponent.once("target-retrieved"); } - info("Click on the first animation widget's selector icon and wait for the selection to change"); + info("Click on the first animation widget's selector icon and wait for the " + + "selection to change"); let onSelection = inspector.selection.once("new-node-front"); let onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT); let selectIconEl = targetNodeComponent.selectNodeEl; @@ -59,4 +79,4 @@ add_task(function*() { "The selected node is the one stored on the animation widget"); yield onPanelUpdated; -}); +} diff --git a/browser/devtools/animationinspector/test/browser_animation_toggle_button_toggles_animations.js b/browser/devtools/animationinspector/test/browser_animation_toggle_button_toggles_animations.js index 5707806bb9a3..d46afd7ebcac 100644 --- a/browser/devtools/animationinspector/test/browser_animation_toggle_button_toggles_animations.js +++ b/browser/devtools/animationinspector/test/browser_animation_toggle_button_toggles_animations.js @@ -11,7 +11,7 @@ add_task(function*() { yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); - let {inspector, panel} = yield openAnimationInspector(); + let {panel} = yield openAnimationInspector(); info("Click the toggle button"); yield panel.toggleAll(); diff --git a/browser/devtools/animationinspector/test/browser_animation_toolbar_exists.js b/browser/devtools/animationinspector/test/browser_animation_toolbar_exists.js index fa51cfbe41ff..9257f322258b 100644 --- a/browser/devtools/animationinspector/test/browser_animation_toolbar_exists.js +++ b/browser/devtools/animationinspector/test/browser_animation_toolbar_exists.js @@ -9,7 +9,7 @@ add_task(function*() { yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); - let {inspector, panel, window} = yield openAnimationInspector(); + let {inspector, window} = yield openAnimationInspector(); let doc = window.document; let toolbar = doc.querySelector("#toolbar"); diff --git a/browser/devtools/animationinspector/test/browser_animation_ui_updates_when_animation_data_changes.js b/browser/devtools/animationinspector/test/browser_animation_ui_updates_when_animation_data_changes.js index b6af2e4d737d..6e4bbb8dbe7d 100644 --- a/browser/devtools/animationinspector/test/browser_animation_ui_updates_when_animation_data_changes.js +++ b/browser/devtools/animationinspector/test/browser_animation_ui_updates_when_animation_data_changes.js @@ -9,36 +9,64 @@ add_task(function*() { yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); - let {panel, inspector} = yield openAnimationInspector(); + let ui = yield openAnimationInspector(); + yield testDataUpdates(ui); + + info("Close the toolbox, reload the tab, and try again with the new UI"); + ui = yield closeAnimationInspectorAndRestartWithNewUI(true); + yield testDataUpdates(ui, true); +}); + +function* testDataUpdates({panel, controller, inspector}, isNewUI=false) { info("Select the test node"); yield selectNode(".animated", inspector); - info("Get the player widget"); - let widget = panel.playerWidgets[0]; + let animation = controller.animationPlayers[0]; + yield setStyle(animation, "animationDuration", "5.5s", isNewUI); + yield setStyle(animation, "animationIterationCount", "300", isNewUI); + yield setStyle(animation, "animationDelay", "45s", isNewUI); - yield setStyle(widget, "animationDuration", "5.5s"); - is(widget.metaDataComponent.durationValue.textContent, "5.50s", - "The widget shows the new duration"); + if (isNewUI) { + let animationsEl = panel.animationsTimelineComponent.animationsEl; + let timeBlockEl = animationsEl.querySelector(".time-block"); - yield setStyle(widget, "animationIterationCount", "300"); - is(widget.metaDataComponent.iterationValue.textContent, "300", - "The widget shows the new iteration count"); + // 45s delay + (300 * 5.5)s duration + let expectedTotalDuration = 1695 * 1000; + let timeRatio = expectedTotalDuration / timeBlockEl.offsetWidth; - yield setStyle(widget, "animationDelay", "45s"); - is(widget.metaDataComponent.delayValue.textContent, "45s", - "The widget shows the new delay"); -}); + // XXX: the nb and size of each iteration cannot be tested easily (displayed + // using a linear-gradient background and capped at 2px wide). They should + // be tested in bug 1173761. + let delayWidth = parseFloat(timeBlockEl.querySelector(".delay").style.width); + is(Math.round(delayWidth * timeRatio), 45 * 1000, + "The timeline has the right delay"); + } else { + let widget = panel.playerWidgets[0]; + is(widget.metaDataComponent.durationValue.textContent, "5.50s", + "The widget shows the new duration"); + is(widget.metaDataComponent.iterationValue.textContent, "300", + "The widget shows the new iteration count"); + is(widget.metaDataComponent.delayValue.textContent, "45s", + "The widget shows the new delay"); + } +} -function* setStyle(widget, name, value) { +function* setStyle(animation, name, value, isNewUI=false) { info("Change the animation style via the content DOM. Setting " + name + " to " + value); + + let onAnimationChanged = once(animation, "changed"); yield executeInContent("devtools:test:setStyle", { selector: ".animated", propertyName: name, propertyValue: value }); + yield onAnimationChanged; - info("Wait for the next state update"); - yield onceNextPlayerRefresh(widget.player); + // If this is the playerWidget-based UI, wait for the auto-refresh event too + // to make sure the UI has updated. + if (!isNewUI) { + yield once(animation, animation.AUTO_REFRESH_EVENT); + } } diff --git a/browser/devtools/animationinspector/test/head.js b/browser/devtools/animationinspector/test/head.js index d8b39c959db3..fdc1c0e20d82 100644 --- a/browser/devtools/animationinspector/test/head.js +++ b/browser/devtools/animationinspector/test/head.js @@ -9,7 +9,7 @@ const {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {}); const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {}); const TargetFactory = devtools.TargetFactory; -const {console} = Components.utils.import("resource://gre/modules/devtools/Console.jsm", {}); +const {console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {}); const {ViewHelpers} = Cu.import("resource:///modules/devtools/ViewHelpers.jsm", {}); // All tests are asynchronous @@ -19,17 +19,20 @@ const TEST_URL_ROOT = "http://example.com/browser/browser/devtools/animationinsp const ROOT_TEST_DIR = getRootDirectory(gTestPath); const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "doc_frame_script.js"; const COMMON_FRAME_SCRIPT_URL = "chrome://browser/content/devtools/frame-script-utils.js"; +const NEW_UI_PREF = "devtools.inspector.animationInspectorV3"; // Auto clean-up when a test ends registerCleanupFunction(function*() { - let target = TargetFactory.forTab(gBrowser.selectedTab); - yield gDevTools.closeToolbox(target); + yield closeAnimationInspector(); while (gBrowser.tabs.length > 1) { gBrowser.removeCurrentTab(); } }); +// Make sure the new UI is off by default. +Services.prefs.setBoolPref(NEW_UI_PREF, false); + // Uncomment this pref to dump all devtools emitted events to the console. // Services.prefs.setBoolPref("devtools.dump.emit", true); @@ -45,6 +48,7 @@ registerCleanupFunction(() => gDevTools.testing = false); registerCleanupFunction(() => { Services.prefs.clearUserPref("devtools.dump.emit"); Services.prefs.clearUserPref("devtools.debugger.log"); + Services.prefs.clearUserPref(NEW_UI_PREF); }); /** @@ -77,6 +81,13 @@ function addTab(url) { return def.promise; } +/** + * Switch ON the new UI pref. + */ +function enableNewUI() { + Services.prefs.setBoolPref(NEW_UI_PREF, true); +} + /** * Reload the current tab location. */ @@ -119,6 +130,25 @@ let selectNode = Task.async(function*(data, inspector, reason="test") { yield updated; }); +/** + * Check if there are the expected number of animations being displayed in the + * panel right now. + * @param {AnimationsPanel} panel + * @param {Number} nbAnimations The expected number of animations. + * @param {String} msg An optional string to be used as the assertion message. + */ +function assertAnimationsDisplayed(panel, nbAnimations, msg="") { + let isNewUI = Services.prefs.getBoolPref(NEW_UI_PREF); + msg = msg || `There are ${nbAnimations} animations in the panel`; + if (isNewUI) { + is(panel.animationsTimelineComponent.animationsEl.childNodes.length, + nbAnimations, msg); + } else { + is(panel.playersEl.querySelectorAll(".player-widget").length, + nbAnimations, msg); + } +} + /** * Takes an Inspector panel that was just created, and waits * for a "inspector-updated" event as well as the animation inspector @@ -131,10 +161,9 @@ let waitForAnimationInspectorReady = Task.async(function*(inspector) { let win = inspector.sidebar.getWindowForTab("animationinspector"); let updated = inspector.once("inspector-updated"); - // In e10s, if we wait for underlying toolbox actors to - // load (by setting gDevTools.testing to true), we miss the "animationinspector-ready" - // event on the sidebar, so check to see if the iframe - // is already loaded. + // In e10s, if we wait for underlying toolbox actors to load (by setting + // gDevTools.testing to true), we miss the "animationinspector-ready" event on + // the sidebar, so check to see if the iframe is already loaded. let tabReady = win.document.readyState === "complete" ? promise.resolve() : inspector.sidebar.once("animationinspector-ready"); @@ -145,7 +174,7 @@ let waitForAnimationInspectorReady = Task.async(function*(inspector) { /** * Open the toolbox, with the inspector tool visible and the animationinspector * sidebar selected. - * @return a promise that resolves when the inspector is ready + * @return a promise that resolves when the inspector is ready. */ let openAnimationInspector = Task.async(function*() { let target = TargetFactory.forTab(gBrowser.selectedTab); @@ -185,6 +214,35 @@ let openAnimationInspector = Task.async(function*() { }; }); +/** + * Close the toolbox. + * @return a promise that resolves when the toolbox has closed. + */ +let closeAnimationInspector = Task.async(function*() { + let target = TargetFactory.forTab(gBrowser.selectedTab); + yield gDevTools.closeToolbox(target); +}); + +/** + * During the time period we migrate from the playerWidgets-based UI to the new + * AnimationTimeline UI, we'll want to run certain tests against both UI. + * This closes the toolbox, switch the new UI pref ON, and opens the toolbox + * again, with the animation inspector panel selected. + * @param {Boolean} reload Optionally reload the page after the toolbox was + * closed and before it is opened again. + * @return a promise that resolves when the animation inspector is ready. + */ +let closeAnimationInspectorAndRestartWithNewUI = Task.async(function*(reload) { + info("Close the toolbox and test again with the new UI"); + yield closeAnimationInspector(); + if (reload) { + yield reloadTab(); + } + enableNewUI(); + return yield openAnimationInspector(); +}); + + /** * Wait for the toolbox frame to receive focus after it loads * @param {Toolbox} toolbox @@ -214,7 +272,7 @@ function hasSideBarTab(inspector, id) { * @param {Object} target An observable object that either supports on/off or * addEventListener/removeEventListener * @param {String} eventName - * @param {Boolean} useCapture Optional, for addEventListener/removeEventListener + * @param {Boolean} useCapture Optional, for add/removeEventListener * @return A promise that resolves when the event has been handled */ function once(target, eventName, useCapture=false) { @@ -278,9 +336,9 @@ function executeInContent(name, data={}, objects={}, expectResponse=true) { mm.sendAsyncMessage(name, data, objects); if (expectResponse) { return waitForContentMessage(name); - } else { - return promise.resolve(); } + + return promise.resolve(); } function onceNextPlayerRefresh(player) { @@ -293,7 +351,9 @@ function onceNextPlayerRefresh(player) { * Simulate a click on the playPause button of a playerWidget. */ let togglePlayPauseButton = Task.async(function*(widget) { - let nextState = widget.player.state.playState === "running" ? "paused" : "running"; + let nextState = widget.player.state.playState === "running" + ? "paused" + : "running"; // Note that instead of simulating a real event here, the callback is just // called. This is better because the callback returns a promise, so we know @@ -344,7 +404,8 @@ let waitForStateCondition = Task.async(function*(player, conditionCheck, desc="" * provided string. * @param {AnimationPlayerFront} player * @param {String} playState The playState to expect. - * @return {Promise} Resolves when the playState has changed to the expected value. + * @return {Promise} Resolves when the playState has changed to the expected + * value. */ function waitForPlayState(player, playState) { return waitForStateCondition(player, state => { diff --git a/browser/devtools/animationinspector/utils.js b/browser/devtools/animationinspector/utils.js new file mode 100644 index 000000000000..137745a45aa6 --- /dev/null +++ b/browser/devtools/animationinspector/utils.js @@ -0,0 +1,135 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* 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"; + +// How many times, maximum, can we loop before we find the optimal time +// interval in the timeline graph. +const OPTIMAL_TIME_INTERVAL_MAX_ITERS = 100; +// Background time graduations should be multiple of this number of millis. +const TIME_INTERVAL_MULTIPLE = 10; +const TIME_INTERVAL_SCALES = 3; +// The default minimum spacing between time graduations in px. +const TIME_GRADUATION_MIN_SPACING = 10; +// RGB color for the time interval background. +const TIME_INTERVAL_COLOR = [128, 136, 144]; +const TIME_INTERVAL_OPACITY_MIN = 32; // byte +const TIME_INTERVAL_OPACITY_ADD = 32; // byte + +/** + * DOM node creation helper function. + * @param {Object} Options to customize the node to be created. + * - nodeType {String} Optional, defaults to "div", + * - attributes {Object} Optional attributes object like + * {attrName1:value1, attrName2: value2, ...} + * - parent {DOMNode} Mandatory node to append the newly created node to. + * - textContent {String} Optional text for the node. + * @return {DOMNode} The newly created node. + */ +function createNode(options) { + if (!options.parent) { + throw new Error("Missing parent DOMNode to create new node"); + } + + let type = options.nodeType || "div"; + let node = options.parent.ownerDocument.createElement(type); + + for (let name in options.attributes || {}) { + let value = options.attributes[name]; + node.setAttribute(name, value); + } + + if (options.textContent) { + node.textContent = options.textContent; + } + + options.parent.appendChild(node); + return node; +} + +exports.createNode = createNode; + +/** + * Given a data-scale, draw the background for a graph (vertical lines) into a + * canvas and set that canvas as an image-element with an ID that can be used + * from CSS. + * @param {Document} document The document where the image-element should be set. + * @param {String} id The ID for the image-element. + * @param {Number} graphWidth The width of the graph. + * @param {Number} timeScale How many px is 1ms in the graph. + */ +function drawGraphElementBackground(document, id, graphWidth, timeScale) { + let canvas = document.createElement("canvas"); + let ctx = canvas.getContext("2d"); + + // Set the canvas width (as requested) and height (1px, repeated along the Y + // axis). + canvas.width = graphWidth; + canvas.height = 1; + + // Create the image data array which will receive the pixels. + let imageData = ctx.createImageData(canvas.width, canvas.height); + let pixelArray = imageData.data; + + let buf = new ArrayBuffer(pixelArray.length); + let view8bit = new Uint8ClampedArray(buf); + let view32bit = new Uint32Array(buf); + + // Build new millisecond tick lines... + let [r, g, b] = TIME_INTERVAL_COLOR; + let alphaComponent = TIME_INTERVAL_OPACITY_MIN; + let interval = findOptimalTimeInterval(timeScale); + + // Insert one pixel for each division on each scale. + for (let i = 1; i <= TIME_INTERVAL_SCALES; i++) { + let increment = interval * Math.pow(2, i); + for (let x = 0; x < canvas.width; x += increment) { + let position = x | 0; + view32bit[position] = (alphaComponent << 24) | (b << 16) | (g << 8) | r; + } + alphaComponent += TIME_INTERVAL_OPACITY_ADD; + } + + // Flush the image data and cache the waterfall background. + pixelArray.set(view8bit); + ctx.putImageData(imageData, 0, 0); + document.mozSetImageElement(id, canvas); +} + +exports.drawGraphElementBackground = drawGraphElementBackground; + +/** + * Find the optimal interval between time graduations in the animation timeline + * graph based on a time scale and a minimum spacing. + * @param {Number} timeScale How many px is 1ms in the graph. + * @param {Number} minSpacing The minimum spacing between 2 graduations, + * defaults to TIME_GRADUATION_MIN_SPACING. + * @return {Number} The optional interval, in pixels. + */ +function findOptimalTimeInterval(timeScale, + minSpacing=TIME_GRADUATION_MIN_SPACING) { + let timingStep = TIME_INTERVAL_MULTIPLE; + let maxIters = OPTIMAL_TIME_INTERVAL_MAX_ITERS; + let numIters = 0; + + if (timeScale > minSpacing) { + return timeScale; + } + + while (true) { + let scaledStep = timeScale * timingStep; + if (++numIters > maxIters) { + return scaledStep; + } + if (scaledStep < minSpacing) { + timingStep *= 2; + continue; + } + return scaledStep; + } +} + +exports.findOptimalTimeInterval = findOptimalTimeInterval; diff --git a/browser/locales/en-US/chrome/browser/devtools/animationinspector.properties b/browser/locales/en-US/chrome/browser/devtools/animationinspector.properties index c878e6ac696c..6db75d2cbf2d 100644 --- a/browser/locales/en-US/chrome/browser/devtools/animationinspector.properties +++ b/browser/locales/en-US/chrome/browser/devtools/animationinspector.properties @@ -52,3 +52,9 @@ player.timeLabel=%Ss # drop-down list items that can be used to change the rate at which the # animation runs (1x being the default, 2x being twice as fast). player.playbackRateLabel=%Sx + +# LOCALIZATION NOTE (timeline.timeGraduationLabel): +# This string is displayed at the top of the animation panel, next to each time +# graduation, to indicate what duration (in milliseconds) this graduation +# corresponds to. +timeline.timeGraduationLabel=%Sms diff --git a/browser/themes/shared/devtools/animationinspector.css b/browser/themes/shared/devtools/animationinspector.css index 6cc0bdbdb17e..4764458f7dd3 100644 --- a/browser/themes/shared/devtools/animationinspector.css +++ b/browser/themes/shared/devtools/animationinspector.css @@ -1,3 +1,17 @@ +/* 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/. */ + +/* Animation-inspector specific theme variables */ + +.theme-dark { + --even-animation-timeline-background-color: rgba(255,255,255,0.03); +} + +.theme-light { + --even-animation-timeline-background-color: rgba(128,128,128,0.03); +} + html { height: 100%; } @@ -32,6 +46,13 @@ body { min-height: 20px; } +/* The main animations container */ + +#players { + height: calc(100% - 20px); + overflow: auto; +} + /* The error message, shown when an invalid/unanimated element is selected */ #error-message { @@ -44,12 +65,6 @@ body { display: none; } -/* The animation players container */ - -#players { - flex: 1; - overflow: auto; -} /* Element picker and toggle-all buttons */ @@ -99,6 +114,156 @@ body { } } +/* Animation timeline component */ + +.animation-timeline { + height: 100%; + overflow: hidden; + /* The timeline gets its background-image from a canvas element created in + /browser/devtools/animationinspector/utils.js drawGraphElementBackground + thanks to document.mozSetImageElement("time-graduations", canvas) + This is done so that the background can be built dynamically from script */ + background-image: -moz-element(#time-graduations); + background-repeat: repeat-y; + /* The animations are drawn 150px from the left edge so that animated nodes + can be displayed in a sidebar */ + background-position: 150px 0; + display: flex; + flex-direction: column; +} + +.animation-timeline .time-header { + margin-left: 150px; + height: 20px; + overflow: hidden; + position: relative; + border-bottom: 1px solid var(--theme-splitter-color); +} + +.animation-timeline .time-header .time-tick { + position: absolute; + top: 3px; +} + +.animation-timeline .animations { + width: 100%; + overflow-y: auto; + overflow-x: hidden; + margin: 0; + padding: 0; + list-style-type: none; +} + +/* Animation block widgets */ + +.animation-timeline .animation { + margin: 4px 0; + height: 20px; + position: relative; +} + +.animation-timeline .animation:nth-child(2n) { + background-color: var(--even-animation-timeline-background-color); +} + +.animation-timeline .animation .target { + width: 150px; + overflow: hidden; + height: 100%; +} + +.animation-timeline .animation-target { + background-color: transparent; +} + +.animation-timeline .animation .time-block { + position: absolute; + top: 0; + left: 150px; + right: 0; + height: 100%; +} + +/* Animation iterations */ + +.animation-timeline .animation .iterations { + position: relative; + height: 100%; + border: 1px solid var(--theme-highlight-lightorange); + box-sizing: border-box; + background: var(--theme-contrast-background); + /* Iterations are displayed with a repeating linear-gradient which size is + dynamically changed from JS */ + background-image: + linear-gradient(to right, + var(--theme-highlight-lightorange) 0, + var(--theme-highlight-lightorange) 1px, + transparent 1px, + transparent 2px); + background-repeat: repeat-x; + background-position: -1px 0; +} + +.animation-timeline .animation .iterations.infinite { + border-right-width: 0; +} + +.animation-timeline .animation .iterations.infinite::before, +.animation-timeline .animation .iterations.infinite::after { + content: ""; + position: absolute; + top: 0; + right: 0; + width: 0; + height: 0; + border-right: 4px solid var(--theme-body-background); + border-top: 4px solid transparent; + border-bottom: 4px solid transparent; +} + +.animation-timeline .animation .iterations.infinite::after { + bottom: 0; + top: unset; +} + +.animation-timeline .animation .animation-title { + height: 1.5em; + width: 100%; + box-sizing: border-box; + overflow: hidden; +} + +.animation-timeline .animation .delay { + position: absolute; + top: 0; + height: 100%; + background-image: linear-gradient(to bottom, + transparent, + transparent 9px, + var(--theme-highlight-lightorange) 9px, + var(--theme-highlight-lightorange) 11px, + transparent 11px, + transparent); +} + +.animation-timeline .animation .delay::before { + position: absolute; + content: ""; + left: 0; + width: 2px; + height: 8px; + top: 50%; + margin-top: -4px; + background: var(--theme-highlight-lightorange); +} + +.animation-timeline .animation .name { + position: absolute; + z-index: 1; + padding: 2px; + white-space: nowrap; +} + /* Animation target node gutter, contains a preview of the dom node */ .animation-target { @@ -253,4 +418,4 @@ body { width: 50px; border-left: 1px solid var(--theme-splitter-color); background: var(--theme-toolbar-background); -} +} \ No newline at end of file diff --git a/toolkit/devtools/server/actors/animation.js b/toolkit/devtools/server/actors/animation.js index 121df2e46607..71b16ca323be 100644 --- a/toolkit/devtools/server/actors/animation.js +++ b/toolkit/devtools/server/actors/animation.js @@ -5,7 +5,8 @@ "use strict"; /** - * Set of actors that expose the Web Animations API to devtools protocol clients. + * Set of actors that expose the Web Animations API to devtools protocol + * clients. * * The |Animations| actor is the main entry point. It is used to discover * animation players on given nodes. @@ -29,11 +30,15 @@ const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {}); const {Task} = Cu.import("resource://gre/modules/Task.jsm", {}); const {setInterval, clearInterval} = require("sdk/timers"); const protocol = require("devtools/server/protocol"); -const {ActorClass, Actor, FrontClass, Front, Arg, method, RetVal, types} = protocol; +const {ActorClass, Actor, FrontClass, Front, + Arg, method, RetVal, types} = protocol; +// Make sure the nodeActor type is know here. const {NodeActor} = require("devtools/server/actors/inspector"); const events = require("sdk/event/core"); -const PLAYER_DEFAULT_AUTO_REFRESH_TIMEOUT = 500; // ms +// How long (in ms) should we wait before polling again the state of an +// animationPlayer. +const PLAYER_DEFAULT_AUTO_REFRESH_TIMEOUT = 500; /** * The AnimationPlayerActor provides information about a given animation: its @@ -47,6 +52,13 @@ const PLAYER_DEFAULT_AUTO_REFRESH_TIMEOUT = 500; // ms let AnimationPlayerActor = ActorClass({ typeName: "animationplayer", + events: { + "changed": { + type: "changed", + state: Arg(0, "json") + } + }, + /** * @param {AnimationsActor} The main AnimationsActor instance * @param {AnimationPlayer} The player object returned by getAnimationPlayers @@ -58,14 +70,29 @@ let AnimationPlayerActor = ActorClass({ initialize: function(animationsActor, player, playerIndex) { Actor.prototype.initialize.call(this, animationsActor.conn); + this.onAnimationMutation = this.onAnimationMutation.bind(this); + + this.tabActor = animationsActor.tabActor; this.player = player; this.node = player.effect.target; this.playerIndex = playerIndex; - this.styles = this.node.ownerDocument.defaultView.getComputedStyle(this.node); + + let win = this.node.ownerDocument.defaultView; + this.styles = win.getComputedStyle(this.node); + + // Listen to animation mutations on the node to alert the front when the + // current animation changes. + this.observer = new win.MutationObserver(this.onAnimationMutation); + this.observer.observe(this.node, {animations: true}); }, destroy: function() { - this.player = this.node = this.styles = null; + // Only try to disconnect the observer if it's not already dead (i.e. if the + // container view hasn't navigated since). + if (this.observer && !Cu.isDeadWrapper(this.observer)) { + this.observer.disconnect(); + } + this.tabActor = this.player = this.node = this.styles = this.observer = null; Actor.prototype.destroy.call(this); }, @@ -95,14 +122,14 @@ let AnimationPlayerActor = ActorClass({ */ getPlayerIndex: function() { let names = this.styles.animationName; + if (names === "none") { + names = this.styles.transitionProperty; + } - // If no names are found, then it's probably a transition, in which case we - // can't find the actual index, so just trust the playerIndex passed by - // the AnimationsActor at initialization time. - // Note that this may be incorrect if by the time the AnimationPlayerActor - // is initialized, one of the transitions has ended, but it's the best we - // can do for now. - if (!names) { + // If we still don't have a name, let's fall back to the provided index + // which may, by now, be wrong, but it's the best we can do until the waapi + // gives us a way to get duration, delay, ... directly. + if (!names || names === "none") { return this.playerIndex; } @@ -114,7 +141,7 @@ let AnimationPlayerActor = ActorClass({ // If there are several names, retrieve the index of the animation name in // the list. names = names.split(",").map(n => n.trim()); - for (let i = 0; i < names.length; i ++) { + for (let i = 0; i < names.length; i++) { if (names[i] === this.player.effect.name) { return i; } @@ -244,6 +271,27 @@ let AnimationPlayerActor = ActorClass({ } }), + /** + * Executed when the current animation changes, used to emit the new state + * the the front. + */ + onAnimationMutation: function(mutations) { + let hasChanged = false; + for (let {changedAnimations} of mutations) { + if (!changedAnimations.length) { + return; + } + if (changedAnimations.some(animation => animation === this.player)) { + hasChanged = true; + break; + } + } + + if (hasChanged) { + events.emit(this, "changed", this.getCurrentState()); + } + }, + /** * Pause the player. */ @@ -348,9 +396,18 @@ let AnimationPlayerFront = FrontClass(AnimationPlayerActor, { delay: this._form.delay, iterationCount: this._form.iterationCount, isRunningOnCompositor: this._form.isRunningOnCompositor - } + }; }, + /** + * Executed when the AnimationPlayerActor emits a "changed" event. Used to + * update the local knowledge of the state. + */ + onChanged: protocol.preEvent("changed", function(partialState) { + let {state} = this.reconstructState(partialState); + this.state = state; + }), + // About auto-refresh: // // The AnimationPlayerFront is capable of automatically refreshing its state @@ -416,19 +473,28 @@ let AnimationPlayerFront = FrontClass(AnimationPlayerActor, { */ getCurrentState: protocol.custom(function() { this.currentStateHasChanged = false; - return this._getCurrentState().then(data => { - for (let key in this.state) { - if (typeof data[key] === "undefined") { - data[key] = this.state[key]; - } else if (data[key] !== this.state[key]) { - this.currentStateHasChanged = true; - } - } - return data; + return this._getCurrentState().then(partialData => { + let {state, hasChanged} = this.reconstructState(partialData); + this.currentStateHasChanged = hasChanged; + return state; }); }, { impl: "_getCurrentState" }), + + reconstructState: function(data) { + let hasChanged = false; + + for (let key in this.state) { + if (typeof data[key] === "undefined") { + data[key] = this.state[key]; + } else if (data[key] !== this.state[key]) { + hasChanged = true; + } + } + + return {state: data, hasChanged}; + } }); /** @@ -449,7 +515,7 @@ let AnimationsActor = exports.AnimationsActor = ActorClass({ typeName: "animations", events: { - "mutations" : { + "mutations": { type: "mutations", changes: Arg(0, "array:animationMutationChange") } @@ -500,7 +566,7 @@ let AnimationsActor = exports.AnimationsActor = ActorClass({ // No care is taken here to destroy the previously stored actors because it // is assumed that the client is responsible for lifetimes of actors. this.actors = []; - for (let i = 0; i < animations.length; i ++) { + for (let i = 0; i < animations.length; i++) { // XXX: for now the index is passed along as the AnimationPlayerActor uses // it to retrieve animation information from CSS. let actor = AnimationPlayerActor(this, animations[i], i); @@ -532,7 +598,7 @@ let AnimationsActor = exports.AnimationsActor = ActorClass({ onAnimationMutation: function(mutations) { let eventData = []; - for (let {addedAnimations, changedAnimations, removedAnimations} of mutations) { + for (let {addedAnimations, removedAnimations} of mutations) { for (let player of removedAnimations) { // Note that animations are reported as removed either when they are // actually removed from the node (e.g. css class removed) or when they @@ -588,9 +654,9 @@ let AnimationsActor = exports.AnimationsActor = ActorClass({ }, /** - * After the client has called getAnimationPlayersForNode for a given DOM node, - * the actor starts sending animation mutations for this node. If the client - * doesn't want this to happen anymore, it should call this method. + * After the client has called getAnimationPlayersForNode for a given DOM + * node, the actor starts sending animation mutations for this node. If the + * client doesn't want this to happen anymore, it should call this method. */ stopAnimationPlayerUpdates: method(function() { if (this.observer && !Cu.isDeadWrapper(this.observer)) { @@ -666,7 +732,7 @@ let AnimationsActor = exports.AnimationsActor = ActorClass({ /** * Play all animations in the current tabActor's frames. - * This method only returns when the animations have left their pending states. + * This method only returns when animations have left their pending states. */ playAll: method(function() { let readyPromises = []; @@ -687,9 +753,8 @@ let AnimationsActor = exports.AnimationsActor = ActorClass({ toggleAll: method(function() { if (this.allAnimationsPaused) { return this.playAll(); - } else { - return this.pauseAll(); } + return this.pauseAll(); }, { request: {}, response: {} From 66995680f39091b3506c69f7da518ed484814ba1 Mon Sep 17 00:00:00 2001 From: Patrick Brosset Date: Mon, 15 Jun 2015 12:03:54 +0200 Subject: [PATCH 09/59] Bug 1155663 - More tests for the timeline-based animation inspector UI; r=bgrins --HG-- rename : browser/devtools/animationinspector/test/browser_animation_timeline_waits_for_delay.js => browser/devtools/animationinspector/test/browser_animation_playerWidgets_scrubber_delayed.js rename : browser/devtools/animationinspector/test/browser_animation_timeline_is_enabled.js => browser/devtools/animationinspector/test/browser_animation_playerWidgets_scrubber_enabled.js rename : browser/devtools/animationinspector/test/browser_animation_timeline_animates.js => browser/devtools/animationinspector/test/browser_animation_playerWidgets_scrubber_moves.js extra : rebase_source : 0dc84ca300bc1180998defd99664ae2ef29032fb --- .../devtools/animationinspector/components.js | 3 + browser/devtools/animationinspector/moz.build | 1 + .../animationinspector/test/browser.ini | 11 +- ...imation_playerWidgets_scrubber_delayed.js} | 0 ...imation_playerWidgets_scrubber_enabled.js} | 0 ...animation_playerWidgets_scrubber_moves.js} | 0 ...r_animation_timeline_displays_with_pref.js | 24 +++ .../test/browser_animation_timeline_header.js | 47 +++++ .../browser_animation_timeline_shows_delay.js | 30 +++ ...ser_animation_timeline_shows_iterations.js | 51 +++++ .../test/browser_animation_timeline_ui.js | 41 ++++ .../devtools/animationinspector/test/head.js | 11 + .../animationinspector/test/unit/.eslintrc | 4 + .../test/unit/test_findOptimalTimeInterval.js | 85 ++++++++ .../test/unit/test_timeScale.js | 191 ++++++++++++++++++ .../animationinspector/test/unit/xpcshell.ini | 9 + browser/devtools/animationinspector/utils.js | 5 +- 17 files changed, 507 insertions(+), 6 deletions(-) rename browser/devtools/animationinspector/test/{browser_animation_timeline_waits_for_delay.js => browser_animation_playerWidgets_scrubber_delayed.js} (100%) rename browser/devtools/animationinspector/test/{browser_animation_timeline_is_enabled.js => browser_animation_playerWidgets_scrubber_enabled.js} (100%) rename browser/devtools/animationinspector/test/{browser_animation_timeline_animates.js => browser_animation_playerWidgets_scrubber_moves.js} (100%) create mode 100644 browser/devtools/animationinspector/test/browser_animation_timeline_displays_with_pref.js create mode 100644 browser/devtools/animationinspector/test/browser_animation_timeline_header.js create mode 100644 browser/devtools/animationinspector/test/browser_animation_timeline_shows_delay.js create mode 100644 browser/devtools/animationinspector/test/browser_animation_timeline_shows_iterations.js create mode 100644 browser/devtools/animationinspector/test/browser_animation_timeline_ui.js create mode 100644 browser/devtools/animationinspector/test/unit/.eslintrc create mode 100644 browser/devtools/animationinspector/test/unit/test_findOptimalTimeInterval.js create mode 100644 browser/devtools/animationinspector/test/unit/test_timeScale.js create mode 100644 browser/devtools/animationinspector/test/unit/xpcshell.ini diff --git a/browser/devtools/animationinspector/components.js b/browser/devtools/animationinspector/components.js index f2c155a6744e..048c65f06e8a 100644 --- a/browser/devtools/animationinspector/components.js +++ b/browser/devtools/animationinspector/components.js @@ -22,6 +22,7 @@ const {Cu} = require("chrome"); Cu.import("resource:///modules/devtools/ViewHelpers.jsm"); +const {Task} = Cu.import("resource://gre/modules/Task.jsm", {}); const { createNode, drawGraphElementBackground, @@ -619,6 +620,8 @@ let TimeScale = { } }; +exports.TimeScale = TimeScale; + /** * UI component responsible for displaying a timeline for animations. * The timeline is essentially a graph with time along the x axis and animations diff --git a/browser/devtools/animationinspector/moz.build b/browser/devtools/animationinspector/moz.build index b69b5c83d074..d22e8eb60ce3 100644 --- a/browser/devtools/animationinspector/moz.build +++ b/browser/devtools/animationinspector/moz.build @@ -5,6 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] EXTRA_JS_MODULES.devtools.animationinspector += [ 'components.js', diff --git a/browser/devtools/animationinspector/test/browser.ini b/browser/devtools/animationinspector/test/browser.ini index 0d83896b0ec4..3dc870489274 100644 --- a/browser/devtools/animationinspector/test/browser.ini +++ b/browser/devtools/animationinspector/test/browser.ini @@ -19,6 +19,9 @@ support-files = [browser_animation_playerWidgets_dont_show_time_after_duration.js] [browser_animation_playerWidgets_have_control_buttons.js] [browser_animation_playerWidgets_meta_data.js] +[browser_animation_playerWidgets_scrubber_delayed.js] +[browser_animation_playerWidgets_scrubber_enabled.js] +[browser_animation_playerWidgets_scrubber_moves.js] [browser_animation_playerWidgets_state_after_pause.js] [browser_animation_playerWidgets_target_nodes.js] [browser_animation_rate_select_shows_presets.js] @@ -30,9 +33,11 @@ support-files = [browser_animation_setting_playbackRate_works.js] [browser_animation_shows_player_on_valid_node.js] [browser_animation_target_highlight_select.js] -[browser_animation_timeline_animates.js] -[browser_animation_timeline_is_enabled.js] -[browser_animation_timeline_waits_for_delay.js] +[browser_animation_timeline_displays_with_pref.js] +[browser_animation_timeline_header.js] +[browser_animation_timeline_shows_delay.js] +[browser_animation_timeline_shows_iterations.js] +[browser_animation_timeline_ui.js] [browser_animation_toggle_button_resets_on_navigate.js] [browser_animation_toggle_button_toggles_animations.js] [browser_animation_toggle_button_updates_playerWidgets.js] diff --git a/browser/devtools/animationinspector/test/browser_animation_timeline_waits_for_delay.js b/browser/devtools/animationinspector/test/browser_animation_playerWidgets_scrubber_delayed.js similarity index 100% rename from browser/devtools/animationinspector/test/browser_animation_timeline_waits_for_delay.js rename to browser/devtools/animationinspector/test/browser_animation_playerWidgets_scrubber_delayed.js diff --git a/browser/devtools/animationinspector/test/browser_animation_timeline_is_enabled.js b/browser/devtools/animationinspector/test/browser_animation_playerWidgets_scrubber_enabled.js similarity index 100% rename from browser/devtools/animationinspector/test/browser_animation_timeline_is_enabled.js rename to browser/devtools/animationinspector/test/browser_animation_playerWidgets_scrubber_enabled.js diff --git a/browser/devtools/animationinspector/test/browser_animation_timeline_animates.js b/browser/devtools/animationinspector/test/browser_animation_playerWidgets_scrubber_moves.js similarity index 100% rename from browser/devtools/animationinspector/test/browser_animation_timeline_animates.js rename to browser/devtools/animationinspector/test/browser_animation_playerWidgets_scrubber_moves.js diff --git a/browser/devtools/animationinspector/test/browser_animation_timeline_displays_with_pref.js b/browser/devtools/animationinspector/test/browser_animation_timeline_displays_with_pref.js new file mode 100644 index 000000000000..673e8e7a4e22 --- /dev/null +++ b/browser/devtools/animationinspector/test/browser_animation_timeline_displays_with_pref.js @@ -0,0 +1,24 @@ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Check that the timeline-based UI is displayed instead of the playerwidget- +// based UI when the "devtools.inspector.animationInspectorV3" is set. + +add_task(function*() { + yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); + let {inspector, panel} = yield openAnimationInspectorNewUI(); + + info("Selecting the test node"); + yield selectNode(".animated", inspector); + + let timeline = panel.animationsTimelineComponent; + + ok(timeline, "The timeline components was created"); + is(timeline.rootWrapperEl.parentNode, panel.playersEl, + "The timeline component was appended in the DOM"); + is(panel.playersEl.querySelectorAll(".player-widget").length, 0, + "There are no playerWidgets in the DOM"); +}); diff --git a/browser/devtools/animationinspector/test/browser_animation_timeline_header.js b/browser/devtools/animationinspector/test/browser_animation_timeline_header.js new file mode 100644 index 000000000000..8277440b2777 --- /dev/null +++ b/browser/devtools/animationinspector/test/browser_animation_timeline_header.js @@ -0,0 +1,47 @@ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Check that the timeline-based UI shows correct time graduations in the +// header. + +const {findOptimalTimeInterval} = require("devtools/animationinspector/utils"); +const {TimeScale} = require("devtools/animationinspector/components"); +// Should be kept in sync with TIME_GRADUATION_MIN_SPACING in components.js +const TIME_GRADUATION_MIN_SPACING = 40; + +add_task(function*() { + yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); + let {panel} = yield openAnimationInspectorNewUI(); + + let timeline = panel.animationsTimelineComponent; + let headerEl = timeline.timeHeaderEl; + + info("Find out how many time graduations should there be"); + let width = headerEl.offsetWidth; + let scale = width / (TimeScale.maxEndTime - TimeScale.minStartTime); + // Note that findOptimalTimeInterval is tested separately in xpcshell test + // test_findOptimalTimeInterval.js, so we assume that it works here. + let interval = findOptimalTimeInterval(scale, TIME_GRADUATION_MIN_SPACING); + let nb = Math.ceil(width / interval); + + is(headerEl.querySelectorAll(".time-tick").length, nb, + "The expected number of time ticks were found"); + + info("Make sure graduations are evenly distributed and show the right times"); + [...headerEl.querySelectorAll(".time-tick")].forEach((tick, i) => { + let left = parseFloat(tick.style.left); + is(Math.round(left), Math.round(i * interval), + "Graduation " + i + " is positioned correctly"); + + // Note that the distancetoRelativeTime and formatTime functions are tested + // separately in xpcshell test test_timeScale.js, so we assume that they + // work here. + let formattedTime = TimeScale.formatTime( + TimeScale.distanceToRelativeTime(i * interval, width)); + is(tick.textContent, formattedTime, + "Graduation " + i + " has the right text content"); + }); +}); diff --git a/browser/devtools/animationinspector/test/browser_animation_timeline_shows_delay.js b/browser/devtools/animationinspector/test/browser_animation_timeline_shows_delay.js new file mode 100644 index 000000000000..51d0a882c0d4 --- /dev/null +++ b/browser/devtools/animationinspector/test/browser_animation_timeline_shows_delay.js @@ -0,0 +1,30 @@ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Check that animation delay is visualized in the timeline-based UI when the +// animation is delayed. + +add_task(function*() { + yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); + let {inspector, panel} = yield openAnimationInspectorNewUI(); + + info("Selecting a delayed animated node"); + yield selectNode(".delayed", inspector); + + info("Getting the animation and delay elements from the panel"); + let timelineEl = panel.animationsTimelineComponent.rootWrapperEl; + let delay = timelineEl.querySelector(".delay"); + + ok(delay, "The animation timeline contains the delay element"); + + info("Selecting a no-delay animated node"); + yield selectNode(".animated", inspector); + + info("Getting the animation and delay elements from the panel again"); + delay = timelineEl.querySelector(".delay"); + + ok(!delay, "The animation timeline contains no delay element"); +}); diff --git a/browser/devtools/animationinspector/test/browser_animation_timeline_shows_iterations.js b/browser/devtools/animationinspector/test/browser_animation_timeline_shows_iterations.js new file mode 100644 index 000000000000..0b47bb808dda --- /dev/null +++ b/browser/devtools/animationinspector/test/browser_animation_timeline_shows_iterations.js @@ -0,0 +1,51 @@ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Check that the timeline-based UI is displays as many iteration elements as +// there are iterations in an animation. + +add_task(function*() { + yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); + let {inspector, panel} = yield openAnimationInspectorNewUI(); + + info("Selecting the test node"); + yield selectNode(".delayed", inspector); + + info("Getting the animation element from the panel"); + let timelineEl = panel.animationsTimelineComponent.rootWrapperEl; + let animation = timelineEl.querySelector(".time-block"); + let iterations = animation.querySelector(".iterations"); + + // Iterations are rendered with a repeating linear-gradient, so we need to + // calculate how many iterations are represented by looking at the background + // size. + let iterationCount = getIterationCountFromBackground(iterations); + + is(iterationCount, 10, + "The animation timeline contains the right number of iterations"); + ok(!iterations.classList.contains("infinite"), + "The iteration element doesn't have the infinite class"); + + info("Selecting another test node with an infinite animation"); + yield selectNode(".animated", inspector); + + info("Getting the animation element from the panel again"); + animation = timelineEl.querySelector(".time-block"); + iterations = animation.querySelector(".iterations"); + + iterationCount = getIterationCountFromBackground(iterations); + + is(iterationCount, 1, + "The animation timeline contains just one iteration"); + ok(iterations.classList.contains("infinite"), + "The iteration element has the infinite class"); +}); + +function getIterationCountFromBackground(el) { + let backgroundSize = parseFloat(el.style.backgroundSize.split(" ")[0]); + let width = el.offsetWidth; + return Math.round(width / backgroundSize); +} diff --git a/browser/devtools/animationinspector/test/browser_animation_timeline_ui.js b/browser/devtools/animationinspector/test/browser_animation_timeline_ui.js new file mode 100644 index 000000000000..fb3be2e5a69c --- /dev/null +++ b/browser/devtools/animationinspector/test/browser_animation_timeline_ui.js @@ -0,0 +1,41 @@ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Check that the timeline-based UI contains the right elements. + +add_task(function*() { + yield addTab(TEST_URL_ROOT + "doc_simple_animation.html"); + let {panel} = yield openAnimationInspectorNewUI(); + + let timeline = panel.animationsTimelineComponent; + let el = timeline.rootWrapperEl; + + ok(el.querySelector(".time-header"), + "The header element is in the DOM of the timeline"); + ok(el.querySelectorAll(".time-header .time-tick").length, + "The header has some time graduations"); + + ok(el.querySelector(".animations"), + "The animations container is in the DOM of the timeline"); + is(el.querySelectorAll(".animations .animation").length, + timeline.animations.length, + "The number of animations displayed matches the number of animations"); + + for (let i = 0; i < timeline.animations.length; i++) { + let animation = timeline.animations[i]; + let animationEl = el.querySelectorAll(".animations .animation")[i]; + + ok(animationEl.querySelector(".target"), + "The animated node target element is in the DOM"); + ok(animationEl.querySelector(".time-block"), + "The timeline element is in the DOM"); + is(animationEl.querySelector(".name").textContent, + animation.state.name, + "The name on the timeline is correct"); + ok(animationEl.querySelector(".iterations"), + "The timeline has iterations displayed"); + } +}); diff --git a/browser/devtools/animationinspector/test/head.js b/browser/devtools/animationinspector/test/head.js index fdc1c0e20d82..19dc8dbfcdd4 100644 --- a/browser/devtools/animationinspector/test/head.js +++ b/browser/devtools/animationinspector/test/head.js @@ -7,6 +7,7 @@ const Cu = Components.utils; const {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {}); const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); +const {require} = devtools; const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {}); const TargetFactory = devtools.TargetFactory; const {console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {}); @@ -214,6 +215,16 @@ let openAnimationInspector = Task.async(function*() { }; }); +/** + * Turn on the new timeline-based UI pref ON, and then open the toolbox, with + * the inspector tool visible and the animationinspector sidebar selected. + * @return a promise that resolves when the inspector is ready. + */ +function openAnimationInspectorNewUI() { + enableNewUI(); + return openAnimationInspector(); +} + /** * Close the toolbox. * @return a promise that resolves when the toolbox has closed. diff --git a/browser/devtools/animationinspector/test/unit/.eslintrc b/browser/devtools/animationinspector/test/unit/.eslintrc new file mode 100644 index 000000000000..44135af644ce --- /dev/null +++ b/browser/devtools/animationinspector/test/unit/.eslintrc @@ -0,0 +1,4 @@ +{ + // Extend from the common devtools xpcshell eslintrc config. + "extends": "../../../.eslintrc.xpcshell" +} \ No newline at end of file diff --git a/browser/devtools/animationinspector/test/unit/test_findOptimalTimeInterval.js b/browser/devtools/animationinspector/test/unit/test_findOptimalTimeInterval.js new file mode 100644 index 000000000000..7373eccc898a --- /dev/null +++ b/browser/devtools/animationinspector/test/unit/test_findOptimalTimeInterval.js @@ -0,0 +1,85 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint no-eval:0 */ + +"use strict"; + +const Cu = Components.utils; +const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); +const {require} = devtools; + +const {findOptimalTimeInterval} = require("devtools/animationinspector/utils"); + +// This test array contains objects that are used to test the +// findOptimalTimeInterval function. Each object should have the following +// properties: +// - desc: an optional string that will be printed out +// - timeScale: a number that represents how many pixels is 1ms +// - minSpacing: an optional number that represents the minim space between 2 +// time graduations +// - expectedInterval: a number that you expect the findOptimalTimeInterval +// function to return as a result. +// Optionally you can pass a string where `interval` is the calculated +// interval, this string will be eval'd and tested to be truthy. +const TEST_DATA = [{ + desc: "With 1px being 1ms and no minSpacing, expect the interval to be the " + + "default min spacing", + timeScale: 1, + minSpacing: undefined, + expectedInterval: 10 +}, { + desc: "With 1px being 1ms and a custom minSpacing being a multiple of 10 " + + "expect the interval to be the custom min spacing", + timeScale: 1, + minSpacing: 40, + expectedInterval: 40 +}, { + desc: "With 1px being 1ms and a custom minSpacing not being multiple of 10 " + + "expect the interval to be the next multiple of 10", + timeScale: 1, + minSpacing: 13, + expectedInterval: 20 +}, { + desc: "If 1ms corresponds to a distance that is greater than the min " + + "spacing then, expect the interval to be this distance", + timeScale: 20, + minSpacing: undefined, + expectedInterval: 20 +}, { + desc: "If 1ms corresponds to a distance that is greater than the min " + + "spacing then, expect the interval to be this distance, even if it " + + "isn't a multiple of 10", + timeScale: 33, + minSpacing: undefined, + expectedInterval: 33 +}, { + desc: "If 1ms is a very small distance, then expect this distance to be " + + "multiplied by 10, 20, 40, 80, etc... until it goes over the min " + + "spacing", + timeScale: 0.001, + minSpacing: undefined, + expectedInterval: 10.24 +}, { + desc: "If the time scale is such that we need to iterate more than the " + + "maximum allowed number of iterations, then expect an interval lower " + + "than the minimum one", + timeScale: 1e-31, + minSpacing: undefined, + expectedInterval: "interval < 10" +}]; + +function run_test() { + for (let {timeScale, desc, minSpacing, expectedInterval} of TEST_DATA) { + do_print("Testing timeScale: " + timeScale + " and minSpacing: " + + minSpacing + ". Expecting " + expectedInterval + "."); + + let interval = findOptimalTimeInterval(timeScale, minSpacing); + if (typeof expectedInterval == "string") { + ok(eval(expectedInterval), desc); + } else { + equal(interval, expectedInterval, desc); + } + } +} diff --git a/browser/devtools/animationinspector/test/unit/test_timeScale.js b/browser/devtools/animationinspector/test/unit/test_timeScale.js new file mode 100644 index 000000000000..9a5335a165cd --- /dev/null +++ b/browser/devtools/animationinspector/test/unit/test_timeScale.js @@ -0,0 +1,191 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const Cu = Components.utils; +const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); +const {require} = devtools; + +const {TimeScale} = require("devtools/animationinspector/components"); + +const TEST_ANIMATIONS = [{ + startTime: 500, + delay: 0, + duration: 1000, + iterationCount: 1 +}, { + startTime: 400, + delay: 100, + duration: 10, + iterationCount: 100 +}, { + startTime: 50, + delay: 1000, + duration: 100, + iterationCount: 20 +}]; +const EXPECTED_MIN_START = 50; +const EXPECTED_MAX_END = 3050; + +const TEST_STARTTIME_TO_DISTANCE = [{ + time: 50, + width: 100, + expectedDistance: 0 +}, { + time: 50, + width: 0, + expectedDistance: 0 +}, { + time: 3050, + width: 200, + expectedDistance: 200 +}, { + time: 1550, + width: 200, + expectedDistance: 100 +}]; + +const TEST_DURATION_TO_DISTANCE = [{ + time: 3000, + width: 100, + expectedDistance: 100 +}, { + time: 0, + width: 100, + expectedDistance: 0 +}]; + +const TEST_DISTANCE_TO_TIME = [{ + distance: 100, + width: 100, + expectedTime: 3050 +}, { + distance: 0, + width: 100, + expectedTime: 50 +}, { + distance: 25, + width: 200, + expectedTime: 425 +}]; + +const TEST_DISTANCE_TO_RELATIVE_TIME = [{ + distance: 100, + width: 100, + expectedTime: 3000 +}, { + distance: 0, + width: 100, + expectedTime: 0 +}, { + distance: 25, + width: 200, + expectedTime: 375 +}]; + +const TEST_FORMAT_TIME_MS = [{ + time: 0, + expectedFormattedTime: "0ms" +}, { + time: 3540.341, + expectedFormattedTime: "3540ms" +}, { + time: 1.99, + expectedFormattedTime: "2ms" +}, { + time: 4000, + expectedFormattedTime: "4000ms" +}]; + +const TEST_FORMAT_TIME_S = [{ + time: 0, + expectedFormattedTime: "0.0s" +}, { + time: 3540.341, + expectedFormattedTime: "3.5s" +}, { + time: 1.99, + expectedFormattedTime: "0.0s" +}, { + time: 4000, + expectedFormattedTime: "4.0s" +}, { + time: 102540, + expectedFormattedTime: "102.5s" +}, { + time: 102940, + expectedFormattedTime: "102.9s" +}]; + +function run_test() { + do_print("Check the default min/max range values"); + equal(TimeScale.minStartTime, Infinity); + equal(TimeScale.maxEndTime, 0); + + do_print("Test adding a few animations"); + for (let {startTime, delay, duration, iterationCount} of TEST_ANIMATIONS) { + TimeScale.addAnimation({startTime, delay, duration, iterationCount}); + } + equal(TimeScale.minStartTime, EXPECTED_MIN_START); + equal(TimeScale.maxEndTime, EXPECTED_MAX_END); + + do_print("Test reseting the animations"); + TimeScale.reset(); + equal(TimeScale.minStartTime, Infinity); + equal(TimeScale.maxEndTime, 0); + + do_print("Test adding the animations again"); + for (let {startTime, delay, duration, iterationCount} of TEST_ANIMATIONS) { + TimeScale.addAnimation({startTime, delay, duration, iterationCount}); + } + equal(TimeScale.minStartTime, EXPECTED_MIN_START); + equal(TimeScale.maxEndTime, EXPECTED_MAX_END); + + do_print("Test converting start times to distances"); + for (let {time, width, expectedDistance} of TEST_STARTTIME_TO_DISTANCE) { + let distance = TimeScale.startTimeToDistance(time, width); + equal(distance, expectedDistance); + } + + do_print("Test converting durations to distances"); + for (let {time, width, expectedDistance} of TEST_DURATION_TO_DISTANCE) { + let distance = TimeScale.durationToDistance(time, width); + equal(distance, expectedDistance); + } + + do_print("Test converting distances to times"); + for (let {distance, width, expectedTime} of TEST_DISTANCE_TO_TIME) { + let time = TimeScale.distanceToTime(distance, width); + equal(time, expectedTime); + } + + do_print("Test converting distances to relative times"); + for (let {distance, width, expectedTime} of TEST_DISTANCE_TO_RELATIVE_TIME) { + let time = TimeScale.distanceToRelativeTime(distance, width); + equal(time, expectedTime); + } + + do_print("Test formatting times (millis)"); + for (let {time, expectedFormattedTime} of TEST_FORMAT_TIME_MS) { + let formattedTime = TimeScale.formatTime(time); + equal(formattedTime, expectedFormattedTime); + } + + // Add 1 more animation to increase the range and test more time formatting + // cases. + TimeScale.addAnimation({ + startTime: 3000, + duration: 5000, + delay: 0, + iterationCount: 1 + }); + + do_print("Test formatting times (seconds)"); + for (let {time, expectedFormattedTime} of TEST_FORMAT_TIME_S) { + let formattedTime = TimeScale.formatTime(time); + equal(formattedTime, expectedFormattedTime); + } +} diff --git a/browser/devtools/animationinspector/test/unit/xpcshell.ini b/browser/devtools/animationinspector/test/unit/xpcshell.ini new file mode 100644 index 000000000000..eed4a1b1f70e --- /dev/null +++ b/browser/devtools/animationinspector/test/unit/xpcshell.ini @@ -0,0 +1,9 @@ +[DEFAULT] +tags = devtools +head = +tail = +firefox-appdir = browser +skip-if = toolkit == 'android' || toolkit == 'gonk' + +[test_findOptimalTimeInterval.js] +[test_timeScale.js] diff --git a/browser/devtools/animationinspector/utils.js b/browser/devtools/animationinspector/utils.js index 137745a45aa6..33cff3884ca7 100644 --- a/browser/devtools/animationinspector/utils.js +++ b/browser/devtools/animationinspector/utils.js @@ -107,12 +107,11 @@ exports.drawGraphElementBackground = drawGraphElementBackground; * @param {Number} timeScale How many px is 1ms in the graph. * @param {Number} minSpacing The minimum spacing between 2 graduations, * defaults to TIME_GRADUATION_MIN_SPACING. - * @return {Number} The optional interval, in pixels. + * @return {Number} The optimal interval, in pixels. */ function findOptimalTimeInterval(timeScale, minSpacing=TIME_GRADUATION_MIN_SPACING) { let timingStep = TIME_INTERVAL_MULTIPLE; - let maxIters = OPTIMAL_TIME_INTERVAL_MAX_ITERS; let numIters = 0; if (timeScale > minSpacing) { @@ -121,7 +120,7 @@ function findOptimalTimeInterval(timeScale, while (true) { let scaledStep = timeScale * timingStep; - if (++numIters > maxIters) { + if (++numIters > OPTIMAL_TIME_INTERVAL_MAX_ITERS) { return scaledStep; } if (scaledStep < minSpacing) { From 05025d4d2c585b4790eb21350c5f79d99d9c2889 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Mon, 15 Jun 2015 15:16:34 +0200 Subject: [PATCH 10/59] Backed out changeset 0b55b1cac565 (bug 1164564) for dt failures in browser_dbg_WorkerActor.attachThread.js --- browser/devtools/debugger/test/browser.ini | 4 - .../test/browser_dbg_WorkerActor.attach.js | 1 + .../browser_dbg_WorkerActor.attachThread.js | 89 ------------------- .../code_WorkerActor.attachThread-worker.js | 16 ---- .../debugger/test/code_frame-script.js | 12 --- .../doc_WorkerActor.attachThread-tab.html | 8 -- browser/devtools/debugger/test/head.js | 64 +------------ toolkit/devtools/client/dbg-client.jsm | 32 ++----- toolkit/devtools/server/actors/script.js | 9 +- .../server/actors/utils/TabSources.js | 2 +- toolkit/devtools/server/actors/worker.js | 43 +-------- toolkit/devtools/server/main.js | 86 +----------------- toolkit/devtools/server/moz.build | 1 - toolkit/devtools/server/worker.js | 66 -------------- toolkit/devtools/worker-loader.js | 6 +- 15 files changed, 18 insertions(+), 421 deletions(-) delete mode 100644 browser/devtools/debugger/test/browser_dbg_WorkerActor.attachThread.js delete mode 100644 browser/devtools/debugger/test/code_WorkerActor.attachThread-worker.js delete mode 100644 browser/devtools/debugger/test/doc_WorkerActor.attachThread-tab.html delete mode 100644 toolkit/devtools/server/worker.js diff --git a/browser/devtools/debugger/test/browser.ini b/browser/devtools/debugger/test/browser.ini index 6243c7831151..e9ef792bdfae 100644 --- a/browser/devtools/debugger/test/browser.ini +++ b/browser/devtools/debugger/test/browser.ini @@ -45,7 +45,6 @@ support-files = code_ugly-8^headers^ code_WorkerActor.attach-worker1.js code_WorkerActor.attach-worker2.js - code_WorkerActor.attachThread-worker.js doc_auto-pretty-print-01.html doc_auto-pretty-print-02.html doc_binary_search.html @@ -108,7 +107,6 @@ support-files = doc_with-frame.html doc_WorkerActor.attach-tab1.html doc_WorkerActor.attach-tab2.html - doc_WorkerActor.attachThread-tab.html head.js sjs_random-javascript.sjs testactors.js @@ -568,5 +566,3 @@ skip-if = e10s && debug skip-if = e10s && debug [browser_dbg_WorkerActor.attach.js] skip-if = e10s && debug -[browser_dbg_WorkerActor.attachThread.js] -skip-if = e10s && debug diff --git a/browser/devtools/debugger/test/browser_dbg_WorkerActor.attach.js b/browser/devtools/debugger/test/browser_dbg_WorkerActor.attach.js index a9ca7a91544d..fe0d839518c5 100644 --- a/browser/devtools/debugger/test/browser_dbg_WorkerActor.attach.js +++ b/browser/devtools/debugger/test/browser_dbg_WorkerActor.attach.js @@ -27,6 +27,7 @@ function test() { // registered. Instead, we have to wait for the promise returned by // createWorker in the tab to be resolved. yield createWorkerInTab(tab, WORKER1_URL); + let { workers } = yield listWorkers(tabClient); let [, workerClient1] = yield attachWorker(tabClient, findWorker(workers, WORKER1_URL)); diff --git a/browser/devtools/debugger/test/browser_dbg_WorkerActor.attachThread.js b/browser/devtools/debugger/test/browser_dbg_WorkerActor.attachThread.js deleted file mode 100644 index fd7f1e839223..000000000000 --- a/browser/devtools/debugger/test/browser_dbg_WorkerActor.attachThread.js +++ /dev/null @@ -1,89 +0,0 @@ -let TAB_URL = EXAMPLE_URL + "doc_WorkerActor.attachThread-tab.html"; -let WORKER_URL = "code_WorkerActor.attachThread-worker.js"; - -function test() { - Task.spawn(function* () { - DebuggerServer.init(); - DebuggerServer.addBrowserActors(); - - let client1 = new DebuggerClient(DebuggerServer.connectPipe()); - yield connect(client1); - let client2 = new DebuggerClient(DebuggerServer.connectPipe()); - yield connect(client2); - - let tab = yield addTab(TAB_URL); - let { tabs: tabs1 } = yield listTabs(client1); - let [, tabClient1] = yield attachTab(client1, findTab(tabs1, TAB_URL)); - let { tabs: tabs2 } = yield listTabs(client2); - let [, tabClient2] = yield attachTab(client2, findTab(tabs2, TAB_URL)); - - yield listWorkers(tabClient1); - yield listWorkers(tabClient2); - yield createWorkerInTab(tab, WORKER_URL); - let { workers: workers1 } = yield listWorkers(tabClient1); - let [, workerClient1] = yield attachWorker(tabClient1, - findWorker(workers1, WORKER_URL)); - let { workers: workers2 } = yield listWorkers(tabClient2); - let [, workerClient2] = yield attachWorker(tabClient2, - findWorker(workers2, WORKER_URL)); - - let location = { line: 5 }; - - let [, threadClient1] = yield attachThread(workerClient1); - let sources1 = yield getSources(threadClient1); - let sourceClient1 = threadClient1.source(findSource(sources1, - EXAMPLE_URL + WORKER_URL)); - let [, breakpointClient1] = yield setBreakpoint(sourceClient1, location); - yield resume(threadClient1); - - let [, threadClient2] = yield attachThread(workerClient2); - let sources2 = yield getSources(threadClient2); - let sourceClient2 = threadClient2.source(findSource(sources2, - EXAMPLE_URL + WORKER_URL)); - let [, breakpointClient2] = yield setBreakpoint(sourceClient2, location); - yield resume(threadClient2); - - postMessageToWorkerInTab(tab, WORKER_URL, "ping"); - yield Promise.all([ - waitForPause(threadClient1).then((packet) => { - is(packet.type, "paused"); - let why = packet.why; - is(why.type, "breakpoint"); - is(why.actors.length, 1); - is(why.actors[0], breakpointClient1.actor); - let frame = packet.frame; - let where = frame.where; - is(where.source.actor, sourceClient1.actor); - is(where.line, location.line); - let variables = frame.environment.bindings.variables; - is(variables.a.value, 1); - is(variables.b.value.type, "undefined"); - is(variables.c.value.type, "undefined"); - return resume(threadClient1); - }), - waitForPause(threadClient2).then((packet) => { - is(packet.type, "paused"); - let why = packet.why; - is(why.type, "breakpoint"); - is(why.actors.length, 1); - is(why.actors[0], breakpointClient2.actor); - let frame = packet.frame; - let where = frame.where; - is(where.source.actor, sourceClient2.actor); - is(where.line, location.line); - let variables = frame.environment.bindings.variables; - is(variables.a.value, 1); - is(variables.b.value.type, "undefined"); - is(variables.c.value.type, "undefined"); - return resume(threadClient2); - }), - ]); - - terminateWorkerInTab(tab, WORKER_URL); - yield waitForWorkerClose(workerClient1); - yield waitForWorkerClose(workerClient2); - yield close(client1); - yield close(client2); - finish(); - }); -} diff --git a/browser/devtools/debugger/test/code_WorkerActor.attachThread-worker.js b/browser/devtools/debugger/test/code_WorkerActor.attachThread-worker.js deleted file mode 100644 index 4c115749dfe8..000000000000 --- a/browser/devtools/debugger/test/code_WorkerActor.attachThread-worker.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -function f() { - var a = 1; - var b = 2; - var c = 3; -} - -self.onmessage = function (event) { - if (event.data == "ping") { - f() - postMessage("pong"); - } -}; - -postMessage("load"); diff --git a/browser/devtools/debugger/test/code_frame-script.js b/browser/devtools/debugger/test/code_frame-script.js index eb9a85cf6da4..529328cbd0f2 100644 --- a/browser/devtools/debugger/test/code_frame-script.js +++ b/browser/devtools/debugger/test/code_frame-script.js @@ -83,15 +83,3 @@ addMessageListener("jsonrpc", function ({ data: { method, params, id } }) { }); }); }); - -addMessageListener("test:postMessageToWorker", function (message) { - dump("Posting message '" + message.data.message + "' to worker with url '" + - message.data.url + "'.\n"); - - let worker = workers[message.data.url]; - worker.postMessage(message.data.message); - worker.addEventListener("message", function listener() { - worker.removeEventListener("message", listener); - sendAsyncMessage("test:postMessageToWorker"); - }); -}); diff --git a/browser/devtools/debugger/test/doc_WorkerActor.attachThread-tab.html b/browser/devtools/debugger/test/doc_WorkerActor.attachThread-tab.html deleted file mode 100644 index 62ab9be7d2e8..000000000000 --- a/browser/devtools/debugger/test/doc_WorkerActor.attachThread-tab.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/browser/devtools/debugger/test/head.js b/browser/devtools/debugger/test/head.js index 857b844a189f..1002c36717c6 100644 --- a/browser/devtools/debugger/test/head.js +++ b/browser/devtools/debugger/test/head.js @@ -512,13 +512,9 @@ function getTab(aTarget, aWindow) { } function getSources(aClient) { - info("Getting sources."); - let deferred = promise.defer(); - aClient.getSources((packet) => { - deferred.resolve(packet.sources); - }); + aClient.getSources(({sources}) => deferred.resolve(sources)); return deferred.promise; } @@ -1133,15 +1129,6 @@ function waitForWorkerListChanged(tabClient) { }); } -function attachThread(workerClient, options) { - info("Attaching to thread."); - return new Promise(function(resolve, reject) { - workerClient.attachThread(options, function (response, threadClient) { - resolve([response, threadClient]); - }); - }); -} - function waitForWorkerClose(workerClient) { info("Waiting for worker to close."); return new Promise(function (resolve) { @@ -1169,52 +1156,3 @@ function waitForWorkerThaw(workerClient) { }); }); } - -function resume(threadClient) { - info("Resuming thread."); - return rdpInvoke(threadClient, threadClient.resume); -} - -function findSource(sources, url) { - info("Finding source with url '" + url + "'.\n"); - for (let source of sources) { - if (source.url === url) { - return source; - } - } - return null; -} - -function setBreakpoint(sourceClient, location) { - info("Setting breakpoint.\n"); - return new Promise(function (resolve) { - sourceClient.setBreakpoint(location, function (response, breakpointClient) { - resolve([response, breakpointClient]); - }); - }); -} - -function waitForEvent(client, type, predicate) { - return new Promise(function (resolve) { - function listener(type, packet) { - if (!predicate(packet)) { - return; - } - client.removeListener(listener); - resolve(packet); - } - - if (predicate) { - client.addListener(type, listener); - } else { - client.addOneTimeListener(type, function (type, packet) { - resolve(packet); - }); - } - }); -} - -function waitForPause(threadClient) { - info("Waiting for pause.\n"); - return waitForEvent(threadClient, "paused"); -} diff --git a/toolkit/devtools/client/dbg-client.jsm b/toolkit/devtools/client/dbg-client.jsm index 833e26a5b136..2f1f0b59eb3e 100644 --- a/toolkit/devtools/client/dbg-client.jsm +++ b/toolkit/devtools/client/dbg-client.jsm @@ -1360,7 +1360,7 @@ TabClient.prototype = { eventSource(TabClient.prototype); function WorkerClient(aClient, aForm) { - this.client = aClient; + this._client = aClient; this._actor = aForm.from; this._isClosed = false; this._isFrozen = aForm.isFrozen; @@ -1376,11 +1376,11 @@ function WorkerClient(aClient, aForm) { WorkerClient.prototype = { get _transport() { - return this.client._transport; + return this._client._transport; }, get request() { - return this.client.request; + return this._client.request; }, get actor() { @@ -1397,41 +1397,19 @@ WorkerClient.prototype = { detach: DebuggerClient.requester({ type: "detach" }, { after: function (aResponse) { - this.client.unregisterClient(this); + this._client.unregisterClient(this); return aResponse; }, telemetry: "WORKERDETACH" }), - attachThread: function(aOptions = {}, aOnResponse = noop) { - if (this.thread) { - DevToolsUtils.executeSoon(() => aOnResponse({ - type: "connected", - threadActor: this.thread._actor, - }, this.thread)); - return; - } - - this.request({ - to: this._actor, - type: "connect", - options: aOptions, - }, (aResponse) => { - if (!aResponse.error) { - this.thread = new ThreadClient(this, aResponse.threadActor); - this.client.registerClient(this.thread); - } - aOnResponse(aResponse, this.thread); - }); - }, - _onClose: function () { this.removeListener("close", this._onClose); this.removeListener("freeze", this._onFreeze); this.removeListener("thaw", this._onThaw); - this.client.unregisterClient(this); + this._client.unregisterClient(this); this._closed = true; }, diff --git a/toolkit/devtools/server/actors/script.js b/toolkit/devtools/server/actors/script.js index 04779a87aed3..0c861ffae160 100644 --- a/toolkit/devtools/server/actors/script.js +++ b/toolkit/devtools/server/actors/script.js @@ -15,7 +15,6 @@ const DevToolsUtils = require("devtools/toolkit/DevToolsUtils"); const { dbg_assert, dumpn, update, fetch } = DevToolsUtils; const { dirname, joinURI } = require("devtools/toolkit/path"); const promise = require("promise"); -const PromiseDebugging = require("PromiseDebugging"); const xpcInspector = require("xpcInspector"); const ScriptStore = require("./utils/ScriptStore"); const {DevToolsWorker} = require("devtools/toolkit/shared/worker.js"); @@ -1495,7 +1494,7 @@ ThreadActor.prototype = { // Clear DOM event breakpoints. // XPCShell tests don't use actual DOM windows for globals and cause // removeListenerForAllEvents to throw. - if (!isWorker && this.global && !this.global.toString().includes("Sandbox")) { + if (this.global && !this.global.toString().includes("Sandbox")) { let els = Cc["@mozilla.org/eventlistenerservice;1"] .getService(Ci.nsIEventListenerService); els.removeListenerForAllEvents(this.global, this._allEventsListener, true); @@ -1934,7 +1933,7 @@ ThreadActor.prototype = { } if (promises.length > 0) { - this.synchronize(promise.all(promises)); + this.synchronize(Promise.all(promises)); } return true; @@ -2871,10 +2870,10 @@ SourceActor.prototype = { actor, GeneratedLocation.fromOriginalLocation(originalLocation) )) { - return promise.resolve(null); + return Promise.resolve(null); } - return promise.resolve(originalLocation); + return Promise.resolve(originalLocation); } else { return this.sources.getAllGeneratedLocations(originalLocation) .then((generatedLocations) => { diff --git a/toolkit/devtools/server/actors/utils/TabSources.js b/toolkit/devtools/server/actors/utils/TabSources.js index d03022ab375f..1368a6218bb7 100644 --- a/toolkit/devtools/server/actors/utils/TabSources.js +++ b/toolkit/devtools/server/actors/utils/TabSources.js @@ -10,7 +10,7 @@ const DevToolsUtils = require("devtools/toolkit/DevToolsUtils"); const { dbg_assert, fetch } = DevToolsUtils; const EventEmitter = require("devtools/toolkit/event-emitter"); const { OriginalLocation, GeneratedLocation, getOffsetColumn } = require("devtools/server/actors/common"); -const { resolve } = require("promise"); +const { resolve } = Promise; loader.lazyRequireGetter(this, "SourceActor", "devtools/server/actors/script", true); loader.lazyRequireGetter(this, "isEvalSource", "devtools/server/actors/script", true); diff --git a/toolkit/devtools/server/actors/worker.js b/toolkit/devtools/server/actors/worker.js index 5d32e633d305..8f87fc79c721 100644 --- a/toolkit/devtools/server/actors/worker.js +++ b/toolkit/devtools/server/actors/worker.js @@ -1,7 +1,6 @@ "use strict"; let { Ci, Cu } = require("chrome"); -let { DebuggerServer } = require("devtools/server/main"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); @@ -29,8 +28,6 @@ function matchWorkerDebugger(dbg, options) { function WorkerActor(dbg) { this._dbg = dbg; this._isAttached = false; - this._threadActor = null; - this._transport = null; } WorkerActor.prototype = { @@ -69,33 +66,6 @@ WorkerActor.prototype = { return { type: "detached" }; }, - onConnect: function (request) { - if (!this._isAttached) { - return { error: "wrongState" }; - } - - if (this._threadActor !== null) { - return { - type: "connected", - threadActor: this._threadActor - }; - } - - return DebuggerServer.connectToWorker( - this.conn, this._dbg, this.actorID, request.options - ).then(({ threadActor, transport }) => { - this._threadActor = threadActor; - this._transport = transport; - - return { - type: "connected", - threadActor: this._threadActor - }; - }, (error) => { - return { error: error.toString() }; - }); - }, - onClose: function () { if (this._isAttached) { this._detach(); @@ -104,10 +74,6 @@ WorkerActor.prototype = { this.conn.sendActorEvent(this.actorID, "close"); }, - onError: function (filename, lineno, message) { - reportError("ERROR:" + filename + ":" + lineno + ":" + message + "\n"); - }, - onFreeze: function () { this.conn.sendActorEvent(this.actorID, "freeze"); }, @@ -117,12 +83,6 @@ WorkerActor.prototype = { }, _detach: function () { - if (this._threadActor !== null) { - this._transport.close(); - this._transport = null; - this._threadActor = null; - } - this._dbg.removeListener(this); this._isAttached = false; } @@ -130,8 +90,7 @@ WorkerActor.prototype = { WorkerActor.prototype.requestTypes = { "attach": WorkerActor.prototype.onAttach, - "detach": WorkerActor.prototype.onDetach, - "connect": WorkerActor.prototype.onConnect + "detach": WorkerActor.prototype.onDetach }; exports.WorkerActor = WorkerActor; diff --git a/toolkit/devtools/server/main.js b/toolkit/devtools/server/main.js index 9c6c3738e6ba..0b8f902caf5c 100644 --- a/toolkit/devtools/server/main.js +++ b/toolkit/devtools/server/main.js @@ -14,7 +14,7 @@ let { Ci, Cc, CC, Cu, Cr } = require("chrome"); let Services = require("Services"); let { ActorPool, OriginalLocation, RegisteredActorFactory, ObservedActorFactory } = require("devtools/server/actors/common"); -let { LocalDebuggerTransport, ChildDebuggerTransport, WorkerDebuggerTransport } = +let { LocalDebuggerTransport, ChildDebuggerTransport } = require("devtools/toolkit/transport/transport"); let DevToolsUtils = require("devtools/toolkit/DevToolsUtils"); let { dumpn, dumpv, dbg_assert } = DevToolsUtils; @@ -685,13 +685,10 @@ var DebuggerServer = { * "debug::packet", and all its actors will have names * beginning with "/". */ - connectToParent: function(aPrefix, aScopeOrManager) { + connectToParent: function(aPrefix, aMessageManager) { this._checkInit(); - let transport = isWorker ? - new WorkerDebuggerTransport(aScopeOrManager, aPrefix) : - new ChildDebuggerTransport(aScopeOrManager, aPrefix); - + let transport = new ChildDebuggerTransport(aMessageManager, aPrefix); return this._onConnection(transport, aPrefix, true); }, @@ -758,83 +755,6 @@ var DebuggerServer = { return deferred.promise; }, - connectToWorker: function (aConnection, aDbg, aId, aOptions) { - return new Promise((resolve, reject) => { - // Step 1: Initialize the worker debugger. - aDbg.initialize("resource://gre/modules/devtools/server/worker.js"); - - // Step 2: Send a connect request to the worker debugger. - aDbg.postMessage(JSON.stringify({ - type: "connect", - id: aId, - options: aOptions - })); - - // Steps 3-5 are performed on the worker thread (see worker.js). - - // Step 6: Wait for a response from the worker debugger. - let listener = { - onClose: () => { - aDbg.removeListener(listener); - - reject("closed"); - }, - - onMessage: (message) => { - let packet = JSON.parse(message); - if (packet.type !== "message" || packet.id !== aId) { - return; - } - - message = packet.message; - if (message.error) { - reject(error); - } - - if (message.type !== "paused") { - return; - } - - aDbg.removeListener(listener); - - // Step 7: Create a transport for the connection to the worker. - let transport = new WorkerDebuggerTransport(aDbg, aId); - transport.ready(); - transport.hooks = { - onClosed: () => { - if (!aDbg.isClosed) { - aDbg.postMessage(JSON.stringify({ - type: "disconnect", - id: aId - })); - } - - aConnection.cancelForwarding(aId); - }, - - onPacket: (packet) => { - // Ensure that any packets received from the server on the worker - // thread are forwarded to the client on the main thread, as if - // they had been sent by the server on the main thread. - aConnection.send(packet); - } - }; - - // Ensure that any packets received from the client on the main thread - // to actors on the worker thread are forwarded to the server on the - // worker thread. - aConnection.setForwarding(aId, transport); - - resolve({ - threadActor: message.from, - transport: transport - }); - } - }; - aDbg.addListener(listener); - }); - }, - /** * Check if the caller is running in a content child process. * diff --git a/toolkit/devtools/server/moz.build b/toolkit/devtools/server/moz.build index 417b34ddcb98..1503896e66da 100644 --- a/toolkit/devtools/server/moz.build +++ b/toolkit/devtools/server/moz.build @@ -51,7 +51,6 @@ EXTRA_JS_MODULES.devtools.server += [ 'content-globals.js', 'main.js', 'protocol.js', - 'worker.js' ] EXTRA_JS_MODULES.devtools.server.actors += [ diff --git a/toolkit/devtools/server/worker.js b/toolkit/devtools/server/worker.js deleted file mode 100644 index 48f414e4828d..000000000000 --- a/toolkit/devtools/server/worker.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict" - -loadSubScript("resource://gre/modules/devtools/worker-loader.js"); - -let { ActorPool } = worker.require("devtools/server/actors/common"); -let { ThreadActor } = worker.require("devtools/server/actors/script"); -let { TabSources } = worker.require("devtools/server/actors/utils/TabSources"); -let makeDebugger = worker.require("devtools/server/actors/utils/make-debugger"); -let { DebuggerServer } = worker.require("devtools/server/main"); - -DebuggerServer.init(); -DebuggerServer.createRootActor = function () { - throw new Error("Should never get here!"); -}; - -let connections = Object.create(null); - -this.addEventListener("message", function (event) { - let packet = JSON.parse(event.data); - switch (packet.type) { - case "connect": - // Step 3: Create a connection to the parent. - let connection = DebuggerServer.connectToParent(packet.id, this); - connections[packet.id] = connection; - - // Step 4: Create a thread actor for the connection to the parent. - let pool = new ActorPool(connection); - connection.addActorPool(pool); - - let sources = null; - - let actor = new ThreadActor({ - makeDebugger: makeDebugger.bind(null, { - findDebuggees: () => { - return [this.global]; - }, - - shouldAddNewGlobalAsDebuggee: () => { - return true; - }, - }), - - get sources() { - if (sources === null) { - sources = new TabSources(actor); - } - return sources; - } - }, global); - - pool.addActor(actor); - - // Step 5: Attach to the thread actor. - // - // This will cause a packet to be sent over the connection to the parent. - // Because this connection uses WorkerDebuggerTransport internally, this - // packet will be sent using WorkerDebuggerGlobalScope.postMessage, causing - // an onMessage event to be fired on the WorkerDebugger in the main thread. - actor.onAttach({}); - break; - - case "disconnect": - connections[packet.id].close(); - break; - }; -}); diff --git a/toolkit/devtools/worker-loader.js b/toolkit/devtools/worker-loader.js index f5932a17aae6..6652c38aab3f 100644 --- a/toolkit/devtools/worker-loader.js +++ b/toolkit/devtools/worker-loader.js @@ -435,8 +435,6 @@ let { } else { // Worker thread let requestors = []; - let scope = this; - let xpcInspector = { get lastNestRequestor() { return requestors.length === 0 ? null : requestors[0]; @@ -444,13 +442,13 @@ let { enterNestedEventLoop: function (requestor) { requestors.push(requestor); - scope.enterEventLoop(); + this.enterEventLoop(); return requestors.length; }, exitNestedEventLoop: function () { requestors.pop(); - scope.leaveEventLoop(); + this.leaveEventLoop(); return requestors.length; } }; From 4cf3440434bfa52e08472b136e5a4443005c6eb3 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Wed, 10 Jun 2015 08:48:01 -0400 Subject: [PATCH 11/59] Bug 1170851 - Warn about add-ons detected as no longer signed. r=mfinkle,Mossop --HG-- extra : rebase_source : b5895802073f699215483e0f1ec284752cbe91fd --- mobile/android/chrome/content/browser.js | 48 ++++++++++++++++--- .../locales/en-US/chrome/browser.properties | 7 +++ 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 27b0fa8a3b14..9539af96e7cb 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -6189,19 +6189,21 @@ let HealthReportStatusListener = { }; var XPInstallObserver = { - init: function xpi_init() { - Services.obs.addObserver(XPInstallObserver, "addon-install-blocked", false); - Services.obs.addObserver(XPInstallObserver, "addon-install-started", false); + init: function() { + Services.obs.addObserver(this, "addon-install-blocked", false); + Services.obs.addObserver(this, "addon-install-started", false); + Services.obs.addObserver(this, "xpi-signature-changed", false); + Services.obs.addObserver(this, "browser-delayed-startup-finished", false); - AddonManager.addInstallListener(XPInstallObserver); + AddonManager.addInstallListener(this); }, - observe: function xpi_observer(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { switch (aTopic) { case "addon-install-started": NativeWindow.toast.show(Strings.browser.GetStringFromName("alertAddonsDownloading"), "short"); break; - case "addon-install-blocked": + case "addon-install-blocked": { let installInfo = aSubject.QueryInterface(Ci.amIWebInstallInfo); let tab = BrowserApp.getTabForBrowser(installInfo.browser); if (!tab) @@ -6268,9 +6270,43 @@ var XPInstallObserver = { } NativeWindow.doorhanger.show(message, aTopic, buttons, tab.id); break; + } + case "xpi-signature-changed": { + if (JSON.parse(aData).disabled.length) { + this._notifyUnsignedAddonsDisabled(); + } + break; + } + case "browser-delayed-startup-finished": { + let disabledAddons = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED); + for (let id of disabledAddons) { + if (AddonManager.getAddonByID(id).signedState <= AddonManager.SIGNEDSTATE_MISSING) { + this._notifyUnsignedAddonsDisabled(); + break; + } + } + break; + } } }, + _notifyUnsignedAddonsDisabled: function() { + new Prompt({ + window: window, + title: Strings.browser.GetStringFromName("unsignedAddonsDisabled.title"), + message: Strings.browser.GetStringFromName("unsignedAddonsDisabled.message"), + buttons: [ + Strings.browser.GetStringFromName("unsignedAddonsDisabled.viewAddons"), + Strings.browser.GetStringFromName("unsignedAddonsDisabled.dismiss") + ] + }).show((data) => { + if (data.button === 0) { + // TODO: Open about:addons to show only unsigned add-ons? + BrowserApp.addTab("about:addons", { parentId: BrowserApp.selectedTab.id }); + } + }); + }, + onInstallEnded: function(aInstall, aAddon) { // Don't create a notification for distribution add-ons. if (Distribution.pendingAddonInstalls.has(aInstall)) { diff --git a/mobile/android/locales/en-US/chrome/browser.properties b/mobile/android/locales/en-US/chrome/browser.properties index c6daab42df44..32c25b9ca6cc 100644 --- a/mobile/android/locales/en-US/chrome/browser.properties +++ b/mobile/android/locales/en-US/chrome/browser.properties @@ -45,6 +45,13 @@ addonError.titleError=Error addonError.titleBlocked=Blocked add-on addonError.learnMore=Learn more +# LOCALIZATION NOTE (unsignedAddonsDisabled.title, unsignedAddonsDisabled.message): +# These strings will appear in a dialog when Firefox detects that installed add-ons cannot be verified. +unsignedAddonsDisabled.title=Unverified add-ons +unsignedAddonsDisabled.message=One or more installed add-ons cannot be verified and have been disabled. +unsignedAddonsDisabled.dismiss=Dismiss +unsignedAddonsDisabled.viewAddons=View add-ons + # LOCALIZATION NOTE (addonError-1, addonError-2, addonError-3, addonError-4, addonError-5): # #1 is the add-on name, #2 is the add-on host, #3 is the application name addonError-1=The add-on could not be downloaded because of a connection failure on #2. From cf1008339be279e330f1bd220ed2e8931d5dd6b6 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Thu, 11 Jun 2015 11:52:41 -0400 Subject: [PATCH 12/59] Bug 1173895 - Hide enable/disable context menu items for app disabled add-ons. r=liuche --HG-- extra : rebase_source : ef56d1b01d71fe33dc0b124e9a1eda6040c8347e --- mobile/android/chrome/content/aboutAddons.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/mobile/android/chrome/content/aboutAddons.js b/mobile/android/chrome/content/aboutAddons.js index a66c7e0c7904..7740c45e8e53 100644 --- a/mobile/android/chrome/content/aboutAddons.js +++ b/mobile/android/chrome/content/aboutAddons.js @@ -58,6 +58,14 @@ var ContextMenus = { document.getElementById("contextmenu-uninstall").removeAttribute("hidden"); } + // Hide the enable/disable context menu items if the add-on was disabled by + // Firefox (e.g. unsigned or blocklisted add-on). + if (addon.appDisabled) { + document.getElementById("contextmenu-enable").setAttribute("hidden", "true"); + document.getElementById("contextmenu-disable").setAttribute("hidden", "true"); + return; + } + let enabled = this.target.getAttribute("isDisabled") != "true"; if (enabled) { document.getElementById("contextmenu-enable").setAttribute("hidden", "true"); @@ -311,16 +319,18 @@ var Addons = { gStringBundle.formatStringFromName("addonStatus.uninstalled", [addon.name], 1); let enableBtn = document.getElementById("enable-btn"); - if (addon.appDisabled) + if (addon.appDisabled) { enableBtn.setAttribute("disabled", "true"); - else + } else { enableBtn.removeAttribute("disabled"); + } let uninstallBtn = document.getElementById("uninstall-btn"); - if (addon.scope == AddonManager.SCOPE_APPLICATION) + if (addon.scope == AddonManager.SCOPE_APPLICATION) { uninstallBtn.setAttribute("disabled", "true"); - else + } else { uninstallBtn.removeAttribute("disabled"); + } let box = document.querySelector("#addons-details > .addon-item .options-box"); box.innerHTML = ""; From 5fe27ac7e1d502b339faf32333291807e01df2ed Mon Sep 17 00:00:00 2001 From: Sami Jaktholm Date: Sat, 13 Jun 2015 09:01:04 +0300 Subject: [PATCH 13/59] Bug 1173196 - Add 'transitionend' listener to the toolbox frame before triggering the transition to avoid missing the event. r=pbrosset --- browser/devtools/framework/toolbox-hosts.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/browser/devtools/framework/toolbox-hosts.js b/browser/devtools/framework/toolbox-hosts.js index c8996df91848..9bc76106fcee 100644 --- a/browser/devtools/framework/toolbox-hosts.js +++ b/browser/devtools/framework/toolbox-hosts.js @@ -106,14 +106,13 @@ BottomHost.prototype = { } this.isMinimized = true; - this.frame.style.marginBottom = -this.frame.height + height + "px"; - this._splitter.classList.add("disabled"); - let onTransitionEnd = () => { this.frame.removeEventListener("transitionend", onTransitionEnd); this.emit("minimized"); }; this.frame.addEventListener("transitionend", onTransitionEnd); + this.frame.style.marginBottom = -this.frame.height + height + "px"; + this._splitter.classList.add("disabled"); }, /** @@ -126,14 +125,13 @@ BottomHost.prototype = { } this.isMinimized = false; - this.frame.style.marginBottom = "0"; - this._splitter.classList.remove("disabled"); - let onTransitionEnd = () => { this.frame.removeEventListener("transitionend", onTransitionEnd); this.emit("maximized"); }; this.frame.addEventListener("transitionend", onTransitionEnd); + this.frame.style.marginBottom = "0"; + this._splitter.classList.remove("disabled"); }, /** From bf15f241b768a7e643ef985ee2596e17d471a1f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Fri, 12 Jun 2015 05:09:00 -0400 Subject: [PATCH 14/59] Bug 1173749 - Use a lighter blue for URLs in the URL bar's autocomplete popup. r=Gijs --- browser/themes/windows/browser.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/browser/themes/windows/browser.css b/browser/themes/windows/browser.css index b2a317c18953..fed80cccf298 100644 --- a/browser/themes/windows/browser.css +++ b/browser/themes/windows/browser.css @@ -1502,6 +1502,13 @@ richlistitem[type~="action"][actiontype="searchengine"] > .ac-title-box > .ac-si } } +@media (-moz-os-version: windows-win10) and (-moz-windows-default-theme) { + .ac-url-text:not([selected="true"]), + .ac-action-text:not([selected="true"]) { + color: Highlight; + } +} + richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon { list-style-image: url("chrome://browser/skin/actionicon-tab.png"); -moz-image-region: rect(0, 16px, 11px, 0); From 8538d005f344be62298fd5d2b13867a044775094 Mon Sep 17 00:00:00 2001 From: Simon Lindholm Date: Fri, 12 Jun 2015 13:09:00 -0400 Subject: [PATCH 15/59] Bug 1174289 - Remove fake focus-ring after e10s findbar is closed. r=evilpie --- toolkit/modules/RemoteFinder.jsm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toolkit/modules/RemoteFinder.jsm b/toolkit/modules/RemoteFinder.jsm index e6c58a019629..dc46b62dc366 100644 --- a/toolkit/modules/RemoteFinder.jsm +++ b/toolkit/modules/RemoteFinder.jsm @@ -235,6 +235,10 @@ RemoteFinderListener.prototype = { this._finder.highlight(data.highlight, data.word); break; + case "Finder:EnableSelection": + this._finder.enableSelection(); + break; + case "Finder:RemoveSelection": this._finder.removeSelection(); break; From 8b2b1647a03002876ffa10eb6179e84260e402c8 Mon Sep 17 00:00:00 2001 From: Simon Lindholm Date: Fri, 12 Jun 2015 13:07:00 -0400 Subject: [PATCH 16/59] Bug 1174291 - Fix ctrl-return for e10s findbar. r=evilpie --- toolkit/modules/RemoteFinder.jsm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolkit/modules/RemoteFinder.jsm b/toolkit/modules/RemoteFinder.jsm index dc46b62dc366..d1d27d4395ab 100644 --- a/toolkit/modules/RemoteFinder.jsm +++ b/toolkit/modules/RemoteFinder.jsm @@ -152,6 +152,9 @@ RemoteFinder.prototype = { keyPress: function (aEvent) { this._browser.messageManager.sendAsyncMessage("Finder:KeyPress", { keyCode: aEvent.keyCode, + ctrlKey: aEvent.ctrlKey, + metaKey: aEvent.metaKey, + altKey: aEvent.altKey, shiftKey: aEvent.shiftKey }); }, From c6594d3239e9d071c7d60485724f195323a83f1d Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Sun, 14 Jun 2015 21:00:24 -0700 Subject: [PATCH 17/59] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/11a288afb671 Author: Kevin Grandon Desc: Merge pull request #30581 from KevinGrandon/bug_1174443_hotspot_settings_gaia_switch Bug 1174443 - [Settings] Convert hotspot switches to use gaia-switch ======== https://hg.mozilla.org/integration/gaia-central/rev/6513bddda0f4 Author: Kevin Grandon Desc: Bug 1174443 - [Settings] Convert hotspot switches to use gaia-switch r=eragon --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 1f4cd4757983..e59a82873fdb 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "1bf2da102560481748ff3f6202fbed5c4daa5832", + "git_revision": "02ff3f527d9524b3657752e9abb24cc590f0ac89", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "79a7d364c5b78cd193be2c401b7763f325f44314", + "revision": "11a288afb6711c7c5e6abe0b56863d09bbead697", "repo_path": "integration/gaia-central" } From 0652dc623d7fe66b4a641396006a6b63b8142eed Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Sun, 14 Jun 2015 21:02:21 -0700 Subject: [PATCH 18/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index a60936eb0086..66c1de8c5f48 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index c76df2ed75da..6435c259c59e 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index d5e47e2b7ffc..477715c35fb0 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index c610847092d3..2bdcd0b869e6 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index b9fb31438aa3..6e9be3762ef7 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index ae28fc3af80f..0968c7758efd 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index d5e47e2b7ffc..477715c35fb0 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 857c1612c339..95264a9e7af4 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index a9926b2be733..23b672aa7457 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 62138c1a60f3..043e3368f6e9 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 66766a212811a554bce4406102b3258bf7a9036a Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Sun, 14 Jun 2015 23:15:13 -0700 Subject: [PATCH 19/59] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/5f5cde7ffde3 Author: Arthur Chen Desc: Merge pull request #30504 from crh0716/1172155 Bug 1172155 - Show a warning when switching to UMS on devices with a limited support r=eragonj ======== https://hg.mozilla.org/integration/gaia-central/rev/3d5f5ccd7a8a Author: Arthur Chen Desc: Bug 1172155 - Show a warning when switching to UMS on devices with a limited support --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index e59a82873fdb..cbde7d9c2eff 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "02ff3f527d9524b3657752e9abb24cc590f0ac89", + "git_revision": "5a06fc68e7cb431fe6af9e8a183bfd196612283b", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "11a288afb6711c7c5e6abe0b56863d09bbead697", + "revision": "5f5cde7ffde352396f796290d9bfce79940025da", "repo_path": "integration/gaia-central" } From d7698dd77343f62407ba1c1ef175e428259351b1 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Sun, 14 Jun 2015 23:17:09 -0700 Subject: [PATCH 20/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 66c1de8c5f48..a0b39474dd3d 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 6435c259c59e..3ce650e6a747 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 477715c35fb0..68d731ef17f7 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 2bdcd0b869e6..c2adf7d20783 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 6e9be3762ef7..bbc3c96613ac 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 0968c7758efd..9d30a117254d 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 477715c35fb0..68d731ef17f7 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 95264a9e7af4..d51597e1127c 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 23b672aa7457..7e35e6e313df 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 043e3368f6e9..3a9e3eb6840c 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 0480d84dfb3796c2c3b0296584ed643eca246bce Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 00:05:24 -0700 Subject: [PATCH 21/59] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/4bab438d9765 Author: Tzu-Lin Huang Desc: Merge pull request #30584 from shamenchens/bug1173237 Bug 1173237 - [Stingray][EPG/TVDeck] Support l10n ID for pin channels… ======== https://hg.mozilla.org/integration/gaia-central/rev/e5b56e915df5 Author: Sherman Chen Desc: Bug 1173237 - [Stingray][EPG/TVDeck] Support l10n ID for pin channels to home --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index cbde7d9c2eff..1747c6d7d90c 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "5a06fc68e7cb431fe6af9e8a183bfd196612283b", + "git_revision": "6fab1149ae3d9aa3b175a5372cd2c3347cd9248a", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "5f5cde7ffde352396f796290d9bfce79940025da", + "revision": "4bab438d976570beb61cc2e082379e0d484d6444", "repo_path": "integration/gaia-central" } From 0b8b5d072dd051195b2c6cd436c9db8039123ffe Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 00:07:21 -0700 Subject: [PATCH 22/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index a0b39474dd3d..d76cd493607f 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 3ce650e6a747..c6843940ceb1 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 68d731ef17f7..f225fc846a6f 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index c2adf7d20783..b5255f2b0d27 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index bbc3c96613ac..f8ef7a018c78 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 9d30a117254d..bbd22b0055cf 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 68d731ef17f7..f225fc846a6f 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index d51597e1127c..56c21e96adef 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 7e35e6e313df..474b30ae10a7 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 3a9e3eb6840c..93ca344f922f 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 98d42787dfd942a881db50efe5e8227589e3f92d Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 01:00:24 -0700 Subject: [PATCH 23/59] Bumping gaia.json for 6 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/cb06a058228f Author: gasolin Desc: Merge pull request #30538 from gasolin/issue-1173675-camera Bug 1173675 - link gaia jsdoc gh-page on camera readme, r=justindarc ======== https://hg.mozilla.org/integration/gaia-central/rev/cb930a7320dd Author: gasolin Desc: Bug 1173675 - link gaia jsdoc gh-page on camera readme, r=justindarc ======== https://hg.mozilla.org/integration/gaia-central/rev/1e92b62fc1c3 Author: gasolin Desc: Merge pull request #30535 from gasolin/issue-1173675-settings Bug 1173675 - link gaia jsdoc gh-page on settings readme, r=arthur ======== https://hg.mozilla.org/integration/gaia-central/rev/eeffc0742ea1 Author: gasolin Desc: Bug 1173675 - link gaia jsdoc gh-page on settings readme, r=arthur ======== https://hg.mozilla.org/integration/gaia-central/rev/77efd133c666 Author: George Desc: Merge pull request #30440 from chenpighead/Bug1168326_PR_to_Gij_test_file Bug 1168326 - Remove SpecialPowers in selection_helper.js ======== https://hg.mozilla.org/integration/gaia-central/rev/4f2d70c23af6 Author: Jeremy Chen Desc: Bug 1168326 - Remove SpecialPowers in selection_helper.js --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 1747c6d7d90c..788a01f0961e 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "6fab1149ae3d9aa3b175a5372cd2c3347cd9248a", + "git_revision": "70f676b76be30c1185358d6ed4823fba0c343644", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "4bab438d976570beb61cc2e082379e0d484d6444", + "revision": "cb06a058228fe42dd60aaaf05680ec66d22c1c69", "repo_path": "integration/gaia-central" } From f9572dad62099ff2991c5e835cea1894f499ff52 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 01:02:19 -0700 Subject: [PATCH 24/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index d76cd493607f..56e377bc4008 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index c6843940ceb1..8a1b2f92a005 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index f225fc846a6f..775298825df9 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index b5255f2b0d27..0d0c5d0fb693 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index f8ef7a018c78..a3f6c5b20a64 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index bbd22b0055cf..05793fc190e0 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index f225fc846a6f..775298825df9 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 56c21e96adef..9d7db7b8c1ad 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 474b30ae10a7..640368f2d2cb 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 93ca344f922f..7e56efa18845 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 79a8bee6569594fed59f15710cd352d9d90f57e8 Mon Sep 17 00:00:00 2001 From: Jocelyn Liu Date: Mon, 15 Jun 2015 17:11:18 +0800 Subject: [PATCH 25/59] Bug 1174071 - Remove 'required' keyword for Bluetooth*EventInit dictionary members. r=btian, r=bz --- .../bluetooth2/BluetoothLeDeviceEvent.cpp | 19 +++++++++++-------- .../bluetooth2/BluetoothLeDeviceEvent.h | 2 +- dom/webidl/BluetoothAttributeEvent.webidl | 2 +- .../BluetoothGattCharacteristicEvent.webidl | 4 ++-- dom/webidl/BluetoothLeDeviceEvent.webidl | 10 +++++----- dom/webidl/BluetoothPairingEvent.webidl | 8 ++++---- 6 files changed, 24 insertions(+), 21 deletions(-) diff --git a/dom/bluetooth/bluetooth2/BluetoothLeDeviceEvent.cpp b/dom/bluetooth/bluetooth2/BluetoothLeDeviceEvent.cpp index 20e77ca7bb9a..fe4d95f19286 100644 --- a/dom/bluetooth/bluetooth2/BluetoothLeDeviceEvent.cpp +++ b/dom/bluetooth/bluetooth2/BluetoothLeDeviceEvent.cpp @@ -92,13 +92,16 @@ BluetoothLeDeviceEvent::Constructor( e->mDevice = aEventInitDict.mDevice; e->mRssi = aEventInitDict.mRssi; - aEventInitDict.mScanRecord.ComputeLengthAndData(); - const uint8_t* data = aEventInitDict.mScanRecord.Data(); - size_t length = aEventInitDict.mScanRecord.Length(); - e->mScanRecord = ArrayBuffer::Create(aGlobal.Context(), length, data); - if (!e->mScanRecord) { - aRv.Throw(NS_ERROR_OUT_OF_MEMORY); - return nullptr; + if (!aEventInitDict.mScanRecord.IsNull()) { + const auto& scanRecord = aEventInitDict.mScanRecord.Value(); + scanRecord.ComputeLengthAndData(); + e->mScanRecord = ArrayBuffer::Create(aGlobal.Context(), + scanRecord.Length(), + scanRecord.Data()); + if (!e->mScanRecord) { + aRv.Throw(NS_ERROR_OUT_OF_MEMORY); + return nullptr; + } } e->SetTrusted(trusted); @@ -106,7 +109,7 @@ BluetoothLeDeviceEvent::Constructor( } BluetoothDevice* -BluetoothLeDeviceEvent::Device() const +BluetoothLeDeviceEvent::GetDevice() const { return mDevice; } diff --git a/dom/bluetooth/bluetooth2/BluetoothLeDeviceEvent.h b/dom/bluetooth/bluetooth2/BluetoothLeDeviceEvent.h index 480da96a60ba..28362c37be1f 100644 --- a/dom/bluetooth/bluetooth2/BluetoothLeDeviceEvent.h +++ b/dom/bluetooth/bluetooth2/BluetoothLeDeviceEvent.h @@ -47,7 +47,7 @@ public: const BluetoothLeDeviceEventInit& aEventInitDict, ErrorResult& aRv); - BluetoothDevice* Device() const; + BluetoothDevice* GetDevice() const; int16_t Rssi() const; diff --git a/dom/webidl/BluetoothAttributeEvent.webidl b/dom/webidl/BluetoothAttributeEvent.webidl index dfeaa28ea531..49fb6ab23ba5 100644 --- a/dom/webidl/BluetoothAttributeEvent.webidl +++ b/dom/webidl/BluetoothAttributeEvent.webidl @@ -15,5 +15,5 @@ interface BluetoothAttributeEvent : Event dictionary BluetoothAttributeEventInit : EventInit { - required sequence attrs; + sequence attrs = []; }; diff --git a/dom/webidl/BluetoothGattCharacteristicEvent.webidl b/dom/webidl/BluetoothGattCharacteristicEvent.webidl index 67b381dfbb93..9dcfa2d98e62 100644 --- a/dom/webidl/BluetoothGattCharacteristicEvent.webidl +++ b/dom/webidl/BluetoothGattCharacteristicEvent.webidl @@ -9,10 +9,10 @@ optional BluetoothGattCharacteristicEventInit eventInitDict)] interface BluetoothGattCharacteristicEvent : Event { - readonly attribute BluetoothGattCharacteristic characteristic; + readonly attribute BluetoothGattCharacteristic? characteristic; }; dictionary BluetoothGattCharacteristicEventInit : EventInit { - required BluetoothGattCharacteristic characteristic; + BluetoothGattCharacteristic? characteristic = null; }; diff --git a/dom/webidl/BluetoothLeDeviceEvent.webidl b/dom/webidl/BluetoothLeDeviceEvent.webidl index c7fc8a489bbf..6bf6b772cea2 100644 --- a/dom/webidl/BluetoothLeDeviceEvent.webidl +++ b/dom/webidl/BluetoothLeDeviceEvent.webidl @@ -8,15 +8,15 @@ Constructor(DOMString type, optional BluetoothLeDeviceEventInit eventInitDict)] interface BluetoothLeDeviceEvent : Event { - readonly attribute BluetoothDevice device; + readonly attribute BluetoothDevice? device; readonly attribute short rssi; [Throws] - readonly attribute ArrayBuffer scanRecord; + readonly attribute ArrayBuffer? scanRecord; }; dictionary BluetoothLeDeviceEventInit : EventInit { - required BluetoothDevice device; - short rssi = 0; - required ArrayBuffer scanRecord; + BluetoothDevice? device = null; + short rssi = 0; + ArrayBuffer? scanRecord = null; }; diff --git a/dom/webidl/BluetoothPairingEvent.webidl b/dom/webidl/BluetoothPairingEvent.webidl index 493603138c06..763681ee5f5a 100644 --- a/dom/webidl/BluetoothPairingEvent.webidl +++ b/dom/webidl/BluetoothPairingEvent.webidl @@ -9,12 +9,12 @@ optional BluetoothPairingEventInit eventInitDict)] interface BluetoothPairingEvent : Event { - readonly attribute DOMString deviceName; - readonly attribute BluetoothPairingHandle handle; + readonly attribute DOMString deviceName; + readonly attribute BluetoothPairingHandle? handle; }; dictionary BluetoothPairingEventInit : EventInit { - required DOMString deviceName; - required BluetoothPairingHandle handle; + DOMString deviceName = ""; + BluetoothPairingHandle? handle = null; }; From 3ded2db982bacfebb9c52190507ed193d8bea30d Mon Sep 17 00:00:00 2001 From: Jocelyn Liu Date: Mon, 15 Jun 2015 17:11:35 +0800 Subject: [PATCH 26/59] Bug 1167064 - Patch1: Switch to bluetooth APIv2. r=shuang --- dom/base/moz.build | 6 +- dom/bindings/moz.build | 6 +- dom/bluetooth/BluetoothUtils.cpp | 6 +- .../bluedroid/BluetoothA2dpManager.cpp | 2 +- .../bluedroid/BluetoothServiceBluedroid.cpp | 68 +++++++++--------- .../bluedroid/BluetoothServiceBluedroid.h | 2 +- dom/bluetooth/bluez/BluetoothDBusService.cpp | 62 ++++++++-------- dom/bluetooth/bluez/BluetoothDBusService.h | 8 +-- dom/bluetooth/moz.build | 70 +++++++++---------- dom/ipc/moz.build | 12 ++-- dom/system/gonk/moz.build | 10 +-- dom/webidl/moz.build | 24 +++---- js/xpconnect/src/moz.build | 10 +-- layout/build/moz.build | 6 +- 14 files changed, 146 insertions(+), 146 deletions(-) diff --git a/dom/base/moz.build b/dom/base/moz.build index da333ad85598..2c53048c3d6d 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -436,13 +436,13 @@ LOCAL_INCLUDES += [ '/xpcom/ds', ] -if CONFIG['MOZ_B2G_BT_API_V2']: +if CONFIG['MOZ_B2G_BT_API_V1']: LOCAL_INCLUDES += [ - '../bluetooth/bluetooth2', + '../bluetooth/bluetooth1', ] else: LOCAL_INCLUDES += [ - '../bluetooth/bluetooth1', + '../bluetooth/bluetooth2', ] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': diff --git a/dom/bindings/moz.build b/dom/bindings/moz.build index 3d8d5f2660ae..58a4a7e39afb 100644 --- a/dom/bindings/moz.build +++ b/dom/bindings/moz.build @@ -91,13 +91,13 @@ if CONFIG['MOZ_AUDIO_CHANNEL_MANAGER']: '/dom/system/gonk', ] -if CONFIG['MOZ_B2G_BT_API_V2']: +if CONFIG['MOZ_B2G_BT_API_V1']: LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth2', + '/dom/bluetooth/bluetooth1', ] else: LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth1', + '/dom/bluetooth/bluetooth2', ] FINAL_LIBRARY = 'xul' diff --git a/dom/bluetooth/BluetoothUtils.cpp b/dom/bluetooth/BluetoothUtils.cpp index 4bad56936c0a..ddbe635f1c30 100644 --- a/dom/bluetooth/BluetoothUtils.cpp +++ b/dom/bluetooth/BluetoothUtils.cpp @@ -278,7 +278,7 @@ DispatchReplyError(BluetoothReplyRunnable* aRunnable, MOZ_ASSERT(!aErrorStr.IsEmpty()); // Reply will be deleted by the runnable after running on main thread -#if MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 BluetoothReply* reply = new BluetoothReply(BluetoothReplyError(STATUS_FAIL, nsString(aErrorStr))); #else @@ -298,7 +298,7 @@ DispatchReplyError(BluetoothReplyRunnable* aRunnable, MOZ_ASSERT(aStatus != STATUS_SUCCESS); // Reply will be deleted by the runnable after running on main thread -#if MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 BluetoothReply* reply = new BluetoothReply(BluetoothReplyError(aStatus, EmptyString())); #else @@ -325,7 +325,7 @@ DispatchStatusChangedEvent(const nsAString& aType, BluetoothService* bs = BluetoothService::Get(); NS_ENSURE_TRUE_VOID(bs); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 bs->DistributeSignal(aType, NS_LITERAL_STRING(KEY_ADAPTER), data); #else BluetoothSignal signal(nsString(aType), NS_LITERAL_STRING(KEY_ADAPTER), data); diff --git a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp index eb406f16661d..07c692873f27 100644 --- a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp @@ -1065,7 +1065,7 @@ BluetoothA2dpManager::GetPlayStatusNotification() return; } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 bs->DistributeSignal(NS_LITERAL_STRING(REQUEST_MEDIA_PLAYSTATUS_ID), NS_LITERAL_STRING(KEY_ADAPTER)); #else diff --git a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp index 03bbe9142f4d..08eee10cd1f1 100644 --- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp @@ -19,13 +19,13 @@ #include "BluetoothServiceBluedroid.h" #include "BluetoothA2dpManager.h" -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 #include "BluetoothGattManager.h" #else // TODO: Support GATT #endif #include "BluetoothHfpManager.h" -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 #include "BluetoothHidManager.h" #else // TODO: Support HID @@ -41,7 +41,7 @@ #include "mozilla/StaticMutex.h" #include "mozilla/StaticPtr.h" #include "mozilla/unused.h" -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 #include "nsDataHashtable.h" #endif @@ -63,7 +63,7 @@ } \ } while(0) -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 #define ENSURE_GATT_MGR_IS_READY_VOID(gatt, runnable) \ do { \ @@ -947,7 +947,7 @@ BluetoothServiceBluedroid::StopInternal() } #endif -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 nsresult BluetoothServiceBluedroid::GetAdaptersInternal( BluetoothReplyRunnable* aRunnable) @@ -1039,7 +1039,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 BT_WARNING("GetRemoteDeviceProperties(%s) failed: %d", NS_ConvertUTF16toUTF8(mDeviceAddress).get(), aStatus); @@ -1083,7 +1083,7 @@ BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal( ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 BluetoothProfileManagerBase* profile = BluetoothUuidHelper::GetBluetoothProfileManager(aServiceUuid); if (!profile) { @@ -1148,7 +1148,7 @@ BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal( ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 int requestedDeviceCount = aDeviceAddress.Length(); if (requestedDeviceCount == 0) { DispatchReplySuccess(aRunnable); @@ -1182,7 +1182,7 @@ public: : mRunnable(aRunnable) { } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 void OnError(BluetoothStatus aStatus) override { MOZ_ASSERT(NS_IsMainThread()); @@ -1214,7 +1214,7 @@ BluetoothServiceBluedroid::StartDiscoveryInternal( MOZ_ASSERT(NS_IsMainThread()); ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 sChangeDiscoveryRunnableArray.AppendElement(aRunnable); #else // Missing in bluetooth1 @@ -1231,7 +1231,7 @@ public: : mRunnable(aRunnable) { } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 void OnError(BluetoothStatus aStatus) override { MOZ_ASSERT(NS_IsMainThread()); @@ -1256,7 +1256,7 @@ private: BluetoothReplyRunnable* mRunnable; }; -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 class BluetoothServiceBluedroid::GetRemoteServicesResultHandler final : public BluetoothResultHandler { @@ -1310,7 +1310,7 @@ BluetoothServiceBluedroid::StopDiscoveryInternal( MOZ_ASSERT(NS_IsMainThread()); ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 sChangeDiscoveryRunnableArray.AppendElement(aRunnable); #else // Missing in bluetooth1 @@ -1331,7 +1331,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 sSetPropertyRunnableArray.RemoveElement(mRunnable); DispatchReplyError(mRunnable, aStatus); #else @@ -1388,7 +1388,7 @@ public: void OnError(BluetoothStatus aStatus) override { -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 sBondingRunnableArray.RemoveElement(mRunnable); DispatchReplyError(mRunnable, aStatus); #else @@ -1429,7 +1429,7 @@ public: void OnError(BluetoothStatus aStatus) override { -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 sUnbondingRunnableArray.RemoveElement(mRunnable); DispatchReplyError(mRunnable, aStatus); #else @@ -1458,7 +1458,7 @@ BluetoothServiceBluedroid::RemoveDeviceInternal( return NS_OK; } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 class BluetoothServiceBluedroid::PinReplyResultHandler final : public BluetoothResultHandler { @@ -1540,7 +1540,7 @@ BluetoothServiceBluedroid::SetPinCodeInternal( } #endif -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 void BluetoothServiceBluedroid::SetPasskeyInternal( const nsAString& aDeviceAddress, uint32_t aPasskey, @@ -1558,7 +1558,7 @@ BluetoothServiceBluedroid::SetPasskeyInternal( } #endif -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 class BluetoothServiceBluedroid::SspReplyResultHandler final : public BluetoothResultHandler { @@ -1641,7 +1641,7 @@ BluetoothServiceBluedroid::SetPairingConfirmationInternal( } #endif -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // Missing in bluetooth2 #else bool @@ -1659,7 +1659,7 @@ BluetoothServiceBluedroid::PrepareAdapterInternal() } #endif -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 void BluetoothServiceBluedroid::NextBluetoothProfileController() #else @@ -1679,7 +1679,7 @@ NextBluetoothProfileController() } } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 void BluetoothServiceBluedroid::ConnectDisconnect( bool aConnect, const nsAString& aDeviceAddress, @@ -1728,7 +1728,7 @@ BluetoothServiceBluedroid::Disconnect( ConnectDisconnect(false, aDeviceAddress, aRunnable, aServiceUuid); } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 bool BluetoothServiceBluedroid::IsConnected(uint16_t aProfileId) { @@ -1953,7 +1953,7 @@ BluetoothServiceBluedroid::ToggleCalls(BluetoothReplyRunnable* aRunnable) { } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // Missing in bluetooth2 #else uint16_t @@ -2062,7 +2062,7 @@ public: void BluetoothServiceBluedroid::AdapterStateChangedNotification(bool aState) { -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 MOZ_ASSERT(NS_IsMainThread()); BT_LOGR("BT_STATE: %d", aState); @@ -2235,7 +2235,7 @@ BluetoothServiceBluedroid::AdapterPropertiesNotification( BluetoothStatus aStatus, int aNumProperties, const BluetoothProperty* aProperties) { -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 MOZ_ASSERT(NS_IsMainThread()); InfallibleTArray propertiesArray; @@ -2390,7 +2390,7 @@ BluetoothServiceBluedroid::RemoteDevicePropertiesNotification( BluetoothStatus aStatus, const nsAString& aBdAddr, int aNumProperties, const BluetoothProperty* aProperties) { -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 MOZ_ASSERT(NS_IsMainThread()); InfallibleTArray propertiesArray; @@ -2596,7 +2596,7 @@ void BluetoothServiceBluedroid::DeviceFoundNotification( int aNumProperties, const BluetoothProperty* aProperties) { -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 MOZ_ASSERT(NS_IsMainThread()); BluetoothValue propertyValue; @@ -2684,7 +2684,7 @@ BluetoothServiceBluedroid::DeviceFoundNotification( void BluetoothServiceBluedroid::DiscoveryStateChangedNotification(bool aState) { -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 MOZ_ASSERT(NS_IsMainThread()); sAdapterDiscovering = aState; @@ -2727,7 +2727,7 @@ BluetoothServiceBluedroid::PinRequestNotification(const nsAString& aRemoteBdAddr const nsAString& aBdName, uint32_t aCod) { -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 MOZ_ASSERT(NS_IsMainThread()); InfallibleTArray propertiesArray; @@ -2766,7 +2766,7 @@ BluetoothServiceBluedroid::SspRequestNotification( { MOZ_ASSERT(NS_IsMainThread()); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 InfallibleTArray propertiesArray; nsAutoString passkey; nsAutoString pairingType; @@ -2826,7 +2826,7 @@ BluetoothServiceBluedroid::BondStateChangedNotification( BluetoothStatus aStatus, const nsAString& aRemoteBdAddr, BluetoothBondState aState) { -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 MOZ_ASSERT(NS_IsMainThread()); if (aState == BOND_STATE_BONDING) { @@ -3023,7 +3023,7 @@ BluetoothServiceBluedroid::LeTestModeNotification(BluetoothStatus aStatus, // FIXME: This will be implemented in the later patchset } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // TODO: Support EnergyInfoNotification #else void @@ -3059,7 +3059,7 @@ BluetoothServiceBluedroid::BackendErrorNotification(bool aCrashed) sIsRestart = true; BT_LOGR("Recovery step2: stop bluetooth"); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 StopBluetooth(false, nullptr); #else StopBluetooth(false); diff --git a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h index b116f0a2bcf9..bdf0c15ed335 100644 --- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h +++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h @@ -7,7 +7,7 @@ #ifndef mozilla_dom_bluetooth_bluetoothservicebluedroid_h__ #define mozilla_dom_bluetooth_bluetoothservicebluedroid_h__ -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 #include "BluetoothCommon.h" #include "BluetoothInterface.h" diff --git a/dom/bluetooth/bluez/BluetoothDBusService.cpp b/dom/bluetooth/bluez/BluetoothDBusService.cpp index 7136d9f461ba..11410617b947 100644 --- a/dom/bluetooth/bluez/BluetoothDBusService.cpp +++ b/dom/bluetooth/bluez/BluetoothDBusService.cpp @@ -91,7 +91,7 @@ USING_BLUETOOTH_NAMESPACE #define TIMEOUT_FORCE_TO_DISABLE_BT 5 #define BT_LAZY_THREAD_TIMEOUT_MS 3000 -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // missing on blutooth2 #else // Set Class of Device value bit @@ -149,7 +149,7 @@ public: return true; } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // TODO: This is the wrong place for handling manager classes BluetoothProfileManagerBase* profile; profile = BluetoothHfpManager::Get(); @@ -627,7 +627,7 @@ public: BluetoothService* bs = BluetoothService::Get(); NS_ENSURE_TRUE_VOID(bs); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // Missing in bluetooth2 #else bs->AdapterAddedReceived(); @@ -663,7 +663,7 @@ private: bool mDelay; }; -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // Missing in bluetooth2 #else class InternalStopDiscoveryTask : public nsRunnable @@ -918,7 +918,7 @@ HasAudioService(uint32_t aCodValue) return ((aCodValue & 0x200000) == 0x200000); } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 static bool ContainsIcon(const InfallibleTArray& aProperties) { @@ -1782,7 +1782,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 BluetoothService* bs = BluetoothService::Get(); NS_ENSURE_TRUE(bs, NS_ERROR_FAILURE); @@ -1886,7 +1886,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData) BluetoothNamedValue(NS_LITERAL_STRING("Path"), GetObjectPathFromAddress(signalPath, address))); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 if (!ContainsIcon(properties)) { #else if (FindProperty(properties, "Icon") < 0) { @@ -1908,7 +1908,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData) } } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // Missing in bluetooth2 #else if (FindProperty(properties, "Class") < 0) { @@ -1987,7 +1987,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData) sAdapterProperties, ArrayLength(sAdapterProperties)); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // Missing in bluetooth2 #else BluetoothNamedValue& property = v.get_ArrayOfBluetoothNamedValue()[0]; @@ -2020,7 +2020,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData) // "bluetooth-pairedstatuschanged" from BluetoothService. BluetoothValue newValue(v); ToLowerCase(newValue.get_ArrayOfBluetoothNamedValue()[0].name()); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 BluetoothSignal signal(NS_LITERAL_STRING("pairedstatuschanged"), NS_LITERAL_STRING(KEY_LOCAL_AGENT), newValue); @@ -2294,7 +2294,7 @@ public: } }; -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 nsresult BluetoothDBusService::StartInternal(BluetoothReplyRunnable* aRunnable) { @@ -2429,7 +2429,7 @@ public: } }; -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 nsresult BluetoothDBusService::StopInternal(BluetoothReplyRunnable* aRunnable) { @@ -2587,7 +2587,7 @@ private: nsRefPtr mRunnable; }; -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 nsresult BluetoothDBusService::GetAdaptersInternal(BluetoothReplyRunnable* aRunnable) { @@ -2639,7 +2639,7 @@ OnSendDiscoveryMessageReply(DBusMessage *aReply, void *aData) errorStr.AssignLiteral("SendDiscovery failed"); } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // Missing in blueooth2 #else // aData may be a nullptr because we may call StopDiscovery internally when @@ -2672,7 +2672,7 @@ public: , mRunnable(aRunnable) { MOZ_ASSERT(!mMessageName.IsEmpty()); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 MOZ_ASSERT(mRunnable); #else // Missing in bluetooth1 @@ -2710,7 +2710,7 @@ BluetoothDBusService::SendDiscoveryMessage(const char* aMessageName, MOZ_ASSERT(!sAdapterPath.IsEmpty()); if (!IsReady()) { -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 NS_NAMED_LITERAL_STRING(errorStr, "Bluetooth service is not ready yet!"); DispatchBluetoothReply(aRunnable, BluetoothValue(), errorStr); #else @@ -2910,7 +2910,7 @@ public: // Icon as audio-card. This is for PTS test TC_AG_COD_BV_02_I. // As HFP specification defined that // service class is "Audio" can be considered as HFP AG. -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 if (!ContainsIcon(devicePropertiesArray)) { #else if (FindProperty(devicePropertiesArray, "Icon") < 0) { @@ -2928,7 +2928,7 @@ public: } } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // Missing in bluetooth2 #else // Check whether the properties array contains CoD. If it doesn't, fallback to restore @@ -3111,7 +3111,7 @@ BluetoothDBusService::GetPairedDevicePropertiesInternal( return NS_OK; } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 nsresult BluetoothDBusService::FetchUuidsInternal(const nsAString& aDeviceAddress, BluetoothReplyRunnable* aRunnable) @@ -3496,7 +3496,7 @@ private: nsRefPtr mRunnable; }; -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 void BluetoothDBusService::PinReplyInternal( const nsAString& aDeviceAddress, bool aAccept, @@ -3601,7 +3601,7 @@ private: nsRefPtr mRunnable; }; -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 void BluetoothDBusService::SetPasskeyInternal(const nsAString& aDeviceAddress, uint32_t aPasskey, @@ -3627,7 +3627,7 @@ BluetoothDBusService::SetPasskeyInternal(const nsAString& aDeviceAddress, } #endif -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 void BluetoothDBusService::SetPairingConfirmationInternal( const nsAString& aDeviceAddress, @@ -3714,7 +3714,7 @@ BluetoothDBusService::Disconnect(const nsAString& aDeviceAddress, ConnectDisconnect(false, aDeviceAddress, aRunnable, aServiceUuid); } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 bool BluetoothDBusService::IsConnected(const uint16_t aServiceUuid) { @@ -3787,7 +3787,7 @@ BluetoothDBusService::ToggleCalls(BluetoothReplyRunnable* aRunnable) class OnUpdateSdpRecordsRunnable : public nsRunnable { public: -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 OnUpdateSdpRecordsRunnable(const nsAString& aObjectPath, BluetoothProfileManagerBase* aManager) : mManager(aManager) @@ -3818,7 +3818,7 @@ public: return NS_OK; } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // Missing in bluetooth2 #else void @@ -4013,7 +4013,7 @@ public: MOZ_ASSERT(sDBusConnection); MOZ_ASSERT(!sAdapterPath.IsEmpty()); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 const nsString objectPath = GetObjectPathFromAddress(sAdapterPath, mDeviceAddress); @@ -4055,7 +4055,7 @@ public: } protected: -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 // Missing in bluetooth2 #else static void CreateDeviceCallback(DBusMessage* aMsg, void* aData) @@ -4096,7 +4096,7 @@ protected: { MOZ_ASSERT(!NS_IsMainThread()); // I/O thread -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 nsRefPtr r( static_cast(aData)); NS_DispatchToMainThread(r); @@ -4124,7 +4124,7 @@ BluetoothDBusService::UpdateSdpRecords(const nsAString& aDeviceAddress, { MOZ_ASSERT(NS_IsMainThread()); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 Task* task = new UpdateSdpRecordsTask(aDeviceAddress, aManager); DispatchToDBusThread(task); #else @@ -4379,7 +4379,7 @@ BluetoothDBusService::SendMetaData(const nsAString& aTitle, a2dp->GetTitle(prevTitle); a2dp->GetAlbum(prevAlbum); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 uint64_t mediaNumber = static_cast(aMediaNumber); if (mediaNumber != a2dp->GetMediaNumber() || !aTitle.Equals(prevTitle) || @@ -4690,7 +4690,7 @@ BluetoothDBusService::UpdateNotification(ControlEventId aEventId, DispatchToDBusThread(task); } -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 void BluetoothDBusService::StartLeScanInternal( const nsTArray& aServiceUuids, diff --git a/dom/bluetooth/bluez/BluetoothDBusService.h b/dom/bluetooth/bluez/BluetoothDBusService.h index c52f39427715..d11d14a19875 100644 --- a/dom/bluetooth/bluez/BluetoothDBusService.h +++ b/dom/bluetooth/bluez/BluetoothDBusService.h @@ -47,7 +47,7 @@ public: bool IsReady(); -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 virtual nsresult StartInternal(BluetoothReplyRunnable* aRunnable) override; virtual nsresult StopInternal(BluetoothReplyRunnable* aRunnable) override; @@ -109,7 +109,7 @@ public: RemoveDeviceInternal(const nsAString& aDeviceObjectPath, BluetoothReplyRunnable* aRunnable) override; -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 virtual void PinReplyInternal(const nsAString& aDeviceAddress, bool aAccept, @@ -153,7 +153,7 @@ public: uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable) override; -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 virtual bool IsConnected(uint16_t aServiceUuid) override; #else @@ -233,7 +233,7 @@ public: SendInputMessage(const nsAString& aDeviceAddresses, const nsAString& aMessage) override; -#ifdef MOZ_B2G_BT_API_V2 +#ifndef MOZ_B2G_BT_API_V1 virtual void StartLeScanInternal(const nsTArray& aServiceUuids, BluetoothReplyRunnable* aRunnable) override; diff --git a/dom/bluetooth/moz.build b/dom/bluetooth/moz.build index 7a00e711eb23..1ad464c257ef 100644 --- a/dom/bluetooth/moz.build +++ b/dom/bluetooth/moz.build @@ -24,7 +24,25 @@ if CONFIG['MOZ_B2G_BT']: 'BluetoothRilListener.cpp' ] - if CONFIG['MOZ_B2G_BT_API_V2']: + if CONFIG['MOZ_B2G_BT_API_V1']: + SOURCES += [ + 'bluetooth1/BluetoothAdapter.cpp', + 'bluetooth1/BluetoothDevice.cpp', + 'bluetooth1/BluetoothManager.cpp', + 'bluetooth1/BluetoothProfileController.cpp', + 'bluetooth1/BluetoothPropertyContainer.cpp', + 'bluetooth1/BluetoothReplyRunnable.cpp', + 'bluetooth1/BluetoothService.cpp', + 'bluetooth1/ipc/BluetoothChild.cpp', + 'bluetooth1/ipc/BluetoothParent.cpp', + 'bluetooth1/ipc/BluetoothServiceChildProcess.cpp', + ] + LOCAL_INCLUDES += [ + 'bluetooth1', + 'bluetooth1/ipc', + ] + DEFINES['MOZ_B2G_BT_API_V1'] = True + else: SOURCES += [ 'bluetooth2/BluetoothAdapter.cpp', 'bluetooth2/BluetoothClassOfDevice.cpp', @@ -49,24 +67,6 @@ if CONFIG['MOZ_B2G_BT']: 'bluetooth2', 'bluetooth2/ipc', ] - DEFINES['MOZ_B2G_BT_API_V2'] = True - else: - SOURCES += [ - 'bluetooth1/BluetoothAdapter.cpp', - 'bluetooth1/BluetoothDevice.cpp', - 'bluetooth1/BluetoothManager.cpp', - 'bluetooth1/BluetoothProfileController.cpp', - 'bluetooth1/BluetoothPropertyContainer.cpp', - 'bluetooth1/BluetoothReplyRunnable.cpp', - 'bluetooth1/BluetoothService.cpp', - 'bluetooth1/ipc/BluetoothChild.cpp', - 'bluetooth1/ipc/BluetoothParent.cpp', - 'bluetooth1/ipc/BluetoothServiceChildProcess.cpp', - ] - LOCAL_INCLUDES += [ - 'bluetooth1', - 'bluetooth1/ipc', - ] # # Bluetooth backends @@ -130,7 +130,7 @@ if CONFIG['MOZ_B2G_BT']: LOCAL_INCLUDES += [ 'bluedroid/hfp-fallback', ] - if CONFIG['MOZ_B2G_BT_API_V2']: + if not CONFIG['MOZ_B2G_BT_API_V1']: SOURCES += [ 'bluedroid/BluetoothGattManager.cpp', ] @@ -163,7 +163,21 @@ EXPORTS.mozilla.dom.bluetooth += [ 'BluetoothCommon.h' ] -if CONFIG['MOZ_B2G_BT_API_V2']: +if CONFIG['MOZ_B2G_BT_API_V1']: + EXPORTS.mozilla.dom.bluetooth.ipc += [ + 'bluetooth1/ipc/BluetoothMessageUtils.h', + ] + EXPORTS.mozilla.dom.bluetooth += [ + 'bluetooth1/BluetoothAdapter.h', + 'bluetooth1/BluetoothDevice.h', + 'bluetooth1/BluetoothManager.h', + ] + IPDL_SOURCES += [ + 'bluetooth1/ipc/BluetoothTypes.ipdlh', + 'bluetooth1/ipc/PBluetooth.ipdl', + 'bluetooth1/ipc/PBluetoothRequest.ipdl', + ] +else: EXPORTS.mozilla.dom.bluetooth.ipc += [ 'bluetooth2/ipc/BluetoothMessageUtils.h', ] @@ -186,20 +200,6 @@ if CONFIG['MOZ_B2G_BT_API_V2']: 'bluetooth2/ipc/PBluetooth.ipdl', 'bluetooth2/ipc/PBluetoothRequest.ipdl', ] -else: - EXPORTS.mozilla.dom.bluetooth.ipc += [ - 'bluetooth1/ipc/BluetoothMessageUtils.h', - ] - EXPORTS.mozilla.dom.bluetooth += [ - 'bluetooth1/BluetoothAdapter.h', - 'bluetooth1/BluetoothDevice.h', - 'bluetooth1/BluetoothManager.h', - ] - IPDL_SOURCES += [ - 'bluetooth1/ipc/BluetoothTypes.ipdlh', - 'bluetooth1/ipc/PBluetooth.ipdl', - 'bluetooth1/ipc/PBluetoothRequest.ipdl', - ] FAIL_ON_WARNINGS = True diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index 7a4b40a96d26..62e8852dddee 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -162,16 +162,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gonk', 'qt'): if CONFIG['MOZ_TOOLKIT_SEARCH']: DEFINES['MOZ_TOOLKIT_SEARCH'] = True -if CONFIG['MOZ_B2G_BT_API_V2']: - LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth2', - '/dom/bluetooth/bluetooth2/ipc', - ] -else: +if CONFIG['MOZ_B2G_BT_API_V1']: LOCAL_INCLUDES += [ '/dom/bluetooth/bluetooth1', '/dom/bluetooth/bluetooth1/ipc', ] +else: + LOCAL_INCLUDES += [ + '/dom/bluetooth/bluetooth2', + '/dom/bluetooth/bluetooth2/ipc', + ] JAR_MANIFESTS += ['jar.mn'] diff --git a/dom/system/gonk/moz.build b/dom/system/gonk/moz.build index 1bb6ccc4b558..0ebafa13ed5d 100644 --- a/dom/system/gonk/moz.build +++ b/dom/system/gonk/moz.build @@ -125,13 +125,13 @@ LOCAL_INCLUDES += [ '/dom/wifi', ] -if CONFIG['MOZ_B2G_BT_API_V2']: - LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth2', - ] -else: +if CONFIG['MOZ_B2G_BT_API_V1']: LOCAL_INCLUDES += [ '/dom/bluetooth/bluetooth1', ] +else: + LOCAL_INCLUDES += [ + '/dom/bluetooth/bluetooth2', + ] FINAL_LIBRARY = 'xul' diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 4fbe39b5e93b..d89804c25fb3 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -645,7 +645,13 @@ if CONFIG['MOZ_DEBUG']: WEBIDL_FILES += ['TestInterfaceJS.webidl', 'TestInterfaceJSDictionaries.webidl'] if CONFIG['MOZ_B2G_BT']: - if CONFIG['MOZ_B2G_BT_API_V2']: + if CONFIG['MOZ_B2G_BT_API_V1']: + WEBIDL_FILES += [ + 'BluetoothAdapter.webidl', + 'BluetoothDevice.webidl', + 'BluetoothManager.webidl', + ] + else: WEBIDL_FILES += [ 'BluetoothAdapter2.webidl', 'BluetoothClassOfDevice.webidl', @@ -660,12 +666,6 @@ if CONFIG['MOZ_B2G_BT']: 'BluetoothPairingHandle.webidl', 'BluetoothPairingListener.webidl', ] - else: - WEBIDL_FILES += [ - 'BluetoothAdapter.webidl', - 'BluetoothDevice.webidl', - 'BluetoothManager.webidl', - ] if CONFIG['MOZ_SIMPLEPUSH']: WEBIDL_FILES += [ @@ -796,17 +796,17 @@ if CONFIG['MOZ_GAMEPAD']: ] if CONFIG['MOZ_B2G_BT']: - if CONFIG['MOZ_B2G_BT_API_V2']: + if CONFIG['MOZ_B2G_BT_API_V1']: + GENERATED_EVENTS_WEBIDL_FILES += [ + 'BluetoothDiscoveryStateChangedEvent.webidl', + ] + else: GENERATED_EVENTS_WEBIDL_FILES += [ 'BluetoothAdapterEvent.webidl', 'BluetoothAttributeEvent.webidl', 'BluetoothGattCharacteristicEvent.webidl', 'BluetoothPairingEvent.webidl', ] - else: - GENERATED_EVENTS_WEBIDL_FILES += [ - 'BluetoothDiscoveryStateChangedEvent.webidl', - ] GENERATED_EVENTS_WEBIDL_FILES += [ 'BluetoothDeviceEvent.webidl', diff --git a/js/xpconnect/src/moz.build b/js/xpconnect/src/moz.build index 84251e78d7d8..35599ff4a139 100644 --- a/js/xpconnect/src/moz.build +++ b/js/xpconnect/src/moz.build @@ -73,11 +73,11 @@ if CONFIG['MOZ_B2G_BT']: LOCAL_INCLUDES += [ '/dom/bluetooth', ] - if CONFIG['MOZ_B2G_BT_API_V2']: - LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth2', - ] - else: + if CONFIG['MOZ_B2G_BT_API_V1']: LOCAL_INCLUDES += [ '/dom/bluetooth/bluetooth1', ] + else: + LOCAL_INCLUDES += [ + '/dom/bluetooth/bluetooth2', + ] diff --git a/layout/build/moz.build b/layout/build/moz.build index abe45694ce72..493245447abb 100644 --- a/layout/build/moz.build +++ b/layout/build/moz.build @@ -108,13 +108,13 @@ if CONFIG['MOZ_B2G_BT']: LOCAL_INCLUDES += [ '/dom/bluetooth', ] - if CONFIG['MOZ_B2G_BT_API_V2']: + if CONFIG['MOZ_B2G_BT_API_V1']: LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth2', + '/dom/bluetooth/bluetooth1', ] else: LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth1', + '/dom/bluetooth/bluetooth2', ] if CONFIG['MOZ_WEBSPEECH']: From 9439bf4f7577484f22cb1ec8f895b9233400cfcc Mon Sep 17 00:00:00 2001 From: Jocelyn Liu Date: Mon, 15 Jun 2015 17:11:41 +0800 Subject: [PATCH 27/59] Bug 1167064 - Patch2: Touch CLOBBER for switching to bluetooth APIv2. r=shuang --- CLOBBER | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLOBBER b/CLOBBER index 321838d35b03..8e927c5e7ece 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Bug 1165422 - Updated the Android SDK versions +Bug 1167064: Switch to bluetooth APIv2. From ea1bac14b0887fe0c7f7fb3ce41e8b13c830c345 Mon Sep 17 00:00:00 2001 From: Jocelyn Liu Date: Mon, 15 Jun 2015 17:11:47 +0800 Subject: [PATCH 28/59] Bug 1167064 - Patch3: Update mochitests for switching to Bluetooth APIv2. r=bz --- .../mochitest/general/test_interfaces.html | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index 3c11c6e893d7..525b63087813 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -183,17 +183,41 @@ var interfaceNamesInGlobalScope = "BlobEvent", // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BluetoothAdapter", b2g: true, permission: ["bluetooth"]}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "BluetoothAdapterEvent", b2g: true, permission: ["bluetooth"]}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "BluetoothAttributeEvent", b2g: true, permission: ["bluetooth"]}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "BluetoothClassOfDevice", b2g: true, permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BluetoothDevice", b2g: true, permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BluetoothDeviceEvent", b2g: true, permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothDiscoveryStateChangedEvent", b2g: true, + {name: "BluetoothDiscoveryHandle", b2g: true, permission: ["bluetooth"]}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "BluetoothGatt", b2g: true, permission: ["bluetooth"]}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "BluetoothGattCharacteristic", b2g: true, permission: ["bluetooth"]}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "BluetoothGattCharacteristicEvent", b2g: true, + permission: ["bluetooth"]}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "BluetoothGattDescriptor", b2g: true, permission: ["bluetooth"]}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "BluetoothGattService", b2g: true, permission: ["bluetooth"]}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "BluetoothLeDeviceEvent", b2g: true, permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BluetoothManager", b2g: true, permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothStatusChangedEvent", b2g: true, permission: ["bluetooth"]}, + {name: "BluetoothPairingEvent", b2g: true, permission: ["bluetooth"]}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "BluetoothPairingHandle", b2g: true, permission: ["bluetooth"]}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "BluetoothStatusChangedEvent", b2g: true, + permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BoxObject", xbl: true}, // IMPORTANT: Do not change this list without review from a DOM peer! From 4ee09b0f6b3e7ed125f4ff5b1a15b0124bc96ddf Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 02:25:14 -0700 Subject: [PATCH 29/59] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/2bd0396108a3 Author: Rex KM Lee Desc: Merge pull request #30467 from rexboy7/1168043-intro-launch Bug 1168043 - [Stingray][Dashboard] Intro launch animation. r=johnhu ======== https://hg.mozilla.org/integration/gaia-central/rev/b7f28d5ae4d3 Author: Rex Lee Desc: Bug 1168043 - [Stingray][Dashboard] Intro launch animation --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 788a01f0961e..5aa3c674717c 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "70f676b76be30c1185358d6ed4823fba0c343644", + "git_revision": "386bd6b583f5abbc8b5a611f9c86fa8b5606e3e7", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "cb06a058228fe42dd60aaaf05680ec66d22c1c69", + "revision": "2bd0396108a3689d286abd15e13e79ad5bfb2422", "repo_path": "integration/gaia-central" } From 71f261090633917fcd915f0c20b2bf1b809f5d56 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 02:27:11 -0700 Subject: [PATCH 30/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 56e377bc4008..81b7b9851917 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 8a1b2f92a005..fc2b53dcb468 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 775298825df9..74332b82fe06 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 0d0c5d0fb693..9c84b855359b 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index a3f6c5b20a64..846b8ce14b93 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 05793fc190e0..e42288eed917 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 775298825df9..74332b82fe06 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 9d7db7b8c1ad..4d658e5f0b19 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 640368f2d2cb..69f7ca555759 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 7e56efa18845..7e1f8aab9079 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 14aef525e99a56f7e1a2489cef93bddbbb5123fd Mon Sep 17 00:00:00 2001 From: Shawn Huang Date: Mon, 15 Jun 2015 18:58:09 +0800 Subject: [PATCH 31/59] Backed out changesets 43a68ed0bc6a for Bug 1167064 --- .../mochitest/general/test_interfaces.html | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index 525b63087813..3c11c6e893d7 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -183,41 +183,17 @@ var interfaceNamesInGlobalScope = "BlobEvent", // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BluetoothAdapter", b2g: true, permission: ["bluetooth"]}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothAdapterEvent", b2g: true, permission: ["bluetooth"]}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothAttributeEvent", b2g: true, permission: ["bluetooth"]}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothClassOfDevice", b2g: true, permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BluetoothDevice", b2g: true, permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BluetoothDeviceEvent", b2g: true, permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothDiscoveryHandle", b2g: true, permission: ["bluetooth"]}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothGatt", b2g: true, permission: ["bluetooth"]}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothGattCharacteristic", b2g: true, + {name: "BluetoothDiscoveryStateChangedEvent", b2g: true, permission: ["bluetooth"]}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothGattCharacteristicEvent", b2g: true, - permission: ["bluetooth"]}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothGattDescriptor", b2g: true, permission: ["bluetooth"]}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothGattService", b2g: true, permission: ["bluetooth"]}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothLeDeviceEvent", b2g: true, permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BluetoothManager", b2g: true, permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothPairingEvent", b2g: true, permission: ["bluetooth"]}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothPairingHandle", b2g: true, permission: ["bluetooth"]}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BluetoothStatusChangedEvent", b2g: true, - permission: ["bluetooth"]}, + {name: "BluetoothStatusChangedEvent", b2g: true, permission: ["bluetooth"]}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BoxObject", xbl: true}, // IMPORTANT: Do not change this list without review from a DOM peer! From 5580283443cde146b07fcb4ac30655b10d793356 Mon Sep 17 00:00:00 2001 From: Shawn Huang Date: Mon, 15 Jun 2015 19:04:18 +0800 Subject: [PATCH 32/59] Backed out changesets 7e91b61455e9 for Bug 1167064 --- CLOBBER | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLOBBER b/CLOBBER index 8e927c5e7ece..321838d35b03 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Bug 1167064: Switch to bluetooth APIv2. +Bug 1165422 - Updated the Android SDK versions From 434fcb6904d1bf4b80c77d7e1893792fc239bf83 Mon Sep 17 00:00:00 2001 From: Shawn Huang Date: Mon, 15 Jun 2015 19:05:03 +0800 Subject: [PATCH 33/59] Backed out changesets 0832ffdd8144 for Bug 1167064 --- dom/base/moz.build | 6 +- dom/bindings/moz.build | 6 +- dom/bluetooth/BluetoothUtils.cpp | 6 +- .../bluedroid/BluetoothA2dpManager.cpp | 2 +- .../bluedroid/BluetoothServiceBluedroid.cpp | 68 +++++++++--------- .../bluedroid/BluetoothServiceBluedroid.h | 2 +- dom/bluetooth/bluez/BluetoothDBusService.cpp | 62 ++++++++-------- dom/bluetooth/bluez/BluetoothDBusService.h | 8 +-- dom/bluetooth/moz.build | 70 +++++++++---------- dom/ipc/moz.build | 12 ++-- dom/system/gonk/moz.build | 10 +-- dom/webidl/moz.build | 24 +++---- js/xpconnect/src/moz.build | 10 +-- layout/build/moz.build | 6 +- 14 files changed, 146 insertions(+), 146 deletions(-) diff --git a/dom/base/moz.build b/dom/base/moz.build index 2c53048c3d6d..da333ad85598 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -436,13 +436,13 @@ LOCAL_INCLUDES += [ '/xpcom/ds', ] -if CONFIG['MOZ_B2G_BT_API_V1']: +if CONFIG['MOZ_B2G_BT_API_V2']: LOCAL_INCLUDES += [ - '../bluetooth/bluetooth1', + '../bluetooth/bluetooth2', ] else: LOCAL_INCLUDES += [ - '../bluetooth/bluetooth2', + '../bluetooth/bluetooth1', ] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': diff --git a/dom/bindings/moz.build b/dom/bindings/moz.build index 58a4a7e39afb..3d8d5f2660ae 100644 --- a/dom/bindings/moz.build +++ b/dom/bindings/moz.build @@ -91,13 +91,13 @@ if CONFIG['MOZ_AUDIO_CHANNEL_MANAGER']: '/dom/system/gonk', ] -if CONFIG['MOZ_B2G_BT_API_V1']: +if CONFIG['MOZ_B2G_BT_API_V2']: LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth1', + '/dom/bluetooth/bluetooth2', ] else: LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth2', + '/dom/bluetooth/bluetooth1', ] FINAL_LIBRARY = 'xul' diff --git a/dom/bluetooth/BluetoothUtils.cpp b/dom/bluetooth/BluetoothUtils.cpp index ddbe635f1c30..4bad56936c0a 100644 --- a/dom/bluetooth/BluetoothUtils.cpp +++ b/dom/bluetooth/BluetoothUtils.cpp @@ -278,7 +278,7 @@ DispatchReplyError(BluetoothReplyRunnable* aRunnable, MOZ_ASSERT(!aErrorStr.IsEmpty()); // Reply will be deleted by the runnable after running on main thread -#ifndef MOZ_B2G_BT_API_V1 +#if MOZ_B2G_BT_API_V2 BluetoothReply* reply = new BluetoothReply(BluetoothReplyError(STATUS_FAIL, nsString(aErrorStr))); #else @@ -298,7 +298,7 @@ DispatchReplyError(BluetoothReplyRunnable* aRunnable, MOZ_ASSERT(aStatus != STATUS_SUCCESS); // Reply will be deleted by the runnable after running on main thread -#ifndef MOZ_B2G_BT_API_V1 +#if MOZ_B2G_BT_API_V2 BluetoothReply* reply = new BluetoothReply(BluetoothReplyError(aStatus, EmptyString())); #else @@ -325,7 +325,7 @@ DispatchStatusChangedEvent(const nsAString& aType, BluetoothService* bs = BluetoothService::Get(); NS_ENSURE_TRUE_VOID(bs); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 bs->DistributeSignal(aType, NS_LITERAL_STRING(KEY_ADAPTER), data); #else BluetoothSignal signal(nsString(aType), NS_LITERAL_STRING(KEY_ADAPTER), data); diff --git a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp index 07c692873f27..eb406f16661d 100644 --- a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp @@ -1065,7 +1065,7 @@ BluetoothA2dpManager::GetPlayStatusNotification() return; } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 bs->DistributeSignal(NS_LITERAL_STRING(REQUEST_MEDIA_PLAYSTATUS_ID), NS_LITERAL_STRING(KEY_ADAPTER)); #else diff --git a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp index 08eee10cd1f1..03bbe9142f4d 100644 --- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp @@ -19,13 +19,13 @@ #include "BluetoothServiceBluedroid.h" #include "BluetoothA2dpManager.h" -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 #include "BluetoothGattManager.h" #else // TODO: Support GATT #endif #include "BluetoothHfpManager.h" -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 #include "BluetoothHidManager.h" #else // TODO: Support HID @@ -41,7 +41,7 @@ #include "mozilla/StaticMutex.h" #include "mozilla/StaticPtr.h" #include "mozilla/unused.h" -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 #include "nsDataHashtable.h" #endif @@ -63,7 +63,7 @@ } \ } while(0) -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 #define ENSURE_GATT_MGR_IS_READY_VOID(gatt, runnable) \ do { \ @@ -947,7 +947,7 @@ BluetoothServiceBluedroid::StopInternal() } #endif -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 nsresult BluetoothServiceBluedroid::GetAdaptersInternal( BluetoothReplyRunnable* aRunnable) @@ -1039,7 +1039,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 BT_WARNING("GetRemoteDeviceProperties(%s) failed: %d", NS_ConvertUTF16toUTF8(mDeviceAddress).get(), aStatus); @@ -1083,7 +1083,7 @@ BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal( ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 BluetoothProfileManagerBase* profile = BluetoothUuidHelper::GetBluetoothProfileManager(aServiceUuid); if (!profile) { @@ -1148,7 +1148,7 @@ BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal( ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 int requestedDeviceCount = aDeviceAddress.Length(); if (requestedDeviceCount == 0) { DispatchReplySuccess(aRunnable); @@ -1182,7 +1182,7 @@ public: : mRunnable(aRunnable) { } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 void OnError(BluetoothStatus aStatus) override { MOZ_ASSERT(NS_IsMainThread()); @@ -1214,7 +1214,7 @@ BluetoothServiceBluedroid::StartDiscoveryInternal( MOZ_ASSERT(NS_IsMainThread()); ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 sChangeDiscoveryRunnableArray.AppendElement(aRunnable); #else // Missing in bluetooth1 @@ -1231,7 +1231,7 @@ public: : mRunnable(aRunnable) { } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 void OnError(BluetoothStatus aStatus) override { MOZ_ASSERT(NS_IsMainThread()); @@ -1256,7 +1256,7 @@ private: BluetoothReplyRunnable* mRunnable; }; -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 class BluetoothServiceBluedroid::GetRemoteServicesResultHandler final : public BluetoothResultHandler { @@ -1310,7 +1310,7 @@ BluetoothServiceBluedroid::StopDiscoveryInternal( MOZ_ASSERT(NS_IsMainThread()); ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 sChangeDiscoveryRunnableArray.AppendElement(aRunnable); #else // Missing in bluetooth1 @@ -1331,7 +1331,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 sSetPropertyRunnableArray.RemoveElement(mRunnable); DispatchReplyError(mRunnable, aStatus); #else @@ -1388,7 +1388,7 @@ public: void OnError(BluetoothStatus aStatus) override { -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 sBondingRunnableArray.RemoveElement(mRunnable); DispatchReplyError(mRunnable, aStatus); #else @@ -1429,7 +1429,7 @@ public: void OnError(BluetoothStatus aStatus) override { -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 sUnbondingRunnableArray.RemoveElement(mRunnable); DispatchReplyError(mRunnable, aStatus); #else @@ -1458,7 +1458,7 @@ BluetoothServiceBluedroid::RemoveDeviceInternal( return NS_OK; } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 class BluetoothServiceBluedroid::PinReplyResultHandler final : public BluetoothResultHandler { @@ -1540,7 +1540,7 @@ BluetoothServiceBluedroid::SetPinCodeInternal( } #endif -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 void BluetoothServiceBluedroid::SetPasskeyInternal( const nsAString& aDeviceAddress, uint32_t aPasskey, @@ -1558,7 +1558,7 @@ BluetoothServiceBluedroid::SetPasskeyInternal( } #endif -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 class BluetoothServiceBluedroid::SspReplyResultHandler final : public BluetoothResultHandler { @@ -1641,7 +1641,7 @@ BluetoothServiceBluedroid::SetPairingConfirmationInternal( } #endif -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // Missing in bluetooth2 #else bool @@ -1659,7 +1659,7 @@ BluetoothServiceBluedroid::PrepareAdapterInternal() } #endif -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 void BluetoothServiceBluedroid::NextBluetoothProfileController() #else @@ -1679,7 +1679,7 @@ NextBluetoothProfileController() } } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 void BluetoothServiceBluedroid::ConnectDisconnect( bool aConnect, const nsAString& aDeviceAddress, @@ -1728,7 +1728,7 @@ BluetoothServiceBluedroid::Disconnect( ConnectDisconnect(false, aDeviceAddress, aRunnable, aServiceUuid); } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 bool BluetoothServiceBluedroid::IsConnected(uint16_t aProfileId) { @@ -1953,7 +1953,7 @@ BluetoothServiceBluedroid::ToggleCalls(BluetoothReplyRunnable* aRunnable) { } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // Missing in bluetooth2 #else uint16_t @@ -2062,7 +2062,7 @@ public: void BluetoothServiceBluedroid::AdapterStateChangedNotification(bool aState) { -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 MOZ_ASSERT(NS_IsMainThread()); BT_LOGR("BT_STATE: %d", aState); @@ -2235,7 +2235,7 @@ BluetoothServiceBluedroid::AdapterPropertiesNotification( BluetoothStatus aStatus, int aNumProperties, const BluetoothProperty* aProperties) { -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 MOZ_ASSERT(NS_IsMainThread()); InfallibleTArray propertiesArray; @@ -2390,7 +2390,7 @@ BluetoothServiceBluedroid::RemoteDevicePropertiesNotification( BluetoothStatus aStatus, const nsAString& aBdAddr, int aNumProperties, const BluetoothProperty* aProperties) { -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 MOZ_ASSERT(NS_IsMainThread()); InfallibleTArray propertiesArray; @@ -2596,7 +2596,7 @@ void BluetoothServiceBluedroid::DeviceFoundNotification( int aNumProperties, const BluetoothProperty* aProperties) { -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 MOZ_ASSERT(NS_IsMainThread()); BluetoothValue propertyValue; @@ -2684,7 +2684,7 @@ BluetoothServiceBluedroid::DeviceFoundNotification( void BluetoothServiceBluedroid::DiscoveryStateChangedNotification(bool aState) { -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 MOZ_ASSERT(NS_IsMainThread()); sAdapterDiscovering = aState; @@ -2727,7 +2727,7 @@ BluetoothServiceBluedroid::PinRequestNotification(const nsAString& aRemoteBdAddr const nsAString& aBdName, uint32_t aCod) { -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 MOZ_ASSERT(NS_IsMainThread()); InfallibleTArray propertiesArray; @@ -2766,7 +2766,7 @@ BluetoothServiceBluedroid::SspRequestNotification( { MOZ_ASSERT(NS_IsMainThread()); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 InfallibleTArray propertiesArray; nsAutoString passkey; nsAutoString pairingType; @@ -2826,7 +2826,7 @@ BluetoothServiceBluedroid::BondStateChangedNotification( BluetoothStatus aStatus, const nsAString& aRemoteBdAddr, BluetoothBondState aState) { -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 MOZ_ASSERT(NS_IsMainThread()); if (aState == BOND_STATE_BONDING) { @@ -3023,7 +3023,7 @@ BluetoothServiceBluedroid::LeTestModeNotification(BluetoothStatus aStatus, // FIXME: This will be implemented in the later patchset } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // TODO: Support EnergyInfoNotification #else void @@ -3059,7 +3059,7 @@ BluetoothServiceBluedroid::BackendErrorNotification(bool aCrashed) sIsRestart = true; BT_LOGR("Recovery step2: stop bluetooth"); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 StopBluetooth(false, nullptr); #else StopBluetooth(false); diff --git a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h index bdf0c15ed335..b116f0a2bcf9 100644 --- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h +++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h @@ -7,7 +7,7 @@ #ifndef mozilla_dom_bluetooth_bluetoothservicebluedroid_h__ #define mozilla_dom_bluetooth_bluetoothservicebluedroid_h__ -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 #include "BluetoothCommon.h" #include "BluetoothInterface.h" diff --git a/dom/bluetooth/bluez/BluetoothDBusService.cpp b/dom/bluetooth/bluez/BluetoothDBusService.cpp index 11410617b947..7136d9f461ba 100644 --- a/dom/bluetooth/bluez/BluetoothDBusService.cpp +++ b/dom/bluetooth/bluez/BluetoothDBusService.cpp @@ -91,7 +91,7 @@ USING_BLUETOOTH_NAMESPACE #define TIMEOUT_FORCE_TO_DISABLE_BT 5 #define BT_LAZY_THREAD_TIMEOUT_MS 3000 -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // missing on blutooth2 #else // Set Class of Device value bit @@ -149,7 +149,7 @@ public: return true; } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // TODO: This is the wrong place for handling manager classes BluetoothProfileManagerBase* profile; profile = BluetoothHfpManager::Get(); @@ -627,7 +627,7 @@ public: BluetoothService* bs = BluetoothService::Get(); NS_ENSURE_TRUE_VOID(bs); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // Missing in bluetooth2 #else bs->AdapterAddedReceived(); @@ -663,7 +663,7 @@ private: bool mDelay; }; -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // Missing in bluetooth2 #else class InternalStopDiscoveryTask : public nsRunnable @@ -918,7 +918,7 @@ HasAudioService(uint32_t aCodValue) return ((aCodValue & 0x200000) == 0x200000); } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 static bool ContainsIcon(const InfallibleTArray& aProperties) { @@ -1782,7 +1782,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 BluetoothService* bs = BluetoothService::Get(); NS_ENSURE_TRUE(bs, NS_ERROR_FAILURE); @@ -1886,7 +1886,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData) BluetoothNamedValue(NS_LITERAL_STRING("Path"), GetObjectPathFromAddress(signalPath, address))); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 if (!ContainsIcon(properties)) { #else if (FindProperty(properties, "Icon") < 0) { @@ -1908,7 +1908,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData) } } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // Missing in bluetooth2 #else if (FindProperty(properties, "Class") < 0) { @@ -1987,7 +1987,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData) sAdapterProperties, ArrayLength(sAdapterProperties)); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // Missing in bluetooth2 #else BluetoothNamedValue& property = v.get_ArrayOfBluetoothNamedValue()[0]; @@ -2020,7 +2020,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData) // "bluetooth-pairedstatuschanged" from BluetoothService. BluetoothValue newValue(v); ToLowerCase(newValue.get_ArrayOfBluetoothNamedValue()[0].name()); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 BluetoothSignal signal(NS_LITERAL_STRING("pairedstatuschanged"), NS_LITERAL_STRING(KEY_LOCAL_AGENT), newValue); @@ -2294,7 +2294,7 @@ public: } }; -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 nsresult BluetoothDBusService::StartInternal(BluetoothReplyRunnable* aRunnable) { @@ -2429,7 +2429,7 @@ public: } }; -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 nsresult BluetoothDBusService::StopInternal(BluetoothReplyRunnable* aRunnable) { @@ -2587,7 +2587,7 @@ private: nsRefPtr mRunnable; }; -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 nsresult BluetoothDBusService::GetAdaptersInternal(BluetoothReplyRunnable* aRunnable) { @@ -2639,7 +2639,7 @@ OnSendDiscoveryMessageReply(DBusMessage *aReply, void *aData) errorStr.AssignLiteral("SendDiscovery failed"); } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // Missing in blueooth2 #else // aData may be a nullptr because we may call StopDiscovery internally when @@ -2672,7 +2672,7 @@ public: , mRunnable(aRunnable) { MOZ_ASSERT(!mMessageName.IsEmpty()); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 MOZ_ASSERT(mRunnable); #else // Missing in bluetooth1 @@ -2710,7 +2710,7 @@ BluetoothDBusService::SendDiscoveryMessage(const char* aMessageName, MOZ_ASSERT(!sAdapterPath.IsEmpty()); if (!IsReady()) { -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 NS_NAMED_LITERAL_STRING(errorStr, "Bluetooth service is not ready yet!"); DispatchBluetoothReply(aRunnable, BluetoothValue(), errorStr); #else @@ -2910,7 +2910,7 @@ public: // Icon as audio-card. This is for PTS test TC_AG_COD_BV_02_I. // As HFP specification defined that // service class is "Audio" can be considered as HFP AG. -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 if (!ContainsIcon(devicePropertiesArray)) { #else if (FindProperty(devicePropertiesArray, "Icon") < 0) { @@ -2928,7 +2928,7 @@ public: } } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // Missing in bluetooth2 #else // Check whether the properties array contains CoD. If it doesn't, fallback to restore @@ -3111,7 +3111,7 @@ BluetoothDBusService::GetPairedDevicePropertiesInternal( return NS_OK; } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 nsresult BluetoothDBusService::FetchUuidsInternal(const nsAString& aDeviceAddress, BluetoothReplyRunnable* aRunnable) @@ -3496,7 +3496,7 @@ private: nsRefPtr mRunnable; }; -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 void BluetoothDBusService::PinReplyInternal( const nsAString& aDeviceAddress, bool aAccept, @@ -3601,7 +3601,7 @@ private: nsRefPtr mRunnable; }; -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 void BluetoothDBusService::SetPasskeyInternal(const nsAString& aDeviceAddress, uint32_t aPasskey, @@ -3627,7 +3627,7 @@ BluetoothDBusService::SetPasskeyInternal(const nsAString& aDeviceAddress, } #endif -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 void BluetoothDBusService::SetPairingConfirmationInternal( const nsAString& aDeviceAddress, @@ -3714,7 +3714,7 @@ BluetoothDBusService::Disconnect(const nsAString& aDeviceAddress, ConnectDisconnect(false, aDeviceAddress, aRunnable, aServiceUuid); } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 bool BluetoothDBusService::IsConnected(const uint16_t aServiceUuid) { @@ -3787,7 +3787,7 @@ BluetoothDBusService::ToggleCalls(BluetoothReplyRunnable* aRunnable) class OnUpdateSdpRecordsRunnable : public nsRunnable { public: -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 OnUpdateSdpRecordsRunnable(const nsAString& aObjectPath, BluetoothProfileManagerBase* aManager) : mManager(aManager) @@ -3818,7 +3818,7 @@ public: return NS_OK; } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // Missing in bluetooth2 #else void @@ -4013,7 +4013,7 @@ public: MOZ_ASSERT(sDBusConnection); MOZ_ASSERT(!sAdapterPath.IsEmpty()); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 const nsString objectPath = GetObjectPathFromAddress(sAdapterPath, mDeviceAddress); @@ -4055,7 +4055,7 @@ public: } protected: -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 // Missing in bluetooth2 #else static void CreateDeviceCallback(DBusMessage* aMsg, void* aData) @@ -4096,7 +4096,7 @@ protected: { MOZ_ASSERT(!NS_IsMainThread()); // I/O thread -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 nsRefPtr r( static_cast(aData)); NS_DispatchToMainThread(r); @@ -4124,7 +4124,7 @@ BluetoothDBusService::UpdateSdpRecords(const nsAString& aDeviceAddress, { MOZ_ASSERT(NS_IsMainThread()); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 Task* task = new UpdateSdpRecordsTask(aDeviceAddress, aManager); DispatchToDBusThread(task); #else @@ -4379,7 +4379,7 @@ BluetoothDBusService::SendMetaData(const nsAString& aTitle, a2dp->GetTitle(prevTitle); a2dp->GetAlbum(prevAlbum); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 uint64_t mediaNumber = static_cast(aMediaNumber); if (mediaNumber != a2dp->GetMediaNumber() || !aTitle.Equals(prevTitle) || @@ -4690,7 +4690,7 @@ BluetoothDBusService::UpdateNotification(ControlEventId aEventId, DispatchToDBusThread(task); } -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 void BluetoothDBusService::StartLeScanInternal( const nsTArray& aServiceUuids, diff --git a/dom/bluetooth/bluez/BluetoothDBusService.h b/dom/bluetooth/bluez/BluetoothDBusService.h index d11d14a19875..c52f39427715 100644 --- a/dom/bluetooth/bluez/BluetoothDBusService.h +++ b/dom/bluetooth/bluez/BluetoothDBusService.h @@ -47,7 +47,7 @@ public: bool IsReady(); -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 virtual nsresult StartInternal(BluetoothReplyRunnable* aRunnable) override; virtual nsresult StopInternal(BluetoothReplyRunnable* aRunnable) override; @@ -109,7 +109,7 @@ public: RemoveDeviceInternal(const nsAString& aDeviceObjectPath, BluetoothReplyRunnable* aRunnable) override; -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 virtual void PinReplyInternal(const nsAString& aDeviceAddress, bool aAccept, @@ -153,7 +153,7 @@ public: uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable) override; -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 virtual bool IsConnected(uint16_t aServiceUuid) override; #else @@ -233,7 +233,7 @@ public: SendInputMessage(const nsAString& aDeviceAddresses, const nsAString& aMessage) override; -#ifndef MOZ_B2G_BT_API_V1 +#ifdef MOZ_B2G_BT_API_V2 virtual void StartLeScanInternal(const nsTArray& aServiceUuids, BluetoothReplyRunnable* aRunnable) override; diff --git a/dom/bluetooth/moz.build b/dom/bluetooth/moz.build index 1ad464c257ef..7a00e711eb23 100644 --- a/dom/bluetooth/moz.build +++ b/dom/bluetooth/moz.build @@ -24,25 +24,7 @@ if CONFIG['MOZ_B2G_BT']: 'BluetoothRilListener.cpp' ] - if CONFIG['MOZ_B2G_BT_API_V1']: - SOURCES += [ - 'bluetooth1/BluetoothAdapter.cpp', - 'bluetooth1/BluetoothDevice.cpp', - 'bluetooth1/BluetoothManager.cpp', - 'bluetooth1/BluetoothProfileController.cpp', - 'bluetooth1/BluetoothPropertyContainer.cpp', - 'bluetooth1/BluetoothReplyRunnable.cpp', - 'bluetooth1/BluetoothService.cpp', - 'bluetooth1/ipc/BluetoothChild.cpp', - 'bluetooth1/ipc/BluetoothParent.cpp', - 'bluetooth1/ipc/BluetoothServiceChildProcess.cpp', - ] - LOCAL_INCLUDES += [ - 'bluetooth1', - 'bluetooth1/ipc', - ] - DEFINES['MOZ_B2G_BT_API_V1'] = True - else: + if CONFIG['MOZ_B2G_BT_API_V2']: SOURCES += [ 'bluetooth2/BluetoothAdapter.cpp', 'bluetooth2/BluetoothClassOfDevice.cpp', @@ -67,6 +49,24 @@ if CONFIG['MOZ_B2G_BT']: 'bluetooth2', 'bluetooth2/ipc', ] + DEFINES['MOZ_B2G_BT_API_V2'] = True + else: + SOURCES += [ + 'bluetooth1/BluetoothAdapter.cpp', + 'bluetooth1/BluetoothDevice.cpp', + 'bluetooth1/BluetoothManager.cpp', + 'bluetooth1/BluetoothProfileController.cpp', + 'bluetooth1/BluetoothPropertyContainer.cpp', + 'bluetooth1/BluetoothReplyRunnable.cpp', + 'bluetooth1/BluetoothService.cpp', + 'bluetooth1/ipc/BluetoothChild.cpp', + 'bluetooth1/ipc/BluetoothParent.cpp', + 'bluetooth1/ipc/BluetoothServiceChildProcess.cpp', + ] + LOCAL_INCLUDES += [ + 'bluetooth1', + 'bluetooth1/ipc', + ] # # Bluetooth backends @@ -130,7 +130,7 @@ if CONFIG['MOZ_B2G_BT']: LOCAL_INCLUDES += [ 'bluedroid/hfp-fallback', ] - if not CONFIG['MOZ_B2G_BT_API_V1']: + if CONFIG['MOZ_B2G_BT_API_V2']: SOURCES += [ 'bluedroid/BluetoothGattManager.cpp', ] @@ -163,21 +163,7 @@ EXPORTS.mozilla.dom.bluetooth += [ 'BluetoothCommon.h' ] -if CONFIG['MOZ_B2G_BT_API_V1']: - EXPORTS.mozilla.dom.bluetooth.ipc += [ - 'bluetooth1/ipc/BluetoothMessageUtils.h', - ] - EXPORTS.mozilla.dom.bluetooth += [ - 'bluetooth1/BluetoothAdapter.h', - 'bluetooth1/BluetoothDevice.h', - 'bluetooth1/BluetoothManager.h', - ] - IPDL_SOURCES += [ - 'bluetooth1/ipc/BluetoothTypes.ipdlh', - 'bluetooth1/ipc/PBluetooth.ipdl', - 'bluetooth1/ipc/PBluetoothRequest.ipdl', - ] -else: +if CONFIG['MOZ_B2G_BT_API_V2']: EXPORTS.mozilla.dom.bluetooth.ipc += [ 'bluetooth2/ipc/BluetoothMessageUtils.h', ] @@ -200,6 +186,20 @@ else: 'bluetooth2/ipc/PBluetooth.ipdl', 'bluetooth2/ipc/PBluetoothRequest.ipdl', ] +else: + EXPORTS.mozilla.dom.bluetooth.ipc += [ + 'bluetooth1/ipc/BluetoothMessageUtils.h', + ] + EXPORTS.mozilla.dom.bluetooth += [ + 'bluetooth1/BluetoothAdapter.h', + 'bluetooth1/BluetoothDevice.h', + 'bluetooth1/BluetoothManager.h', + ] + IPDL_SOURCES += [ + 'bluetooth1/ipc/BluetoothTypes.ipdlh', + 'bluetooth1/ipc/PBluetooth.ipdl', + 'bluetooth1/ipc/PBluetoothRequest.ipdl', + ] FAIL_ON_WARNINGS = True diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index 62e8852dddee..7a4b40a96d26 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -162,16 +162,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gonk', 'qt'): if CONFIG['MOZ_TOOLKIT_SEARCH']: DEFINES['MOZ_TOOLKIT_SEARCH'] = True -if CONFIG['MOZ_B2G_BT_API_V1']: - LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth1', - '/dom/bluetooth/bluetooth1/ipc', - ] -else: +if CONFIG['MOZ_B2G_BT_API_V2']: LOCAL_INCLUDES += [ '/dom/bluetooth/bluetooth2', '/dom/bluetooth/bluetooth2/ipc', ] +else: + LOCAL_INCLUDES += [ + '/dom/bluetooth/bluetooth1', + '/dom/bluetooth/bluetooth1/ipc', + ] JAR_MANIFESTS += ['jar.mn'] diff --git a/dom/system/gonk/moz.build b/dom/system/gonk/moz.build index 0ebafa13ed5d..1bb6ccc4b558 100644 --- a/dom/system/gonk/moz.build +++ b/dom/system/gonk/moz.build @@ -125,13 +125,13 @@ LOCAL_INCLUDES += [ '/dom/wifi', ] -if CONFIG['MOZ_B2G_BT_API_V1']: - LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth1', - ] -else: +if CONFIG['MOZ_B2G_BT_API_V2']: LOCAL_INCLUDES += [ '/dom/bluetooth/bluetooth2', ] +else: + LOCAL_INCLUDES += [ + '/dom/bluetooth/bluetooth1', + ] FINAL_LIBRARY = 'xul' diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index d89804c25fb3..4fbe39b5e93b 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -645,13 +645,7 @@ if CONFIG['MOZ_DEBUG']: WEBIDL_FILES += ['TestInterfaceJS.webidl', 'TestInterfaceJSDictionaries.webidl'] if CONFIG['MOZ_B2G_BT']: - if CONFIG['MOZ_B2G_BT_API_V1']: - WEBIDL_FILES += [ - 'BluetoothAdapter.webidl', - 'BluetoothDevice.webidl', - 'BluetoothManager.webidl', - ] - else: + if CONFIG['MOZ_B2G_BT_API_V2']: WEBIDL_FILES += [ 'BluetoothAdapter2.webidl', 'BluetoothClassOfDevice.webidl', @@ -666,6 +660,12 @@ if CONFIG['MOZ_B2G_BT']: 'BluetoothPairingHandle.webidl', 'BluetoothPairingListener.webidl', ] + else: + WEBIDL_FILES += [ + 'BluetoothAdapter.webidl', + 'BluetoothDevice.webidl', + 'BluetoothManager.webidl', + ] if CONFIG['MOZ_SIMPLEPUSH']: WEBIDL_FILES += [ @@ -796,17 +796,17 @@ if CONFIG['MOZ_GAMEPAD']: ] if CONFIG['MOZ_B2G_BT']: - if CONFIG['MOZ_B2G_BT_API_V1']: - GENERATED_EVENTS_WEBIDL_FILES += [ - 'BluetoothDiscoveryStateChangedEvent.webidl', - ] - else: + if CONFIG['MOZ_B2G_BT_API_V2']: GENERATED_EVENTS_WEBIDL_FILES += [ 'BluetoothAdapterEvent.webidl', 'BluetoothAttributeEvent.webidl', 'BluetoothGattCharacteristicEvent.webidl', 'BluetoothPairingEvent.webidl', ] + else: + GENERATED_EVENTS_WEBIDL_FILES += [ + 'BluetoothDiscoveryStateChangedEvent.webidl', + ] GENERATED_EVENTS_WEBIDL_FILES += [ 'BluetoothDeviceEvent.webidl', diff --git a/js/xpconnect/src/moz.build b/js/xpconnect/src/moz.build index 35599ff4a139..84251e78d7d8 100644 --- a/js/xpconnect/src/moz.build +++ b/js/xpconnect/src/moz.build @@ -73,11 +73,11 @@ if CONFIG['MOZ_B2G_BT']: LOCAL_INCLUDES += [ '/dom/bluetooth', ] - if CONFIG['MOZ_B2G_BT_API_V1']: - LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth1', - ] - else: + if CONFIG['MOZ_B2G_BT_API_V2']: LOCAL_INCLUDES += [ '/dom/bluetooth/bluetooth2', ] + else: + LOCAL_INCLUDES += [ + '/dom/bluetooth/bluetooth1', + ] diff --git a/layout/build/moz.build b/layout/build/moz.build index 493245447abb..abe45694ce72 100644 --- a/layout/build/moz.build +++ b/layout/build/moz.build @@ -108,13 +108,13 @@ if CONFIG['MOZ_B2G_BT']: LOCAL_INCLUDES += [ '/dom/bluetooth', ] - if CONFIG['MOZ_B2G_BT_API_V1']: + if CONFIG['MOZ_B2G_BT_API_V2']: LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth1', + '/dom/bluetooth/bluetooth2', ] else: LOCAL_INCLUDES += [ - '/dom/bluetooth/bluetooth2', + '/dom/bluetooth/bluetooth1', ] if CONFIG['MOZ_WEBSPEECH']: From edf19a3ee1c2b05f7a72a71f63c95e6ef768e0bd Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 04:09:10 -0700 Subject: [PATCH 34/59] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/dba91d7dd983 Author: Evan Tseng Desc: Merge pull request #30173 from evanxd/bug-1167077 Bug 1167077 - Set all audio channels belonged to System app as muted r=alive ======== https://hg.mozilla.org/integration/gaia-central/rev/b8a4227d222b Author: Evan Xd Desc: Bug 1167077 - Set all audio channels belonged to System app as muted r=alive --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 5aa3c674717c..5f8756f53168 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "386bd6b583f5abbc8b5a611f9c86fa8b5606e3e7", + "git_revision": "bc730eae6a2489a2b5c345b838bb7a1dae9c6477", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "2bd0396108a3689d286abd15e13e79ad5bfb2422", + "revision": "dba91d7dd983b84e1b0cea48c57b948245153989", "repo_path": "integration/gaia-central" } From aee2ad522f0a3deaed27192aa79a1aad32f54cd1 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 04:09:30 -0700 Subject: [PATCH 35/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 81b7b9851917..8deb97b8e36d 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index fc2b53dcb468..b27dd318e0bd 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 74332b82fe06..bfa20afb7fcd 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 9c84b855359b..4398da23cbdb 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 846b8ce14b93..f6e2bc620ca9 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index e42288eed917..6625c9863d45 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 74332b82fe06..bfa20afb7fcd 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 4d658e5f0b19..4b4bdd984be6 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 69f7ca555759..1eabf3970e51 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 7e1f8aab9079..674e2b5dcea9 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 68a3ee2bc1b92c01bca11ca405372f53cbcb3d1d Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 04:20:22 -0700 Subject: [PATCH 36/59] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/25a0fc194099 Author: Arthur Chen Desc: Merge pull request #30585 from crh0716/1166909 Bug 1166909 - Remove the anchor element r=eragonj ======== https://hg.mozilla.org/integration/gaia-central/rev/ce341ef1c3ad Author: Arthur Chen Desc: Bug 1166909 - Remove the anchor element --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 5f8756f53168..db18ca91d58c 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "bc730eae6a2489a2b5c345b838bb7a1dae9c6477", + "git_revision": "5e208c43c10b25d79fd7134f690024f167a12d8f", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "dba91d7dd983b84e1b0cea48c57b948245153989", + "revision": "25a0fc19409970915dd978e46e3b7c251bd04999", "repo_path": "integration/gaia-central" } From a14292cd2ad719ea39012e58d899c11385c59d72 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 04:22:21 -0700 Subject: [PATCH 37/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 8deb97b8e36d..b72f2381187d 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index b27dd318e0bd..f8d329aa37e8 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index bfa20afb7fcd..20118494b1fb 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 4398da23cbdb..372493d46132 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index f6e2bc620ca9..07bcccee4ac3 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 6625c9863d45..d46f3c040690 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index bfa20afb7fcd..20118494b1fb 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 4b4bdd984be6..542b315d40ac 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 1eabf3970e51..01d442e77c81 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 674e2b5dcea9..e97a7d7bcebf 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From d64075980d05ec969efafb80f9f89a34ae506717 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 04:36:21 -0700 Subject: [PATCH 38/59] Bumping gaia.json for 3 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/fbb9918f7033 Author: Dale Harvey Desc: Bug 1168915 - Ensure default status bar is light theme. r=alive ======== https://hg.mozilla.org/integration/gaia-central/rev/84d56ade180c Author: albertopq Desc: Merge pull request #30530 from albertopq/1171563-landscape-apps Bug 1171563 - Lock orientation on SIM dialogs r=mhenretty ======== https://hg.mozilla.org/integration/gaia-central/rev/7a733a566a85 Author: albertopq Desc: Bug 1171563 - Lock orientation on SIM dialogs --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index db18ca91d58c..274edbe31e8d 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "5e208c43c10b25d79fd7134f690024f167a12d8f", + "git_revision": "41314de6a43aec60539f0679f0c03103403ea926", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "25a0fc19409970915dd978e46e3b7c251bd04999", + "revision": "fbb9918f70331f7abd862c0175a5e31787104900", "repo_path": "integration/gaia-central" } From 74d4fb35f5b88611c47592ecfd828fe52133bf87 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 04:38:17 -0700 Subject: [PATCH 39/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index b72f2381187d..b6dda60e4ea3 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index f8d329aa37e8..cf71f5e89e70 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 20118494b1fb..64c612c1cd19 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 372493d46132..76f9d275fea4 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 07bcccee4ac3..1c28ecece624 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index d46f3c040690..9d8b40587762 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 20118494b1fb..64c612c1cd19 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 542b315d40ac..dab94278a1de 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 01d442e77c81..ac4a645ea9cb 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index e97a7d7bcebf..afc17542f6eb 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From de38317b092dab96ea6d6c479fb1a8014df3548a Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 15 Jun 2015 14:44:03 +0200 Subject: [PATCH 40/59] Bug 1171017: Rename |BluetoothDaemonConnectionConsumer| to |DaemonSocketConsumer|, r=shuang --- dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp | 2 +- dom/bluetooth/bluedroid/BluetoothDaemonInterface.h | 4 ++-- ipc/bluetooth/BluetoothDaemonConnection.cpp | 2 +- ipc/bluetooth/BluetoothDaemonConnection.h | 6 +++--- ipc/bluetooth/BluetoothDaemonConnectionConsumer.cpp | 6 +++--- ipc/bluetooth/BluetoothDaemonConnectionConsumer.h | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp index d1de652ad452..b921a2afb5b8 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp @@ -2321,7 +2321,7 @@ BluetoothDaemonInterface::GetBluetoothGattInterface() return mGattInterface; } -// |BluetoothDaemonConnectionConsumer|, |ListenSocketConsumer| +// |DaemonSocketConsumer|, |ListenSocketConsumer| void BluetoothDaemonInterface::OnConnectSuccess(int aIndex) diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h index 681dcddb4bfb..5f624757fd34 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h @@ -31,7 +31,7 @@ class BluetoothDaemonSocketInterface; class BluetoothDaemonInterface final : public BluetoothInterface - , public mozilla::ipc::BluetoothDaemonConnectionConsumer + , public mozilla::ipc::DaemonSocketConsumer , public mozilla::ipc::ListenSocketConsumer { public: @@ -143,7 +143,7 @@ protected: unsigned long aPostfixLength, nsACString& aAddress); - // Methods for |BluetoothDaemonConnectionConsumer| and |ListenSocketConsumer| + // Methods for |DaemonSocketConsumer| and |ListenSocketConsumer| // void OnConnectSuccess(int aIndex) override; diff --git a/ipc/bluetooth/BluetoothDaemonConnection.cpp b/ipc/bluetooth/BluetoothDaemonConnection.cpp index 96550eceb64e..c1225da15c14 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.cpp +++ b/ipc/bluetooth/BluetoothDaemonConnection.cpp @@ -344,7 +344,7 @@ BluetoothDaemonConnectionIO::ShutdownOnIOThread() BluetoothDaemonConnection::BluetoothDaemonConnection( BluetoothDaemonPDUConsumer* aPDUConsumer, - BluetoothDaemonConnectionConsumer* aConsumer, + DaemonSocketConsumer* aConsumer, int aIndex) : mIO(nullptr) , mPDUConsumer(aPDUConsumer) diff --git a/ipc/bluetooth/BluetoothDaemonConnection.h b/ipc/bluetooth/BluetoothDaemonConnection.h index cccc3e68b134..c5f488cdc090 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.h +++ b/ipc/bluetooth/BluetoothDaemonConnection.h @@ -17,7 +17,7 @@ class MessageLoop; namespace mozilla { namespace ipc { -class BluetoothDaemonConnectionConsumer; +class DaemonSocketConsumer; class BluetoothDaemonConnectionIO; class BluetoothDaemonPDUConsumer; @@ -118,7 +118,7 @@ class BluetoothDaemonConnection : public ConnectionOrientedSocket { public: BluetoothDaemonConnection(BluetoothDaemonPDUConsumer* aPDUConsumer, - BluetoothDaemonConnectionConsumer* aConsumer, + DaemonSocketConsumer* aConsumer, int aIndex); virtual ~BluetoothDaemonConnection(); @@ -146,7 +146,7 @@ public: private: BluetoothDaemonConnectionIO* mIO; BluetoothDaemonPDUConsumer* mPDUConsumer; - BluetoothDaemonConnectionConsumer* mConsumer; + DaemonSocketConsumer* mConsumer; int mIndex; }; diff --git a/ipc/bluetooth/BluetoothDaemonConnectionConsumer.cpp b/ipc/bluetooth/BluetoothDaemonConnectionConsumer.cpp index fe9e4462928b..7cf2626fe28d 100644 --- a/ipc/bluetooth/BluetoothDaemonConnectionConsumer.cpp +++ b/ipc/bluetooth/BluetoothDaemonConnectionConsumer.cpp @@ -10,13 +10,13 @@ namespace mozilla { namespace ipc { // -// BluetoothDaemonConnectionConsumer +// DaemonSocketConsumer // -BluetoothDaemonConnectionConsumer::BluetoothDaemonConnectionConsumer() +DaemonSocketConsumer::DaemonSocketConsumer() { } -BluetoothDaemonConnectionConsumer::~BluetoothDaemonConnectionConsumer() +DaemonSocketConsumer::~DaemonSocketConsumer() { } } diff --git a/ipc/bluetooth/BluetoothDaemonConnectionConsumer.h b/ipc/bluetooth/BluetoothDaemonConnectionConsumer.h index 99cc21a90fd1..7791b60fb18b 100644 --- a/ipc/bluetooth/BluetoothDaemonConnectionConsumer.h +++ b/ipc/bluetooth/BluetoothDaemonConnectionConsumer.h @@ -16,9 +16,9 @@ namespace mozilla { namespace ipc { /* - * |BluetoothDaemonConnectionConsumer| handles socket events. + * |DaemonSocketConsumer| handles socket events. */ -class BluetoothDaemonConnectionConsumer +class DaemonSocketConsumer { public: /** @@ -43,8 +43,8 @@ public: virtual void OnDisconnect(int aIndex) = 0; protected: - BluetoothDaemonConnectionConsumer(); - virtual ~BluetoothDaemonConnectionConsumer(); + DaemonSocketConsumer(); + virtual ~DaemonSocketConsumer(); }; } From 4a2cc0e2171efda64f933015c5164328f15ada5c Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 15 Jun 2015 14:44:03 +0200 Subject: [PATCH 41/59] Bug 1171017: Rename |BluetoothDaemonPDUConsumer| to |DaemonSocketIOConsumer|, r=shuang --- .../bluedroid/BluetoothDaemonInterface.cpp | 4 ++-- ipc/bluetooth/BluetoothDaemonConnection.cpp | 18 ++++++++--------- ipc/bluetooth/BluetoothDaemonConnection.h | 20 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp index b921a2afb5b8..d1013d02a191 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp @@ -1404,7 +1404,7 @@ const int BluetoothDaemonCoreModule::MAX_NUM_CLIENTS = 1; // |UnregisterModule| works like |RegisterModule|, but for cleanups. // // |BluetoothDaemonProtocol| also handles PDU receiving. It implements -// the method |Handle| from |BluetoothDaemonPDUConsumer|. The socket +// the method |Handle| from |DaemonSocketIOConsumer|. The socket // connections of type |BluetoothDaemonConnection| invoke this method // to forward received PDUs for processing by higher layers. The // implementation of |Handle| checks the service id of the PDU and @@ -1427,7 +1427,7 @@ const int BluetoothDaemonCoreModule::MAX_NUM_CLIENTS = 1; // PDUs into a module. // class BluetoothDaemonProtocol final - : public BluetoothDaemonPDUConsumer + : public DaemonSocketIOConsumer , public BluetoothDaemonSetupModule , public BluetoothDaemonCoreModule , public BluetoothDaemonSocketModule diff --git a/ipc/bluetooth/BluetoothDaemonConnection.cpp b/ipc/bluetooth/BluetoothDaemonConnection.cpp index c1225da15c14..56f7cb9bcdba 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.cpp +++ b/ipc/bluetooth/BluetoothDaemonConnection.cpp @@ -198,13 +198,13 @@ BluetoothDaemonPDU::OnError(const char* aFunction, int aErrno) } // -// BluetoothDaemonPDUConsumer +// DaemonSocketIOConsumer // -BluetoothDaemonPDUConsumer::BluetoothDaemonPDUConsumer() +DaemonSocketIOConsumer::DaemonSocketIOConsumer() { } -BluetoothDaemonPDUConsumer::~BluetoothDaemonPDUConsumer() +DaemonSocketIOConsumer::~DaemonSocketIOConsumer() { } // @@ -219,7 +219,7 @@ public: int aFd, ConnectionStatus aConnectionStatus, UnixSocketConnector* aConnector, BluetoothDaemonConnection* aConnection, - BluetoothDaemonPDUConsumer* aConsumer); + DaemonSocketIOConsumer* aConsumer); // Methods for |DataSocketIO| // @@ -241,7 +241,7 @@ public: private: BluetoothDaemonConnection* mConnection; - BluetoothDaemonPDUConsumer* mConsumer; + DaemonSocketIOConsumer* mConsumer; nsAutoPtr mPDU; bool mShuttingDownOnIOThread; }; @@ -253,7 +253,7 @@ BluetoothDaemonConnectionIO::BluetoothDaemonConnectionIO( ConnectionStatus aConnectionStatus, UnixSocketConnector* aConnector, BluetoothDaemonConnection* aConnection, - BluetoothDaemonPDUConsumer* aConsumer) + DaemonSocketIOConsumer* aConsumer) : ConnectionOrientedSocketIO(aConsumerLoop, aIOLoop, aFd, @@ -343,11 +343,11 @@ BluetoothDaemonConnectionIO::ShutdownOnIOThread() // BluetoothDaemonConnection::BluetoothDaemonConnection( - BluetoothDaemonPDUConsumer* aPDUConsumer, + DaemonSocketIOConsumer* aIOConsumer, DaemonSocketConsumer* aConsumer, int aIndex) : mIO(nullptr) - , mPDUConsumer(aPDUConsumer) + , mIOConsumer(aIOConsumer) , mConsumer(aConsumer) , mIndex(aIndex) { @@ -371,7 +371,7 @@ BluetoothDaemonConnection::PrepareAccept(UnixSocketConnector* aConnector, mIO = new BluetoothDaemonConnectionIO( aConsumerLoop, aIOLoop, -1, UnixSocketWatcher::SOCKET_IS_CONNECTING, - aConnector, this, mPDUConsumer); + aConnector, this, mIOConsumer); aIO = mIO; return NS_OK; diff --git a/ipc/bluetooth/BluetoothDaemonConnection.h b/ipc/bluetooth/BluetoothDaemonConnection.h index c5f488cdc090..0a7015a81b43 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.h +++ b/ipc/bluetooth/BluetoothDaemonConnection.h @@ -19,7 +19,7 @@ namespace ipc { class DaemonSocketConsumer; class BluetoothDaemonConnectionIO; -class BluetoothDaemonPDUConsumer; +class DaemonSocketIOConsumer; /* * |BlutoothDaemonPDU| represents a single PDU that is transfered from or to @@ -58,7 +58,7 @@ public: BluetoothDaemonPDU(size_t aPayloadSize); ~BluetoothDaemonPDU(); - void SetConsumer(BluetoothDaemonPDUConsumer* aConsumer) + void SetConsumer(DaemonSocketIOConsumer* aConsumer) { mConsumer = aConsumer; } @@ -87,37 +87,37 @@ private: size_t GetPayloadSize() const; void OnError(const char* aFunction, int aErrno); - BluetoothDaemonPDUConsumer* mConsumer; + DaemonSocketIOConsumer* mConsumer; void* mUserData; ScopedClose mReceivedFd; }; /* - * |BluetoothDaemonPDUConsumer| processes incoming PDUs from the Bluetooth + * |DaemonSocketIOConsumer| processes incoming PDUs from the Bluetooth * daemon. Please note that its method |Handle| runs on a different than the * consumer thread. */ -class BluetoothDaemonPDUConsumer +class DaemonSocketIOConsumer { public: - virtual ~BluetoothDaemonPDUConsumer(); + virtual ~DaemonSocketIOConsumer(); virtual void Handle(BluetoothDaemonPDU& aPDU) = 0; virtual void StoreUserData(const BluetoothDaemonPDU& aPDU) = 0; protected: - BluetoothDaemonPDUConsumer(); + DaemonSocketIOConsumer(); }; /* * |BluetoothDaemonConnection| represents the socket to connect to the * Bluetooth daemon. It offers connection establishment and sending - * PDUs. PDU receiving is performed by |BluetoothDaemonPDUConsumer|. + * PDUs. PDU receiving is performed by |DaemonSocketIOConsumer|. */ class BluetoothDaemonConnection : public ConnectionOrientedSocket { public: - BluetoothDaemonConnection(BluetoothDaemonPDUConsumer* aPDUConsumer, + BluetoothDaemonConnection(DaemonSocketIOConsumer* aIOConsumer, DaemonSocketConsumer* aConsumer, int aIndex); virtual ~BluetoothDaemonConnection(); @@ -145,7 +145,7 @@ public: private: BluetoothDaemonConnectionIO* mIO; - BluetoothDaemonPDUConsumer* mPDUConsumer; + DaemonSocketIOConsumer* mIOConsumer; DaemonSocketConsumer* mConsumer; int mIndex; }; From 160760d61d9d89671f58d482da029e9982160935 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 15 Jun 2015 14:44:03 +0200 Subject: [PATCH 42/59] Bug 1171017: Rename |BluetoothSocketPDU| to |DaemonSocketPDU|, r=shuang --- .../BluetoothDaemonA2dpInterface.cpp | 48 +-- .../bluedroid/BluetoothDaemonA2dpInterface.h | 40 +-- .../BluetoothDaemonAvrcpInterface.cpp | 150 ++++---- .../bluedroid/BluetoothDaemonAvrcpInterface.h | 108 +++--- .../BluetoothDaemonGattInterface.cpp | 214 ++++++------ .../bluedroid/BluetoothDaemonGattInterface.h | 182 +++++----- .../BluetoothDaemonHandsfreeInterface.cpp | 194 +++++------ .../BluetoothDaemonHandsfreeInterface.h | 144 ++++---- .../bluedroid/BluetoothDaemonHelpers.cpp | 140 ++++---- .../bluedroid/BluetoothDaemonHelpers.h | 238 ++++++------- .../bluedroid/BluetoothDaemonInterface.cpp | 320 +++++++++--------- .../BluetoothDaemonSocketInterface.cpp | 30 +- .../BluetoothDaemonSocketInterface.h | 20 +- ipc/bluetooth/BluetoothDaemonConnection.cpp | 26 +- ipc/bluetooth/BluetoothDaemonConnection.h | 14 +- 15 files changed, 934 insertions(+), 934 deletions(-) diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp index ef408174fb88..afef70a78801 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp @@ -27,7 +27,7 @@ BluetoothDaemonA2dpModule::SetNotificationHandler( } nsresult -BluetoothDaemonA2dpModule::Send(BluetoothDaemonPDU* aPDU, +BluetoothDaemonA2dpModule::Send(DaemonSocketPDU* aPDU, BluetoothA2dpResultHandler* aRes) { aRes->AddRef(); // Keep reference for response @@ -35,11 +35,11 @@ BluetoothDaemonA2dpModule::Send(BluetoothDaemonPDU* aPDU, } void -BluetoothDaemonA2dpModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData) +BluetoothDaemonA2dpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonA2dpModule::* const HandleOp[])( - const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = { + const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::HandleRsp), INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::HandleNtf), }; @@ -61,7 +61,7 @@ BluetoothDaemonA2dpModule::ConnectCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(SERVICE_ID, + nsAutoPtr pdu(new DaemonSocketPDU(SERVICE_ID, OPCODE_CONNECT, 6)); // Address nsresult rv = PackPDU( @@ -83,7 +83,7 @@ BluetoothDaemonA2dpModule::DisconnectCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(SERVICE_ID, + nsAutoPtr pdu(new DaemonSocketPDU(SERVICE_ID, OPCODE_DISCONNECT, 6)); // Address nsresult rv = PackPDU( @@ -104,8 +104,8 @@ BluetoothDaemonA2dpModule::DisconnectCmd( void BluetoothDaemonA2dpModule::ErrorRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothA2dpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothA2dpResultHandler* aRes) { ErrorRunnable::Dispatch( aRes, &BluetoothA2dpResultHandler::OnError, UnpackPDUInitOp(aPDU)); @@ -113,7 +113,7 @@ BluetoothDaemonA2dpModule::ErrorRsp( void BluetoothDaemonA2dpModule::ConnectRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothA2dpResultHandler* aRes) { ResultRunnable::Dispatch( @@ -122,7 +122,7 @@ BluetoothDaemonA2dpModule::ConnectRsp( void BluetoothDaemonA2dpModule::DisconnectRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothA2dpResultHandler* aRes) { ResultRunnable::Dispatch( @@ -131,12 +131,12 @@ BluetoothDaemonA2dpModule::DisconnectRsp( void BluetoothDaemonA2dpModule::HandleRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonA2dpModule::* const HandleRsp[])( - const BluetoothDaemonPDUHeader&, - BluetoothDaemonPDU&, + const DaemonSocketPDUHeader&, + DaemonSocketPDU&, BluetoothA2dpResultHandler*) = { INIT_ARRAY_AT(OPCODE_ERROR, &BluetoothDaemonA2dpModule::ErrorRsp), @@ -186,14 +186,14 @@ class BluetoothDaemonA2dpModule::ConnectionStateInitOp final : private PDUInitOp { public: - ConnectionStateInitOp(BluetoothDaemonPDU& aPDU) + ConnectionStateInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (BluetoothA2dpConnectionState& aArg1, nsString& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read state */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -214,7 +214,7 @@ public: void BluetoothDaemonA2dpModule::ConnectionStateNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ConnectionStateNotification::Dispatch( &BluetoothA2dpNotificationHandler::ConnectionStateNotification, @@ -226,7 +226,7 @@ class BluetoothDaemonA2dpModule::AudioStateInitOp final : private PDUInitOp { public: - AudioStateInitOp(BluetoothDaemonPDU& aPDU) + AudioStateInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -234,7 +234,7 @@ public: operator () (BluetoothA2dpAudioState& aArg1, nsString& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read state */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -255,7 +255,7 @@ public: void BluetoothDaemonA2dpModule::AudioStateNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { AudioStateNotification::Dispatch( &BluetoothA2dpNotificationHandler::AudioStateNotification, @@ -267,14 +267,14 @@ class BluetoothDaemonA2dpModule::AudioConfigInitOp final : private PDUInitOp { public: - AudioConfigInitOp(BluetoothDaemonPDU& aPDU) + AudioConfigInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (nsString& aArg1, uint32_t aArg2, uint8_t aArg3) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read address */ nsresult rv = UnpackPDU( @@ -301,7 +301,7 @@ public: void BluetoothDaemonA2dpModule::AudioConfigNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { AudioConfigNotification::Dispatch( &BluetoothA2dpNotificationHandler::AudioConfigNotification, @@ -310,11 +310,11 @@ BluetoothDaemonA2dpModule::AudioConfigNtf( void BluetoothDaemonA2dpModule::HandleNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonA2dpModule::* const HandleNtf[])( - const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&) = { + const DaemonSocketPDUHeader&, DaemonSocketPDU&) = { INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::ConnectionStateNtf), INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::AudioStateNtf), #if ANDROID_VERSION >= 21 diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.h index 408a59f80120..e5623c59f622 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.h @@ -30,7 +30,7 @@ public: static const int MAX_NUM_CLIENTS; - virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0; + virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0; virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode, uint32_t aMaxNumClients, @@ -52,11 +52,11 @@ public: BluetoothA2dpResultHandler* aRes); protected: - nsresult Send(BluetoothDaemonPDU* aPDU, + nsresult Send(DaemonSocketPDU* aPDU, BluetoothA2dpResultHandler* aRes); - void HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); + void HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); // // Responses @@ -69,20 +69,20 @@ protected: BluetoothStatus, BluetoothStatus> ErrorRunnable; - void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ErrorRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothA2dpResultHandler* aRes); - void ConnectRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ConnectRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothA2dpResultHandler* aRes); - void DisconnectRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void DisconnectRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothA2dpResultHandler* aRes); - void HandleRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void HandleRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); // @@ -114,17 +114,17 @@ protected: class AudioStateInitOp; class AudioConfigInitOp; - void ConnectionStateNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ConnectionStateNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void AudioStateNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void AudioStateNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void AudioConfigNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void AudioConfigNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void HandleNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void HandleNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); static BluetoothA2dpNotificationHandler* sNotificationHandler; diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp index 639aa583f3e6..28f99e99e8fe 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp @@ -27,7 +27,7 @@ BluetoothDaemonAvrcpModule::SetNotificationHandler( } nsresult -BluetoothDaemonAvrcpModule::Send(BluetoothDaemonPDU* aPDU, +BluetoothDaemonAvrcpModule::Send(DaemonSocketPDU* aPDU, BluetoothAvrcpResultHandler* aRes) { if (aRes) { @@ -37,11 +37,11 @@ BluetoothDaemonAvrcpModule::Send(BluetoothDaemonPDU* aPDU, } void -BluetoothDaemonAvrcpModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData) +BluetoothDaemonAvrcpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonAvrcpModule::* const HandleOp[])( - const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = { + const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::HandleRsp), INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::HandleNtf), }; @@ -63,8 +63,8 @@ BluetoothDaemonAvrcpModule::GetPlayStatusRspCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_GET_PLAY_STATUS_RSP, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_PLAY_STATUS_RSP, 1 + // Play status 4 + // Duration 4)); // Position @@ -88,8 +88,8 @@ BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_LIST_PLAYER_APP_ATTR_RSP, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_LIST_PLAYER_APP_ATTR_RSP, 1 + // # Attributes aNumAttr)); // Player attributes @@ -113,8 +113,8 @@ BluetoothDaemonAvrcpModule::ListPlayerAppValueRspCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_LIST_PLAYER_APP_VALUE_RSP, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_LIST_PLAYER_APP_VALUE_RSP, 1 + // # Values aNumVal)); // Player values @@ -138,8 +138,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValueRspCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_VALUE_RSP, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_VALUE_RSP, 1 + // # Pairs 2 * aNumAttrs)); // Attribute-value pairs nsresult rv = PackPDU( @@ -163,8 +163,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP, 0)); // Dynamically allocated nsresult rv = PackPDU( PackConversion(aNumAttr), @@ -187,8 +187,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP, 0)); // Dynamically allocated nsresult rv = PackPDU( PackConversion(aNumVal), @@ -211,8 +211,8 @@ BluetoothDaemonAvrcpModule::GetElementAttrRspCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_GET_ELEMENT_ATTR_RSP, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_ELEMENT_ATTR_RSP, 0)); // Dynamically allocated nsresult rv = PackPDU( aNumAttr, @@ -234,8 +234,8 @@ BluetoothDaemonAvrcpModule::SetPlayerAppValueRspCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_SET_PLAYER_APP_VALUE_RSP, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_SET_PLAYER_APP_VALUE_RSP, 1)); // Status code nsresult rv = PackPDU(aRspStatus, *pdu); @@ -258,8 +258,8 @@ BluetoothDaemonAvrcpModule::RegisterNotificationRspCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_REGISTER_NOTIFICATION_RSP, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_REGISTER_NOTIFICATION_RSP, 1 + // Event 1 + // Type 1 + // Data length @@ -285,8 +285,8 @@ BluetoothDaemonAvrcpModule::SetVolumeCmd(uint8_t aVolume, { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_SET_VOLUME, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_SET_VOLUME, 1)); // Volume nsresult rv = PackPDU(aVolume, *pdu); @@ -306,8 +306,8 @@ BluetoothDaemonAvrcpModule::SetVolumeCmd(uint8_t aVolume, void BluetoothDaemonAvrcpModule::ErrorRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes) { ErrorRunnable::Dispatch( aRes, &BluetoothAvrcpResultHandler::OnError, UnpackPDUInitOp(aPDU)); @@ -315,8 +315,8 @@ BluetoothDaemonAvrcpModule::ErrorRsp( void BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothAvrcpResultHandler::GetPlayStatusRsp, @@ -325,8 +325,8 @@ BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp( void BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothAvrcpResultHandler::ListPlayerAppAttrRsp, @@ -335,8 +335,8 @@ BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp( void BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothAvrcpResultHandler::ListPlayerAppValueRsp, @@ -345,8 +345,8 @@ BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp( void BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothAvrcpResultHandler::GetPlayerAppValueRsp, @@ -355,8 +355,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp( void BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothAvrcpResultHandler::GetPlayerAppAttrTextRsp, @@ -365,8 +365,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp( void BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothAvrcpResultHandler::GetPlayerAppValueTextRsp, @@ -375,8 +375,8 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp( void BluetoothDaemonAvrcpModule::GetElementAttrRspRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothAvrcpResultHandler::GetElementAttrRsp, @@ -385,8 +385,8 @@ BluetoothDaemonAvrcpModule::GetElementAttrRspRsp( void BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothAvrcpResultHandler::SetPlayerAppValueRsp, @@ -395,8 +395,8 @@ BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp( void BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothAvrcpResultHandler::RegisterNotificationRsp, @@ -405,8 +405,8 @@ BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp( void BluetoothDaemonAvrcpModule::SetVolumeRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothAvrcpResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothAvrcpResultHandler::SetVolume, @@ -415,12 +415,12 @@ BluetoothDaemonAvrcpModule::SetVolumeRsp( void BluetoothDaemonAvrcpModule::HandleRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonAvrcpModule::* const HandleRsp[])( - const BluetoothDaemonPDUHeader&, - BluetoothDaemonPDU&, + const DaemonSocketPDUHeader&, + DaemonSocketPDU&, BluetoothAvrcpResultHandler*) = { INIT_ARRAY_AT(OPCODE_ERROR, &BluetoothDaemonAvrcpModule::ErrorRsp), @@ -486,14 +486,14 @@ class BluetoothDaemonAvrcpModule::RemoteFeatureInitOp final : private PDUInitOp { public: - RemoteFeatureInitOp(BluetoothDaemonPDU& aPDU) + RemoteFeatureInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (nsString& aArg1, unsigned long& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read address */ nsresult rv = UnpackPDU( @@ -516,7 +516,7 @@ public: void BluetoothDaemonAvrcpModule::RemoteFeatureNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { RemoteFeatureNotification::Dispatch( &BluetoothAvrcpNotificationHandler::RemoteFeatureNotification, @@ -525,7 +525,7 @@ BluetoothDaemonAvrcpModule::RemoteFeatureNtf( void BluetoothDaemonAvrcpModule::GetPlayStatusNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { GetPlayStatusNotification::Dispatch( &BluetoothAvrcpNotificationHandler::GetPlayStatusNotification, @@ -534,7 +534,7 @@ BluetoothDaemonAvrcpModule::GetPlayStatusNtf( void BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ListPlayerAppAttrNotification::Dispatch( &BluetoothAvrcpNotificationHandler::ListPlayerAppAttrNotification, @@ -543,7 +543,7 @@ BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf( void BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ListPlayerAppValuesNotification::Dispatch( &BluetoothAvrcpNotificationHandler::ListPlayerAppValuesNotification, @@ -555,7 +555,7 @@ class BluetoothDaemonAvrcpModule::GetPlayerAppValueInitOp final : private PDUInitOp { public: - GetPlayerAppValueInitOp(BluetoothDaemonPDU& aPDU) + GetPlayerAppValueInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -563,7 +563,7 @@ public: operator () (uint8_t& aArg1, nsAutoArrayPtr& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read number of attributes */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -584,7 +584,7 @@ public: void BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { GetPlayerAppValueNotification::Dispatch( &BluetoothAvrcpNotificationHandler::GetPlayerAppValueNotification, @@ -596,7 +596,7 @@ class BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextInitOp final : private PDUInitOp { public: - GetPlayerAppAttrsTextInitOp(BluetoothDaemonPDU& aPDU) + GetPlayerAppAttrsTextInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -604,7 +604,7 @@ public: operator () (uint8_t& aArg1, nsAutoArrayPtr& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read number of attributes */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -625,7 +625,7 @@ public: void BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { GetPlayerAppAttrsTextNotification::Dispatch( &BluetoothAvrcpNotificationHandler::GetPlayerAppAttrsTextNotification, @@ -637,7 +637,7 @@ class BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextInitOp final : private PDUInitOp { public: - GetPlayerAppValuesTextInitOp(BluetoothDaemonPDU& aPDU) + GetPlayerAppValuesTextInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -645,7 +645,7 @@ public: operator () (uint8_t& aArg1, uint8_t& aArg2, nsAutoArrayPtr& aArg3) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read attribute */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -671,7 +671,7 @@ public: void BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { GetPlayerAppValuesTextNotification::Dispatch( &BluetoothAvrcpNotificationHandler::GetPlayerAppValuesTextNotification, @@ -680,7 +680,7 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf( void BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { SetPlayerAppValueNotification::Dispatch( &BluetoothAvrcpNotificationHandler::SetPlayerAppValueNotification, @@ -692,7 +692,7 @@ class BluetoothDaemonAvrcpModule::GetElementAttrInitOp final : private PDUInitOp { public: - GetElementAttrInitOp(BluetoothDaemonPDU& aPDU) + GetElementAttrInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -700,7 +700,7 @@ public: operator () (uint8_t& aArg1, nsAutoArrayPtr& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read number of attributes */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -721,7 +721,7 @@ public: void BluetoothDaemonAvrcpModule::GetElementAttrNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { GetElementAttrNotification::Dispatch( &BluetoothAvrcpNotificationHandler::GetElementAttrNotification, @@ -730,7 +730,7 @@ BluetoothDaemonAvrcpModule::GetElementAttrNtf( void BluetoothDaemonAvrcpModule::RegisterNotificationNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { RegisterNotificationNotification::Dispatch( &BluetoothAvrcpNotificationHandler::RegisterNotificationNotification, @@ -740,7 +740,7 @@ BluetoothDaemonAvrcpModule::RegisterNotificationNtf( #if ANDROID_VERSION >= 19 void BluetoothDaemonAvrcpModule::VolumeChangeNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { VolumeChangeNotification::Dispatch( &BluetoothAvrcpNotificationHandler::VolumeChangeNotification, @@ -752,14 +752,14 @@ class BluetoothDaemonAvrcpModule::PassthroughCmdInitOp final : private PDUInitOp { public: - PassthroughCmdInitOp(BluetoothDaemonPDU& aPDU) + PassthroughCmdInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (int& aArg1, int& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); nsresult rv = UnpackPDU(pdu, UnpackConversion(aArg1)); if (NS_FAILED(rv)) { @@ -776,7 +776,7 @@ public: void BluetoothDaemonAvrcpModule::PassthroughCmdNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { PassthroughCmdNotification::Dispatch( &BluetoothAvrcpNotificationHandler::PassthroughCmdNotification, @@ -786,11 +786,11 @@ BluetoothDaemonAvrcpModule::PassthroughCmdNtf( void BluetoothDaemonAvrcpModule::HandleNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonAvrcpModule::* const HandleNtf[])( - const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&) = { + const DaemonSocketPDUHeader&, DaemonSocketPDU&) = { #if ANDROID_VERSION >= 19 INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::RemoteFeatureNtf), INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::GetPlayStatusNtf), diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.h index 5f41bc4509e6..42645c65d1b5 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.h @@ -62,7 +62,7 @@ public: static const int MAX_NUM_CLIENTS; - virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0; + virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0; virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode, uint32_t aMaxNumClients, @@ -116,11 +116,11 @@ public: nsresult SetVolumeCmd(uint8_t aVolume, BluetoothAvrcpResultHandler* aRes); protected: - nsresult Send(BluetoothDaemonPDU* aPDU, + nsresult Send(DaemonSocketPDU* aPDU, BluetoothAvrcpResultHandler* aRes); - void HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); + void HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); // // Responses @@ -133,52 +133,52 @@ protected: BluetoothStatus, BluetoothStatus> ErrorRunnable; - void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ErrorRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes); - void GetPlayStatusRspRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void GetPlayStatusRspRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes); - void ListPlayerAppAttrRspRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ListPlayerAppAttrRspRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes); - void ListPlayerAppValueRspRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ListPlayerAppValueRspRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes); - void GetPlayerAppValueRspRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void GetPlayerAppValueRspRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes); - void GetPlayerAppAttrTextRspRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void GetPlayerAppAttrTextRspRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes); - void GetPlayerAppValueTextRspRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void GetPlayerAppValueTextRspRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes); - void GetElementAttrRspRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void GetElementAttrRspRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes); - void SetPlayerAppValueRspRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void SetPlayerAppValueRspRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes); - void RegisterNotificationRspRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void RegisterNotificationRspRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes); - void SetVolumeRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void SetVolumeRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothAvrcpResultHandler* aRes); - void HandleRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void HandleRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); // @@ -247,44 +247,44 @@ protected: class PassthroughCmdInitOp; class RemoteFeatureInitOp; - void RemoteFeatureNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void RemoteFeatureNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void GetPlayStatusNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void GetPlayStatusNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ListPlayerAppAttrNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ListPlayerAppAttrNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ListPlayerAppValuesNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ListPlayerAppValuesNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void GetPlayerAppValueNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void GetPlayerAppValueNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void GetPlayerAppAttrsTextNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void GetPlayerAppAttrsTextNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void GetPlayerAppValuesTextNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void GetPlayerAppValuesTextNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void SetPlayerAppValueNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void SetPlayerAppValueNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void GetElementAttrNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void GetElementAttrNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void RegisterNotificationNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void RegisterNotificationNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void VolumeChangeNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void VolumeChangeNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void PassthroughCmdNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void PassthroughCmdNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void HandleNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void HandleNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); static BluetoothAvrcpNotificationHandler* sNotificationHandler; diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp index 5c0e5f830628..2753c7cf8828 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp @@ -27,7 +27,7 @@ BluetoothDaemonGattModule::SetNotificationHandler( } nsresult -BluetoothDaemonGattModule::Send(BluetoothDaemonPDU* aPDU, +BluetoothDaemonGattModule::Send(DaemonSocketPDU* aPDU, BluetoothGattResultHandler* aRes) { if (aRes) { @@ -37,7 +37,7 @@ BluetoothDaemonGattModule::Send(BluetoothDaemonPDU* aPDU, } nsresult -BluetoothDaemonGattModule::Send(BluetoothDaemonPDU* aPDU, +BluetoothDaemonGattModule::Send(DaemonSocketPDU* aPDU, BluetoothGattClientResultHandler* aRes) { if (aRes) { @@ -47,11 +47,11 @@ BluetoothDaemonGattModule::Send(BluetoothDaemonPDU* aPDU, } void -BluetoothDaemonGattModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData) +BluetoothDaemonGattModule::HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonGattModule::* const HandleOp[])( - const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = { + const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::HandleRsp), INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::HandleNtf), }; @@ -73,8 +73,8 @@ BluetoothDaemonGattModule::ClientRegisterCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_REGISTER, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_REGISTER, 16)); // Service UUID nsresult rv = PackPDU(aUuid, *pdu); @@ -96,8 +96,8 @@ BluetoothDaemonGattModule::ClientUnregisterCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_UNREGISTER, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_UNREGISTER, 4)); // Client Interface nsresult rv = PackPDU(aClientIf, *pdu); @@ -118,8 +118,8 @@ BluetoothDaemonGattModule::ClientScanCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_SCAN, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_SCAN, 4 + // Client Interface 1)); // Start @@ -143,8 +143,8 @@ BluetoothDaemonGattModule::ClientConnectCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_CONNECT, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_CONNECT, 4 + // Client Interface 6 + // Remote Address 1 + // Is Direct @@ -173,8 +173,8 @@ BluetoothDaemonGattModule::ClientDisconnectCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_DISCONNECT, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_DISCONNECT, 4 + // Client Interface 6 + // Remote Address 4)); // Connection ID @@ -200,8 +200,8 @@ BluetoothDaemonGattModule::ClientListenCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_LISTEN, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_LISTEN, 4 + // Client Interface 1)); // Start @@ -226,8 +226,8 @@ BluetoothDaemonGattModule::ClientRefreshCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_REFRESH, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_REFRESH, 4 + // Client Interface 6)); // Remote Address @@ -252,11 +252,11 @@ BluetoothDaemonGattModule::ClientSearchServiceCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_SEARCH_SERVICE, - 4 + // Connection ID - 1 + // Filtered - 16)); // UUID + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_SEARCH_SERVICE, + 4 + // Connection ID + 1 + // Filtered + 16)); // UUID nsresult rv = PackPDU(PackConversion(aConnId), PackConversion(aFiltered), @@ -281,8 +281,8 @@ BluetoothDaemonGattModule::ClientGetIncludedServiceCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_GET_INCLUDED_SERVICE, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_GET_INCLUDED_SERVICE, 4 + // Connection ID 18 + // Service ID 1 + // Continuation @@ -310,8 +310,8 @@ BluetoothDaemonGattModule::ClientGetCharacteristicCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_GET_CHARACTERISTIC, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_GET_CHARACTERISTIC, 4 + // Connection ID 18 + // Service ID 1 + // Continuation @@ -341,8 +341,8 @@ BluetoothDaemonGattModule::ClientGetDescriptorCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_GET_DESCRIPTOR, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_GET_DESCRIPTOR, 4 + // Connection ID 18 + // Service ID 17 + // Characteristic ID @@ -372,8 +372,8 @@ BluetoothDaemonGattModule::ClientReadCharacteristicCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_READ_CHARACTERISTIC, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_READ_CHARACTERISTIC, 4 + // Connection ID 18 + // Service ID 17 + // Characteristic ID @@ -401,8 +401,8 @@ BluetoothDaemonGattModule::ClientWriteCharacteristicCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_WRITE_CHARACTERISTIC, 0)); + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_WRITE_CHARACTERISTIC, 0)); nsresult rv = PackPDU(PackConversion(aConnId), aServiceId, aCharId, aWriteType, @@ -427,8 +427,8 @@ BluetoothDaemonGattModule::ClientReadDescriptorCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_READ_DESCRIPTOR, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_READ_DESCRIPTOR, 4 + // Connection ID 18 + // Service ID 17 + // Characteristic ID @@ -458,8 +458,8 @@ BluetoothDaemonGattModule::ClientWriteDescriptorCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_WRITE_DESCRIPTOR, 0)); + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_WRITE_DESCRIPTOR, 0)); nsresult rv = PackPDU(PackConversion(aConnId), aServiceId, aCharId, aDescriptorId, aWriteType, @@ -482,8 +482,8 @@ BluetoothDaemonGattModule::ClientExecuteWriteCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_EXECUTE_WRITE, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_EXECUTE_WRITE, 4 + // Connection ID 4)); // Execute @@ -508,8 +508,8 @@ BluetoothDaemonGattModule::ClientRegisterNotificationCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_REGISTER_NOTIFICATION, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_REGISTER_NOTIFICATION, 4 + // Client Interface 6 + // Remote Address 18 + // Service ID @@ -537,8 +537,8 @@ BluetoothDaemonGattModule::ClientDeregisterNotificationCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_DEREGISTER_NOTIFICATION, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_DEREGISTER_NOTIFICATION, 4 + // Client Interface 6 + // Remote Address 18 + // Service ID @@ -565,8 +565,8 @@ BluetoothDaemonGattModule::ClientReadRemoteRssiCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_READ_REMOTE_RSSI, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_READ_REMOTE_RSSI, 4 + // Client Interface 6)); // Remote Address @@ -590,8 +590,8 @@ BluetoothDaemonGattModule::ClientGetDeviceTypeCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_GET_DEVICE_TYPE, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_GET_DEVICE_TYPE, 6)); // Remote Address nsresult rv = PackPDU( @@ -618,8 +618,8 @@ BluetoothDaemonGattModule::ClientSetAdvDataCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_SET_ADV_DATA, 0)); + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_SET_ADV_DATA, 0)); nsresult rv = PackPDU( PackConversion(aServerIf), @@ -650,8 +650,8 @@ BluetoothDaemonGattModule::ClientTestCommandCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLIENT_TEST_COMMAND, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLIENT_TEST_COMMAND, 4 + // Command 6 + // Address 16 + // UUID @@ -682,8 +682,8 @@ BluetoothDaemonGattModule::ClientTestCommandCmd( void BluetoothDaemonGattModule::ErrorRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothGattResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattResultHandler* aRes) { ErrorRunnable::Dispatch( aRes, &BluetoothGattResultHandler::OnError, UnpackPDUInitOp(aPDU)); @@ -691,7 +691,7 @@ BluetoothDaemonGattModule::ErrorRsp( void BluetoothDaemonGattModule::ClientRegisterRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -701,7 +701,7 @@ BluetoothDaemonGattModule::ClientRegisterRsp( void BluetoothDaemonGattModule::ClientUnregisterRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -711,7 +711,7 @@ BluetoothDaemonGattModule::ClientUnregisterRsp( void BluetoothDaemonGattModule::ClientScanRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -720,7 +720,7 @@ BluetoothDaemonGattModule::ClientScanRsp( void BluetoothDaemonGattModule::ClientConnectRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -729,7 +729,7 @@ BluetoothDaemonGattModule::ClientConnectRsp( void BluetoothDaemonGattModule::ClientDisconnectRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -739,7 +739,7 @@ BluetoothDaemonGattModule::ClientDisconnectRsp( void BluetoothDaemonGattModule::ClientListenRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -748,7 +748,7 @@ BluetoothDaemonGattModule::ClientListenRsp( void BluetoothDaemonGattModule::ClientRefreshRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -757,7 +757,7 @@ BluetoothDaemonGattModule::ClientRefreshRsp( void BluetoothDaemonGattModule::ClientSearchServiceRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -767,7 +767,7 @@ BluetoothDaemonGattModule::ClientSearchServiceRsp( void BluetoothDaemonGattModule::ClientGetIncludedServiceRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -777,7 +777,7 @@ BluetoothDaemonGattModule::ClientGetIncludedServiceRsp( void BluetoothDaemonGattModule::ClientGetCharacteristicRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -787,7 +787,7 @@ BluetoothDaemonGattModule::ClientGetCharacteristicRsp( void BluetoothDaemonGattModule::ClientGetDescriptorRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -797,7 +797,7 @@ BluetoothDaemonGattModule::ClientGetDescriptorRsp( void BluetoothDaemonGattModule::ClientReadCharacteristicRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -807,7 +807,7 @@ BluetoothDaemonGattModule::ClientReadCharacteristicRsp( void BluetoothDaemonGattModule::ClientWriteCharacteristicRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -817,7 +817,7 @@ BluetoothDaemonGattModule::ClientWriteCharacteristicRsp( void BluetoothDaemonGattModule::ClientReadDescriptorRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -827,7 +827,7 @@ BluetoothDaemonGattModule::ClientReadDescriptorRsp( void BluetoothDaemonGattModule::ClientWriteDescriptorRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -837,7 +837,7 @@ BluetoothDaemonGattModule::ClientWriteDescriptorRsp( void BluetoothDaemonGattModule::ClientExecuteWriteRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -847,7 +847,7 @@ BluetoothDaemonGattModule::ClientExecuteWriteRsp( void BluetoothDaemonGattModule::ClientRegisterNotificationRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -857,7 +857,7 @@ BluetoothDaemonGattModule::ClientRegisterNotificationRsp( void BluetoothDaemonGattModule::ClientDeregisterNotificationRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -867,7 +867,7 @@ BluetoothDaemonGattModule::ClientDeregisterNotificationRsp( void BluetoothDaemonGattModule::ClientReadRemoteRssiRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -877,7 +877,7 @@ BluetoothDaemonGattModule::ClientReadRemoteRssiRsp( void BluetoothDaemonGattModule::ClientGetDeviceTypeRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -887,7 +887,7 @@ BluetoothDaemonGattModule::ClientGetDeviceTypeRsp( void BluetoothDaemonGattModule::ClientSetAdvDataRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -897,7 +897,7 @@ BluetoothDaemonGattModule::ClientSetAdvDataRsp( void BluetoothDaemonGattModule::ClientTestCommandRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes) { ClientResultRunnable::Dispatch( @@ -907,20 +907,20 @@ BluetoothDaemonGattModule::ClientTestCommandRsp( void BluetoothDaemonGattModule::HandleRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonGattModule::* const HandleRsp[])( - const BluetoothDaemonPDUHeader&, - BluetoothDaemonPDU&, + const DaemonSocketPDUHeader&, + DaemonSocketPDU&, BluetoothGattResultHandler*) = { INIT_ARRAY_AT(OPCODE_ERROR, &BluetoothDaemonGattModule::ErrorRsp) }; static void (BluetoothDaemonGattModule::* const HandleClientRsp[])( - const BluetoothDaemonPDUHeader&, - BluetoothDaemonPDU&, + const DaemonSocketPDUHeader&, + DaemonSocketPDU&, BluetoothGattClientResultHandler*) = { INIT_ARRAY_AT(0, nullptr), INIT_ARRAY_AT(OPCODE_CLIENT_REGISTER, @@ -1032,7 +1032,7 @@ public: void BluetoothDaemonGattModule::ClientRegisterNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientRegisterNotification::Dispatch( &BluetoothGattClientNotificationHandler::RegisterClientNotification, @@ -1044,7 +1044,7 @@ class BluetoothDaemonGattModule::ClientScanResultInitOp final : private PDUInitOp { public: - ClientScanResultInitOp(BluetoothDaemonPDU& aPDU) + ClientScanResultInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1053,7 +1053,7 @@ public: int& aArg2, BluetoothGattAdvData& aArg3) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read address */ nsresult rv = UnpackPDU( @@ -1085,7 +1085,7 @@ public: void BluetoothDaemonGattModule::ClientScanResultNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientScanResultNotification::Dispatch( &BluetoothGattClientNotificationHandler::ScanResultNotification, @@ -1097,7 +1097,7 @@ class BluetoothDaemonGattModule::ClientConnectDisconnectInitOp final : private PDUInitOp { public: - ClientConnectDisconnectInitOp(BluetoothDaemonPDU& aPDU) + ClientConnectDisconnectInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1107,7 +1107,7 @@ public: int& aArg3, nsString& aArg4) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read connection ID */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -1138,7 +1138,7 @@ public: void BluetoothDaemonGattModule::ClientConnectNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientConnectNotification::Dispatch( &BluetoothGattClientNotificationHandler::ConnectNotification, @@ -1147,7 +1147,7 @@ BluetoothDaemonGattModule::ClientConnectNtf( void BluetoothDaemonGattModule::ClientDisconnectNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientDisconnectNotification::Dispatch( &BluetoothGattClientNotificationHandler::DisconnectNotification, @@ -1156,7 +1156,7 @@ BluetoothDaemonGattModule::ClientDisconnectNtf( void BluetoothDaemonGattModule::ClientSearchCompleteNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientSearchCompleteNotification::Dispatch( &BluetoothGattClientNotificationHandler::SearchCompleteNotification, @@ -1165,7 +1165,7 @@ BluetoothDaemonGattModule::ClientSearchCompleteNtf( void BluetoothDaemonGattModule::ClientSearchResultNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientSearchResultNotification::Dispatch( &BluetoothGattClientNotificationHandler::SearchResultNotification, @@ -1174,7 +1174,7 @@ BluetoothDaemonGattModule::ClientSearchResultNtf( void BluetoothDaemonGattModule::ClientGetCharacteristicNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientGetCharacteristicNotification::Dispatch( &BluetoothGattClientNotificationHandler::GetCharacteristicNotification, @@ -1183,7 +1183,7 @@ BluetoothDaemonGattModule::ClientGetCharacteristicNtf( void BluetoothDaemonGattModule::ClientGetDescriptorNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientGetDescriptorNotification::Dispatch( &BluetoothGattClientNotificationHandler::GetDescriptorNotification, @@ -1192,7 +1192,7 @@ BluetoothDaemonGattModule::ClientGetDescriptorNtf( void BluetoothDaemonGattModule::ClientGetIncludedServiceNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientGetIncludedServiceNotification::Dispatch( &BluetoothGattClientNotificationHandler::GetIncludedServiceNotification, @@ -1201,7 +1201,7 @@ BluetoothDaemonGattModule::ClientGetIncludedServiceNtf( void BluetoothDaemonGattModule::ClientRegisterNotificationNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientRegisterNotificationNotification::Dispatch( &BluetoothGattClientNotificationHandler::RegisterNotificationNotification, @@ -1210,7 +1210,7 @@ BluetoothDaemonGattModule::ClientRegisterNotificationNtf( void BluetoothDaemonGattModule::ClientNotifyNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientNotifyNotification::Dispatch( &BluetoothGattClientNotificationHandler::NotifyNotification, @@ -1219,7 +1219,7 @@ BluetoothDaemonGattModule::ClientNotifyNtf( void BluetoothDaemonGattModule::ClientReadCharacteristicNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientReadCharacteristicNotification::Dispatch( &BluetoothGattClientNotificationHandler::ReadCharacteristicNotification, @@ -1228,7 +1228,7 @@ BluetoothDaemonGattModule::ClientReadCharacteristicNtf( void BluetoothDaemonGattModule::ClientWriteCharacteristicNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientWriteCharacteristicNotification::Dispatch( &BluetoothGattClientNotificationHandler::WriteCharacteristicNotification, @@ -1237,7 +1237,7 @@ BluetoothDaemonGattModule::ClientWriteCharacteristicNtf( void BluetoothDaemonGattModule::ClientReadDescriptorNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientReadDescriptorNotification::Dispatch( &BluetoothGattClientNotificationHandler::ReadDescriptorNotification, @@ -1246,7 +1246,7 @@ BluetoothDaemonGattModule::ClientReadDescriptorNtf( void BluetoothDaemonGattModule::ClientWriteDescriptorNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientWriteDescriptorNotification::Dispatch( &BluetoothGattClientNotificationHandler::WriteDescriptorNotification, @@ -1255,7 +1255,7 @@ BluetoothDaemonGattModule::ClientWriteDescriptorNtf( void BluetoothDaemonGattModule::ClientExecuteWriteNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientExecuteWriteNotification::Dispatch( &BluetoothGattClientNotificationHandler::ExecuteWriteNotification, @@ -1267,7 +1267,7 @@ class BluetoothDaemonGattModule::ClientReadRemoteRssiInitOp final : private PDUInitOp { public: - ClientReadRemoteRssiInitOp(BluetoothDaemonPDU& aPDU) + ClientReadRemoteRssiInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1277,7 +1277,7 @@ public: int& aArg3, BluetoothGattStatus& aArg4) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read client interface */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -1307,7 +1307,7 @@ public: void BluetoothDaemonGattModule::ClientReadRemoteRssiNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientReadRemoteRssiNotification::Dispatch( &BluetoothGattClientNotificationHandler::ReadRemoteRssiNotification, @@ -1316,7 +1316,7 @@ BluetoothDaemonGattModule::ClientReadRemoteRssiNtf( void BluetoothDaemonGattModule::ClientListenNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClientListenNotification::Dispatch( &BluetoothGattClientNotificationHandler::ListenNotification, @@ -1325,11 +1325,11 @@ BluetoothDaemonGattModule::ClientListenNtf( void BluetoothDaemonGattModule::HandleNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonGattModule::* const HandleNtf[])( - const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&) = { + const DaemonSocketPDUHeader&, DaemonSocketPDU&) = { INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::ClientRegisterNtf), INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::ClientScanResultNtf), INIT_ARRAY_AT(2, &BluetoothDaemonGattModule::ClientConnectNtf), diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.h index f1d9da514b64..8c701ddcef30 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.h @@ -51,7 +51,7 @@ public: static const int MAX_NUM_CLIENTS; - virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0; + virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0; virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode, uint32_t aMaxNumClients, @@ -211,14 +211,14 @@ public: // TODO: Add server commands protected: - nsresult Send(BluetoothDaemonPDU* aPDU, + nsresult Send(DaemonSocketPDU* aPDU, BluetoothGattResultHandler* aRes); - nsresult Send(BluetoothDaemonPDU* aPDU, + nsresult Send(DaemonSocketPDU* aPDU, BluetoothGattClientResultHandler* aRes); - void HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); + void HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); // // Responses @@ -234,100 +234,100 @@ protected: BluetoothStatus, BluetoothStatus> ErrorRunnable; - void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ErrorRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattResultHandler* aRes); - void ClientRegisterRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientRegisterRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientUnregisterRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientUnregisterRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientScanRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientScanRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientConnectRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientConnectRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientDisconnectRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientDisconnectRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientListenRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientListenRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientRefreshRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientRefreshRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientSearchServiceRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientSearchServiceRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientGetIncludedServiceRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientGetIncludedServiceRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientGetCharacteristicRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientGetCharacteristicRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientGetDescriptorRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientGetDescriptorRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientReadCharacteristicRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientReadCharacteristicRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientWriteCharacteristicRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientWriteCharacteristicRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientReadDescriptorRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientReadDescriptorRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientWriteDescriptorRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientWriteDescriptorRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientExecuteWriteRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientExecuteWriteRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientRegisterNotificationRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientRegisterNotificationRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientDeregisterNotificationRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientDeregisterNotificationRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientReadRemoteRssiRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientReadRemoteRssiRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientGetDeviceTypeRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientGetDeviceTypeRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientSetAdvDataRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientSetAdvDataRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void ClientTestCommandRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClientTestCommandRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothGattClientResultHandler* aRes); - void HandleRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void HandleRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); // TODO: Add Server responses @@ -456,62 +456,62 @@ protected: class ClientConnectDisconnectInitOp; class ClientReadRemoteRssiInitOp; - void ClientRegisterNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientRegisterNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientScanResultNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientScanResultNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientConnectNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientConnectNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientDisconnectNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientDisconnectNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientSearchCompleteNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientSearchCompleteNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientSearchResultNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientSearchResultNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientGetCharacteristicNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientGetCharacteristicNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientGetDescriptorNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientGetDescriptorNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientGetIncludedServiceNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientGetIncludedServiceNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientRegisterNotificationNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientRegisterNotificationNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientNotifyNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientNotifyNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientReadCharacteristicNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientReadCharacteristicNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientWriteCharacteristicNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientWriteCharacteristicNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientReadDescriptorNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientReadDescriptorNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientWriteDescriptorNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientWriteDescriptorNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientExecuteWriteNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientExecuteWriteNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientReadRemoteRssiNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientReadRemoteRssiNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClientListenNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClientListenNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void HandleNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void HandleNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); static BluetoothGattNotificationHandler* sNotificationHandler; diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp index c571c3e0d473..f765ced952ae 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp @@ -30,7 +30,7 @@ BluetoothDaemonHandsfreeModule::SetNotificationHandler( } nsresult -BluetoothDaemonHandsfreeModule::Send(BluetoothDaemonPDU* aPDU, +BluetoothDaemonHandsfreeModule::Send(DaemonSocketPDU* aPDU, BluetoothHandsfreeResultHandler* aRes) { aRes->AddRef(); // Keep reference for response @@ -38,11 +38,11 @@ BluetoothDaemonHandsfreeModule::Send(BluetoothDaemonPDU* aPDU, } void -BluetoothDaemonHandsfreeModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData) +BluetoothDaemonHandsfreeModule::HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonHandsfreeModule::* const HandleOp[])( - const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = { + const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::HandleRsp), INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::HandleNtf), }; @@ -64,8 +64,8 @@ BluetoothDaemonHandsfreeModule::ConnectCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CONNECT, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CONNECT, 6)); // Address nsresult rv = PackPDU( @@ -87,8 +87,8 @@ BluetoothDaemonHandsfreeModule::DisconnectCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_DISCONNECT, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_DISCONNECT, 6)); // Address nsresult rv = PackPDU( @@ -110,8 +110,8 @@ BluetoothDaemonHandsfreeModule::ConnectAudioCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CONNECT_AUDIO, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CONNECT_AUDIO, 6)); // Address nsresult rv = PackPDU( @@ -133,8 +133,8 @@ BluetoothDaemonHandsfreeModule::DisconnectAudioCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_DISCONNECT_AUDIO, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_DISCONNECT_AUDIO, 6)); // Address nsresult rv = PackPDU( @@ -156,8 +156,8 @@ BluetoothDaemonHandsfreeModule::StartVoiceRecognitionCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_START_VOICE_RECOGNITION, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_START_VOICE_RECOGNITION, 6)); // Address (BlueZ 5.25) nsresult rv; @@ -182,8 +182,8 @@ BluetoothDaemonHandsfreeModule::StopVoiceRecognitionCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_STOP_VOICE_RECOGNITION, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_STOP_VOICE_RECOGNITION, 6)); // Address (BlueZ 5.25) nsresult rv; @@ -209,8 +209,8 @@ BluetoothDaemonHandsfreeModule::VolumeControlCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_VOLUME_CONTROL, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_VOLUME_CONTROL, 1 + // Volume type 1 + // Volume 6)); // Address (BlueZ 5.25) @@ -241,8 +241,8 @@ BluetoothDaemonHandsfreeModule::DeviceStatusNotificationCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_DEVICE_STATUS_NOTIFICATION, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_DEVICE_STATUS_NOTIFICATION, 1 + // Network state 1 + // Service type 1 + // Signal strength @@ -269,8 +269,8 @@ BluetoothDaemonHandsfreeModule::CopsResponseCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_COPS_RESPONSE, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_COPS_RESPONSE, 0 + // Dynamically allocated 6)); // Address (BlueZ 5.25) @@ -302,8 +302,8 @@ BluetoothDaemonHandsfreeModule::CindResponseCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CIND_RESPONSE, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CIND_RESPONSE, 1 + // Service 1 + // # Active 1 + // # Held @@ -350,8 +350,8 @@ BluetoothDaemonHandsfreeModule::FormattedAtResponseCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_FORMATTED_AT_RESPONSE, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_FORMATTED_AT_RESPONSE, 0 + // Dynamically allocated 6)); // Address (BlueZ 5.25) @@ -380,8 +380,8 @@ BluetoothDaemonHandsfreeModule::AtResponseCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_AT_RESPONSE, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_AT_RESPONSE, 1 + // AT Response code 1 + // Error code 6)); // Address (BlueZ 5.25) @@ -417,8 +417,8 @@ BluetoothDaemonHandsfreeModule::ClccResponseCmd( NS_ConvertUTF16toUTF8 number(aNumber); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CLCC_RESPONSE, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CLCC_RESPONSE, 1 + // Call index 1 + // Call direction 1 + // Call state @@ -460,8 +460,8 @@ BluetoothDaemonHandsfreeModule::PhoneStateChangeCmd( NS_ConvertUTF16toUTF8 number(aNumber); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_PHONE_STATE_CHANGE, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_PHONE_STATE_CHANGE, 1 + // # Active 1 + // # Held 1 + // Call state @@ -491,8 +491,8 @@ BluetoothDaemonHandsfreeModule::ConfigureWbsCmd( { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu( - new BluetoothDaemonPDU(SERVICE_ID, OPCODE_CONFIGURE_WBS, + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CONFIGURE_WBS, 6 + // Address 1)); // Config @@ -514,8 +514,8 @@ BluetoothDaemonHandsfreeModule::ConfigureWbsCmd( void BluetoothDaemonHandsfreeModule::ErrorRsp( - const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) + const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ErrorRunnable::Dispatch( aRes, &BluetoothHandsfreeResultHandler::OnError, UnpackPDUInitOp(aPDU)); @@ -523,7 +523,7 @@ BluetoothDaemonHandsfreeModule::ErrorRsp( void BluetoothDaemonHandsfreeModule::ConnectRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -532,7 +532,7 @@ BluetoothDaemonHandsfreeModule::ConnectRsp( void BluetoothDaemonHandsfreeModule::DisconnectRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -541,7 +541,7 @@ BluetoothDaemonHandsfreeModule::DisconnectRsp( void BluetoothDaemonHandsfreeModule::ConnectAudioRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -551,7 +551,7 @@ BluetoothDaemonHandsfreeModule::ConnectAudioRsp( void BluetoothDaemonHandsfreeModule::DisconnectAudioRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -561,7 +561,7 @@ BluetoothDaemonHandsfreeModule::DisconnectAudioRsp( void BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -571,7 +571,7 @@ BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp( void BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -581,7 +581,7 @@ BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp( void BluetoothDaemonHandsfreeModule::VolumeControlRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -591,7 +591,7 @@ BluetoothDaemonHandsfreeModule::VolumeControlRsp( void BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -601,7 +601,7 @@ BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp( void BluetoothDaemonHandsfreeModule::CopsResponseRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -611,7 +611,7 @@ BluetoothDaemonHandsfreeModule::CopsResponseRsp( void BluetoothDaemonHandsfreeModule::CindResponseRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -621,7 +621,7 @@ BluetoothDaemonHandsfreeModule::CindResponseRsp( void BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -631,7 +631,7 @@ BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp( void BluetoothDaemonHandsfreeModule::AtResponseRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -641,7 +641,7 @@ BluetoothDaemonHandsfreeModule::AtResponseRsp( void BluetoothDaemonHandsfreeModule::ClccResponseRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -651,7 +651,7 @@ BluetoothDaemonHandsfreeModule::ClccResponseRsp( void BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -661,7 +661,7 @@ BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp( void BluetoothDaemonHandsfreeModule::ConfigureWbsRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes) { ResultRunnable::Dispatch( @@ -671,12 +671,12 @@ BluetoothDaemonHandsfreeModule::ConfigureWbsRsp( void BluetoothDaemonHandsfreeModule::HandleRsp( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonHandsfreeModule::* const HandleRsp[])( - const BluetoothDaemonPDUHeader&, - BluetoothDaemonPDU&, + const DaemonSocketPDUHeader&, + DaemonSocketPDU&, BluetoothHandsfreeResultHandler*) = { INIT_ARRAY_AT(OPCODE_ERROR, &BluetoothDaemonHandsfreeModule::ErrorRsp), @@ -752,7 +752,7 @@ class BluetoothDaemonHandsfreeModule::ConnectionStateInitOp final : private PDUInitOp { public: - ConnectionStateInitOp(BluetoothDaemonPDU& aPDU) + ConnectionStateInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -760,7 +760,7 @@ public: operator () (BluetoothHandsfreeConnectionState& aArg1, nsString& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read state */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -789,7 +789,7 @@ public: void BluetoothDaemonHandsfreeModule::ConnectionStateNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ConnectionStateNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::ConnectionStateNotification, @@ -801,14 +801,14 @@ class BluetoothDaemonHandsfreeModule::AudioStateInitOp final : private PDUInitOp { public: - AudioStateInitOp(BluetoothDaemonPDU& aPDU) + AudioStateInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (BluetoothHandsfreeAudioState& aArg1, nsString& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read state */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -829,7 +829,7 @@ public: void BluetoothDaemonHandsfreeModule::AudioStateNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { AudioStateNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::AudioStateNotification, @@ -841,7 +841,7 @@ class BluetoothDaemonHandsfreeModule::VoiceRecognitionInitOp final : private PDUInitOp { public: - VoiceRecognitionInitOp(BluetoothDaemonPDU& aPDU) + VoiceRecognitionInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -849,7 +849,7 @@ public: operator () (BluetoothHandsfreeVoiceRecognitionState& aArg1, nsString& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read state */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -874,7 +874,7 @@ public: void BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { VoiceRecognitionNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::VoiceRecognitionNotification, @@ -886,7 +886,7 @@ class BluetoothDaemonHandsfreeModule::AnswerCallInitOp final : private PDUInitOp { public: - AnswerCallInitOp(BluetoothDaemonPDU& aPDU) + AnswerCallInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -910,7 +910,7 @@ public: void BluetoothDaemonHandsfreeModule::AnswerCallNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { AnswerCallNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::AnswerCallNotification, @@ -922,7 +922,7 @@ class BluetoothDaemonHandsfreeModule::HangupCallInitOp final : private PDUInitOp { public: - HangupCallInitOp(BluetoothDaemonPDU& aPDU) + HangupCallInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -946,7 +946,7 @@ public: void BluetoothDaemonHandsfreeModule::HangupCallNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { HangupCallNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::HangupCallNotification, @@ -958,7 +958,7 @@ class BluetoothDaemonHandsfreeModule::VolumeInitOp final : private PDUInitOp { public: - VolumeInitOp(BluetoothDaemonPDU& aPDU) + VolumeInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -966,7 +966,7 @@ public: operator () (BluetoothHandsfreeVolumeType& aArg1, int& aArg2, nsString& aArg3) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read volume type */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -997,7 +997,7 @@ public: void BluetoothDaemonHandsfreeModule::VolumeNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { VolumeNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::VolumeNotification, @@ -1009,14 +1009,14 @@ class BluetoothDaemonHandsfreeModule::DialCallInitOp final : private PDUInitOp { public: - DialCallInitOp(BluetoothDaemonPDU& aPDU) + DialCallInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (nsString& aArg1, nsString& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); nsresult rv; /* Read address @@ -1045,7 +1045,7 @@ public: void BluetoothDaemonHandsfreeModule::DialCallNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { DialCallNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::DialCallNotification, @@ -1057,14 +1057,14 @@ class BluetoothDaemonHandsfreeModule::DtmfInitOp final : private PDUInitOp { public: - DtmfInitOp(BluetoothDaemonPDU& aPDU) + DtmfInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (char& aArg1, nsString& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read tone */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -1089,7 +1089,7 @@ public: void BluetoothDaemonHandsfreeModule::DtmfNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { DtmfNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::DtmfNotification, @@ -1101,14 +1101,14 @@ class BluetoothDaemonHandsfreeModule::NRECInitOp final : private PDUInitOp { public: - NRECInitOp(BluetoothDaemonPDU& aPDU) + NRECInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (BluetoothHandsfreeNRECState& aArg1, nsString& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read state */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -1133,7 +1133,7 @@ public: void BluetoothDaemonHandsfreeModule::NRECNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { NRECNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::NRECNotification, @@ -1145,14 +1145,14 @@ class BluetoothDaemonHandsfreeModule::CallHoldInitOp final : private PDUInitOp { public: - CallHoldInitOp(BluetoothDaemonPDU& aPDU) + CallHoldInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (BluetoothHandsfreeCallHoldType& aArg1, nsString& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read type */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -1177,7 +1177,7 @@ public: void BluetoothDaemonHandsfreeModule::CallHoldNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { CallHoldNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::CallHoldNotification, @@ -1189,7 +1189,7 @@ class BluetoothDaemonHandsfreeModule::CnumInitOp final : private PDUInitOp { public: - CnumInitOp(BluetoothDaemonPDU& aPDU) + CnumInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1213,7 +1213,7 @@ public: void BluetoothDaemonHandsfreeModule::CnumNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { CnumNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::CnumNotification, @@ -1225,7 +1225,7 @@ class BluetoothDaemonHandsfreeModule::CindInitOp final : private PDUInitOp { public: - CindInitOp(BluetoothDaemonPDU& aPDU) + CindInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1249,7 +1249,7 @@ public: void BluetoothDaemonHandsfreeModule::CindNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { CindNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::CindNotification, @@ -1261,7 +1261,7 @@ class BluetoothDaemonHandsfreeModule::CopsInitOp final : private PDUInitOp { public: - CopsInitOp(BluetoothDaemonPDU& aPDU) + CopsInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1285,7 +1285,7 @@ public: void BluetoothDaemonHandsfreeModule::CopsNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { CopsNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::CopsNotification, @@ -1297,7 +1297,7 @@ class BluetoothDaemonHandsfreeModule::ClccInitOp final : private PDUInitOp { public: - ClccInitOp(BluetoothDaemonPDU& aPDU) + ClccInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1321,7 +1321,7 @@ public: void BluetoothDaemonHandsfreeModule::ClccNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { ClccNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::ClccNotification, @@ -1333,14 +1333,14 @@ class BluetoothDaemonHandsfreeModule::UnknownAtInitOp final : private PDUInitOp { public: - UnknownAtInitOp(BluetoothDaemonPDU& aPDU) + UnknownAtInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (nsCString& aArg1, nsString& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); nsresult rv; /* Read address @@ -1369,7 +1369,7 @@ public: void BluetoothDaemonHandsfreeModule::UnknownAtNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { UnknownAtNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::UnknownAtNotification, @@ -1381,7 +1381,7 @@ class BluetoothDaemonHandsfreeModule::KeyPressedInitOp final : private PDUInitOp { public: - KeyPressedInitOp(BluetoothDaemonPDU& aPDU) + KeyPressedInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1405,7 +1405,7 @@ public: void BluetoothDaemonHandsfreeModule::KeyPressedNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU) + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU) { KeyPressedNotification::Dispatch( &BluetoothHandsfreeNotificationHandler::KeyPressedNotification, @@ -1414,11 +1414,11 @@ BluetoothDaemonHandsfreeModule::KeyPressedNtf( void BluetoothDaemonHandsfreeModule::HandleNtf( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonHandsfreeModule::* const HandleNtf[])( - const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&) = { + const DaemonSocketPDUHeader&, DaemonSocketPDU&) = { INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::ConnectionStateNtf), INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::AudioStateNtf), INIT_ARRAY_AT(2, &BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf), diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.h index 081867559843..ef3c2dab9237 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.h @@ -41,7 +41,7 @@ public: OPCODE_CONFIGURE_WBS = 0x0f }; - virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0; + virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0; virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode, uint32_t aMaxNumClients, @@ -125,11 +125,11 @@ public: BluetoothHandsfreeResultHandler* aRes); protected: - nsresult Send(BluetoothDaemonPDU* aPDU, + nsresult Send(DaemonSocketPDU* aPDU, BluetoothHandsfreeResultHandler* aRes); - void HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); + void HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); // // Responses @@ -142,72 +142,72 @@ protected: BluetoothStatus, BluetoothStatus> ErrorRunnable; - void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ErrorRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void ConnectRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ConnectRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void DisconnectRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void DisconnectRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void ConnectAudioRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ConnectAudioRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void DisconnectAudioRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void DisconnectAudioRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void StartVoiceRecognitionRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void StartVoiceRecognitionRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void StopVoiceRecognitionRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void StopVoiceRecognitionRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void VolumeControlRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void VolumeControlRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void DeviceStatusNotificationRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void DeviceStatusNotificationRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void CopsResponseRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void CopsResponseRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void CindResponseRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void CindResponseRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void FormattedAtResponseRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void FormattedAtResponseRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void AtResponseRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void AtResponseRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void ClccResponseRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ClccResponseRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void PhoneStateChangeRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void PhoneStateChangeRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void ConfigureWbsRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ConfigureWbsRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothHandsfreeResultHandler* aRes); - void HandleRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void HandleRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); // @@ -318,56 +318,56 @@ protected: class UnknownAtInitOp; class KeyPressedInitOp; - void ConnectionStateNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ConnectionStateNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void AudioStateNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void AudioStateNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void VoiceRecognitionNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void VoiceRecognitionNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void AnswerCallNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void AnswerCallNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void HangupCallNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void HangupCallNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void VolumeNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void VolumeNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void DialCallNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void DialCallNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void DtmfNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void DtmfNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void NRECNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void NRECNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void CallHoldNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void CallHoldNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void CnumNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void CnumNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void CindNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void CindNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void CopsNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void CopsNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void ClccNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void ClccNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void UnknownAtNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void UnknownAtNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void KeyPressedNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU); + void KeyPressedNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU); - void HandleNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void HandleNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); static BluetoothHandsfreeNotificationHandler* sNotificationHandler; diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp index 5d2b17ed346d..0a8cbb5284b8 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp @@ -1070,20 +1070,20 @@ Convert(const ConvertArray& aIn, Tout& aOut) // nsresult -PackPDU(bool aIn, BluetoothDaemonPDU& aPDU) +PackPDU(bool aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothAddress& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothAddress& aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackArray(aIn.mAddr, sizeof(aIn.mAddr)), aPDU); } nsresult PackPDU(const BluetoothAvrcpAttributeTextPairs& aIn, - BluetoothDaemonPDU& aPDU) + DaemonSocketPDU& aPDU) { size_t i; @@ -1119,7 +1119,7 @@ PackPDU(const BluetoothAvrcpAttributeTextPairs& aIn, nsresult PackPDU(const BluetoothAvrcpAttributeValuePairs& aIn, - BluetoothDaemonPDU& aPDU) + DaemonSocketPDU& aPDU) { size_t i; @@ -1137,7 +1137,7 @@ PackPDU(const BluetoothAvrcpAttributeValuePairs& aIn, } nsresult -PackPDU(const BluetoothAvrcpElementAttribute& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothAvrcpElementAttribute& aIn, DaemonSocketPDU& aPDU) { nsresult rv = PackPDU(PackConversion(aIn.mId), aPDU); if (NS_FAILED(rv)) { @@ -1163,13 +1163,13 @@ PackPDU(const BluetoothAvrcpElementAttribute& aIn, BluetoothDaemonPDU& aPDU) } nsresult -PackPDU(BluetoothAvrcpEvent aIn, BluetoothDaemonPDU& aPDU) +PackPDU(BluetoothAvrcpEvent aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothAvrcpEventParamPair& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothAvrcpEventParamPair& aIn, DaemonSocketPDU& aPDU) { nsresult rv; @@ -1211,110 +1211,110 @@ PackPDU(const BluetoothAvrcpEventParamPair& aIn, BluetoothDaemonPDU& aPDU) } nsresult -PackPDU(BluetoothAvrcpNotification aIn, BluetoothDaemonPDU& aPDU) +PackPDU(BluetoothAvrcpNotification aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(BluetoothAvrcpPlayerAttribute aIn, BluetoothDaemonPDU& aPDU) +PackPDU(BluetoothAvrcpPlayerAttribute aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(BluetoothAvrcpStatus aIn, BluetoothDaemonPDU& aPDU) +PackPDU(BluetoothAvrcpStatus aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothConfigurationParameter& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothConfigurationParameter& aIn, DaemonSocketPDU& aPDU) { return PackPDU(aIn.mType, aIn.mLength, PackArray(aIn.mValue.get(), aIn.mLength), aPDU); } nsresult -PackPDU(const BluetoothDaemonPDUHeader& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const DaemonSocketPDUHeader& aIn, DaemonSocketPDU& aPDU) { return PackPDU(aIn.mService, aIn.mOpcode, aIn.mLength, aPDU); } nsresult -PackPDU(const BluetoothHandsfreeAtResponse& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothHandsfreeAtResponse& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothHandsfreeCallAddressType& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothHandsfreeCallAddressType& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothHandsfreeCallDirection& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothHandsfreeCallDirection& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothHandsfreeCallMode& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothHandsfreeCallMode& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothHandsfreeCallMptyType& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothHandsfreeCallMptyType& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothHandsfreeCallState& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothHandsfreeCallState& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothHandsfreeNetworkState& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothHandsfreeNetworkState& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothHandsfreeServiceType& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothHandsfreeServiceType& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothHandsfreeVolumeType& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothHandsfreeVolumeType& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothHandsfreeWbsConfig& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothHandsfreeWbsConfig& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothNamedValue& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothNamedValue& aIn, DaemonSocketPDU& aPDU) { nsresult rv = PackPDU( PackConversion(aIn.name()), aPDU); @@ -1350,7 +1350,7 @@ PackPDU(const BluetoothNamedValue& aIn, BluetoothDaemonPDU& aPDU) } nsresult -PackPDU(const BluetoothPinCode& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothPinCode& aIn, DaemonSocketPDU& aPDU) { return PackPDU(aIn.mLength, PackArray(aIn.mPinCode, sizeof(aIn.mPinCode)), @@ -1358,56 +1358,56 @@ PackPDU(const BluetoothPinCode& aIn, BluetoothDaemonPDU& aPDU) } nsresult -PackPDU(BluetoothPropertyType aIn, BluetoothDaemonPDU& aPDU) +PackPDU(BluetoothPropertyType aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackConversion(aIn), aPDU); } nsresult -PackPDU(BluetoothSspVariant aIn, BluetoothDaemonPDU& aPDU) +PackPDU(BluetoothSspVariant aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackConversion(aIn), aPDU); } nsresult -PackPDU(BluetoothScanMode aIn, BluetoothDaemonPDU& aPDU) +PackPDU(BluetoothScanMode aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothServiceName& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothServiceName& aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackArray(aIn.mName, sizeof(aIn.mName)), aPDU); } nsresult -PackPDU(BluetoothSocketType aIn, BluetoothDaemonPDU& aPDU) +PackPDU(BluetoothSocketType aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackConversion(aIn), aPDU); } nsresult -PackPDU(ControlPlayStatus aIn, BluetoothDaemonPDU& aPDU) +PackPDU(ControlPlayStatus aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackConversion(aIn), aPDU); } nsresult -PackPDU(BluetoothTransport aIn, BluetoothDaemonPDU& aPDU) +PackPDU(BluetoothTransport aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackConversion(aIn), aPDU); } nsresult -PackPDU(const BluetoothUuid& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothUuid& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackArray(aIn.mUuid, sizeof(aIn.mUuid)), aPDU); } nsresult -PackPDU(const BluetoothGattId& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothGattId& aIn, DaemonSocketPDU& aPDU) { nsresult rv = PackPDU(PackReversed(aIn.mUuid), aPDU); if (NS_FAILED(rv)) { @@ -1417,7 +1417,7 @@ PackPDU(const BluetoothGattId& aIn, BluetoothDaemonPDU& aPDU) } nsresult -PackPDU(const BluetoothGattServiceId& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const BluetoothGattServiceId& aIn, DaemonSocketPDU& aPDU) { nsresult rv = PackPDU(aIn.mId, aPDU); if (NS_FAILED(rv)) { @@ -1427,13 +1427,13 @@ PackPDU(const BluetoothGattServiceId& aIn, BluetoothDaemonPDU& aPDU) } nsresult -PackPDU(BluetoothGattAuthReq aIn, BluetoothDaemonPDU& aPDU) +PackPDU(BluetoothGattAuthReq aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackConversion(aIn), aPDU); } nsresult -PackPDU(BluetoothGattWriteType aIn, BluetoothDaemonPDU& aPDU) +PackPDU(BluetoothGattWriteType aIn, DaemonSocketPDU& aPDU) { return PackPDU(PackConversion(aIn), aPDU); } @@ -1443,60 +1443,60 @@ PackPDU(BluetoothGattWriteType aIn, BluetoothDaemonPDU& aPDU) // nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, bool& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, bool& aOut) { return UnpackPDU(aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, char& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, char& aOut) { return UnpackPDU(aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpAudioState& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothA2dpAudioState& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpConnectionState& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothA2dpConnectionState& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAclState& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAclState& aOut) { return UnpackPDU(aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpEvent& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpEvent& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerAttribute& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpPlayerAttribute& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut) { /* Read number of attribute-value pairs */ nsresult rv = UnpackPDU(aPDU, aOut.mNumAttr); @@ -1518,55 +1518,55 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut) } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpRemoteFeature& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpRemoteFeature& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothBondState& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothBondState& aOut) { return UnpackPDU(aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothTypeOfDevice& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothTypeOfDevice& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeAudioState& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeAudioState& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeCallHoldType& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeCallHoldType& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeConnectionState& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeConnectionState& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeNRECState& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeNRECState& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeVoiceRecognitionState& aOut) { return UnpackPDU( @@ -1575,14 +1575,14 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeVolumeType& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeVolumeType& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothProperty& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothProperty& aOut) { nsresult rv = UnpackPDU(aPDU, aOut.mType); if (NS_FAILED(rv)) { @@ -1667,14 +1667,14 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothProperty& aOut) } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothPropertyType& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothPropertyType& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothRemoteInfo& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothRemoteInfo& aOut) { nsresult rv = UnpackPDU(aPDU, UnpackConversion(aOut.mVerMajor)); @@ -1689,13 +1689,13 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothRemoteInfo& aOut) } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothScanMode& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothScanMode& aOut) { return UnpackPDU(aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothServiceRecord& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothServiceRecord& aOut) { /* unpack UUID */ nsresult rv = UnpackPDU(aPDU, aOut.mUuid); @@ -1712,26 +1712,26 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothServiceRecord& aOut) } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothSspVariant& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothSspVariant& aOut) { return UnpackPDU( aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothStatus& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothStatus& aOut) { return UnpackPDU(aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattStatus& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattStatus& aOut) { return UnpackPDU(aPDU, UnpackConversion(aOut)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattId& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattId& aOut) { /* unpack UUID */ nsresult rv = UnpackPDU(aPDU, UnpackReversed(aOut.mUuid)); @@ -1743,7 +1743,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattId& aOut) } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattServiceId& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattServiceId& aOut) { /* unpack id */ nsresult rv = UnpackPDU(aPDU, aOut.mId); @@ -1755,7 +1755,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattServiceId& aOut) } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattReadParam& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattReadParam& aOut) { /* unpack service id */ nsresult rv = UnpackPDU(aPDU, aOut.mServiceId); @@ -1792,7 +1792,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattReadParam& aOut) } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattWriteParam& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattWriteParam& aOut) { /* unpack service id */ nsresult rv = UnpackPDU(aPDU, aOut.mServiceId); @@ -1814,7 +1814,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattWriteParam& aOut) } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattNotifyParam& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattNotifyParam& aOut) { /* unpack address and convert to nsString */ @@ -1851,7 +1851,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattNotifyParam& aOut) return aPDU.Read(aOut.mValue, aOut.mLength); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, nsDependentCString& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, nsDependentCString& aOut) { // We get a pointer to the first character in the PDU, a length // of 1 ensures we consume the \0 byte. With 'str' pointing to @@ -1881,7 +1881,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, nsDependentCString& aOut) } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackCString0& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, const UnpackCString0& aOut) { nsDependentCString cstring; @@ -1896,7 +1896,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackCString0& aOut) } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackString0& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, const UnpackString0& aOut) { nsDependentCString cstring; diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h index 6d16109ef066..18e378633581 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h @@ -106,14 +106,14 @@ struct BluetoothConfigurationParameter { nsAutoArrayPtr mValue; }; -struct BluetoothDaemonPDUHeader { - BluetoothDaemonPDUHeader() +struct DaemonSocketPDUHeader { + DaemonSocketPDUHeader() : mService(0x00) , mOpcode(0x00) , mLength(0x00) { } - BluetoothDaemonPDUHeader(uint8_t aService, uint8_t aOpcode, uint8_t aLength) + DaemonSocketPDUHeader(uint8_t aService, uint8_t aOpcode, uint8_t aLength) : mService(aService) , mOpcode(aOpcode) , mLength(aLength) @@ -346,141 +346,141 @@ Convert(BluetoothGattWriteType aIn, int32_t& aOut); // introduce link errors on non-handled data types template nsresult -PackPDU(T aIn, BluetoothDaemonPDU& aPDU); +PackPDU(T aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(bool aIn, BluetoothDaemonPDU& aPDU); +PackPDU(bool aIn, DaemonSocketPDU& aPDU); inline nsresult -PackPDU(uint8_t aIn, BluetoothDaemonPDU& aPDU) +PackPDU(uint8_t aIn, DaemonSocketPDU& aPDU) { return aPDU.Write(aIn); } inline nsresult -PackPDU(uint16_t aIn, BluetoothDaemonPDU& aPDU) +PackPDU(uint16_t aIn, DaemonSocketPDU& aPDU) { return aPDU.Write(aIn); } inline nsresult -PackPDU(int32_t aIn, BluetoothDaemonPDU& aPDU) +PackPDU(int32_t aIn, DaemonSocketPDU& aPDU) { return aPDU.Write(aIn); } inline nsresult -PackPDU(uint32_t aIn, BluetoothDaemonPDU& aPDU) +PackPDU(uint32_t aIn, DaemonSocketPDU& aPDU) { return aPDU.Write(aIn); } nsresult -PackPDU(const BluetoothAddress& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothAddress& aIn, DaemonSocketPDU& aPDU); nsresult PackPDU(const BluetoothAvrcpAttributeTextPairs& aIn, - BluetoothDaemonPDU& aPDU); + DaemonSocketPDU& aPDU); nsresult PackPDU(const BluetoothAvrcpAttributeValuePairs& aIn, - BluetoothDaemonPDU& aPDU); + DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothAvrcpElementAttribute& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothAvrcpElementAttribute& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(BluetoothAvrcpEvent aIn, BluetoothDaemonPDU& aPDU); +PackPDU(BluetoothAvrcpEvent aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothAvrcpEventParamPair& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothAvrcpEventParamPair& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(BluetoothAvrcpNotification aIn, BluetoothDaemonPDU& aPDU); +PackPDU(BluetoothAvrcpNotification aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(BluetoothAvrcpPlayerAttribute aIn, BluetoothDaemonPDU& aPDU); +PackPDU(BluetoothAvrcpPlayerAttribute aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(BluetoothAvrcpStatus aIn, BluetoothDaemonPDU& aPDU); +PackPDU(BluetoothAvrcpStatus aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothConfigurationParameter& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothConfigurationParameter& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothDaemonPDUHeader& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const DaemonSocketPDUHeader& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothHandsfreeAtResponse& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothHandsfreeAtResponse& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothHandsfreeCallAddressType& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothHandsfreeCallAddressType& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothHandsfreeCallDirection& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothHandsfreeCallDirection& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothHandsfreeCallMode& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothHandsfreeCallMode& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothHandsfreeCallMptyType& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothHandsfreeCallMptyType& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothHandsfreeCallState& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothHandsfreeCallState& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothHandsfreeNetworkState& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothHandsfreeNetworkState& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothHandsfreeServiceType& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothHandsfreeServiceType& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothHandsfreeVolumeType& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothHandsfreeVolumeType& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothHandsfreeWbsConfig& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothHandsfreeWbsConfig& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothNamedValue& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothNamedValue& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothPinCode& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothPinCode& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(BluetoothPropertyType aIn, BluetoothDaemonPDU& aPDU); +PackPDU(BluetoothPropertyType aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothServiceName& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothServiceName& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(BluetoothSocketType aIn, BluetoothDaemonPDU& aPDU); +PackPDU(BluetoothSocketType aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(BluetoothSspVariant aIn, BluetoothDaemonPDU& aPDU); +PackPDU(BluetoothSspVariant aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(BluetoothScanMode aIn, BluetoothDaemonPDU& aPDU); +PackPDU(BluetoothScanMode aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(ControlPlayStatus aIn, BluetoothDaemonPDU& aPDU); +PackPDU(ControlPlayStatus aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothUuid& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothUuid& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothGattId& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothGattId& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(const BluetoothGattServiceId& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const BluetoothGattServiceId& aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(BluetoothGattAuthReq aIn, BluetoothDaemonPDU& aPDU); +PackPDU(BluetoothGattAuthReq aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(BluetoothGattWriteType aIn, BluetoothDaemonPDU& aPDU); +PackPDU(BluetoothGattWriteType aIn, DaemonSocketPDU& aPDU); nsresult -PackPDU(BluetoothTransport aIn, BluetoothDaemonPDU& aPDU); +PackPDU(BluetoothTransport aIn, DaemonSocketPDU& aPDU); /* |PackConversion| is a helper for packing converted values. Pass * an instance of this structure to |PackPDU| to convert a value from @@ -497,7 +497,7 @@ struct PackConversion { template inline nsresult -PackPDU(const PackConversion& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const PackConversion& aIn, DaemonSocketPDU& aPDU) { Tout out; @@ -529,7 +529,7 @@ struct PackArray */ template inline nsresult -PackPDU(const PackArray& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const PackArray& aIn, DaemonSocketPDU& aPDU) { for (size_t i = 0; i < aIn.mLength; ++i) { nsresult rv = PackPDU(aIn.mData[i], aPDU); @@ -542,7 +542,7 @@ PackPDU(const PackArray& aIn, BluetoothDaemonPDU& aPDU) template<> inline nsresult -PackPDU(const PackArray& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const PackArray& aIn, DaemonSocketPDU& aPDU) { /* Write raw bytes in one pass */ return aPDU.Write(aIn.mData, aIn.mLength); @@ -550,7 +550,7 @@ PackPDU(const PackArray& aIn, BluetoothDaemonPDU& aPDU) template<> inline nsresult -PackPDU(const PackArray& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const PackArray& aIn, DaemonSocketPDU& aPDU) { /* Write raw bytes in one pass */ return aPDU.Write(aIn.mData, aIn.mLength); @@ -572,7 +572,7 @@ struct PackCString0 /* This implementation of |PackPDU| packs a 0-terminated C string. */ inline nsresult -PackPDU(const PackCString0& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const PackCString0& aIn, DaemonSocketPDU& aPDU) { return PackPDU( PackArray(reinterpret_cast(aIn.mString.get()), @@ -598,14 +598,14 @@ struct PackReversed */ template nsresult -PackPDU(const PackReversed& aIn, BluetoothDaemonPDU& aPDU); +PackPDU(const PackReversed& aIn, DaemonSocketPDU& aPDU); /* This implementation of |PackPDU| packs elements in |PackArray| in reversed * order. (ex. reversed GATT UUID, see bug 1171866) */ template inline nsresult -PackPDU(const PackReversed>& aIn, BluetoothDaemonPDU& aPDU) +PackPDU(const PackReversed>& aIn, DaemonSocketPDU& aPDU) { for (size_t i = 0; i < aIn.mValue.mLength; ++i) { nsresult rv = PackPDU(aIn.mValue.mData[aIn.mValue.mLength - i - 1], aPDU); @@ -622,7 +622,7 @@ PackPDU(const PackReversed>& aIn, BluetoothDaemonPDU& aPDU) template <> inline nsresult PackPDU(const PackReversed& aIn, - BluetoothDaemonPDU& aPDU) + DaemonSocketPDU& aPDU) { return PackPDU( PackReversed>( @@ -632,7 +632,7 @@ PackPDU(const PackReversed& aIn, template inline nsresult -PackPDU(const T1& aIn1, const T2& aIn2, BluetoothDaemonPDU& aPDU) +PackPDU(const T1& aIn1, const T2& aIn2, DaemonSocketPDU& aPDU) { nsresult rv = PackPDU(aIn1, aPDU); if (NS_FAILED(rv)) { @@ -644,7 +644,7 @@ PackPDU(const T1& aIn1, const T2& aIn2, BluetoothDaemonPDU& aPDU) template inline nsresult PackPDU(const T1& aIn1, const T2& aIn2, const T3& aIn3, - BluetoothDaemonPDU& aPDU) + DaemonSocketPDU& aPDU) { nsresult rv = PackPDU(aIn1, aPDU); if (NS_FAILED(rv)) { @@ -660,7 +660,7 @@ PackPDU(const T1& aIn1, const T2& aIn2, const T3& aIn3, template inline nsresult PackPDU(const T1& aIn1, const T2& aIn2, const T3& aIn3, const T4& aIn4, - BluetoothDaemonPDU& aPDU) + DaemonSocketPDU& aPDU) { nsresult rv = PackPDU(aIn1, aPDU); if (NS_FAILED(rv)) { @@ -682,7 +682,7 @@ template nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, T& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, T& aOut); inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, int8_t& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, int8_t& aOut) { return aPDU.Read(aOut); } inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, uint8_t& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, uint8_t& aOut) { return aPDU.Read(aOut); } inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, uint16_t& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, uint16_t& aOut) { return aPDU.Read(aOut); } inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, int32_t& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, int32_t& aOut) { return aPDU.Read(aOut); } inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, uint32_t& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, uint32_t& aOut) { return aPDU.Read(aOut); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, bool& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, bool& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, char& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, char& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpAudioState& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothA2dpAudioState& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothA2dpConnectionState& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothA2dpConnectionState& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAclState& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAclState& aOut); inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAddress& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAddress& aOut) { return aPDU.Read(aOut.mAddr, sizeof(aOut.mAddr)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpEvent& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpEvent& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpMediaAttribute& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerAttribute& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpPlayerAttribute& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpPlayerSettings& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothAvrcpRemoteFeature& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothAvrcpRemoteFeature& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothBondState& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothBondState& aOut); inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothDaemonPDUHeader& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, DaemonSocketPDUHeader& aOut) { nsresult rv = UnpackPDU(aPDU, aOut.mService); if (NS_FAILED(rv)) { @@ -933,80 +933,80 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothDaemonPDUHeader& aOut) } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothTypeOfDevice& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothTypeOfDevice& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeAudioState& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeAudioState& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeCallHoldType& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeCallHoldType& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeConnectionState& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeConnectionState& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeNRECState& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeNRECState& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeVoiceRecognitionState& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothHandsfreeVolumeType& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothHandsfreeVolumeType& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothRemoteInfo& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothRemoteInfo& aOut); inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothRemoteName& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothRemoteName& aOut) { return aPDU.Read(aOut.mName, sizeof(aOut.mName)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothProperty& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothProperty& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothPropertyType& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothPropertyType& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothScanMode& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothScanMode& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothServiceRecord& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothServiceRecord& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothSspVariant& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothSspVariant& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothStatus& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothStatus& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattStatus& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattStatus& aOut); inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothUuid& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothUuid& aOut) { return aPDU.Read(aOut.mUuid, sizeof(aOut.mUuid)); } nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattId& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattId& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattServiceId& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattServiceId& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattReadParam& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattReadParam& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattWriteParam& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattWriteParam& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, BluetoothGattNotifyParam& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, BluetoothGattNotifyParam& aOut); nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, nsDependentCString& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, nsDependentCString& aOut); /* |UnpackConversion| is a helper for convering unpacked values. Pass * an instance of this structure to |UnpackPDU| to read a value from @@ -1023,7 +1023,7 @@ struct UnpackConversion { template inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackConversion& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, const UnpackConversion& aOut) { Tin in; nsresult rv = UnpackPDU(aPDU, in); @@ -1067,7 +1067,7 @@ struct UnpackArray template inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackArray& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, const UnpackArray& aOut) { for (size_t i = 0; i < aOut.mLength; ++i) { nsresult rv = UnpackPDU(aPDU, aOut.mData[i]); @@ -1080,7 +1080,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackArray& aOut) template inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, UnpackArray& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, UnpackArray& aOut) { for (size_t i = 0; i < aOut.mLength; ++i) { nsresult rv = UnpackPDU(aPDU, aOut.mData[i]); @@ -1093,7 +1093,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, UnpackArray& aOut) template<> inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackArray& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, const UnpackArray& aOut) { /* Read raw bytes in one pass */ return aPDU.Read(aOut.mData, aOut.mLength); @@ -1101,7 +1101,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackArray& aOut) template inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, nsTArray& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, nsTArray& aOut) { for (typename nsTArray::size_type i = 0; i < aOut.Length(); ++i) { nsresult rv = UnpackPDU(aPDU, aOut[i]); @@ -1128,7 +1128,7 @@ struct UnpackCString0 /* This implementation of |UnpackPDU| unpacks a 0-terminated C string. */ nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackCString0& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, const UnpackCString0& aOut); /* |UnpackString0| is a helper for unpacking 0-terminated C string, * including the \0 character. Pass an instance of this structure @@ -1148,7 +1148,7 @@ struct UnpackString0 * and converts it to wide-character encoding. */ nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackString0& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, const UnpackString0& aOut); /* |UnpackReversed| is a helper for unpacking data in reversed order. Pass an * instance of this structure as the second argument to |UnpackPDU| to unpack @@ -1173,11 +1173,11 @@ struct UnpackReversed */ template nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackReversed& aOut); +UnpackPDU(DaemonSocketPDU& aPDU, const UnpackReversed& aOut); template inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackReversed>& aOut) +UnpackPDU(DaemonSocketPDU& aPDU, const UnpackReversed>& aOut) { for (size_t i = 0; i < aOut.mValue->mLength; ++i) { nsresult rv = UnpackPDU(aPDU, @@ -1194,7 +1194,7 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, const UnpackReversed>& aOut) */ template<> inline nsresult -UnpackPDU(BluetoothDaemonPDU& aPDU, +UnpackPDU(DaemonSocketPDU& aPDU, const UnpackReversed& aOut) { return UnpackPDU( @@ -1211,11 +1211,11 @@ UnpackPDU(BluetoothDaemonPDU& aPDU, class PDUInitOp { protected: - PDUInitOp(BluetoothDaemonPDU& aPDU) + PDUInitOp(DaemonSocketPDU& aPDU) : mPDU(&aPDU) { } - BluetoothDaemonPDU& GetPDU() const + DaemonSocketPDU& GetPDU() const { return *mPDU; // cannot be nullptr } @@ -1237,7 +1237,7 @@ protected: } private: - BluetoothDaemonPDU* mPDU; // Hold pointer to allow for constant instances + DaemonSocketPDU* mPDU; // Hold pointer to allow for constant instances }; // |UnpackPDUInitOp| is a general-purpose init operator for all variants @@ -1247,7 +1247,7 @@ private: class UnpackPDUInitOp final : private PDUInitOp { public: - UnpackPDUInitOp(BluetoothDaemonPDU& aPDU) + UnpackPDUInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1271,7 +1271,7 @@ public: template nsresult operator () (T1& aArg1, T2& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); nsresult rv = UnpackPDU(pdu, aArg1); if (NS_FAILED(rv)) { @@ -1288,7 +1288,7 @@ public: template nsresult operator () (T1& aArg1, T2& aArg2, T3& aArg3) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); nsresult rv = UnpackPDU(pdu, aArg1); if (NS_FAILED(rv)) { @@ -1309,7 +1309,7 @@ public: template nsresult operator () (T1& aArg1, T2& aArg2, T3& aArg3, T4& aArg4) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); nsresult rv = UnpackPDU(pdu, aArg1); if (NS_FAILED(rv)) { @@ -1335,7 +1335,7 @@ public: nsresult operator () (T1& aArg1, T2& aArg2, T3& aArg3, T4& aArg4, T5& aArg5) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); nsresult rv = UnpackPDU(pdu, aArg1); if (NS_FAILED(rv)) { diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp index d1013d02a191..d0e56b73b0e8 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp @@ -34,7 +34,7 @@ static const int sRetryInterval = 100; // ms class BluetoothDaemonSetupModule { public: - virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0; + virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0; // Commands // @@ -45,7 +45,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x00, 0x01, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x00, 0x01, 0)); #if ANDROID_VERSION >= 21 nsresult rv = PackPDU(aId, aMode, aMaxNumClients, *pdu); @@ -68,7 +68,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x00, 0x02, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x00, 0x02, 0)); nsresult rv = PackPDU(aId, *pdu); if (NS_FAILED(rv)) { @@ -87,7 +87,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x00, 0x03, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x00, 0x03, 0)); nsresult rv = PackPDU( aLen, PackArray(aParam, aLen), *pdu); @@ -106,12 +106,12 @@ protected: // Called to handle PDUs with Service field equal to 0x00, which // contains internal operations for setup and configuration. - void HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData) + void HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonSetupModule::* const HandleRsp[])( - const BluetoothDaemonPDUHeader&, - BluetoothDaemonPDU&, + const DaemonSocketPDUHeader&, + DaemonSocketPDU&, BluetoothSetupResultHandler*) = { INIT_ARRAY_AT(0x00, &BluetoothDaemonSetupModule::ErrorRsp), INIT_ARRAY_AT(0x01, &BluetoothDaemonSetupModule::RegisterModuleRsp), @@ -135,7 +135,7 @@ protected: (this->*(HandleRsp[aHeader.mOpcode]))(aHeader, aPDU, res); } - nsresult Send(BluetoothDaemonPDU* aPDU, BluetoothSetupResultHandler* aRes) + nsresult Send(DaemonSocketPDU* aPDU, BluetoothSetupResultHandler* aRes) { aRes->AddRef(); // Keep reference for response return Send(aPDU, static_cast(aRes)); @@ -154,8 +154,8 @@ private: ErrorRunnable; void - ErrorRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + ErrorRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothSetupResultHandler* aRes) { ErrorRunnable::Dispatch( @@ -163,8 +163,8 @@ private: } void - RegisterModuleRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + RegisterModuleRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothSetupResultHandler* aRes) { ResultRunnable::Dispatch( @@ -173,8 +173,8 @@ private: } void - UnregisterModuleRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + UnregisterModuleRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothSetupResultHandler* aRes) { ResultRunnable::Dispatch( @@ -183,8 +183,8 @@ private: } void - ConfigurationRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + ConfigurationRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothSetupResultHandler* aRes) { ResultRunnable::Dispatch( @@ -205,13 +205,13 @@ public: static const int MAX_NUM_CLIENTS; - virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0; + virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0; nsresult EnableCmd(BluetoothResultHandler* aRes) { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x01, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x01, 0)); nsresult rv = Send(pdu, aRes); if (NS_FAILED(rv)) { @@ -225,7 +225,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x02, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x02, 0)); nsresult rv = Send(pdu, aRes); if (NS_FAILED(rv)) { @@ -239,7 +239,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x03, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x03, 0)); nsresult rv = Send(pdu, aRes); if (NS_FAILED(rv)) { @@ -254,7 +254,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x04, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x04, 0)); nsresult rv = PackPDU( PackConversion(aName), *pdu); @@ -274,7 +274,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x05, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x05, 0)); nsresult rv = PackPDU(aProperty, *pdu); if (NS_FAILED(rv)) { @@ -293,7 +293,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x06, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x06, 0)); nsresult rv = PackPDU( PackConversion(aRemoteAddr), *pdu); @@ -314,7 +314,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x07, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x07, 0)); nsresult rv = PackPDU( PackConversion(aRemoteAddr), @@ -336,7 +336,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x08, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x08, 0)); nsresult rv = PackPDU( PackConversion(aRemoteAddr), @@ -358,7 +358,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x09, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x09, 0)); nsresult rv = PackPDU( PackConversion(aRemoteAddr), @@ -379,7 +379,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x0a, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x0a, 0)); nsresult rv = PackPDU( PackConversion(aRemoteAddr), *pdu); @@ -398,7 +398,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x0b, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x0b, 0)); nsresult rv = Send(pdu, aRes); if (NS_FAILED(rv)) { @@ -412,7 +412,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x0c, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x0c, 0)); nsresult rv = Send(pdu, aRes); if (NS_FAILED(rv)) { @@ -428,7 +428,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x0d, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x0d, 0)); #if ANDROID_VERSION >= 21 nsresult rv = PackPDU( @@ -453,7 +453,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x0e, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x0e, 0)); nsresult rv = PackPDU( PackConversion(aBdAddr), *pdu); @@ -473,7 +473,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x0f, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x0f, 0)); nsresult rv = PackPDU( PackConversion(aBdAddr), *pdu); @@ -494,7 +494,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x10, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x10, 0)); nsresult rv = PackPDU( PackConversion(aBdAddr), @@ -517,7 +517,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x11, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x11, 0)); nsresult rv = PackPDU( PackConversion(aBdAddr), @@ -537,7 +537,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x12, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x12, 0)); nsresult rv = PackPDU(aEnable, *pdu); if (NS_FAILED(rv)) { @@ -556,7 +556,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x13, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x13, 0)); nsresult rv = PackPDU(aOpcode, aLen, PackArray(aBuf, aLen), *pdu); @@ -576,7 +576,7 @@ public: { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x01, 0x14, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x01, 0x14, 0)); nsresult rv = PackPDU(aOpcode, aLen, PackArray(aBuf, aLen), *pdu); @@ -593,11 +593,11 @@ public: protected: - void HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData) + void HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonCoreModule::* const HandleOp[])( - const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = { + const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::HandleRsp), INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::HandleNtf), }; @@ -607,7 +607,7 @@ protected: (this->*(HandleOp[!!(aHeader.mOpcode & 0x80)]))(aHeader, aPDU, aUserData); } - nsresult Send(BluetoothDaemonPDU* aPDU, BluetoothResultHandler* aRes) + nsresult Send(DaemonSocketPDU* aPDU, BluetoothResultHandler* aRes) { aRes->AddRef(); // Keep reference for response return Send(aPDU, static_cast(aRes)); @@ -625,32 +625,32 @@ private: BluetoothStatus, BluetoothStatus> ErrorRunnable; - void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ErrorRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ErrorRunnable::Dispatch( aRes, &BluetoothResultHandler::OnError, UnpackPDUInitOp(aPDU)); } - void EnableRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void EnableRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothResultHandler::Enable, UnpackPDUInitOp(aPDU)); } - void DisableRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void DisableRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( aRes, &BluetoothResultHandler::Disable, UnpackPDUInitOp(aPDU)); } - void GetAdapterPropertiesRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void GetAdapterPropertiesRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -658,8 +658,8 @@ private: UnpackPDUInitOp(aPDU)); } - void GetAdapterPropertyRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void GetAdapterPropertyRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -667,8 +667,8 @@ private: UnpackPDUInitOp(aPDU)); } - void SetAdapterPropertyRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void SetAdapterPropertyRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -676,8 +676,8 @@ private: UnpackPDUInitOp(aPDU)); } - void GetRemoteDevicePropertiesRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void GetRemoteDevicePropertiesRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -686,8 +686,8 @@ private: } void - GetRemoteDevicePropertyRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + GetRemoteDevicePropertyRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -695,8 +695,8 @@ private: UnpackPDUInitOp(aPDU)); } - void SetRemoteDevicePropertyRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void SetRemoteDevicePropertyRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -704,8 +704,8 @@ private: UnpackPDUInitOp(aPDU)); } - void GetRemoteServiceRecordRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void GetRemoteServiceRecordRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -713,8 +713,8 @@ private: UnpackPDUInitOp(aPDU)); } - void GetRemoteServicesRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void GetRemoteServicesRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -722,8 +722,8 @@ private: UnpackPDUInitOp(aPDU)); } - void StartDiscoveryRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void StartDiscoveryRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -731,8 +731,8 @@ private: UnpackPDUInitOp(aPDU)); } - void CancelDiscoveryRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void CancelDiscoveryRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -740,8 +740,8 @@ private: UnpackPDUInitOp(aPDU)); } - void CreateBondRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void CreateBondRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -749,8 +749,8 @@ private: UnpackPDUInitOp(aPDU)); } - void RemoveBondRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void RemoveBondRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -758,8 +758,8 @@ private: UnpackPDUInitOp(aPDU)); } - void CancelBondRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void CancelBondRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -767,8 +767,8 @@ private: UnpackPDUInitOp(aPDU)); } - void PinReplyRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void PinReplyRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -776,8 +776,8 @@ private: UnpackPDUInitOp(aPDU)); } - void SspReplyRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void SspReplyRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -785,8 +785,8 @@ private: UnpackPDUInitOp(aPDU)); } - void DutModeConfigureRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void DutModeConfigureRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -794,8 +794,8 @@ private: UnpackPDUInitOp(aPDU)); } - void DutModeSendRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void DutModeSendRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -803,8 +803,8 @@ private: UnpackPDUInitOp(aPDU)); } - void LeTestModeRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void LeTestModeRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothResultHandler* aRes) { ResultRunnable::Dispatch( @@ -812,12 +812,12 @@ private: UnpackPDUInitOp(aPDU)); } - void HandleRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData) + void HandleRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonCoreModule::* const HandleRsp[])( - const BluetoothDaemonPDUHeader&, - BluetoothDaemonPDU&, + const DaemonSocketPDUHeader&, + DaemonSocketPDU&, BluetoothResultHandler*) = { INIT_ARRAY_AT(0x00, &BluetoothDaemonCoreModule::ErrorRsp), INIT_ARRAY_AT(0x01, &BluetoothDaemonCoreModule::EnableRsp), @@ -939,8 +939,8 @@ private: BluetoothStatus, uint16_t> LeTestModeNotification; - void AdapterStateChangedNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU) + void AdapterStateChangedNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU) { AdapterStateChangedNotification::Dispatch( &BluetoothNotificationHandler::AdapterStateChangedNotification, @@ -951,7 +951,7 @@ private: class AdapterPropertiesInitOp final : private PDUInitOp { public: - AdapterPropertiesInitOp(BluetoothDaemonPDU& aPDU) + AdapterPropertiesInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -959,7 +959,7 @@ private: operator () (BluetoothStatus& aArg1, int& aArg2, nsAutoArrayPtr& aArg3) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read status */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -986,8 +986,8 @@ private: } }; - void AdapterPropertiesNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU) + void AdapterPropertiesNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU) { AdapterPropertiesNotification::Dispatch( &BluetoothNotificationHandler::AdapterPropertiesNotification, @@ -998,7 +998,7 @@ private: class RemoteDevicePropertiesInitOp final : private PDUInitOp { public: - RemoteDevicePropertiesInitOp(BluetoothDaemonPDU& aPDU) + RemoteDevicePropertiesInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1006,7 +1006,7 @@ private: operator () (BluetoothStatus& aArg1, nsString& aArg2, int& aArg3, nsAutoArrayPtr& aArg4) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read status */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -1040,8 +1040,8 @@ private: } }; - void RemoteDevicePropertiesNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU) + void RemoteDevicePropertiesNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU) { RemoteDevicePropertiesNotification::Dispatch( &BluetoothNotificationHandler::RemoteDevicePropertiesNotification, @@ -1052,14 +1052,14 @@ private: class DeviceFoundInitOp final : private PDUInitOp { public: - DeviceFoundInitOp(BluetoothDaemonPDU& aPDU) + DeviceFoundInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (int& aArg1, nsAutoArrayPtr& aArg2) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read number of properties */ uint8_t numProperties; @@ -1080,16 +1080,16 @@ private: } }; - void DeviceFoundNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU) + void DeviceFoundNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU) { DeviceFoundNotification::Dispatch( &BluetoothNotificationHandler::DeviceFoundNotification, DeviceFoundInitOp(aPDU)); } - void DiscoveryStateChangedNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU) + void DiscoveryStateChangedNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU) { DiscoveryStateChangedNotification::Dispatch( &BluetoothNotificationHandler::DiscoveryStateChangedNotification, @@ -1100,14 +1100,14 @@ private: class PinRequestInitOp final : private PDUInitOp { public: - PinRequestInitOp(BluetoothDaemonPDU& aPDU) + PinRequestInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (nsString& aArg1, nsString& aArg2, uint32_t& aArg3) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read remote address */ nsresult rv = UnpackPDU( @@ -1133,8 +1133,8 @@ private: } }; - void PinRequestNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU) + void PinRequestNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU) { PinRequestNotification::Dispatch( &BluetoothNotificationHandler::PinRequestNotification, @@ -1145,7 +1145,7 @@ private: class SspRequestInitOp final : private PDUInitOp { public: - SspRequestInitOp(BluetoothDaemonPDU& aPDU) + SspRequestInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1153,7 +1153,7 @@ private: operator () (nsString& aArg1, nsString& aArg2, uint32_t& aArg3, BluetoothSspVariant& aArg4, uint32_t& aArg5) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read remote address */ nsresult rv = UnpackPDU( @@ -1191,8 +1191,8 @@ private: } }; - void SspRequestNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU) + void SspRequestNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU) { SspRequestNotification::Dispatch( &BluetoothNotificationHandler::SspRequestNotification, @@ -1203,7 +1203,7 @@ private: class BondStateChangedInitOp final : private PDUInitOp { public: - BondStateChangedInitOp(BluetoothDaemonPDU& aPDU) + BondStateChangedInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1211,7 +1211,7 @@ private: operator () (BluetoothStatus& aArg1, nsString& aArg2, BluetoothBondState& aArg3) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read status */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -1236,8 +1236,8 @@ private: } }; - void BondStateChangedNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU) + void BondStateChangedNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU) { BondStateChangedNotification::Dispatch( &BluetoothNotificationHandler::BondStateChangedNotification, @@ -1248,14 +1248,14 @@ private: class AclStateChangedInitOp final : private PDUInitOp { public: - AclStateChangedInitOp(BluetoothDaemonPDU& aPDU) + AclStateChangedInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (BluetoothStatus& aArg1, nsString& aArg2, bool& aArg3) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read status */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -1281,8 +1281,8 @@ private: } }; - void AclStateChangedNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU) + void AclStateChangedNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU) { AclStateChangedNotification::Dispatch( &BluetoothNotificationHandler::AclStateChangedNotification, @@ -1293,7 +1293,7 @@ private: class DutModeRecvInitOp final : private PDUInitOp { public: - DutModeRecvInitOp(BluetoothDaemonPDU& aPDU) + DutModeRecvInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } @@ -1301,7 +1301,7 @@ private: operator () (uint16_t& aArg1, nsAutoArrayPtr& aArg2, uint8_t& aArg3) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); /* Read opcode */ nsresult rv = UnpackPDU(pdu, aArg1); @@ -1325,27 +1325,27 @@ private: } }; - void DutModeRecvNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU) + void DutModeRecvNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU) { DutModeRecvNotification::Dispatch( &BluetoothNotificationHandler::DutModeRecvNotification, DutModeRecvInitOp(aPDU)); } - void LeTestModeNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU) + void LeTestModeNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU) { LeTestModeNotification::Dispatch( &BluetoothNotificationHandler::LeTestModeNotification, UnpackPDUInitOp(aPDU)); } - void HandleNtf(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData) + void HandleNtf(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonCoreModule::* const HandleNtf[])( - const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&) = { + const DaemonSocketPDUHeader&, DaemonSocketPDU&) = { INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::AdapterStateChangedNtf), INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::AdapterPropertiesNtf), INIT_ARRAY_AT(2, &BluetoothDaemonCoreModule::RemoteDevicePropertiesNtf), @@ -1450,32 +1450,32 @@ public: // Outgoing PDUs // - nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) override; + nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) override; - void StoreUserData(const BluetoothDaemonPDU& aPDU) override; + void StoreUserData(const DaemonSocketPDU& aPDU) override; // Incoming PUDs // - void Handle(BluetoothDaemonPDU& aPDU) override; + void Handle(DaemonSocketPDU& aPDU) override; - void* FetchUserData(const BluetoothDaemonPDUHeader& aHeader); + void* FetchUserData(const DaemonSocketPDUHeader& aHeader); private: - void HandleSetupSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); - void HandleCoreSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); - void HandleSocketSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); - void HandleHandsfreeSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); - void HandleA2dpSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); - void HandleAvrcpSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); - void HandleGattSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); + void HandleSetupSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); + void HandleCoreSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); + void HandleSocketSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); + void HandleHandsfreeSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); + void HandleA2dpSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); + void HandleAvrcpSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); + void HandleGattSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); BluetoothDaemonConnection* mConnection; nsTArray mUserDataQ; @@ -1507,7 +1507,7 @@ BluetoothDaemonProtocol::UnregisterModule(uint8_t aId, } nsresult -BluetoothDaemonProtocol::Send(BluetoothDaemonPDU* aPDU, void* aUserData) +BluetoothDaemonProtocol::Send(DaemonSocketPDU* aPDU, void* aUserData) { MOZ_ASSERT(mConnection); MOZ_ASSERT(aPDU); @@ -1528,7 +1528,7 @@ BluetoothDaemonProtocol::Send(BluetoothDaemonPDU* aPDU, void* aUserData) void BluetoothDaemonProtocol::HandleSetupSvc( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { BluetoothDaemonSetupModule::HandleSvc(aHeader, aPDU, aUserData); @@ -1536,7 +1536,7 @@ BluetoothDaemonProtocol::HandleSetupSvc( void BluetoothDaemonProtocol::HandleCoreSvc( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { BluetoothDaemonCoreModule::HandleSvc(aHeader, aPDU, aUserData); @@ -1544,7 +1544,7 @@ BluetoothDaemonProtocol::HandleCoreSvc( void BluetoothDaemonProtocol::HandleSocketSvc( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { BluetoothDaemonSocketModule::HandleSvc(aHeader, aPDU, aUserData); @@ -1552,7 +1552,7 @@ BluetoothDaemonProtocol::HandleSocketSvc( void BluetoothDaemonProtocol::HandleHandsfreeSvc( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { BluetoothDaemonHandsfreeModule::HandleSvc(aHeader, aPDU, aUserData); @@ -1560,7 +1560,7 @@ BluetoothDaemonProtocol::HandleHandsfreeSvc( void BluetoothDaemonProtocol::HandleA2dpSvc( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { BluetoothDaemonA2dpModule::HandleSvc(aHeader, aPDU, aUserData); @@ -1568,7 +1568,7 @@ BluetoothDaemonProtocol::HandleA2dpSvc( void BluetoothDaemonProtocol::HandleAvrcpSvc( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { BluetoothDaemonAvrcpModule::HandleSvc(aHeader, aPDU, aUserData); @@ -1576,17 +1576,17 @@ BluetoothDaemonProtocol::HandleAvrcpSvc( void BluetoothDaemonProtocol::HandleGattSvc( - const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU, + const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData) { BluetoothDaemonGattModule::HandleSvc(aHeader, aPDU, aUserData); } void -BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU) +BluetoothDaemonProtocol::Handle(DaemonSocketPDU& aPDU) { static void (BluetoothDaemonProtocol::* const HandleSvc[])( - const BluetoothDaemonPDUHeader&, BluetoothDaemonPDU&, void*) = { + const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { INIT_ARRAY_AT(0x00, &BluetoothDaemonProtocol::HandleSetupSvc), INIT_ARRAY_AT(0x01, &BluetoothDaemonProtocol::HandleCoreSvc), INIT_ARRAY_AT(0x02, &BluetoothDaemonProtocol::HandleSocketSvc), @@ -1603,7 +1603,7 @@ BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU) &BluetoothDaemonProtocol::HandleGattSvc) }; - BluetoothDaemonPDUHeader header; + DaemonSocketPDUHeader header; if (NS_FAILED(UnpackPDU(aPDU, header)) || NS_WARN_IF(!(header.mService < MOZ_ARRAY_LENGTH(HandleSvc))) || @@ -1615,7 +1615,7 @@ BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU) } void -BluetoothDaemonProtocol::StoreUserData(const BluetoothDaemonPDU& aPDU) +BluetoothDaemonProtocol::StoreUserData(const DaemonSocketPDU& aPDU) { MOZ_ASSERT(!NS_IsMainThread()); @@ -1623,7 +1623,7 @@ BluetoothDaemonProtocol::StoreUserData(const BluetoothDaemonPDU& aPDU) } void* -BluetoothDaemonProtocol::FetchUserData(const BluetoothDaemonPDUHeader& aHeader) +BluetoothDaemonProtocol::FetchUserData(const DaemonSocketPDUHeader& aHeader) { MOZ_ASSERT(!NS_IsMainThread()); diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp index 71572fe4b3fc..84457605693c 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp @@ -30,7 +30,7 @@ BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType, { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x02, 0x01, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x02, 0x01, 0)); nsresult rv = PackPDU( aType, @@ -59,7 +59,7 @@ BluetoothDaemonSocketModule::ConnectCmd(const nsAString& aBdAddr, { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new BluetoothDaemonPDU(0x02, 0x02, 0)); + nsAutoPtr pdu(new DaemonSocketPDU(0x02, 0x02, 0)); nsresult rv = PackPDU( PackConversion(aBdAddr), @@ -156,13 +156,13 @@ BluetoothDaemonSocketModule::CloseCmd(BluetoothSocketResultHandler* aRes) } void -BluetoothDaemonSocketModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, +BluetoothDaemonSocketModule::HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData) { static void (BluetoothDaemonSocketModule::* const HandleRsp[])( - const BluetoothDaemonPDUHeader&, - BluetoothDaemonPDU&, + const DaemonSocketPDUHeader&, + DaemonSocketPDU&, BluetoothSocketResultHandler*) = { INIT_ARRAY_AT(0x00, &BluetoothDaemonSocketModule::ErrorRsp), INIT_ARRAY_AT(0x01, &BluetoothDaemonSocketModule::ListenRsp), @@ -186,7 +186,7 @@ BluetoothDaemonSocketModule::HandleSvc(const BluetoothDaemonPDUHeader& aHeader, } nsresult -BluetoothDaemonSocketModule::Send(BluetoothDaemonPDU* aPDU, +BluetoothDaemonSocketModule::Send(DaemonSocketPDU* aPDU, BluetoothSocketResultHandler* aRes) { aRes->AddRef(); // Keep reference for response @@ -203,8 +203,8 @@ BluetoothDaemonSocketModule::SocketFlags(bool aEncrypt, bool aAuth) // void -BluetoothDaemonSocketModule::ErrorRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, +BluetoothDaemonSocketModule::ErrorRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothSocketResultHandler* aRes) { ErrorRunnable::Dispatch( @@ -214,14 +214,14 @@ BluetoothDaemonSocketModule::ErrorRsp(const BluetoothDaemonPDUHeader& aHeader, class BluetoothDaemonSocketModule::ListenInitOp final : private PDUInitOp { public: - ListenInitOp(BluetoothDaemonPDU& aPDU) + ListenInitOp(DaemonSocketPDU& aPDU) : PDUInitOp(aPDU) { } nsresult operator () (int& aArg1) const { - BluetoothDaemonPDU& pdu = GetPDU(); + DaemonSocketPDU& pdu = GetPDU(); aArg1 = pdu.AcquireFd(); @@ -234,8 +234,8 @@ public: }; void -BluetoothDaemonSocketModule::ListenRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, +BluetoothDaemonSocketModule::ListenRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothSocketResultHandler* aRes) { IntResultRunnable::Dispatch( @@ -274,8 +274,8 @@ public: }; void -BluetoothDaemonSocketModule::ConnectRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, +BluetoothDaemonSocketModule::ConnectRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothSocketResultHandler* aRes) { /* the file descriptor is attached in the PDU's ancillary data */ diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h index 3632afeac18a..031ab7f5fa01 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h @@ -20,7 +20,7 @@ class BluetoothDaemonSocketModule public: static const int MAX_NUM_CLIENTS; - virtual nsresult Send(BluetoothDaemonPDU* aPDU, void* aUserData) = 0; + virtual nsresult Send(DaemonSocketPDU* aPDU, void* aUserData) = 0; // Commands // @@ -43,10 +43,10 @@ public: protected: - void HandleSvc(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, void* aUserData); + void HandleSvc(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, void* aUserData); - nsresult Send(BluetoothDaemonPDU* aPDU, BluetoothSocketResultHandler* aRes); + nsresult Send(DaemonSocketPDU* aPDU, BluetoothSocketResultHandler* aRes); private: class AcceptWatcher; @@ -74,16 +74,16 @@ private: int, const nsAString_internal&, int> IntStringIntResultRunnable; - void ErrorRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ErrorRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothSocketResultHandler* aRes); - void ListenRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ListenRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothSocketResultHandler* aRes); - void ConnectRsp(const BluetoothDaemonPDUHeader& aHeader, - BluetoothDaemonPDU& aPDU, + void ConnectRsp(const DaemonSocketPDUHeader& aHeader, + DaemonSocketPDU& aPDU, BluetoothSocketResultHandler* aRes); }; diff --git a/ipc/bluetooth/BluetoothDaemonConnection.cpp b/ipc/bluetooth/BluetoothDaemonConnection.cpp index 56f7cb9bcdba..5c2ad7ce766c 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.cpp +++ b/ipc/bluetooth/BluetoothDaemonConnection.cpp @@ -37,10 +37,10 @@ namespace ipc { static const char sBluetoothdSocketName[] = "bluez_hal_socket"; // -// BluetoothDaemonPDU +// DaemonSocketPDU // -BluetoothDaemonPDU::BluetoothDaemonPDU(uint8_t aService, uint8_t aOpcode, +DaemonSocketPDU::DaemonSocketPDU(uint8_t aService, uint8_t aOpcode, uint16_t aPayloadSize) : mConsumer(nullptr) , mUserData(nullptr) @@ -59,7 +59,7 @@ BluetoothDaemonPDU::BluetoothDaemonPDU(uint8_t aService, uint8_t aOpcode, memcpy(data + OFF_LENGTH, &aPayloadSize, sizeof(aPayloadSize)); } -BluetoothDaemonPDU::BluetoothDaemonPDU(size_t aPayloadSize) +DaemonSocketPDU::DaemonSocketPDU(size_t aPayloadSize) : mConsumer(nullptr) , mUserData(nullptr) { @@ -67,14 +67,14 @@ BluetoothDaemonPDU::BluetoothDaemonPDU(size_t aPayloadSize) ResetBuffer(new uint8_t[availableSpace], 0, 0, availableSpace); } -BluetoothDaemonPDU::~BluetoothDaemonPDU() +DaemonSocketPDU::~DaemonSocketPDU() { nsAutoArrayPtr data(GetBuffer()); ResetBuffer(nullptr, 0, 0, 0); } void -BluetoothDaemonPDU::GetHeader(uint8_t& aService, uint8_t& aOpcode, +DaemonSocketPDU::GetHeader(uint8_t& aService, uint8_t& aOpcode, uint16_t& aPayloadSize) { memcpy(&aService, GetData(OFF_SERVICE), sizeof(aService)); @@ -83,7 +83,7 @@ BluetoothDaemonPDU::GetHeader(uint8_t& aService, uint8_t& aOpcode, } ssize_t -BluetoothDaemonPDU::Send(int aFd) +DaemonSocketPDU::Send(int aFd) { struct iovec iv; memset(&iv, 0, sizeof(iv)); @@ -120,7 +120,7 @@ BluetoothDaemonPDU::Send(int aFd) ((_cmsghdr)->cmsg_type == SCM_RIGHTS) ) ssize_t -BluetoothDaemonPDU::Receive(int aFd) +DaemonSocketPDU::Receive(int aFd) { struct iovec iv; memset(&iv, 0, sizeof(iv)); @@ -163,13 +163,13 @@ BluetoothDaemonPDU::Receive(int aFd) } int -BluetoothDaemonPDU::AcquireFd() +DaemonSocketPDU::AcquireFd() { return mReceivedFd.forget(); } nsresult -BluetoothDaemonPDU::UpdateHeader() +DaemonSocketPDU::UpdateHeader() { size_t len = GetPayloadSize(); if (len >= MAX_PAYLOAD_LENGTH) { @@ -183,7 +183,7 @@ BluetoothDaemonPDU::UpdateHeader() } size_t -BluetoothDaemonPDU::GetPayloadSize() const +DaemonSocketPDU::GetPayloadSize() const { MOZ_ASSERT(GetSize() >= HEADER_SIZE); @@ -191,7 +191,7 @@ BluetoothDaemonPDU::GetPayloadSize() const } void -BluetoothDaemonPDU::OnError(const char* aFunction, int aErrno) +DaemonSocketPDU::OnError(const char* aFunction, int aErrno) { CHROMIUM_LOG("%s failed with error %d (%s)", aFunction, aErrno, strerror(aErrno)); @@ -242,7 +242,7 @@ public: private: BluetoothDaemonConnection* mConnection; DaemonSocketIOConsumer* mConsumer; - nsAutoPtr mPDU; + nsAutoPtr mPDU; bool mShuttingDownOnIOThread; }; @@ -276,7 +276,7 @@ BluetoothDaemonConnectionIO::QueryReceiveBuffer(UnixSocketIOBuffer** aBuffer) if (!mPDU) { /* There's only one PDU for receiving. We reuse it every time. */ - mPDU = new BluetoothDaemonPDU(BluetoothDaemonPDU::MAX_PAYLOAD_LENGTH); + mPDU = new DaemonSocketPDU(DaemonSocketPDU::MAX_PAYLOAD_LENGTH); } *aBuffer = mPDU.get(); diff --git a/ipc/bluetooth/BluetoothDaemonConnection.h b/ipc/bluetooth/BluetoothDaemonConnection.h index 0a7015a81b43..49c3e0830861 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.h +++ b/ipc/bluetooth/BluetoothDaemonConnection.h @@ -22,7 +22,7 @@ class BluetoothDaemonConnectionIO; class DaemonSocketIOConsumer; /* - * |BlutoothDaemonPDU| represents a single PDU that is transfered from or to + * |DaemonSocketPDU| represents a single PDU that is transfered from or to * the Bluetooth daemon. Each PDU contains exactly one command. * * A PDU as the following format @@ -41,7 +41,7 @@ class DaemonSocketIOConsumer; * https://git.kernel.org/cgit/bluetooth/bluez.git/tree/android/hal-ipc-api.txt?id=5.24 * */ -class BluetoothDaemonPDU final : public UnixSocketIOBuffer +class DaemonSocketPDU final : public UnixSocketIOBuffer { public: enum { @@ -53,10 +53,10 @@ public: MAX_PAYLOAD_LENGTH = 1 << 16 }; - BluetoothDaemonPDU(uint8_t aService, uint8_t aOpcode, + DaemonSocketPDU(uint8_t aService, uint8_t aOpcode, uint16_t aPayloadSize); - BluetoothDaemonPDU(size_t aPayloadSize); - ~BluetoothDaemonPDU(); + DaemonSocketPDU(size_t aPayloadSize); + ~DaemonSocketPDU(); void SetConsumer(DaemonSocketIOConsumer* aConsumer) { @@ -102,8 +102,8 @@ class DaemonSocketIOConsumer public: virtual ~DaemonSocketIOConsumer(); - virtual void Handle(BluetoothDaemonPDU& aPDU) = 0; - virtual void StoreUserData(const BluetoothDaemonPDU& aPDU) = 0; + virtual void Handle(DaemonSocketPDU& aPDU) = 0; + virtual void StoreUserData(const DaemonSocketPDU& aPDU) = 0; protected: DaemonSocketIOConsumer(); From 21133b1b767a0ffea5d723e71238b1b256c9469b Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 15 Jun 2015 14:44:03 +0200 Subject: [PATCH 43/59] Bug 1171017: Rename |BluetoothDaemonConnectionIO| to |DaemonSocketIO|, r=shuang --- ipc/bluetooth/BluetoothDaemonConnection.cpp | 39 ++++++++++----------- ipc/bluetooth/BluetoothDaemonConnection.h | 4 +-- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/ipc/bluetooth/BluetoothDaemonConnection.cpp b/ipc/bluetooth/BluetoothDaemonConnection.cpp index 5c2ad7ce766c..db45c325c0f4 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.cpp +++ b/ipc/bluetooth/BluetoothDaemonConnection.cpp @@ -208,18 +208,18 @@ DaemonSocketIOConsumer::~DaemonSocketIOConsumer() { } // -// BluetoothDaemonConnectionIO +// DaemonSocketIO // -class BluetoothDaemonConnectionIO final : public ConnectionOrientedSocketIO +class DaemonSocketIO final : public ConnectionOrientedSocketIO { public: - BluetoothDaemonConnectionIO(MessageLoop* aConsumerLoop, - MessageLoop* aIOLoop, - int aFd, ConnectionStatus aConnectionStatus, - UnixSocketConnector* aConnector, - BluetoothDaemonConnection* aConnection, - DaemonSocketIOConsumer* aConsumer); + DaemonSocketIO(MessageLoop* aConsumerLoop, + MessageLoop* aIOLoop, + int aFd, ConnectionStatus aConnectionStatus, + UnixSocketConnector* aConnector, + BluetoothDaemonConnection* aConnection, + DaemonSocketIOConsumer* aConsumer); // Methods for |DataSocketIO| // @@ -246,7 +246,7 @@ private: bool mShuttingDownOnIOThread; }; -BluetoothDaemonConnectionIO::BluetoothDaemonConnectionIO( +DaemonSocketIO::DaemonSocketIO( MessageLoop* aConsumerLoop, MessageLoop* aIOLoop, int aFd, @@ -270,7 +270,7 @@ BluetoothDaemonConnectionIO::BluetoothDaemonConnectionIO( // |DataSocketIO| nsresult -BluetoothDaemonConnectionIO::QueryReceiveBuffer(UnixSocketIOBuffer** aBuffer) +DaemonSocketIO::QueryReceiveBuffer(UnixSocketIOBuffer** aBuffer) { MOZ_ASSERT(aBuffer); @@ -284,7 +284,7 @@ BluetoothDaemonConnectionIO::QueryReceiveBuffer(UnixSocketIOBuffer** aBuffer) } void -BluetoothDaemonConnectionIO::ConsumeBuffer() +DaemonSocketIO::ConsumeBuffer() { MOZ_ASSERT(mConsumer); @@ -292,7 +292,7 @@ BluetoothDaemonConnectionIO::ConsumeBuffer() } void -BluetoothDaemonConnectionIO::DiscardBuffer() +DaemonSocketIO::DiscardBuffer() { // Nothing to do. } @@ -300,13 +300,13 @@ BluetoothDaemonConnectionIO::DiscardBuffer() // |SocketIOBase| SocketBase* -BluetoothDaemonConnectionIO::GetSocketBase() +DaemonSocketIO::GetSocketBase() { return mConnection; } bool -BluetoothDaemonConnectionIO::IsShutdownOnConsumerThread() const +DaemonSocketIO::IsShutdownOnConsumerThread() const { MOZ_ASSERT(IsConsumerThread()); @@ -314,13 +314,13 @@ BluetoothDaemonConnectionIO::IsShutdownOnConsumerThread() const } bool -BluetoothDaemonConnectionIO::IsShutdownOnIOThread() const +DaemonSocketIO::IsShutdownOnIOThread() const { return mShuttingDownOnIOThread; } void -BluetoothDaemonConnectionIO::ShutdownOnConsumerThread() +DaemonSocketIO::ShutdownOnConsumerThread() { MOZ_ASSERT(IsConsumerThread()); MOZ_ASSERT(!IsShutdownOnConsumerThread()); @@ -329,7 +329,7 @@ BluetoothDaemonConnectionIO::ShutdownOnConsumerThread() } void -BluetoothDaemonConnectionIO::ShutdownOnIOThread() +DaemonSocketIO::ShutdownOnIOThread() { MOZ_ASSERT(!IsConsumerThread()); MOZ_ASSERT(!mShuttingDownOnIOThread); @@ -369,7 +369,7 @@ BluetoothDaemonConnection::PrepareAccept(UnixSocketConnector* aConnector, SetConnectionStatus(SOCKET_CONNECTING); - mIO = new BluetoothDaemonConnectionIO( + mIO = new DaemonSocketIO( aConsumerLoop, aIOLoop, -1, UnixSocketWatcher::SOCKET_IS_CONNECTING, aConnector, this, mIOConsumer); aIO = mIO; @@ -387,8 +387,7 @@ BluetoothDaemonConnection::SendSocketData(UnixSocketIOBuffer* aBuffer) mIO->GetIOLoop()->PostTask( FROM_HERE, - new SocketIOSendTask(mIO, aBuffer)); + new SocketIOSendTask(mIO, aBuffer)); } // |SocketBase| diff --git a/ipc/bluetooth/BluetoothDaemonConnection.h b/ipc/bluetooth/BluetoothDaemonConnection.h index 49c3e0830861..68df18fb7f77 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.h +++ b/ipc/bluetooth/BluetoothDaemonConnection.h @@ -18,7 +18,7 @@ namespace mozilla { namespace ipc { class DaemonSocketConsumer; -class BluetoothDaemonConnectionIO; +class DaemonSocketIO; class DaemonSocketIOConsumer; /* @@ -144,7 +144,7 @@ public: void OnDisconnect() override; private: - BluetoothDaemonConnectionIO* mIO; + DaemonSocketIO* mIO; DaemonSocketIOConsumer* mIOConsumer; DaemonSocketConsumer* mConsumer; int mIndex; From 41d8f3ac72ae7c0ef2b1c4931f947450b13e602a Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 15 Jun 2015 14:44:03 +0200 Subject: [PATCH 44/59] Bug 1171017: Rename |BluetoothDaemonConnection| to |DaemonSocket|, r=shuang --- .../bluedroid/BluetoothDaemonInterface.cpp | 12 ++++---- .../bluedroid/BluetoothDaemonInterface.h | 6 ++-- ipc/bluetooth/BluetoothDaemonConnection.cpp | 30 +++++++++---------- ipc/bluetooth/BluetoothDaemonConnection.h | 16 +++++----- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp index d0e56b73b0e8..0052e0d84094 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp @@ -1405,7 +1405,7 @@ const int BluetoothDaemonCoreModule::MAX_NUM_CLIENTS = 1; // // |BluetoothDaemonProtocol| also handles PDU receiving. It implements // the method |Handle| from |DaemonSocketIOConsumer|. The socket -// connections of type |BluetoothDaemonConnection| invoke this method +// connections of type |DaemonSocket| invoke this method // to forward received PDUs for processing by higher layers. The // implementation of |Handle| checks the service id of the PDU and // forwards it to the correct module class using the module's method @@ -1439,7 +1439,7 @@ class BluetoothDaemonProtocol final public: BluetoothDaemonProtocol(); - void SetConnection(BluetoothDaemonConnection* aConnection); + void SetConnection(DaemonSocket* aConnection); nsresult RegisterModule(uint8_t aId, uint8_t aMode, uint32_t aMaxNumClients, BluetoothSetupResultHandler* aRes) override; @@ -1477,7 +1477,7 @@ private: void HandleGattSvc(const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData); - BluetoothDaemonConnection* mConnection; + DaemonSocket* mConnection; nsTArray mUserDataQ; }; @@ -1485,7 +1485,7 @@ BluetoothDaemonProtocol::BluetoothDaemonProtocol() { } void -BluetoothDaemonProtocol::SetConnection(BluetoothDaemonConnection* aConnection) +BluetoothDaemonProtocol::SetConnection(DaemonSocket* aConnection) { mConnection = aConnection; } @@ -1863,7 +1863,7 @@ BluetoothDaemonInterface::Init( // Init, step 1: Listen for command channel... */ if (!mCmdChannel) { - mCmdChannel = new BluetoothDaemonConnection(mProtocol, this, CMD_CHANNEL); + mCmdChannel = new DaemonSocket(mProtocol, this, CMD_CHANNEL); } else if ( NS_WARN_IF(mCmdChannel->GetConnectionStatus() == SOCKET_CONNECTED)) { // Command channel should not be open; let's close it. @@ -2355,7 +2355,7 @@ BluetoothDaemonInterface::OnConnectSuccess(int aIndex) case CMD_CHANNEL: // Init, step 3: Listen for notification channel... if (!mNtfChannel) { - mNtfChannel = new BluetoothDaemonConnection(mProtocol, this, NTF_CHANNEL); + mNtfChannel = new DaemonSocket(mProtocol, this, NTF_CHANNEL); } else if ( NS_WARN_IF(mNtfChannel->GetConnectionStatus() == SOCKET_CONNECTED)) { /* Notification channel should not be open; let's close it. */ diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h index 5f624757fd34..891e3ebda048 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h @@ -14,7 +14,7 @@ namespace mozilla { namespace ipc { -class BluetoothDaemonConnection; +class DaemonSocket; class ListenSocket; } @@ -156,8 +156,8 @@ private: nsCString mListenSocketName; nsRefPtr mListenSocket; - nsRefPtr mCmdChannel; - nsRefPtr mNtfChannel; + nsRefPtr mCmdChannel; + nsRefPtr mNtfChannel; nsAutoPtr mProtocol; nsTArray > mResultHandlerQ; diff --git a/ipc/bluetooth/BluetoothDaemonConnection.cpp b/ipc/bluetooth/BluetoothDaemonConnection.cpp index db45c325c0f4..9661e21d5de4 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.cpp +++ b/ipc/bluetooth/BluetoothDaemonConnection.cpp @@ -218,7 +218,7 @@ public: MessageLoop* aIOLoop, int aFd, ConnectionStatus aConnectionStatus, UnixSocketConnector* aConnector, - BluetoothDaemonConnection* aConnection, + DaemonSocket* aConnection, DaemonSocketIOConsumer* aConsumer); // Methods for |DataSocketIO| @@ -240,7 +240,7 @@ public: void ShutdownOnIOThread() override; private: - BluetoothDaemonConnection* mConnection; + DaemonSocket* mConnection; DaemonSocketIOConsumer* mConsumer; nsAutoPtr mPDU; bool mShuttingDownOnIOThread; @@ -252,7 +252,7 @@ DaemonSocketIO::DaemonSocketIO( int aFd, ConnectionStatus aConnectionStatus, UnixSocketConnector* aConnector, - BluetoothDaemonConnection* aConnection, + DaemonSocket* aConnection, DaemonSocketIOConsumer* aConsumer) : ConnectionOrientedSocketIO(aConsumerLoop, aIOLoop, @@ -339,10 +339,10 @@ DaemonSocketIO::ShutdownOnIOThread() } // -// BluetoothDaemonConnection +// DaemonSocket // -BluetoothDaemonConnection::BluetoothDaemonConnection( +DaemonSocket::DaemonSocket( DaemonSocketIOConsumer* aIOConsumer, DaemonSocketConsumer* aConsumer, int aIndex) @@ -354,16 +354,16 @@ BluetoothDaemonConnection::BluetoothDaemonConnection( MOZ_ASSERT(mConsumer); } -BluetoothDaemonConnection::~BluetoothDaemonConnection() +DaemonSocket::~DaemonSocket() { } // |ConnectionOrientedSocket| nsresult -BluetoothDaemonConnection::PrepareAccept(UnixSocketConnector* aConnector, - MessageLoop* aConsumerLoop, - MessageLoop* aIOLoop, - ConnectionOrientedSocketIO*& aIO) +DaemonSocket::PrepareAccept(UnixSocketConnector* aConnector, + MessageLoop* aConsumerLoop, + MessageLoop* aIOLoop, + ConnectionOrientedSocketIO*& aIO) { MOZ_ASSERT(!mIO); @@ -380,7 +380,7 @@ BluetoothDaemonConnection::PrepareAccept(UnixSocketConnector* aConnector, // |DataSocket| void -BluetoothDaemonConnection::SendSocketData(UnixSocketIOBuffer* aBuffer) +DaemonSocket::SendSocketData(UnixSocketIOBuffer* aBuffer) { MOZ_ASSERT(mIO); MOZ_ASSERT(mIO->IsConsumerThread()); @@ -393,7 +393,7 @@ BluetoothDaemonConnection::SendSocketData(UnixSocketIOBuffer* aBuffer) // |SocketBase| void -BluetoothDaemonConnection::Close() +DaemonSocket::Close() { if (!mIO) { CHROMIUM_LOG("Bluetooth daemon already disconnected!"); @@ -410,19 +410,19 @@ BluetoothDaemonConnection::Close() } void -BluetoothDaemonConnection::OnConnectSuccess() +DaemonSocket::OnConnectSuccess() { mConsumer->OnConnectSuccess(mIndex); } void -BluetoothDaemonConnection::OnConnectError() +DaemonSocket::OnConnectError() { mConsumer->OnConnectError(mIndex); } void -BluetoothDaemonConnection::OnDisconnect() +DaemonSocket::OnDisconnect() { mConsumer->OnDisconnect(mIndex); } diff --git a/ipc/bluetooth/BluetoothDaemonConnection.h b/ipc/bluetooth/BluetoothDaemonConnection.h index 68df18fb7f77..cc13de03eb3b 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.h +++ b/ipc/bluetooth/BluetoothDaemonConnection.h @@ -4,8 +4,8 @@ * 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/. */ -#ifndef mozilla_ipc_bluetooth_BluetoothDaemonConnection_h -#define mozilla_ipc_bluetooth_BluetoothDaemonConnection_h +#ifndef mozilla_ipc_bluetooth_DaemonSocket_h +#define mozilla_ipc_bluetooth_DaemonSocket_h #include "mozilla/Attributes.h" #include "mozilla/FileUtils.h" @@ -110,17 +110,17 @@ protected: }; /* - * |BluetoothDaemonConnection| represents the socket to connect to the + * |DaemonSocket| represents the socket to connect to the * Bluetooth daemon. It offers connection establishment and sending * PDUs. PDU receiving is performed by |DaemonSocketIOConsumer|. */ -class BluetoothDaemonConnection : public ConnectionOrientedSocket +class DaemonSocket : public ConnectionOrientedSocket { public: - BluetoothDaemonConnection(DaemonSocketIOConsumer* aIOConsumer, - DaemonSocketConsumer* aConsumer, - int aIndex); - virtual ~BluetoothDaemonConnection(); + DaemonSocket(DaemonSocketIOConsumer* aIOConsumer, + DaemonSocketConsumer* aConsumer, + int aIndex); + virtual ~DaemonSocket(); // Methods for |ConnectionOrientedSocket| // From 3126a07df493057078bebcbac0bf02ec611b5092 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 15 Jun 2015 14:44:03 +0200 Subject: [PATCH 45/59] Bug 1171017: Move classes from ipc/bluetooth to ipc/hal, r=shuang The class |DaemonSocket| and its helpers implement a service- neutral connection to a HAL daemon. This patch moves the code to an appropriate directory and breaks up the code into smaller pieces. --HG-- rename : ipc/bluetooth/BluetoothDaemonConnection.cpp => ipc/hal/DaemonSocket.cpp rename : ipc/bluetooth/BluetoothDaemonConnection.h => ipc/hal/DaemonSocket.h rename : ipc/bluetooth/BluetoothDaemonConnectionConsumer.cpp => ipc/hal/DaemonSocketConsumer.cpp rename : ipc/bluetooth/BluetoothDaemonConnectionConsumer.h => ipc/hal/DaemonSocketConsumer.h rename : ipc/bluetooth/moz.build => ipc/hal/moz.build --- .../bluedroid/BluetoothDaemonHelpers.h | 2 +- .../bluedroid/BluetoothDaemonInterface.cpp | 1 + .../bluedroid/BluetoothDaemonInterface.h | 2 +- ipc/bluetooth/BluetoothDaemonConnection.h | 156 -------------- .../DaemonSocket.cpp} | 191 +----------------- ipc/hal/DaemonSocket.h | 63 ++++++ .../DaemonSocketConsumer.cpp} | 12 +- .../DaemonSocketConsumer.h} | 30 ++- ipc/hal/DaemonSocketPDU.cpp | 188 +++++++++++++++++ ipc/hal/DaemonSocketPDU.h | 91 +++++++++ ipc/{bluetooth => hal}/moz.build | 12 +- ipc/moz.build | 5 +- 12 files changed, 390 insertions(+), 363 deletions(-) delete mode 100644 ipc/bluetooth/BluetoothDaemonConnection.h rename ipc/{bluetooth/BluetoothDaemonConnection.cpp => hal/DaemonSocket.cpp} (52%) create mode 100644 ipc/hal/DaemonSocket.h rename ipc/{bluetooth/BluetoothDaemonConnectionConsumer.cpp => hal/DaemonSocketConsumer.cpp} (73%) rename ipc/{bluetooth/BluetoothDaemonConnectionConsumer.h => hal/DaemonSocketConsumer.h} (68%) create mode 100644 ipc/hal/DaemonSocketPDU.cpp create mode 100644 ipc/hal/DaemonSocketPDU.h rename ipc/{bluetooth => hal}/moz.build (70%) diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h index 18e378633581..3b31d7c3bb84 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h @@ -10,7 +10,7 @@ #include "BluetoothCommon.h" #include "mozilla/ArrayUtils.h" #include "mozilla/dom/bluetooth/BluetoothTypes.h" -#include "mozilla/ipc/BluetoothDaemonConnection.h" +#include "mozilla/ipc/DaemonSocketPDU.h" #include "nsThreadUtils.h" using namespace mozilla::ipc; diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp index 0052e0d84094..3f22be1422af 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp @@ -17,6 +17,7 @@ #include "BluetoothDaemonSetupInterface.h" #include "BluetoothDaemonSocketInterface.h" #include "BluetoothInterfaceHelpers.h" +#include "mozilla/ipc/DaemonSocket.h" #include "mozilla/ipc/ListenSocket.h" #include "mozilla/unused.h" #include "prrng.h" diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h index 891e3ebda048..1d2b33610032 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.h @@ -8,7 +8,7 @@ #define mozilla_dom_bluetooth_bluedroid_bluetoothdaemoninterface_h__ #include "BluetoothInterface.h" -#include "mozilla/ipc/BluetoothDaemonConnectionConsumer.h" +#include "mozilla/ipc/DaemonSocketConsumer.h" #include "mozilla/ipc/ListenSocketConsumer.h" namespace mozilla { diff --git a/ipc/bluetooth/BluetoothDaemonConnection.h b/ipc/bluetooth/BluetoothDaemonConnection.h deleted file mode 100644 index cc13de03eb3b..000000000000 --- a/ipc/bluetooth/BluetoothDaemonConnection.h +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef mozilla_ipc_bluetooth_DaemonSocket_h -#define mozilla_ipc_bluetooth_DaemonSocket_h - -#include "mozilla/Attributes.h" -#include "mozilla/FileUtils.h" -#include "mozilla/ipc/ConnectionOrientedSocket.h" -#include "nsAutoPtr.h" - -class MessageLoop; - -namespace mozilla { -namespace ipc { - -class DaemonSocketConsumer; -class DaemonSocketIO; -class DaemonSocketIOConsumer; - -/* - * |DaemonSocketPDU| represents a single PDU that is transfered from or to - * the Bluetooth daemon. Each PDU contains exactly one command. - * - * A PDU as the following format - * - * | 1 | 1 | 2 | n | - * | service | opcode | payload length | payload | - * - * Service and Opcode each require 1 byte, the payload length requires 2 - * bytes, and the payload requires the number of bytes as stored in the - * payload-length field. - * - * Each service and opcode can have a different payload with individual - * length. For the exact details of the Bluetooth protocol, please refer - * to - * - * https://git.kernel.org/cgit/bluetooth/bluez.git/tree/android/hal-ipc-api.txt?id=5.24 - * - */ -class DaemonSocketPDU final : public UnixSocketIOBuffer -{ -public: - enum { - OFF_SERVICE = 0, - OFF_OPCODE = 1, - OFF_LENGTH = 2, - OFF_PAYLOAD = 4, - HEADER_SIZE = OFF_PAYLOAD, - MAX_PAYLOAD_LENGTH = 1 << 16 - }; - - DaemonSocketPDU(uint8_t aService, uint8_t aOpcode, - uint16_t aPayloadSize); - DaemonSocketPDU(size_t aPayloadSize); - ~DaemonSocketPDU(); - - void SetConsumer(DaemonSocketIOConsumer* aConsumer) - { - mConsumer = aConsumer; - } - - void SetUserData(void* aUserData) - { - mUserData = aUserData; - } - - void* GetUserData() const - { - return mUserData; - } - - void GetHeader(uint8_t& aService, uint8_t& aOpcode, - uint16_t& aPayloadSize); - - ssize_t Send(int aFd) override; - ssize_t Receive(int aFd) override; - - int AcquireFd(); - - nsresult UpdateHeader(); - -private: - size_t GetPayloadSize() const; - void OnError(const char* aFunction, int aErrno); - - DaemonSocketIOConsumer* mConsumer; - void* mUserData; - ScopedClose mReceivedFd; -}; - -/* - * |DaemonSocketIOConsumer| processes incoming PDUs from the Bluetooth - * daemon. Please note that its method |Handle| runs on a different than the - * consumer thread. - */ -class DaemonSocketIOConsumer -{ -public: - virtual ~DaemonSocketIOConsumer(); - - virtual void Handle(DaemonSocketPDU& aPDU) = 0; - virtual void StoreUserData(const DaemonSocketPDU& aPDU) = 0; - -protected: - DaemonSocketIOConsumer(); -}; - -/* - * |DaemonSocket| represents the socket to connect to the - * Bluetooth daemon. It offers connection establishment and sending - * PDUs. PDU receiving is performed by |DaemonSocketIOConsumer|. - */ -class DaemonSocket : public ConnectionOrientedSocket -{ -public: - DaemonSocket(DaemonSocketIOConsumer* aIOConsumer, - DaemonSocketConsumer* aConsumer, - int aIndex); - virtual ~DaemonSocket(); - - // Methods for |ConnectionOrientedSocket| - // - - nsresult PrepareAccept(UnixSocketConnector* aConnector, - MessageLoop* aConsumerLoop, - MessageLoop* aIOLoop, - ConnectionOrientedSocketIO*& aIO) override; - - // Methods for |DataSocket| - // - - void SendSocketData(UnixSocketIOBuffer* aBuffer) override; - - // Methods for |SocketBase| - // - - void Close() override; - void OnConnectSuccess() override; - void OnConnectError() override; - void OnDisconnect() override; - -private: - DaemonSocketIO* mIO; - DaemonSocketIOConsumer* mIOConsumer; - DaemonSocketConsumer* mConsumer; - int mIndex; -}; - -} -} - -#endif diff --git a/ipc/bluetooth/BluetoothDaemonConnection.cpp b/ipc/hal/DaemonSocket.cpp similarity index 52% rename from ipc/bluetooth/BluetoothDaemonConnection.cpp rename to ipc/hal/DaemonSocket.cpp index 9661e21d5de4..26f62a08a782 100644 --- a/ipc/bluetooth/BluetoothDaemonConnection.cpp +++ b/ipc/hal/DaemonSocket.cpp @@ -4,16 +4,9 @@ * 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/. */ -#include "BluetoothDaemonConnection.h" -#include -#include -#include -#include -#include -#include "mozilla/ipc/BluetoothDaemonConnectionConsumer.h" -#include "mozilla/ipc/DataSocket.h" -#include "nsTArray.h" -#include "nsXULAppAPI.h" +#include "DaemonSocket.h" +#include "mozilla/ipc/DaemonSocketConsumer.h" +#include "mozilla/ipc/DaemonSocketPDU.h" #ifdef CHROMIUM_LOG #undef CHROMIUM_LOG @@ -31,182 +24,6 @@ namespace mozilla { namespace ipc { -// The connection to the Bluetooth daemon is established -// using an abstract socket name. The \0 prefix will be added -// by the |Connect| method. -static const char sBluetoothdSocketName[] = "bluez_hal_socket"; - -// -// DaemonSocketPDU -// - -DaemonSocketPDU::DaemonSocketPDU(uint8_t aService, uint8_t aOpcode, - uint16_t aPayloadSize) - : mConsumer(nullptr) - , mUserData(nullptr) -{ - // Allocate memory - size_t availableSpace = HEADER_SIZE + aPayloadSize; - ResetBuffer(new uint8_t[availableSpace], 0, 0, availableSpace); - - // Reserve PDU header - uint8_t* data = Append(HEADER_SIZE); - MOZ_ASSERT(data); - - // Setup PDU header - data[OFF_SERVICE] = aService; - data[OFF_OPCODE] = aOpcode; - memcpy(data + OFF_LENGTH, &aPayloadSize, sizeof(aPayloadSize)); -} - -DaemonSocketPDU::DaemonSocketPDU(size_t aPayloadSize) - : mConsumer(nullptr) - , mUserData(nullptr) -{ - size_t availableSpace = HEADER_SIZE + aPayloadSize; - ResetBuffer(new uint8_t[availableSpace], 0, 0, availableSpace); -} - -DaemonSocketPDU::~DaemonSocketPDU() -{ - nsAutoArrayPtr data(GetBuffer()); - ResetBuffer(nullptr, 0, 0, 0); -} - -void -DaemonSocketPDU::GetHeader(uint8_t& aService, uint8_t& aOpcode, - uint16_t& aPayloadSize) -{ - memcpy(&aService, GetData(OFF_SERVICE), sizeof(aService)); - memcpy(&aOpcode, GetData(OFF_OPCODE), sizeof(aOpcode)); - memcpy(&aPayloadSize, GetData(OFF_LENGTH), sizeof(aPayloadSize)); -} - -ssize_t -DaemonSocketPDU::Send(int aFd) -{ - struct iovec iv; - memset(&iv, 0, sizeof(iv)); - iv.iov_base = GetData(GetLeadingSpace()); - iv.iov_len = GetSize(); - - struct msghdr msg; - memset(&msg, 0, sizeof(msg)); - msg.msg_iov = &iv; - msg.msg_iovlen = 1; - msg.msg_control = nullptr; - msg.msg_controllen = 0; - - ssize_t res = TEMP_FAILURE_RETRY(sendmsg(aFd, &msg, 0)); - if (res < 0) { - MOZ_ASSERT(errno != EBADF); /* internal error */ - OnError("sendmsg", errno); - return -1; - } - - Consume(res); - - if (mConsumer) { - // We successfully sent a PDU, now store the - // result runnable in the consumer. - mConsumer->StoreUserData(*this); - } - - return res; -} - -#define CMSGHDR_CONTAINS_FD(_cmsghdr) \ - ( ((_cmsghdr)->cmsg_level == SOL_SOCKET) && \ - ((_cmsghdr)->cmsg_type == SCM_RIGHTS) ) - -ssize_t -DaemonSocketPDU::Receive(int aFd) -{ - struct iovec iv; - memset(&iv, 0, sizeof(iv)); - iv.iov_base = GetData(0); - iv.iov_len = GetAvailableSpace(); - - uint8_t cmsgbuf[CMSG_SPACE(sizeof(int))]; - - struct msghdr msg; - memset(&msg, 0, sizeof(msg)); - msg.msg_iov = &iv; - msg.msg_iovlen = 1; - msg.msg_control = cmsgbuf; - msg.msg_controllen = sizeof(cmsgbuf); - - ssize_t res = TEMP_FAILURE_RETRY(recvmsg(aFd, &msg, MSG_NOSIGNAL)); - if (res < 0) { - MOZ_ASSERT(errno != EBADF); /* internal error */ - OnError("recvmsg", errno); - return -1; - } - if (msg.msg_flags & (MSG_CTRUNC | MSG_OOB | MSG_ERRQUEUE)) { - return -1; - } - - SetRange(0, res); - - struct cmsghdr *chdr = CMSG_FIRSTHDR(&msg); - - for (; chdr; chdr = CMSG_NXTHDR(&msg, chdr)) { - if (NS_WARN_IF(!CMSGHDR_CONTAINS_FD(chdr))) { - continue; - } - // Retrieve sent file descriptor. If multiple file descriptors - // have been sent, we close all but the final one. - mReceivedFd = *(static_cast(CMSG_DATA(chdr))); - } - - return res; -} - -int -DaemonSocketPDU::AcquireFd() -{ - return mReceivedFd.forget(); -} - -nsresult -DaemonSocketPDU::UpdateHeader() -{ - size_t len = GetPayloadSize(); - if (len >= MAX_PAYLOAD_LENGTH) { - return NS_ERROR_ILLEGAL_VALUE; - } - uint16_t len16 = static_cast(len); - - memcpy(GetData(OFF_LENGTH), &len16, sizeof(len16)); - - return NS_OK; -} - -size_t -DaemonSocketPDU::GetPayloadSize() const -{ - MOZ_ASSERT(GetSize() >= HEADER_SIZE); - - return GetSize() - HEADER_SIZE; -} - -void -DaemonSocketPDU::OnError(const char* aFunction, int aErrno) -{ - CHROMIUM_LOG("%s failed with error %d (%s)", - aFunction, aErrno, strerror(aErrno)); -} - -// -// DaemonSocketIOConsumer -// - -DaemonSocketIOConsumer::DaemonSocketIOConsumer() -{ } - -DaemonSocketIOConsumer::~DaemonSocketIOConsumer() -{ } - // // DaemonSocketIO // @@ -396,7 +213,7 @@ void DaemonSocket::Close() { if (!mIO) { - CHROMIUM_LOG("Bluetooth daemon already disconnected!"); + CHROMIUM_LOG("HAL daemon already disconnected!"); return; } diff --git a/ipc/hal/DaemonSocket.h b/ipc/hal/DaemonSocket.h new file mode 100644 index 000000000000..63d3a2e5cc08 --- /dev/null +++ b/ipc/hal/DaemonSocket.h @@ -0,0 +1,63 @@ +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef mozilla_ipc_DaemonSocket_h +#define mozilla_ipc_DaemonSocket_h + +#include "mozilla/ipc/ConnectionOrientedSocket.h" + +namespace mozilla { +namespace ipc { + +class DaemonSocketConsumer; +class DaemonSocketIO; +class DaemonSocketIOConsumer; + +/** + * |DaemonSocket| represents the socket to connect to the HAL daemon. It + * offers connection establishment and sending PDUs. PDU receiving is + * performed by |DaemonSocketIOConsumer|. + */ +class DaemonSocket : public ConnectionOrientedSocket +{ +public: + DaemonSocket(DaemonSocketIOConsumer* aIOConsumer, + DaemonSocketConsumer* aConsumer, + int aIndex); + virtual ~DaemonSocket(); + + // Methods for |ConnectionOrientedSocket| + // + + nsresult PrepareAccept(UnixSocketConnector* aConnector, + MessageLoop* aConsumerLoop, + MessageLoop* aIOLoop, + ConnectionOrientedSocketIO*& aIO) override; + + // Methods for |DataSocket| + // + + void SendSocketData(UnixSocketIOBuffer* aBuffer) override; + + // Methods for |SocketBase| + // + + void Close() override; + void OnConnectSuccess() override; + void OnConnectError() override; + void OnDisconnect() override; + +private: + DaemonSocketIO* mIO; + DaemonSocketIOConsumer* mIOConsumer; + DaemonSocketConsumer* mConsumer; + int mIndex; +}; + +} +} + +#endif diff --git a/ipc/bluetooth/BluetoothDaemonConnectionConsumer.cpp b/ipc/hal/DaemonSocketConsumer.cpp similarity index 73% rename from ipc/bluetooth/BluetoothDaemonConnectionConsumer.cpp rename to ipc/hal/DaemonSocketConsumer.cpp index 7cf2626fe28d..ad57d5f575d0 100644 --- a/ipc/bluetooth/BluetoothDaemonConnectionConsumer.cpp +++ b/ipc/hal/DaemonSocketConsumer.cpp @@ -4,11 +4,21 @@ * 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/. */ -#include "BluetoothDaemonConnectionConsumer.h" +#include "DaemonSocketConsumer.h" namespace mozilla { namespace ipc { +// +// DaemonSocketIOConsumer +// + +DaemonSocketIOConsumer::DaemonSocketIOConsumer() +{ } + +DaemonSocketIOConsumer::~DaemonSocketIOConsumer() +{ } + // // DaemonSocketConsumer // diff --git a/ipc/bluetooth/BluetoothDaemonConnectionConsumer.h b/ipc/hal/DaemonSocketConsumer.h similarity index 68% rename from ipc/bluetooth/BluetoothDaemonConnectionConsumer.h rename to ipc/hal/DaemonSocketConsumer.h index 7791b60fb18b..4dda45046fef 100644 --- a/ipc/bluetooth/BluetoothDaemonConnectionConsumer.h +++ b/ipc/hal/DaemonSocketConsumer.h @@ -4,18 +4,32 @@ * 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/. */ -#ifndef mozilla_ipc_BluetoothDaemonConnectionConsumer_h -#define mozilla_ipc_BluetoothDaemonConnectionConsumer_h - -#include "mozilla/Attributes.h" -#include "mozilla/FileUtils.h" -#include "mozilla/ipc/ConnectionOrientedSocket.h" -#include "nsAutoPtr.h" +#ifndef mozilla_ipc_DaemonSocketConsumer_h +#define mozilla_ipc_DaemonSocketConsumer_h namespace mozilla { namespace ipc { -/* +class DaemonSocketPDU; + +/** + * |DaemonSocketIOConsumer| processes incoming PDUs from the + * HAL daemon. Please note that its method |Handle| runs on a + * different than the consumer thread. + */ +class DaemonSocketIOConsumer +{ +public: + virtual ~DaemonSocketIOConsumer(); + + virtual void Handle(DaemonSocketPDU& aPDU) = 0; + virtual void StoreUserData(const DaemonSocketPDU& aPDU) = 0; + +protected: + DaemonSocketIOConsumer(); +}; + +/** * |DaemonSocketConsumer| handles socket events. */ class DaemonSocketConsumer diff --git a/ipc/hal/DaemonSocketPDU.cpp b/ipc/hal/DaemonSocketPDU.cpp new file mode 100644 index 000000000000..a410e55a8d1a --- /dev/null +++ b/ipc/hal/DaemonSocketPDU.cpp @@ -0,0 +1,188 @@ +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* 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/. */ + +#include "DaemonSocketPDU.h" +#include "mozilla/ipc/DaemonSocketConsumer.h" + +#ifdef CHROMIUM_LOG +#undef CHROMIUM_LOG +#endif + +#if defined(MOZ_WIDGET_GONK) +#include +#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "I/O", args); +#else +#include +#define IODEBUG true +#define CHROMIUM_LOG(args...) if (IODEBUG) printf(args); +#endif + +namespace mozilla { +namespace ipc { + +// +// DaemonSocketPDU +// + +DaemonSocketPDU::DaemonSocketPDU(uint8_t aService, uint8_t aOpcode, + uint16_t aPayloadSize) + : mConsumer(nullptr) + , mUserData(nullptr) +{ + // Allocate memory + size_t availableSpace = HEADER_SIZE + aPayloadSize; + ResetBuffer(new uint8_t[availableSpace], 0, 0, availableSpace); + + // Reserve PDU header + uint8_t* data = Append(HEADER_SIZE); + MOZ_ASSERT(data); + + // Setup PDU header + data[OFF_SERVICE] = aService; + data[OFF_OPCODE] = aOpcode; + memcpy(data + OFF_LENGTH, &aPayloadSize, sizeof(aPayloadSize)); +} + +DaemonSocketPDU::DaemonSocketPDU(size_t aPayloadSize) + : mConsumer(nullptr) + , mUserData(nullptr) +{ + size_t availableSpace = HEADER_SIZE + aPayloadSize; + ResetBuffer(new uint8_t[availableSpace], 0, 0, availableSpace); +} + +DaemonSocketPDU::~DaemonSocketPDU() +{ + nsAutoArrayPtr data(GetBuffer()); + ResetBuffer(nullptr, 0, 0, 0); +} + +void +DaemonSocketPDU::GetHeader(uint8_t& aService, uint8_t& aOpcode, + uint16_t& aPayloadSize) +{ + memcpy(&aService, GetData(OFF_SERVICE), sizeof(aService)); + memcpy(&aOpcode, GetData(OFF_OPCODE), sizeof(aOpcode)); + memcpy(&aPayloadSize, GetData(OFF_LENGTH), sizeof(aPayloadSize)); +} + +ssize_t +DaemonSocketPDU::Send(int aFd) +{ + struct iovec iv; + memset(&iv, 0, sizeof(iv)); + iv.iov_base = GetData(GetLeadingSpace()); + iv.iov_len = GetSize(); + + struct msghdr msg; + memset(&msg, 0, sizeof(msg)); + msg.msg_iov = &iv; + msg.msg_iovlen = 1; + msg.msg_control = nullptr; + msg.msg_controllen = 0; + + ssize_t res = TEMP_FAILURE_RETRY(sendmsg(aFd, &msg, 0)); + if (res < 0) { + MOZ_ASSERT(errno != EBADF); /* internal error */ + OnError("sendmsg", errno); + return -1; + } + + Consume(res); + + if (mConsumer) { + // We successfully sent a PDU, now store the + // result runnable in the consumer. + mConsumer->StoreUserData(*this); + } + + return res; +} + +#define CMSGHDR_CONTAINS_FD(_cmsghdr) \ + ( ((_cmsghdr)->cmsg_level == SOL_SOCKET) && \ + ((_cmsghdr)->cmsg_type == SCM_RIGHTS) ) + +ssize_t +DaemonSocketPDU::Receive(int aFd) +{ + struct iovec iv; + memset(&iv, 0, sizeof(iv)); + iv.iov_base = GetData(0); + iv.iov_len = GetAvailableSpace(); + + uint8_t cmsgbuf[CMSG_SPACE(sizeof(int))]; + + struct msghdr msg; + memset(&msg, 0, sizeof(msg)); + msg.msg_iov = &iv; + msg.msg_iovlen = 1; + msg.msg_control = cmsgbuf; + msg.msg_controllen = sizeof(cmsgbuf); + + ssize_t res = TEMP_FAILURE_RETRY(recvmsg(aFd, &msg, MSG_NOSIGNAL)); + if (res < 0) { + MOZ_ASSERT(errno != EBADF); /* internal error */ + OnError("recvmsg", errno); + return -1; + } + if (msg.msg_flags & (MSG_CTRUNC | MSG_OOB | MSG_ERRQUEUE)) { + return -1; + } + + SetRange(0, res); + + struct cmsghdr *chdr = CMSG_FIRSTHDR(&msg); + + for (; chdr; chdr = CMSG_NXTHDR(&msg, chdr)) { + if (NS_WARN_IF(!CMSGHDR_CONTAINS_FD(chdr))) { + continue; + } + // Retrieve sent file descriptor. If multiple file descriptors + // have been sent, we close all but the final one. + mReceivedFd = *(static_cast(CMSG_DATA(chdr))); + } + + return res; +} + +int +DaemonSocketPDU::AcquireFd() +{ + return mReceivedFd.forget(); +} + +nsresult +DaemonSocketPDU::UpdateHeader() +{ + size_t len = GetPayloadSize(); + if (len >= MAX_PAYLOAD_LENGTH) { + return NS_ERROR_ILLEGAL_VALUE; + } + uint16_t len16 = static_cast(len); + + memcpy(GetData(OFF_LENGTH), &len16, sizeof(len16)); + + return NS_OK; +} + +size_t +DaemonSocketPDU::GetPayloadSize() const +{ + MOZ_ASSERT(GetSize() >= HEADER_SIZE); + + return GetSize() - HEADER_SIZE; +} + +void +DaemonSocketPDU::OnError(const char* aFunction, int aErrno) +{ + CHROMIUM_LOG("%s failed with error %d (%s)", + aFunction, aErrno, strerror(aErrno)); +} + +} +} diff --git a/ipc/hal/DaemonSocketPDU.h b/ipc/hal/DaemonSocketPDU.h new file mode 100644 index 000000000000..95275f03c5c0 --- /dev/null +++ b/ipc/hal/DaemonSocketPDU.h @@ -0,0 +1,91 @@ +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef mozilla_ipc_DaemonSocketPDU_h +#define mozilla_ipc_DaemonSocketPDU_h + +#include "mozilla/FileUtils.h" +#include "mozilla/ipc/SocketBase.h" + +namespace mozilla { +namespace ipc { + +class DaemonSocketIOConsumer; + +/** + * |DaemonSocketPDU| represents a single PDU that is transfered from or to + * the HAL daemon. Each PDU contains exactly one command. + * + * A PDU as the following format + * + * | 1 | 1 | 2 | n | + * | service | opcode | payload length | payload | + * + * Service and Opcode each require 1 byte, the payload length requires 2 + * bytes, and the payload requires the number of bytes as stored in the + * payload-length field. + * + * Each service and opcode can have a different payload with individual + * length. For the exact details of the HAL protocol, please refer to + * + * https://git.kernel.org/cgit/bluetooth/bluez.git/tree/android/hal-ipc-api.txt?id=5.24 + * + */ +class DaemonSocketPDU final : public UnixSocketIOBuffer +{ +public: + enum { + OFF_SERVICE = 0, + OFF_OPCODE = 1, + OFF_LENGTH = 2, + OFF_PAYLOAD = 4, + HEADER_SIZE = OFF_PAYLOAD, + MAX_PAYLOAD_LENGTH = 1 << 16 + }; + + DaemonSocketPDU(uint8_t aService, uint8_t aOpcode, uint16_t aPayloadSize); + DaemonSocketPDU(size_t aPayloadSize); + ~DaemonSocketPDU(); + + void SetConsumer(DaemonSocketIOConsumer* aConsumer) + { + mConsumer = aConsumer; + } + + void SetUserData(void* aUserData) + { + mUserData = aUserData; + } + + void* GetUserData() const + { + return mUserData; + } + + void GetHeader(uint8_t& aService, uint8_t& aOpcode, + uint16_t& aPayloadSize); + + ssize_t Send(int aFd) override; + ssize_t Receive(int aFd) override; + + int AcquireFd(); + + nsresult UpdateHeader(); + +private: + size_t GetPayloadSize() const; + void OnError(const char* aFunction, int aErrno); + + DaemonSocketIOConsumer* mConsumer; + void* mUserData; + ScopedClose mReceivedFd; +}; + +} +} + +#endif + diff --git a/ipc/bluetooth/moz.build b/ipc/hal/moz.build similarity index 70% rename from ipc/bluetooth/moz.build rename to ipc/hal/moz.build index 7a71491aab9c..382856dec0a1 100644 --- a/ipc/bluetooth/moz.build +++ b/ipc/hal/moz.build @@ -5,13 +5,15 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXPORTS.mozilla.ipc += [ - 'BluetoothDaemonConnection.h', - 'BluetoothDaemonConnectionConsumer.h' + 'DaemonSocket.h', + 'DaemonSocketConsumer.h', + 'DaemonSocketPDU.h' ] -SOURCES += [ - 'BluetoothDaemonConnection.cpp', - 'BluetoothDaemonConnectionConsumer.cpp' +UNIFIED_SOURCES += [ + 'DaemonSocket.cpp', + 'DaemonSocketConsumer.cpp', + 'DaemonSocketPDU.cpp' ] include('/ipc/chromium/chromium-config.mozbuild') diff --git a/ipc/moz.build b/ipc/moz.build index 568ca5d2b35a..ab07dc69458b 100644 --- a/ipc/moz.build +++ b/ipc/moz.build @@ -14,9 +14,6 @@ DIRS += [ if CONFIG['MOZ_B2G_RIL']: DIRS += ['ril'] -if CONFIG['MOZ_B2G_BT_BLUEDROID']: - DIRS += ['bluetooth'] - if CONFIG['MOZ_B2G_BT_BLUEZ']: DIRS += ['dbus'] @@ -27,7 +24,7 @@ if CONFIG['MOZ_B2G_RIL'] or CONFIG['MOZ_B2G_BT'] or CONFIG['MOZ_NFC'] or CONFIG[ DIRS += ['unixfd', 'unixsocket'] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - DIRS += ['keystore', 'netd'] + DIRS += ['hal', 'keystore', 'netd'] if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': DIRS += ['contentproc'] From b40f7f8054896706016ba6a03d8e3e0f898a5b7c Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 06:01:21 -0700 Subject: [PATCH 46/59] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/9a8fc6181218 Author: Yura Zenevich Desc: Merge pull request #30568 from yzen/bug-1156786-string-update Bug 1156786 - updating super swiper achievement to customizer champ. ======== https://hg.mozilla.org/integration/gaia-central/rev/11d2f2a3f13d Author: Yura Zenevich Desc: Bug 1156786 - updating super swiper achievement to customizer champ. ======== https://hg.mozilla.org/integration/gaia-central/rev/02055803c780 Author: Yura Zenevich Desc: Merge pull request #30420 from yzen/bug-1162040-settings Bug 1162040 - updating accessibility for gaia-icons used in settings … ======== https://hg.mozilla.org/integration/gaia-central/rev/b7cd738e1b97 Author: Yura Zenevich Desc: Bug 1162040 - updating accessibility for gaia-icons used in settings app. --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 274edbe31e8d..2fa370e977d5 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "41314de6a43aec60539f0679f0c03103403ea926", + "git_revision": "7dda863fb006fd3cb77c8e92aec739b2f829115b", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "fbb9918f70331f7abd862c0175a5e31787104900", + "revision": "9a8fc6181218d1cec0a41a8f8edd5ef6855d14eb", "repo_path": "integration/gaia-central" } From 0942476890c562b08d72f57772f550d4d9fb1d51 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 06:03:21 -0700 Subject: [PATCH 47/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 4 ++-- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 4 ++-- b2g/config/emulator-kk/sources.xml | 4 ++-- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 4 ++-- b2g/config/nexus-4/sources.xml | 4 ++-- b2g/config/nexus-5-l/sources.xml | 4 ++-- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index b6dda60e4ea3..e5da6346fb7b 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + @@ -146,7 +146,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index cf71f5e89e70..8fcbea6529b1 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 64c612c1cd19..1ebb989c39bf 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 76f9d275fea4..6c4a023bff31 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + @@ -135,7 +135,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 1c28ecece624..e6dff25025d6 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + @@ -133,7 +133,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 9d8b40587762..d607f34cb5b9 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 64c612c1cd19..1ebb989c39bf 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index dab94278a1de..47d6f93c4356 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + @@ -146,7 +146,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index ac4a645ea9cb..6d30a6123a27 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + @@ -130,7 +130,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index afc17542f6eb..1a1bdd3782b0 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + @@ -156,5 +156,5 @@ - + From 51b372892942b7ddaade396e9607dbfad1c06d9c Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 06:40:27 -0700 Subject: [PATCH 48/59] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/ff5f46e8f0b3 Author: Borja Salguero Desc: Merge pull request #30547 from jpruden92/bug1173098-contacts Bug 1173098 - [Contacts][NGA] Remove dependency with Contacts.confirmDialog. ======== https://hg.mozilla.org/integration/gaia-central/rev/c37af8f6d750 Author: jpruden92 Desc: Bug 1173098 - [Contacts][NGA] Remove dependency with Contacts.confirmDialog. ======== https://hg.mozilla.org/integration/gaia-central/rev/e800c12637e2 Author: Yura Zenevich Desc: Merge pull request #30433 from yzen/bug-1162040-shared Bug 1162040 - updating to latest gaia-icons and updating shared style… ======== https://hg.mozilla.org/integration/gaia-central/rev/45c993f8d395 Author: Yura Zenevich Desc: Bug 1162040 - updating to latest gaia-icons and updating shared styles that include gaia-icons. r=wilsonpage --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 2fa370e977d5..7a0a136f23c1 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "7dda863fb006fd3cb77c8e92aec739b2f829115b", + "git_revision": "7a068be308f6b6429b2af79bac89a982e6c18d49", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "9a8fc6181218d1cec0a41a8f8edd5ef6855d14eb", + "revision": "ff5f46e8f0b309f7400d22305da40449933b0512", "repo_path": "integration/gaia-central" } From 2e4a45d6170ba4c2484b5e1b799b100e8321d8b6 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 06:42:49 -0700 Subject: [PATCH 49/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index e5da6346fb7b..4bfb70861955 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 8fcbea6529b1..2b951a16e918 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 1ebb989c39bf..3983a996ba75 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 6c4a023bff31..037468639755 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index e6dff25025d6..de33764b0d85 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index d607f34cb5b9..3a228ede1925 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 1ebb989c39bf..3983a996ba75 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 47d6f93c4356..8e1e8ed381ae 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 6d30a6123a27..66ec3cd1ca8a 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 1a1bdd3782b0..f5e926911a63 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From a347a0342962283399e2eac0a6ee96c95524f61a Mon Sep 17 00:00:00 2001 From: Dale Harvey Date: Mon, 15 Jun 2015 14:56:07 +0100 Subject: [PATCH 50/59] Bug 1174682 - Rename logshake-screenshot to screenshot.png. r=gerard-majax --- b2g/components/LogShake.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/components/LogShake.jsm b/b2g/components/LogShake.jsm index 05d67e69773c..c9330f9a6e6c 100644 --- a/b2g/components/LogShake.jsm +++ b/b2g/components/LogShake.jsm @@ -277,7 +277,7 @@ let LogShake = { try { LogCapture.getScreenshot().then(screenshot => { - logArrays["logshake-screenshot.png"] = screenshot; + logArrays["screenshot.png"] = screenshot; }); } catch (ex) { Cu.reportError("Unable to get screenshot dump: " + ex); From 7faab4ec1c32b9cc3c364cfc975dc7e7def84d46 Mon Sep 17 00:00:00 2001 From: Samael Wang Date: Mon, 15 Jun 2015 17:17:56 +0800 Subject: [PATCH 51/59] Bug 1173156 - Fix typo and add a Marionette test case. r=btseng --- dom/mobilemessage/gonk/SmsService.js | 33 +++++++------ ...test_outgoing_unstable_voice_connection.js | 46 +++++++++++++++++++ 2 files changed, 66 insertions(+), 13 deletions(-) diff --git a/dom/mobilemessage/gonk/SmsService.js b/dom/mobilemessage/gonk/SmsService.js index acf36f553fa2..b13b98956432 100644 --- a/dom/mobilemessage/gonk/SmsService.js +++ b/dom/mobilemessage/gonk/SmsService.js @@ -76,17 +76,17 @@ XPCOMUtils.defineLazyGetter(this, "gWAP", function() { return ns; }); -XPCOMUtils.defineLazyGetter(this, "gSmsSendingSchedulars", function() { +XPCOMUtils.defineLazyGetter(this, "gSmsSendingSchedulers", function() { return { - _schedulars: [], - getSchedularByServiceId: function(aServiceId) { - let schedular = this._schedulars[aServiceId]; - if (!schedular) { - schedular = this._schedulars[aServiceId] = - new SmsSendingSchedular(aServiceId); + _schedulers: [], + getSchedulerByServiceId: function(aServiceId) { + let scheduler = this._schedulers[aServiceId]; + if (!scheduler) { + scheduler = this._schedulers[aServiceId] = + new SmsSendingScheduler(aServiceId); } - return schedular; + return scheduler; } }; }); @@ -334,11 +334,14 @@ SmsService.prototype = { * Schedule the sending request. */ _scheduleSending: function(aServiceId, aDomMessage, aSilent, aOptions, aRequest) { - gSmsSendingSchedulars.getSchedularByServiceId(aServiceId) + gSmsSendingSchedulers.getSchedulerByServiceId(aServiceId) .schedule({ messageId: aDomMessage.id, onSend: () => { - if (DEBUG) debug("onSend: " + aDomMessage.id); + if (DEBUG) { + debug("onSend: messageId=" + aDomMessage.id + + ", serviceId=" + aServiceId); + } this._sendToTheAir(aServiceId, aDomMessage, aSilent, @@ -1193,14 +1196,14 @@ function getEnabledGsmTableTuplesFromMcc() { return tuples; }; -function SmsSendingSchedular(aServiceId) { +function SmsSendingScheduler(aServiceId) { this._serviceId = aServiceId; this._queue = []; Services.obs.addObserver(this, kSmsDeletedObserverTopic, false); Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false); } -SmsSendingSchedular.prototype = { +SmsSendingScheduler.prototype = { QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionListener]), _serviceId: 0, @@ -1250,6 +1253,10 @@ SmsSendingSchedular.prototype = { */ schedule: function(aSendingRequest) { if (aSendingRequest) { + if (DEBUG) { + debug("scheduling message: messageId=" + aSendingRequest.messageId + + ", serviceId=" + this._serviceId); + } this._ensureMoboConnObserverRegistration(); this._queue.push(aSendingRequest) @@ -1268,7 +1275,7 @@ SmsSendingSchedular.prototype = { */ send: function() { let connection = - gMobileConnectionService.getItemByServiceId(this._servicdeId); + gMobileConnectionService.getItemByServiceId(this._serviceId); // If the voice connection is temporarily unavailable, pend the request. let voiceInfo = connection && connection.voice; diff --git a/dom/mobilemessage/tests/marionette/test_outgoing_unstable_voice_connection.js b/dom/mobilemessage/tests/marionette/test_outgoing_unstable_voice_connection.js index b01e91158b6a..d5c5ad2d3287 100644 --- a/dom/mobilemessage/tests/marionette/test_outgoing_unstable_voice_connection.js +++ b/dom/mobilemessage/tests/marionette/test_outgoing_unstable_voice_connection.js @@ -127,10 +127,56 @@ function turnOnVoiceDeleteMessagesAndVerify(aMessageIdsToDelete, return Promise.all(promises); } +/** + * Send messages on the second SIM and verify success while voice connection + * on first SIM is disabled. + * + * @return an array of message IDs. + */ +function sendMessagesOnSecondSIM() { + return new Promise(function(resolve, reject) { + try { + let eventCount = 0; + let now = Date.now(); + let messageIds = []; + manager.addEventListener("sent", function onevent(aEvent) { + log("onsent event received."); + + let message = aEvent.message; + let expectedBody = MESSAGES[eventCount++]; + messageIds.push(message.id); + is(message.delivery, "sent", "message.delivery"); + is(message.receiver, RECEIVER, "message.receiver"); + is(message.body, expectedBody, "message.body: expected '" + expectedBody + + "'' but got '" + message.body + "'"); + + // timestamp is in seconds. + ok(Math.floor(message.timestamp / 1000) >= Math.floor(now / 1000), + "expected " + message.timestamp + " >= " + now); + + // resolve when all messages are appeared "sent" + if (eventCount == MESSAGES.length) { + manager.removeEventListener("sent", onevent); + resolve(messageIds); + } + }); + + // send messages + for (let body of MESSAGES) { + manager.send(RECEIVER, body, { serviceId: 1 }); + } + } catch (err) { + log("Error: " + err); + reject(err); + } + }); +} + startTestCommon(function testCaseMain() { return pushPrefEnv({ set: [['dom.sms.requestStatusReport', true]] }) .then(() => ensureMobileConnection()) .then(() => setEmulatorVoiceStateAndWait("unregistered")) + .then(() => runIfMultiSIM(() => sendMessagesOnSecondSIM())) .then(() => sendMessagesAndVerifySending()) // Delete the first message and wait for result. .then((aMessageIds) => turnOnVoiceDeleteMessagesAndVerify([aMessageIds[0]], From 8f1a8b43a94ef3b33371022a240d369a0f2f9b23 Mon Sep 17 00:00:00 2001 From: Liang-Heng Chen Date: Mon, 15 Jun 2015 03:53:00 -0400 Subject: [PATCH 52/59] Bug 1171827 - Temporarily disale mDNS device provider. r=schien --- dom/presentation/provider/PresentationDeviceProviderModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/presentation/provider/PresentationDeviceProviderModule.cpp b/dom/presentation/provider/PresentationDeviceProviderModule.cpp index fefbc0d0ce40..1d16170af98e 100644 --- a/dom/presentation/provider/PresentationDeviceProviderModule.cpp +++ b/dom/presentation/provider/PresentationDeviceProviderModule.cpp @@ -28,7 +28,7 @@ static const mozilla::Module::ContractIDEntry kPresentationDeviceProviderContrac }; static const mozilla::Module::CategoryEntry kPresentationDeviceProviderCategories[] = { -#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16 +#if 0 // defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16 { PRESENTATION_DEVICE_PROVIDER_CATEGORY, "MulticastDNSDeviceProvider", MULTICAST_DNS_PROVIDER_CONTRACT_ID}, #endif { nullptr } From d4d455c259089599fabfb361b89875cc2a4effe8 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 07:45:14 -0700 Subject: [PATCH 53/59] Bumping gaia.json for 6 gaia revision(s) a=gaia-bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/ce7512d1e4c4 Author: Ryan VanderMeulen Desc: Merge pull request #30540 from chenpighead/Bug1173706 Bug 1173706 - Let system bootup and fake app launch use the same marionette client. ======== https://hg.mozilla.org/integration/gaia-central/rev/22bd58bae3cc Author: Jeremy Chen Desc: Bug 1173706 - Let system bootup and fake app launch use the same marionette client. ======== https://hg.mozilla.org/integration/gaia-central/rev/30eaaf9ca680 Author: Ryan VanderMeulen Desc: Merge pull request #30565 from aosmond/bug1166619 Bug 1166619 - Prevent capture when battery status is shutdown, even from hardware buttons. ======== https://hg.mozilla.org/integration/gaia-central/rev/823e05a04c96 Author: Andrew Osmond Desc: Bug 1166619 - Prevent capture when battery status is shutdown, even from hardware buttons. ======== https://hg.mozilla.org/integration/gaia-central/rev/fad462d07fc4 Author: Borja Salguero Desc: Merge pull request #30541 from borjasalguero/bug_1173278 Bug 1173278 - [Contacts][NGA] 'extServices' should not be tied to 'co… ======== https://hg.mozilla.org/integration/gaia-central/rev/cdaba8b62d8b Author: borjasalguero Desc: Bug 1173278 - [Contacts][NGA] 'extServices' should not be tied to 'contact.js' r=arcturus --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 7a0a136f23c1..f811d8c8f315 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "7a068be308f6b6429b2af79bac89a982e6c18d49", + "git_revision": "0a19986e8b8fead59c5316e13032530097e5026d", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "ff5f46e8f0b309f7400d22305da40449933b0512", + "revision": "ce7512d1e4c4fbf36d5314a5dc10166bc76493f4", "repo_path": "integration/gaia-central" } From 9ca77c6be81f582cae44f7bf8cd9dfc010606f76 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 07:47:11 -0700 Subject: [PATCH 54/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 4bfb70861955..d4f06a3e040e 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 2b951a16e918..90de3695923d 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 3983a996ba75..4f1fe418d3db 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 037468639755..66163141a150 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index de33764b0d85..1fb344566367 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 3a228ede1925..574b45d62f86 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 3983a996ba75..4f1fe418d3db 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 8e1e8ed381ae..24494b30a1c8 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 66ec3cd1ca8a..9192a49124ac 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index f5e926911a63..c7dfc0e6de2d 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 51e64c0d2c7e6f74786413331db6ebcc943f7004 Mon Sep 17 00:00:00 2001 From: Jocelyn Liu Date: Mon, 15 Jun 2015 08:41:00 -0400 Subject: [PATCH 55/59] Bug 1174717 - Passing fallible when calling AppendElement method for Sequence types in bluetooth2. r=shuang --- dom/bluetooth/BluetoothCommon.h | 12 ++++++++++++ dom/bluetooth/bluetooth2/BluetoothAdapter.cpp | 8 ++++---- dom/bluetooth/bluetooth2/BluetoothDevice.cpp | 2 +- dom/bluetooth/bluetooth2/BluetoothManager.cpp | 6 +++--- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/dom/bluetooth/BluetoothCommon.h b/dom/bluetooth/BluetoothCommon.h index 2fe650134717..5b83ae0b11c3 100644 --- a/dom/bluetooth/BluetoothCommon.h +++ b/dom/bluetooth/BluetoothCommon.h @@ -123,6 +123,18 @@ extern bool gBluetoothDebugFlag; array.AppendElement(name); \ } while(0) \ +/** + * Convert an enum value to string then append it to a fallible array. + */ +#define BT_APPEND_ENUM_STRING_FALLIBLE(array, enumType, enumValue) \ + do { \ + uint32_t index = uint32_t(enumValue); \ + nsAutoString name; \ + name.AssignASCII(enumType##Values::strings[index].value, \ + enumType##Values::strings[index].length); \ + array.AppendElement(name, mozilla::fallible); \ + } while(0) \ + /** * Resolve |promise| with |ret| if |x| is false. */ diff --git a/dom/bluetooth/bluetooth2/BluetoothAdapter.cpp b/dom/bluetooth/bluetooth2/BluetoothAdapter.cpp index 0bf02784dca0..e637615a91a2 100644 --- a/dom/bluetooth/bluetooth2/BluetoothAdapter.cpp +++ b/dom/bluetooth/bluetooth2/BluetoothAdapter.cpp @@ -1019,9 +1019,9 @@ BluetoothAdapter::SetAdapterState(BluetoothAdapterState aState) // Fire BluetoothAttributeEvent for changed adapter state Sequence types; - BT_APPEND_ENUM_STRING(types, - BluetoothAdapterAttribute, - BluetoothAdapterAttribute::State); + BT_APPEND_ENUM_STRING_FALLIBLE(types, + BluetoothAdapterAttribute, + BluetoothAdapterAttribute::State); DispatchAttributeEvent(types); } @@ -1047,7 +1047,7 @@ BluetoothAdapter::HandlePropertyChanged(const BluetoothValue& aValue) // BluetoothAdapterAttribute properties if (IsAdapterAttributeChanged(type, arr[i].value())) { SetPropertyByValue(arr[i]); - BT_APPEND_ENUM_STRING(types, BluetoothAdapterAttribute, type); + BT_APPEND_ENUM_STRING_FALLIBLE(types, BluetoothAdapterAttribute, type); } } diff --git a/dom/bluetooth/bluetooth2/BluetoothDevice.cpp b/dom/bluetooth/bluetooth2/BluetoothDevice.cpp index a6a9fc77fc1a..01547e024ff6 100644 --- a/dom/bluetooth/bluetooth2/BluetoothDevice.cpp +++ b/dom/bluetooth/bluetooth2/BluetoothDevice.cpp @@ -292,7 +292,7 @@ BluetoothDevice::HandlePropertyChanged(const BluetoothValue& aValue) // BluetoothDeviceAttribute properties if (IsDeviceAttributeChanged(type, arr[i].value())) { SetPropertyByValue(arr[i]); - BT_APPEND_ENUM_STRING(types, BluetoothDeviceAttribute, type); + BT_APPEND_ENUM_STRING_FALLIBLE(types, BluetoothDeviceAttribute, type); } } diff --git a/dom/bluetooth/bluetooth2/BluetoothManager.cpp b/dom/bluetooth/bluetooth2/BluetoothManager.cpp index 821444b63173..ed2b87e48e24 100644 --- a/dom/bluetooth/bluetooth2/BluetoothManager.cpp +++ b/dom/bluetooth/bluetooth2/BluetoothManager.cpp @@ -255,9 +255,9 @@ BluetoothManager::DispatchAttributeEvent() BT_API2_LOGR(); Sequence types; - BT_APPEND_ENUM_STRING(types, - BluetoothManagerAttribute, - BluetoothManagerAttribute::DefaultAdapter); + BT_APPEND_ENUM_STRING_FALLIBLE(types, + BluetoothManagerAttribute, + BluetoothManagerAttribute::DefaultAdapter); // Notify application of default adapter change BluetoothAttributeEventInit init; From e44dec99b5b892a5bff501d9859b28d77aa89e14 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 09:00:27 -0700 Subject: [PATCH 56/59] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/2f13e4d5c4e7 Author: Marshall Culpepper Desc: Merge pull request #30574 from marshall/bug1169349_ftuImei Bug 1169349 - Use IMEI as the FTU ping device ID for dogfooders. ======== https://hg.mozilla.org/integration/gaia-central/rev/92107405b6b0 Author: Marshall Culpepper Desc: Bug 1169349 - Use IMEI as the FTU ping device ID for dogfooders. r=thills --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index f811d8c8f315..d4ed21c43206 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "0a19986e8b8fead59c5316e13032530097e5026d", + "git_revision": "25799901335c6c4bfcd9afa1c8748ca23a76e0b7", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "ce7512d1e4c4fbf36d5314a5dc10166bc76493f4", + "revision": "2f13e4d5c4e7ae37160f866c10364c9267dd8f4a", "repo_path": "integration/gaia-central" } From 8a0b8844cc7eb0149e4cc132ee07e20300562bc9 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 09:02:22 -0700 Subject: [PATCH 57/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index d4f06a3e040e..0caeb63ef27c 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 90de3695923d..8cfaf4d5c827 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 4f1fe418d3db..c10075d03160 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 66163141a150..e99b65a2e2f2 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 1fb344566367..a0f2d33c7eda 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 574b45d62f86..475f35c3852a 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 4f1fe418d3db..c10075d03160 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 24494b30a1c8..878ba8c652f6 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 9192a49124ac..714bae216bfc 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index c7dfc0e6de2d..d9efcd6c9fa9 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 692f2377fa114606f061c7bf836e18c29b5933ad Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 09:26:24 -0700 Subject: [PATCH 58/59] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/43b90c580707 Author: Tzu-Lin Huang Desc: Merge pull request #30438 from dwi2/bug1169535 Bug 1169535 - [Stingray] Collapse folder when focus move to filter ======== https://hg.mozilla.org/integration/gaia-central/rev/1e072506be56 Author: Tzu-Lin Huang Desc: Bug 1169535 - [Stingray] Collapse folder when focus move to filter --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index d4ed21c43206..e0c7672ad1ce 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "25799901335c6c4bfcd9afa1c8748ca23a76e0b7", + "git_revision": "0c073eda92b099bc008488e52edb0745c5f7975e", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "2f13e4d5c4e7ae37160f866c10364c9267dd8f4a", + "revision": "43b90c58070717da08d510200a0c848da68a4390", "repo_path": "integration/gaia-central" } From 1ac299f88241037b7957bd4ad92fd3205a42ccb1 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 15 Jun 2015 09:28:20 -0700 Subject: [PATCH 59/59] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 0caeb63ef27c..6e039f9b10f5 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 8cfaf4d5c827..bca8911dc97f 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index c10075d03160..ebf0fb592ac9 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index e99b65a2e2f2..967c234f73e4 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index a0f2d33c7eda..356d10837444 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 475f35c3852a..7cb65af4a21f 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index c10075d03160..ebf0fb592ac9 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 878ba8c652f6..048520a45c6a 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 714bae216bfc..922b827f4b3d 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index d9efcd6c9fa9..05304f414e02 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - +