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

Side by Side Diff: Source/devtools/front_end/bindings/TempFile.js

Issue 712593002: DevTools: DevTools opened for an old version of chrome or webview can't record cpu/heap profile. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: worker name was changed Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 if (this._tempFile) 356 if (this._tempFile)
357 this._tempFile.remove(); 357 this._tempFile.remove();
358 } 358 }
359 } 359 }
360 360
361 /** 361 /**
362 * @constructor 362 * @constructor
363 */ 363 */
364 WebInspector.TempStorageCleaner = function() 364 WebInspector.TempStorageCleaner = function()
365 { 365 {
366 this._worker = Runtime.startSharedWorker("temp_storage_shared_worker", "Temp Storage"); 366 try {
367 this._worker.onerror = this._handleError.bind(this); 367 this._worker = Runtime.startSharedWorker("temp_storage_shared_worker", " TempStorageCleaner");
368 this._callbacks = []; 368 this._worker.onerror = this._handleError.bind(this);
369 this._worker.port.onmessage = this._handleMessage.bind(this); 369 this._callbacks = [];
370 this._worker.port.onerror = this._handleError.bind(this); 370 this._worker.port.onmessage = this._handleMessage.bind(this);
371 this._worker.port.onerror = this._handleError.bind(this);
372 } catch (e) {
373 if (e.name === "URLMismatchError")
374 console.log("Shared worker wasn't started due to url difference. " + e);
375 else
376 throw e;
377 }
371 } 378 }
372 379
373 WebInspector.TempStorageCleaner.prototype = { 380 WebInspector.TempStorageCleaner.prototype = {
374 /** 381 /**
375 * @param {!function()} callback 382 * @param {!function()} callback
376 */ 383 */
377 ensureStorageCleared: function(callback) 384 ensureStorageCleared: function(callback)
378 { 385 {
379 if (this._callbacks) 386 if (this._callbacks)
380 this._callbacks.push(callback); 387 this._callbacks.push(callback);
(...skipping 27 matching lines...) Expand all
408 415
409 /** 416 /**
410 * @param {!function()} callback 417 * @param {!function()} callback
411 */ 418 */
412 WebInspector.TempFile._ensureTempStorageCleared = function(callback) 419 WebInspector.TempFile._ensureTempStorageCleared = function(callback)
413 { 420 {
414 if (!WebInspector.TempFile._storageCleaner) 421 if (!WebInspector.TempFile._storageCleaner)
415 WebInspector.TempFile._storageCleaner = new WebInspector.TempStorageClea ner(); 422 WebInspector.TempFile._storageCleaner = new WebInspector.TempStorageClea ner();
416 WebInspector.TempFile._storageCleaner.ensureStorageCleared(callback); 423 WebInspector.TempFile._storageCleaner.ensureStorageCleared(callback);
417 } 424 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698