Skip to content
This repository was archived by the owner on Jul 3, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/inspector/js/inspectorPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function runSwfPlayer(data, gfxWindow) {
Shumway.FileLoadingService.instance = new Shumway.Player.ShumwayComFileLoadingService();
Shumway.FileLoadingService.instance.init(file);
} else {
Shumway.ExternalInterfaceService.instance = new Shumway.Player.PlayerInternalExternalInterface();
Shumway.LocalConnectionService.instance = new Shumway.Player.PlayerInternalLocalConnectionService();
Shumway.FileLoadingService.instance = new Shumway.Player.BrowserFileLoadingService();
Shumway.FileLoadingService.instance.init(file, data.fileReadChunkSize);
Expand Down
27 changes: 22 additions & 5 deletions src/base/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,19 @@ module Shumway {
console.warn.apply(console, arguments);
}

export function warnOnce(message: any, arg1?: any, arg2?: any/*...messages: any[]*/) {
if (release) {
return;
}
var key = argumentsToString(arguments);
if (_warnedCounts[key]) {
_warnedCounts[key]++;
return;
}
_warnedCounts[key] = 1;
console.warn.apply(console, arguments);
}

export function warnCounts() {
var list = [];
for (var key in _warnedCounts) {
Expand Down Expand Up @@ -1818,7 +1831,8 @@ module Shumway {
export function pointInPolygon(x: number, y: number, polygon: Float32Array): boolean {
// release || assert (((polygon.length & 1) === 0) && polygon.length >= 8);
// release || assert (polygon[0] === polygon[polygon.length - 2] &&
// polygon[1] === polygon[polygon.length - 1], "First and last points should be equal.");
// polygon[1] === polygon[polygon.length - 1], "First and last points should be
// equal.");
var crosses = 0;
var n = polygon.length - 2;
var p = polygon;
Expand Down Expand Up @@ -1857,7 +1871,8 @@ module Shumway {
export function pointInPolygonInt32(x: number, y: number, polygon: Int32Array): boolean {
// release || assert (((polygon.length & 1) === 0) && polygon.length >= 8);
// release || assert (polygon[0] === polygon[polygon.length - 2] &&
// polygon[1] === polygon[polygon.length - 1], "First and last points should be equal.");
// polygon[1] === polygon[polygon.length - 1], "First and last points should be
// equal.");
x = x | 0;
y = y | 0;
var crosses = 0;
Expand Down Expand Up @@ -2145,8 +2160,9 @@ module Shumway {
}

/**
* Visitors can return RETURN if they wish to stop the iteration or DELETE if they need to delete the current node.
* NOTE: DELETE most likley doesn't work if there are multiple active iterations going on.
* Visitors can return RETURN if they wish to stop the iteration or DELETE if they need to
* delete the current node. NOTE: DELETE most likley doesn't work if there are multiple active
* iterations going on.
*/
public forEach(visitor: (value: T) => any) {
var curr = this._head;
Expand Down Expand Up @@ -3368,7 +3384,8 @@ module Shumway {
}
return;
}
// enterTimeline("convertImage", ImageType[sourceFormat] + " to " + ImageType[targetFormat] + " (" + memorySizeToString(source.length));
// enterTimeline("convertImage", ImageType[sourceFormat] + " to " + ImageType[targetFormat] +
// " (" + memorySizeToString(source.length));
if (sourceFormat === ImageType.PremultipliedAlphaARGB &&
targetFormat === ImageType.StraightAlphaRGBA) {
Shumway.ColorUtilities.ensureUnpremultiplyTable();
Expand Down
38 changes: 38 additions & 0 deletions src/player/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,44 @@ module Shumway.Player {
}
}

/**
* Implementation of IExternalInterfaceService that just does the minimal amount of work
* required to pretend that ExternalInterface is available.
*
* Doesn't actually execute anything when `call` is used and never invokes registered callbacks.
*/
export class PlayerInternalExternalInterface implements IExternalInterfaceService {

get enabled() {
return true;
}

initJS(callback: (functionName: string, args: any[]) => any) {
Debug.warnOnce('SWF running in Shell or Inspector uses ExternalInterface, might not work' +
' correctly');
}

registerCallback(functionName: string) {
// Empty stub.
}

unregisterCallback(functionName: string) {
// Empty stub.
}

eval(expression: string): any {
return undefined;
}

call(request: string): any {
return undefined;
}

getId(): string {
return '';
}
}

export class ShumwayComFileLoadingService implements IFileLoadingService {
private _baseUrl: string = null;
private _nextSessionId: number = 1; // 0 - is reserved
Expand Down
1 change: 1 addition & 0 deletions src/shell/playerservices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ module Shumway.Shell {
Shumway.BinaryFileReader = <typeof BinaryFileReader><any>ShellBinaryFileReader;
Shumway.Telemetry.instance = shellTelemetry;
Shumway.FileLoadingService.instance = shellFileLoadingService;
Shumway.ExternalInterfaceService.instance = new Player.PlayerInternalExternalInterface();
Shumway.LocalConnectionService.instance = new Player.PlayerInternalLocalConnectionService();
}
}
1 change: 1 addition & 0 deletions test/harness/slavePlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Shumway.Telemetry.instance = {
};

Shumway.FileLoadingService.instance = new Shumway.Player.BrowserFileLoadingService();
Shumway.ExternalInterfaceService.instance = new Shumway.Player.PlayerInternalExternalInterface();
Shumway.LocalConnectionService.instance = new Shumway.Player.PlayerInternalLocalConnectionService();

function runSwfPlayer(flashParams, settings, gfxWindow) {
Expand Down
Loading