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

Side by Side Diff: chrome/browser/chromeos/drive/search_metadata.cc

Issue 22243002: GTTF: Enable glibcxx debug mode for Debug builds by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/drive/search_metadata.h" 5 #include "chrome/browser/chromeos/drive/search_metadata.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 bool empty() const { return queue_.empty(); } 72 bool empty() const { return queue_.empty(); }
73 73
74 size_t size() const { return queue_.size(); } 74 size_t size() const { return queue_.size(); }
75 75
76 const T* top() const { return queue_.top(); } 76 const T* top() const { return queue_.top(); }
77 77
78 void push(T* x) { queue_.push(x); } 78 void push(T* x) { queue_.push(x); }
79 79
80 void pop() { 80 void pop() {
81 delete queue_.top(); 81 // Keep top alive for the pop() call so that debug checks can access
82 // underlying data (e.g. validating heap property of the priority queue
83 // will call the comparator).
84 T* saved_top = queue_.top();
82 queue_.pop(); 85 queue_.pop();
86 delete saved_top;
83 } 87 }
84 88
85 private: 89 private:
86 std::priority_queue<T*, std::vector<T*>, Compare> queue_; 90 std::priority_queue<T*, std::vector<T*>, Compare> queue_;
87 91
88 DISALLOW_COPY_AND_ASSIGN(ScopedPriorityQueue); 92 DISALLOW_COPY_AND_ASSIGN(ScopedPriorityQueue);
89 }; 93 };
90 94
91 // Returns true if |entry| is eligible for the search |options| and should be 95 // Returns true if |entry| is eligible for the search |options| and should be
92 // tested for the match with the query. If 96 // tested for the match with the query. If
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(pre))); 275 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(pre)));
272 highlighted_text->append("<b>"); 276 highlighted_text->append("<b>");
273 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(match))); 277 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(match)));
274 highlighted_text->append("</b>"); 278 highlighted_text->append("</b>");
275 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(post))); 279 highlighted_text->append(net::EscapeForHTML(base::UTF16ToUTF8(post)));
276 return true; 280 return true;
277 } 281 }
278 282
279 } // namespace internal 283 } // namespace internal
280 } // namespace drive 284 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698