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

Side by Side Diff: content/renderer/load_progress_tracker.cc

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 | « content/renderer/image_loading_helper.cc ('k') | content/renderer/p2p/ipc_network_manager.cc » ('j') | 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 #include "content/renderer/load_progress_tracker.h" 5 #include "content/renderer/load_progress_tracker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "content/renderer/render_view_impl.h" 10 #include "content/renderer/render_view_impl.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 weak_factory_.InvalidateWeakPtrs(); 61 weak_factory_.InvalidateWeakPtrs();
62 SendChangeLoadProgress(); 62 SendChangeLoadProgress();
63 if (progress == 1.0) 63 if (progress == 1.0)
64 ResetStates(); 64 ResetStates();
65 return; 65 return;
66 } 66 }
67 67
68 if (weak_factory_.HasWeakPtrs()) 68 if (weak_factory_.HasWeakPtrs())
69 return; 69 return;
70 70
71 MessageLoop::current()->PostDelayedTask( 71 base::MessageLoop::current()->PostDelayedTask(
72 FROM_HERE, 72 FROM_HERE,
73 base::Bind(&LoadProgressTracker::SendChangeLoadProgress, 73 base::Bind(&LoadProgressTracker::SendChangeLoadProgress,
74 weak_factory_.GetWeakPtr()), 74 weak_factory_.GetWeakPtr()),
75 min_delay); 75 min_delay);
76 } 76 }
77 77
78 void LoadProgressTracker::SendChangeLoadProgress() { 78 void LoadProgressTracker::SendChangeLoadProgress() {
79 last_time_progress_sent_ = base::TimeTicks::Now(); 79 last_time_progress_sent_ = base::TimeTicks::Now();
80 render_view_->Send( 80 render_view_->Send(
81 new ViewHostMsg_DidChangeLoadProgress(render_view_->routing_id(), 81 new ViewHostMsg_DidChangeLoadProgress(render_view_->routing_id(),
82 progress_)); 82 progress_));
83 } 83 }
84 84
85 void LoadProgressTracker::ResetStates() { 85 void LoadProgressTracker::ResetStates() {
86 tracked_frame_ = NULL; 86 tracked_frame_ = NULL;
87 progress_ = 0.0; 87 progress_ = 0.0;
88 weak_factory_.InvalidateWeakPtrs(); 88 weak_factory_.InvalidateWeakPtrs();
89 last_time_progress_sent_ = base::TimeTicks(); 89 last_time_progress_sent_ = base::TimeTicks();
90 } 90 }
91 91
92 } // namespace content 92 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/image_loading_helper.cc ('k') | content/renderer/p2p/ipc_network_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698