OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/visitedlink/visitedlink_event_listener.h" | 5 #include "chrome/browser/visitedlink/visitedlink_event_listener.h" |
6 | 6 |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
10 #include "content/browser/renderer_host/render_process_host.h" | 10 #include "content/browser/renderer_host/render_process_host.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 VisitedLinkMaster* master = profile->GetVisitedLinkMaster(); | 127 VisitedLinkMaster* master = profile->GetVisitedLinkMaster(); |
128 if (master && master->shared_memory() == table_memory) | 128 if (master && master->shared_memory() == table_memory) |
129 i->second->SendVisitedLinkTable(table_memory); | 129 i->second->SendVisitedLinkTable(table_memory); |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 void VisitedLinkEventListener::Add(VisitedLinkMaster::Fingerprint fingerprint) { | 133 void VisitedLinkEventListener::Add(VisitedLinkMaster::Fingerprint fingerprint) { |
134 pending_visited_links_.push_back(fingerprint); | 134 pending_visited_links_.push_back(fingerprint); |
135 | 135 |
136 if (!coalesce_timer_.IsRunning()) { | 136 if (!coalesce_timer_.IsRunning()) { |
137 coalesce_timer_.Start(FROM_HERE, | 137 coalesce_timer_.Start( |
138 TimeDelta::FromMilliseconds(kCommitIntervalMs), this, | 138 TimeDelta::FromMilliseconds(kCommitIntervalMs), this, |
139 &VisitedLinkEventListener::CommitVisitedLinks); | 139 &VisitedLinkEventListener::CommitVisitedLinks); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 void VisitedLinkEventListener::Reset() { | 143 void VisitedLinkEventListener::Reset() { |
144 pending_visited_links_.clear(); | 144 pending_visited_links_.clear(); |
145 coalesce_timer_.Stop(); | 145 coalesce_timer_.Stop(); |
146 | 146 |
147 for (Updaters::iterator i = updaters_.begin(); i != updaters_.end(); ++i) { | 147 for (Updaters::iterator i = updaters_.begin(); i != updaters_.end(); ++i) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 int child_id = widget->process()->id(); | 192 int child_id = widget->process()->id(); |
193 if (updaters_.count(child_id)) | 193 if (updaters_.count(child_id)) |
194 updaters_[child_id]->Update(); | 194 updaters_[child_id]->Update(); |
195 break; | 195 break; |
196 } | 196 } |
197 default: | 197 default: |
198 NOTREACHED(); | 198 NOTREACHED(); |
199 break; | 199 break; |
200 } | 200 } |
201 } | 201 } |
OLD | NEW |