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

Side by Side Diff: chrome/browser/android/provider/chrome_browser_provider.cc

Issue 1105413002: Avoid conversion of index to BookmarkNode pointer unnacessarily. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/browser/android/provider/chrome_browser_provider.h" 5 #include "chrome/browser/android/provider/chrome_browser_provider.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <list> 8 #include <list>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 RunOnUIThreadBlocking::Run( 255 RunOnUIThreadBlocking::Run(
256 base::Bind(&RemoveBookmarkTask::RunOnUIThread, model(), id)); 256 base::Bind(&RemoveBookmarkTask::RunOnUIThread, model(), id));
257 return deleted_; 257 return deleted_;
258 } 258 }
259 259
260 static void RunOnUIThread(BookmarkModel* model, const int64 id) { 260 static void RunOnUIThread(BookmarkModel* model, const int64 id) {
261 DCHECK_CURRENTLY_ON(BrowserThread::UI); 261 DCHECK_CURRENTLY_ON(BrowserThread::UI);
262 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id); 262 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id);
263 if (node && node->parent()) { 263 if (node && node->parent()) {
264 const BookmarkNode* parent_node = node->parent(); 264 const BookmarkNode* parent_node = node->parent();
265 model->Remove(parent_node, parent_node->GetIndexOf(node)); 265 model->Remove(parent_node, node);
266 } 266 }
267 } 267 }
268 268
269 // Verify that the bookmark was actually removed. Called synchronously. 269 // Verify that the bookmark was actually removed. Called synchronously.
270 void BookmarkNodeRemoved(BookmarkModel* bookmark_model, 270 void BookmarkNodeRemoved(BookmarkModel* bookmark_model,
271 const BookmarkNode* parent, 271 const BookmarkNode* parent,
272 int old_index, 272 int old_index,
273 const BookmarkNode* node, 273 const BookmarkNode* node,
274 const std::set<GURL>& removed_urls) override { 274 const std::set<GURL>& removed_urls) override {
275 if (bookmark_model == model() && node->id() == id_to_delete_) 275 if (bookmark_model == model() && node->id() == id_to_delete_)
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); 1643 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env);
1644 if (obj.is_null()) 1644 if (obj.is_null())
1645 return; 1645 return;
1646 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); 1646 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj());
1647 } 1647 }
1648 1648
1649 void ChromeBrowserProvider::OnKeywordSearchTermDeleted( 1649 void ChromeBrowserProvider::OnKeywordSearchTermDeleted(
1650 history::HistoryService* history_service, 1650 history::HistoryService* history_service,
1651 history::URLID url_id) { 1651 history::URLID url_id) {
1652 } 1652 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698