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

Side by Side Diff: chrome/browser/resources/net_internals/timeline_view.js

Issue 9581021: [refactor] Split up SourceTracker into SourceTracker + EventsTracker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update based on mmenke comments Created 8 years, 9 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
« no previous file with comments | « chrome/browser/resources/net_internals/source_tracker.js ('k') | 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * TimelineView displays a zoomable and scrollable graph of a number of values 6 * TimelineView displays a zoomable and scrollable graph of a number of values
7 * over time. The TimelineView class itself is responsible primarily for 7 * over time. The TimelineView class itself is responsible primarily for
8 * updating the TimelineDataSeries its GraphView displays. 8 * updating the TimelineDataSeries its GraphView displays.
9 */ 9 */
10 var TimelineView = (function() { 10 var TimelineView = (function() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 // DataSeries depend on some of the global constants, so they're only 45 // DataSeries depend on some of the global constants, so they're only
46 // created once constants have been received. We also use this message to 46 // created once constants have been received. We also use this message to
47 // recreate DataSeries when log files are being loaded. 47 // recreate DataSeries when log files are being loaded.
48 g_browser.addConstantsObserver(this); 48 g_browser.addConstantsObserver(this);
49 49
50 // We observe new log entries to determine the range of the graph, and pass 50 // We observe new log entries to determine the range of the graph, and pass
51 // them on to each DataSource. We initialize the graph range to initially 51 // them on to each DataSource. We initialize the graph range to initially
52 // include all events, but after that, we only update it to be the current 52 // include all events, but after that, we only update it to be the current
53 // time on a timer. 53 // time on a timer.
54 g_browser.sourceTracker.addLogEntryObserver(this); 54 EventsTracker.getInstance().addLogEntryObserver(this);
55 this.graphRangeInitialized_ = false; 55 this.graphRangeInitialized_ = false;
56 } 56 }
57 57
58 // ID for special HTML element in category_tabs.html 58 // ID for special HTML element in category_tabs.html
59 TimelineView.TAB_HANDLE_ID = 'tab-handle-timeline'; 59 TimelineView.TAB_HANDLE_ID = 'tab-handle-timeline';
60 60
61 // IDs for special HTML elements in timeline_view.html 61 // IDs for special HTML elements in timeline_view.html
62 TimelineView.GRAPH_DIV_ID = 'timeline-view-graph-div'; 62 TimelineView.GRAPH_DIV_ID = 'timeline-view-graph-div';
63 TimelineView.GRAPH_CANVAS_ID = 'timeline-view-graph-canvas'; 63 TimelineView.GRAPH_CANVAS_ID = 'timeline-view-graph-canvas';
64 TimelineView.SELECTION_DIV_ID = 'timeline-view-selection-div'; 64 TimelineView.SELECTION_DIV_ID = 'timeline-view-selection-div';
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 }, 224 },
225 225
226 /** 226 /**
227 * When we receive the constants, create or recreate the DataSeries. 227 * When we receive the constants, create or recreate the DataSeries.
228 */ 228 */
229 onReceivedConstants: function(constants) { 229 onReceivedConstants: function(constants) {
230 this.createDataSeries_(); 230 this.createDataSeries_();
231 }, 231 },
232 232
233 /** 233 /**
234 * When log entries are deleted, simpler to recreate the DataSeries, rather 234 * When all log entries are deleted, recreate the DataSeries.
235 * than clearing them.
236 */ 235 */
237 onAllLogEntriesDeleted: function() { 236 onAllLogEntriesDeleted: function() {
238 this.graphRangeInitialized_ = false; 237 this.graphRangeInitialized_ = false;
239 this.createDataSeries_(); 238 this.createDataSeries_();
240 }, 239 },
241 240
242 onReceivedLogEntries: function(entries) { 241 onReceivedLogEntries: function(entries) {
243 // Pass each entry to every DataSeries, one at a time. Not having each 242 // Pass each entry to every DataSeries, one at a time. Not having each
244 // data series get data directly from the SourceTracker saves us from 243 // data series get data directly from the EventsTracker saves us from
245 // having very un-Javascript-like destructors for when we load new, 244 // having very un-Javascript-like destructors for when we load new,
246 // constants and slightly simplifies DataSeries objects. 245 // constants and slightly simplifies DataSeries objects.
247 for (var entry = 0; entry < entries.length; ++entry) { 246 for (var entry = 0; entry < entries.length; ++entry) {
248 for (var i = 0; i < this.dataSeries_.length; ++i) 247 for (var i = 0; i < this.dataSeries_.length; ++i)
249 this.dataSeries_[i].onReceivedLogEntry(entries[entry]); 248 this.dataSeries_[i].onReceivedLogEntry(entries[entry]);
250 } 249 }
251 250
252 // If this is the first non-empty set of entries we've received, or we're 251 // If this is the first non-empty set of entries we've received, or we're
253 // viewing a loaded log file, we will need to update the date range. 252 // viewing a loaded log file, we will need to update the date range.
254 if (this.graphRangeInitialized_ && !MainView.isViewingLoadedLog()) 253 if (this.graphRangeInitialized_ && !MainView.isViewingLoadedLog())
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 this.leftView_.setGeometry(0, 0, newWidth, 100); 289 this.leftView_.setGeometry(0, 0, newWidth, 100);
291 290
292 // Force a re-layout now that the left view has changed width. 291 // Force a re-layout now that the left view has changed width.
293 this.setGeometry(this.getLeft(), this.getTop(), this.getWidth(), 292 this.setGeometry(this.getLeft(), this.getTop(), this.getWidth(),
294 this.getHeight()); 293 this.getHeight());
295 } 294 }
296 }; 295 };
297 296
298 return TimelineView; 297 return TimelineView;
299 })(); 298 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/source_tracker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698