| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright 2015 The Chromium Authors. All rights reserved. | 3 Copyright 2015 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 <link rel="import" href="/tracing/base/guid.html"> | 7 <link rel="import" href="/tracing/base/guid.html"> |
| 8 <link rel="import" href="/tracing/mre/function_handle.html"> | 8 <link rel="import" href="/tracing/mre/function_handle.html"> |
| 9 | 9 |
| 10 <script> | 10 <script> |
| 11 'use strict'; | 11 'use strict'; |
| 12 | 12 |
| 13 tr.exportTo('tr.mre', function() { | 13 tr.exportTo('tr.mre', function() { |
| 14 function Job(mapFunctionHandle, opt_guid) { | 14 function Job(mapFunctionHandle, opt_guid) { |
| 15 this.mapFunctionHandle_ = mapFunctionHandle; | 15 this.mapFunctionHandle_ = mapFunctionHandle; |
| 16 if (opt_guid === undefined) | 16 if (opt_guid === undefined) { |
| 17 this.guid_ = tr.b.GUID.allocateSimple(); | 17 this.guid_ = tr.b.GUID.allocateSimple(); |
| 18 else | 18 } else { |
| 19 this.guid_ = opt_guid; | 19 this.guid_ = opt_guid; |
| 20 } |
| 20 } | 21 } |
| 21 | 22 |
| 22 Job.prototype = { | 23 Job.prototype = { |
| 23 get mapFunctionHandle() { return this.mapFunctionHandle_; }, | 24 get mapFunctionHandle() { return this.mapFunctionHandle_; }, |
| 24 get guid() { return this.guid_; }, | 25 get guid() { return this.guid_; }, |
| 25 | 26 |
| 26 asDict: function() { | 27 asDict: function() { |
| 27 return { | 28 return { |
| 28 map_function_handle: this.mapFunctionHandle_.asDict(), | 29 map_function_handle: this.mapFunctionHandle_.asDict(), |
| 29 guid: this.guid_.toString() | 30 guid: this.guid_.toString() |
| 30 }; | 31 }; |
| 31 } | 32 } |
| 32 }; | 33 }; |
| 33 | 34 |
| 34 Job.fromDict = function(jobDict) { | 35 Job.fromDict = function(jobDict) { |
| 35 var mapFunctionHandle = null; | 36 var mapFunctionHandle = null; |
| 36 if (jobDict.map_function_handle !== null) { | 37 if (jobDict.map_function_handle !== null) { |
| 37 mapFunctionHandle = tr.mre.FunctionHandle.fromDict( | 38 mapFunctionHandle = tr.mre.FunctionHandle.fromDict( |
| 38 jobDict.map_function_handle); | 39 jobDict.map_function_handle); |
| 39 } | 40 } |
| 40 | 41 |
| 41 return new Job(mapFunctionHandle, jobDict.guid); | 42 return new Job(mapFunctionHandle, jobDict.guid); |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 return { | 45 return { |
| 45 Job, | 46 Job, |
| 46 }; | 47 }; |
| 47 }); | 48 }); |
| 48 </script> | 49 </script> |
| OLD | NEW |