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

Side by Side Diff: chrome/renderer/extensions/user_script_idle_scheduler.cc

Issue 9844008: Using DidCommitProvisionalLoad() instead of DidStartProvisionalLoad() in USIS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « chrome/renderer/extensions/user_script_idle_scheduler.h ('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 #include "chrome/renderer/extensions/user_script_idle_scheduler.h" 5 #include "chrome/renderer/extensions/user_script_idle_scheduler.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 "chrome/common/extensions/extension_error_utils.h" 9 #include "chrome/common/extensions/extension_error_utils.h"
10 #include "chrome/common/extensions/extension_manifest_constants.h" 10 #include "chrome/common/extensions/extension_manifest_constants.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 base::TimeDelta::FromMilliseconds(kUserScriptIdleTimeoutMs)); 60 base::TimeDelta::FromMilliseconds(kUserScriptIdleTimeoutMs));
61 } 61 }
62 62
63 void UserScriptIdleScheduler::DidFinishLoad() { 63 void UserScriptIdleScheduler::DidFinishLoad() {
64 // Ensure that running scripts does not keep any progress UI running. 64 // Ensure that running scripts does not keep any progress UI running.
65 MessageLoop::current()->PostTask( 65 MessageLoop::current()->PostTask(
66 FROM_HERE, base::Bind(&UserScriptIdleScheduler::MaybeRun, 66 FROM_HERE, base::Bind(&UserScriptIdleScheduler::MaybeRun,
67 weak_factory_.GetWeakPtr())); 67 weak_factory_.GetWeakPtr()));
68 } 68 }
69 69
70 void UserScriptIdleScheduler::DidStartProvisionalLoad() { 70 void UserScriptIdleScheduler::DidCommitProvisionalLoad() {
71 // The frame is navigating, so reset the state since we'll want to inject 71 // The frame is navigating, so reset the state since we'll want to inject
72 // scripts once the load finishes. 72 // scripts once the load finishes.
73 has_run_ = false; 73 has_run_ = false;
74 weak_factory_.InvalidateWeakPtrs(); 74 weak_factory_.InvalidateWeakPtrs();
75 while (!pending_code_execution_queue_.empty()) 75 while (!pending_code_execution_queue_.empty())
76 pending_code_execution_queue_.pop(); 76 pending_code_execution_queue_.pop();
77 } 77 }
78 78
79 void UserScriptIdleScheduler::MaybeRun() { 79 void UserScriptIdleScheduler::MaybeRun() {
80 if (has_run_) 80 if (has_run_)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 if (!parent_frame) 174 if (!parent_frame)
175 return false; 175 return false;
176 176
177 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; 177 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame;
178 child_frame = child_frame->nextSibling()) { 178 child_frame = child_frame->nextSibling()) {
179 frames_vector->push_back(child_frame); 179 frames_vector->push_back(child_frame);
180 GetAllChildFrames(child_frame, frames_vector); 180 GetAllChildFrames(child_frame, frames_vector);
181 } 181 }
182 return true; 182 return true;
183 } 183 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/user_script_idle_scheduler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698