Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: Source/core/inspector/InjectedScriptCanvasModuleSource.js

Issue 315253002: DevTools: [JSDoc] Fix injected scripts JSDoc and related code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 /** 253 /**
254 * @constructor 254 * @constructor
255 * @implements {StackTrace} 255 * @implements {StackTrace}
256 * @param {number=} stackTraceLimit 256 * @param {number=} stackTraceLimit
257 * @param {Function=} topMostFunctionToIgnore 257 * @param {Function=} topMostFunctionToIgnore
258 * @see http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi 258 * @see http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
259 */ 259 */
260 function StackTraceV8(stackTraceLimit, topMostFunctionToIgnore) 260 function StackTraceV8(stackTraceLimit, topMostFunctionToIgnore)
261 { 261 {
262 StackTrace.call(this);
263
264 var oldPrepareStackTrace = Error.prepareStackTrace; 262 var oldPrepareStackTrace = Error.prepareStackTrace;
265 var oldStackTraceLimit = Error.stackTraceLimit; 263 var oldStackTraceLimit = Error.stackTraceLimit;
266 if (typeof stackTraceLimit === "number") 264 if (typeof stackTraceLimit === "number")
267 Error.stackTraceLimit = stackTraceLimit; 265 Error.stackTraceLimit = stackTraceLimit;
268 266
269 /** 267 /**
270 * @param {Object} error 268 * @param {Object} error
271 * @param {!Array.<CallSite>} structuredStackTrace 269 * @param {!Array.<CallSite>} structuredStackTrace
272 * @return {!Array.<{sourceURL: string, lineNumber: number, columnNumber: nu mber}>} 270 * @return {!Array.<{sourceURL: string, lineNumber: number, columnNumber: nu mber}>}
273 */ 271 */
(...skipping 18 matching lines...) Expand all
292 290
293 StackTraceV8.prototype = { 291 StackTraceV8.prototype = {
294 /** 292 /**
295 * @override 293 * @override
296 * @param {number} index 294 * @param {number} index
297 * @return {{sourceURL: string, lineNumber: number, columnNumber: number}|un defined} 295 * @return {{sourceURL: string, lineNumber: number, columnNumber: number}|un defined}
298 */ 296 */
299 callFrame: function(index) 297 callFrame: function(index)
300 { 298 {
301 return this._stackTrace[index]; 299 return this._stackTrace[index];
302 }, 300 }
303
304 __proto__: StackTrace.prototype
305 } 301 }
306 302
307 /** 303 /**
308 * @constructor 304 * @constructor
309 * @template T 305 * @template T
310 */ 306 */
311 function Cache() 307 function Cache()
312 { 308 {
313 this.reset(); 309 this.reset();
314 } 310 }
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 if (!wrappedObject) 976 if (!wrappedObject)
981 return null; 977 return null;
982 var proxy = Object.create(wrappedObject.__proto__); // In order to emula te "instanceof". 978 var proxy = Object.create(wrappedObject.__proto__); // In order to emula te "instanceof".
983 979
984 var customWrapFunctions = this._customWrapFunctions(); 980 var customWrapFunctions = this._customWrapFunctions();
985 /** @type {!Array.<string>} */ 981 /** @type {!Array.<string>} */
986 this._proxyStatePropertyNames = []; 982 this._proxyStatePropertyNames = [];
987 983
988 /** 984 /**
989 * @param {string} property 985 * @param {string} property
986 * @this {Resource}
990 */ 987 */
991 function processProperty(property) 988 function processProperty(property)
992 { 989 {
993 if (typeof wrappedObject[property] === "function") { 990 if (typeof wrappedObject[property] === "function") {
994 var customWrapFunction = customWrapFunctions[property]; 991 var customWrapFunction = customWrapFunctions[property];
995 if (customWrapFunction) 992 if (customWrapFunction)
996 proxy[property] = this._wrapCustomFunction(this, wrappedObje ct, wrappedObject[property], property, customWrapFunction); 993 proxy[property] = this._wrapCustomFunction(this, wrappedObje ct, wrappedObject[property], property, customWrapFunction);
997 else 994 else
998 proxy[property] = this._wrapFunction(this, wrappedObject, wr appedObject[property], property); 995 proxy[property] = this._wrapFunction(this, wrappedObject, wr appedObject[property], property);
999 } else if (TypeUtils.isEnumPropertyName(property, wrappedObject)) { 996 } else if (TypeUtils.isEnumPropertyName(property, wrappedObject)) {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 } 1158 }
1162 } 1159 }
1163 1160
1164 /** 1161 /**
1165 * @param {function(new:Resource, !Object, string)} resourceConstructor 1162 * @param {function(new:Resource, !Object, string)} resourceConstructor
1166 * @param {string} resourceName 1163 * @param {string} resourceName
1167 * @return {function(this:Resource.WrapFunction)} 1164 * @return {function(this:Resource.WrapFunction)}
1168 */ 1165 */
1169 Resource.WrapFunction.resourceFactoryMethod = function(resourceConstructor, reso urceName) 1166 Resource.WrapFunction.resourceFactoryMethod = function(resourceConstructor, reso urceName)
1170 { 1167 {
1171 /** @this Resource.WrapFunction */ 1168 /** @this {Resource.WrapFunction} */
1172 return function() 1169 return function()
1173 { 1170 {
1174 var wrappedObject = /** @type {Object} */ (this.result()); 1171 var wrappedObject = /** @type {Object} */ (this.result());
1175 if (!wrappedObject) 1172 if (!wrappedObject)
1176 return; 1173 return;
1177 var resource = new resourceConstructor(wrappedObject, resourceName); 1174 var resource = new resourceConstructor(wrappedObject, resourceName);
1178 var manager = this._resource.manager(); 1175 var manager = this._resource.manager();
1179 if (manager) 1176 if (manager)
1180 manager.registerResource(resource); 1177 manager.registerResource(resource);
1181 this.overrideResult(resource.proxyObject()); 1178 this.overrideResult(resource.proxyObject());
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 /** 1277 /**
1281 * @override 1278 * @override
1282 * @return {!Object.<string, Function>} 1279 * @return {!Object.<string, Function>}
1283 */ 1280 */
1284 _customWrapFunctions: function() 1281 _customWrapFunctions: function()
1285 { 1282 {
1286 var wrapFunctions = Object.create(null); 1283 var wrapFunctions = Object.create(null);
1287 var wrappedObject = this.wrappedObject(); 1284 var wrappedObject = this.wrappedObject();
1288 if (wrappedObject) { 1285 if (wrappedObject) {
1289 for (var property in wrappedObject) { 1286 for (var property in wrappedObject) {
1290 /** @this Resource.WrapFunction */ 1287 /** @this {Resource.WrapFunction} */
1291 wrapFunctions[property] = function() 1288 wrapFunctions[property] = function()
1292 { 1289 {
1293 this._resource.pushCall(this.call()); 1290 this._resource.pushCall(this.call());
1294 } 1291 }
1295 } 1292 }
1296 } 1293 }
1297 return wrapFunctions; 1294 return wrapFunctions;
1298 }, 1295 },
1299 1296
1300 __proto__: Resource.prototype 1297 __proto__: Resource.prototype
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after
2945 stateModifyingWrapFunction("compressedTexSubImage2D"); 2942 stateModifyingWrapFunction("compressedTexSubImage2D");
2946 stateModifyingWrapFunction("copyTexImage2D", WebGLTextureResource.pr ototype.pushCall_copyTexImage2D); 2943 stateModifyingWrapFunction("copyTexImage2D", WebGLTextureResource.pr ototype.pushCall_copyTexImage2D);
2947 stateModifyingWrapFunction("copyTexSubImage2D", WebGLTextureResource .prototype.pushCall_copyTexImage2D); 2944 stateModifyingWrapFunction("copyTexSubImage2D", WebGLTextureResource .prototype.pushCall_copyTexImage2D);
2948 stateModifyingWrapFunction("generateMipmap"); 2945 stateModifyingWrapFunction("generateMipmap");
2949 stateModifyingWrapFunction("texImage2D"); 2946 stateModifyingWrapFunction("texImage2D");
2950 stateModifyingWrapFunction("texSubImage2D"); 2947 stateModifyingWrapFunction("texSubImage2D");
2951 stateModifyingWrapFunction("texParameterf", WebGLTextureResource.pro totype.pushCall_texParameter); 2948 stateModifyingWrapFunction("texParameterf", WebGLTextureResource.pro totype.pushCall_texParameter);
2952 stateModifyingWrapFunction("texParameteri", WebGLTextureResource.pro totype.pushCall_texParameter); 2949 stateModifyingWrapFunction("texParameteri", WebGLTextureResource.pro totype.pushCall_texParameter);
2953 stateModifyingWrapFunction("renderbufferStorage"); 2950 stateModifyingWrapFunction("renderbufferStorage");
2954 2951
2955 /** @this Resource.WrapFunction */ 2952 /** @this {Resource.WrapFunction} */
2956 wrapFunctions["getError"] = function() 2953 wrapFunctions["getError"] = function()
2957 { 2954 {
2958 var gl = /** @type {WebGLRenderingContext} */ (this._originalObj ect); 2955 var gl = /** @type {WebGLRenderingContext} */ (this._originalObj ect);
2959 var error = this.result(); 2956 var error = this.result();
2960 if (error !== gl.NO_ERROR) 2957 if (error !== gl.NO_ERROR)
2961 this._resource.clearError(error); 2958 this._resource.clearError(error);
2962 else { 2959 else {
2963 error = this._resource.nextError(); 2960 error = this._resource.nextError();
2964 if (error !== gl.NO_ERROR) 2961 if (error !== gl.NO_ERROR)
2965 this.overrideResult(error); 2962 this.overrideResult(error);
2966 } 2963 }
2967 } 2964 }
2968 2965
2969 /** 2966 /**
2970 * @param {string} name 2967 * @param {string} name
2971 * @this Resource.WrapFunction 2968 * @this {Resource.WrapFunction}
2972 */ 2969 */
2973 wrapFunctions["getExtension"] = function(name) 2970 wrapFunctions["getExtension"] = function(name)
2974 { 2971 {
2975 this._resource.registerWebGLExtension(name, this.result()); 2972 this._resource.registerWebGLExtension(name, this.result());
2976 } 2973 }
2977 2974
2978 // 2975 //
2979 // Register bound WebGL resources. 2976 // Register bound WebGL resources.
2980 // 2977 //
2981 2978
2982 /** 2979 /**
2983 * @param {WebGLProgram} program 2980 * @param {WebGLProgram} program
2984 * @param {WebGLShader} shader 2981 * @param {WebGLShader} shader
2985 * @this Resource.WrapFunction 2982 * @this {Resource.WrapFunction}
2986 */ 2983 */
2987 wrapFunctions["attachShader"] = function(program, shader) 2984 wrapFunctions["attachShader"] = function(program, shader)
2988 { 2985 {
2989 var resource = this._resource.currentBinding(program); 2986 var resource = this._resource.currentBinding(program);
2990 if (resource) { 2987 if (resource) {
2991 resource.pushCall(this.call()); 2988 resource.pushCall(this.call());
2992 var shaderResource = /** @type {WebGLShaderResource} */ (Res ource.forObject(shader)); 2989 var shaderResource = /** @type {WebGLShaderResource} */ (Res ource.forObject(shader));
2993 if (shaderResource) { 2990 if (shaderResource) {
2994 var shaderType = shaderResource.type(); 2991 var shaderType = shaderResource.type();
2995 resource._registerBoundResource("__attachShader_" + shad erType, shaderResource); 2992 resource._registerBoundResource("__attachShader_" + shad erType, shaderResource);
2996 } 2993 }
2997 } 2994 }
2998 } 2995 }
2999 /** 2996 /**
3000 * @param {number} target 2997 * @param {number} target
3001 * @param {number} attachment 2998 * @param {number} attachment
3002 * @param {number} objectTarget 2999 * @param {number} objectTarget
3003 * @param {WebGLRenderbuffer|WebGLTexture} obj 3000 * @param {WebGLRenderbuffer|WebGLTexture} obj
3004 * @this Resource.WrapFunction 3001 * @this {Resource.WrapFunction}
3005 */ 3002 */
3006 wrapFunctions["framebufferRenderbuffer"] = wrapFunctions["framebuffe rTexture2D"] = function(target, attachment, objectTarget, obj) 3003 wrapFunctions["framebufferRenderbuffer"] = wrapFunctions["framebuffe rTexture2D"] = function(target, attachment, objectTarget, obj)
3007 { 3004 {
3008 var resource = this._resource.currentBinding(target); 3005 var resource = this._resource.currentBinding(target);
3009 if (resource) { 3006 if (resource) {
3010 resource.pushCall(this.call()); 3007 resource.pushCall(this.call());
3011 resource._registerBoundResource("__framebufferAttachmentObje ctName", obj); 3008 resource._registerBoundResource("__framebufferAttachmentObje ctName", obj);
3012 } 3009 }
3013 } 3010 }
3014 /** 3011 /**
3015 * @param {number} target 3012 * @param {number} target
3016 * @param {Object} obj 3013 * @param {Object} obj
3017 * @this Resource.WrapFunction 3014 * @this {Resource.WrapFunction}
3018 */ 3015 */
3019 wrapFunctions["bindBuffer"] = wrapFunctions["bindFramebuffer"] = wra pFunctions["bindRenderbuffer"] = function(target, obj) 3016 wrapFunctions["bindBuffer"] = wrapFunctions["bindFramebuffer"] = wra pFunctions["bindRenderbuffer"] = function(target, obj)
3020 { 3017 {
3021 this._resource.currentBinding(target); // To call WebGLBoundReso urce.prototype.pushBinding(). 3018 this._resource.currentBinding(target); // To call WebGLBoundReso urce.prototype.pushBinding().
3022 this._resource._registerBoundResource("__bindBuffer_" + target, obj); 3019 this._resource._registerBoundResource("__bindBuffer_" + target, obj);
3023 } 3020 }
3024 /** 3021 /**
3025 * @param {number} target 3022 * @param {number} target
3026 * @param {WebGLTexture} obj 3023 * @param {WebGLTexture} obj
3027 * @this Resource.WrapFunction 3024 * @this {Resource.WrapFunction}
3028 */ 3025 */
3029 wrapFunctions["bindTexture"] = function(target, obj) 3026 wrapFunctions["bindTexture"] = function(target, obj)
3030 { 3027 {
3031 this._resource.currentBinding(target); // To call WebGLBoundReso urce.prototype.pushBinding(). 3028 this._resource.currentBinding(target); // To call WebGLBoundReso urce.prototype.pushBinding().
3032 var gl = /** @type {WebGLRenderingContext} */ (this._originalObj ect); 3029 var gl = /** @type {WebGLRenderingContext} */ (this._originalObj ect);
3033 var currentTextureBinding = /** @type {number} */ (gl.getParamet er(gl.ACTIVE_TEXTURE)); 3030 var currentTextureBinding = /** @type {number} */ (gl.getParamet er(gl.ACTIVE_TEXTURE));
3034 this._resource._registerBoundResource("__bindTexture_" + target + "_" + currentTextureBinding, obj); 3031 this._resource._registerBoundResource("__bindTexture_" + target + "_" + currentTextureBinding, obj);
3035 } 3032 }
3036 /** 3033 /**
3037 * @param {WebGLProgram} program 3034 * @param {WebGLProgram} program
3038 * @this Resource.WrapFunction 3035 * @this {Resource.WrapFunction}
3039 */ 3036 */
3040 wrapFunctions["useProgram"] = function(program) 3037 wrapFunctions["useProgram"] = function(program)
3041 { 3038 {
3042 this._resource._registerBoundResource("__useProgram", program); 3039 this._resource._registerBoundResource("__useProgram", program);
3043 } 3040 }
3044 /** 3041 /**
3045 * @param {number} index 3042 * @param {number} index
3046 * @this Resource.WrapFunction 3043 * @this {Resource.WrapFunction}
3047 */ 3044 */
3048 wrapFunctions["vertexAttribPointer"] = function(index) 3045 wrapFunctions["vertexAttribPointer"] = function(index)
3049 { 3046 {
3050 var gl = /** @type {WebGLRenderingContext} */ (this._originalObj ect); 3047 var gl = /** @type {WebGLRenderingContext} */ (this._originalObj ect);
3051 this._resource._registerBoundResource("__vertexAttribPointer_" + index, gl.getParameter(gl.ARRAY_BUFFER_BINDING)); 3048 this._resource._registerBoundResource("__vertexAttribPointer_" + index, gl.getParameter(gl.ARRAY_BUFFER_BINDING));
3052 } 3049 }
3053 3050
3054 WebGLRenderingContextResource._wrapFunctions = wrapFunctions; 3051 WebGLRenderingContextResource._wrapFunctions = wrapFunctions;
3055 } 3052 }
3056 3053
3057 /** 3054 /**
3058 * @param {string} methodName 3055 * @param {string} methodName
3059 * @param {function(this:Resource, !Call)=} pushCallFunc 3056 * @param {function(this:Resource, !Call)=} pushCallFunc
3060 */ 3057 */
3061 function stateModifyingWrapFunction(methodName, pushCallFunc) 3058 function stateModifyingWrapFunction(methodName, pushCallFunc)
3062 { 3059 {
3063 if (pushCallFunc) { 3060 if (pushCallFunc) {
3064 /** 3061 /**
3065 * @param {Object|number} target 3062 * @param {Object|number} target
3066 * @this Resource.WrapFunction 3063 * @this {Resource.WrapFunction}
3067 */ 3064 */
3068 wrapFunctions[methodName] = function(target) 3065 wrapFunctions[methodName] = function(target)
3069 { 3066 {
3070 var resource = this._resource.currentBinding(target); 3067 var resource = this._resource.currentBinding(target);
3071 if (resource) 3068 if (resource)
3072 pushCallFunc.call(resource, this.call()); 3069 pushCallFunc.call(resource, this.call());
3073 } 3070 }
3074 } else { 3071 } else {
3075 /** 3072 /**
3076 * @param {Object|number} target 3073 * @param {Object|number} target
3077 * @this Resource.WrapFunction 3074 * @this {Resource.WrapFunction}
3078 */ 3075 */
3079 wrapFunctions[methodName] = function(target) 3076 wrapFunctions[methodName] = function(target)
3080 { 3077 {
3081 var resource = this._resource.currentBinding(target); 3078 var resource = this._resource.currentBinding(target);
3082 if (resource) 3079 if (resource)
3083 resource.pushCall(this.call()); 3080 resource.pushCall(this.call());
3084 } 3081 }
3085 } 3082 }
3086 } 3083 }
3087 3084
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
3490 CanvasRenderingContext2DResource._wrapFunctions = wrapFunctions; 3487 CanvasRenderingContext2DResource._wrapFunctions = wrapFunctions;
3491 } 3488 }
3492 3489
3493 /** 3490 /**
3494 * @param {string} methodName 3491 * @param {string} methodName
3495 * @param {function(this:Resource, !Call)=} func 3492 * @param {function(this:Resource, !Call)=} func
3496 */ 3493 */
3497 function stateModifyingWrapFunction(methodName, func) 3494 function stateModifyingWrapFunction(methodName, func)
3498 { 3495 {
3499 if (func) { 3496 if (func) {
3500 /** @this Resource.WrapFunction */ 3497 /** @this {Resource.WrapFunction} */
3501 wrapFunctions[methodName] = function() 3498 wrapFunctions[methodName] = function()
3502 { 3499 {
3503 func.call(this._resource, this.call()); 3500 func.call(this._resource, this.call());
3504 } 3501 }
3505 } else { 3502 } else {
3506 /** @this Resource.WrapFunction */ 3503 /** @this {Resource.WrapFunction} */
3507 wrapFunctions[methodName] = function() 3504 wrapFunctions[methodName] = function()
3508 { 3505 {
3509 this._resource.pushCall(this.call()); 3506 this._resource.pushCall(this.call());
3510 } 3507 }
3511 } 3508 }
3512 } 3509 }
3513 3510
3514 return wrapFunctions; 3511 return wrapFunctions;
3515 }, 3512 },
3516 3513
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
4157 }; 4154 };
4158 }, 4155 },
4159 4156
4160 /** 4157 /**
4161 * @param {number} stepNum 4158 * @param {number} stepNum
4162 */ 4159 */
4163 _replayCallArguments: function(stepNum) 4160 _replayCallArguments: function(stepNum)
4164 { 4161 {
4165 /** 4162 /**
4166 * @param {*} obj 4163 * @param {*} obj
4164 * @this {TraceLogPlayer}
4167 */ 4165 */
4168 function replayIfNotCreatedInThisTraceLog(obj) 4166 function replayIfNotCreatedInThisTraceLog(obj)
4169 { 4167 {
4170 if (!(obj instanceof ReplayableResource)) 4168 if (!(obj instanceof ReplayableResource))
4171 return; 4169 return;
4172 var replayableResource = /** @type {!ReplayableResource} */ (obj); 4170 var replayableResource = /** @type {!ReplayableResource} */ (obj);
4173 if (!this._traceLog.createdInThisTraceLog(replayableResource.id())) 4171 if (!this._traceLog.createdInThisTraceLog(replayableResource.id()))
4174 replayableResource.replay(this._replayWorldCache) 4172 replayableResource.replay(this._replayWorldCache)
4175 } 4173 }
4176 var replayableCalls = this._traceLog.replayableCalls(); 4174 var replayableCalls = this._traceLog.replayableCalls();
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
4577 _parseStringId: function(stringId) 4575 _parseStringId: function(stringId)
4578 { 4576 {
4579 return InjectedScriptHost.evaluate("(" + stringId + ")"); 4577 return InjectedScriptHost.evaluate("(" + stringId + ")");
4580 } 4578 }
4581 } 4579 }
4582 4580
4583 var injectedCanvasModule = new InjectedCanvasModule(); 4581 var injectedCanvasModule = new InjectedCanvasModule();
4584 return injectedCanvasModule; 4582 return injectedCanvasModule;
4585 4583
4586 }) 4584 })
OLDNEW
« no previous file with comments | « no previous file | Source/core/inspector/InjectedScriptSource.js » ('j') | Source/core/inspector/InjectedScriptSource.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698