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

Unified Diff: chrome/browser/resources/new_new_tab.js

Issue 150194: Fix performance issues with NNTP.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/new_new_tab.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/new_new_tab.js
===================================================================
--- chrome/browser/resources/new_new_tab.js (revision 19722)
+++ chrome/browser/resources/new_new_tab.js (working copy)
@@ -65,6 +65,7 @@
}
}
+var loading = true;
var mostVisitedData = [];
var gotMostVisited = false;
var gotShownSections = false;
@@ -101,9 +102,17 @@
processData('#tab-items', data);
}
-function onShownSections(m) {
+function onShownSections(mask) {
logEvent('received shown sections');
- setShownSections(m);
+ if (mask != shownSections) {
+ shownSections = mask;
+ // No need to relayout these unless changed.
+ mostVisited.updateDisplayMode();
+ layoutMostVisited();
+ layoutLowerSections();
+ updateOptionMenu();
+ }
+
gotShownSections = true;
onDataLoaded();
}
@@ -327,7 +336,7 @@
TIPS: 8
};
-var shownSections = Section.RECENT | Section.TIPS;
+var shownSections = Section.THUMB | Section.RECENT | Section.TIPS;
function showSection(section) {
if (!(section & shownSections)) {
@@ -373,19 +382,6 @@
}
}
-/**
- * This is called when we get the shown sections pref from the backend.
- */
-function setShownSections(mask) {
- if (mask != shownSections) {
- shownSections = mask;
- mostVisited.updateDisplayMode();
- layoutMostVisited();
- layoutLowerSections();
- updateOptionMenu();
- }
-}
-
var mostVisited = {
getItem: function(el) {
return findAncestorByClass(el, 'thumbnail-container');
@@ -596,6 +592,7 @@
*/
function onDataLoaded() {
if (gotMostVisited && gotShownSections) {
+ loading = false;
// Remove class name in a timeout so that changes done in this JS thread are
// not animated.
window.setTimeout(function() {
@@ -659,13 +656,18 @@
///////////////////////////////////////////////////////////////////////////////
// Things we know are not needed at startup go below here
-// Notification
-
function afterTransition(f) {
- // The duration of all transitions are 500ms
- window.setTimeout(f, 500);
+ if (loading) {
+ // Make sure we do not use a timer during load since it slows down the UI.
+ f();
+ } else {
+ // The duration of all transitions are 500ms
+ window.setTimeout(f, 500);
+ }
}
+// Notification
+
function showNotification(text, actionText, f) {
var notificationElement = $('notification');
var actionLink = notificationElement.querySelector('.link');
@@ -755,7 +757,6 @@
handleMouseOver: function(e) {
var el = e.target;
var index = Array.prototype.indexOf.call(this.menu.children, el);
- console.log(el, index);
this.setSelectedIndex(index);
},
« no previous file with comments | « chrome/browser/resources/new_new_tab.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698