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

Side by Side Diff: chrome/browser/content_settings/content_settings_pref_provider.cc

Issue 21030009: Make element removal methods in DictionaryValue and ListValue take scoped_ptr's as outparams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 7 years, 4 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
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/content_settings/content_settings_pref_provider.h" 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 move_items.push_back( 541 move_items.push_back(
542 std::make_pair(pattern_str, canonicalized_pattern_str)); 542 std::make_pair(pattern_str, canonicalized_pattern_str));
543 } 543 }
544 } 544 }
545 545
546 for (size_t i = 0; i < remove_items.size(); ++i) { 546 for (size_t i = 0; i < remove_items.size(); ++i) {
547 all_settings_dictionary->RemoveWithoutPathExpansion(remove_items[i], NULL); 547 all_settings_dictionary->RemoveWithoutPathExpansion(remove_items[i], NULL);
548 } 548 }
549 549
550 for (size_t i = 0; i < move_items.size(); ++i) { 550 for (size_t i = 0; i < move_items.size(); ++i) {
551 Value* pattern_settings_dictionary = NULL; 551 scoped_ptr<Value> pattern_settings_dictionary;
552 all_settings_dictionary->RemoveWithoutPathExpansion( 552 all_settings_dictionary->RemoveWithoutPathExpansion(
553 move_items[i].first, &pattern_settings_dictionary); 553 move_items[i].first, &pattern_settings_dictionary);
554 all_settings_dictionary->SetWithoutPathExpansion( 554 all_settings_dictionary->SetWithoutPathExpansion(
555 move_items[i].second, pattern_settings_dictionary); 555 move_items[i].second, pattern_settings_dictionary.release());
556 } 556 }
557 } 557 }
558 558
559 void PrefProvider::ShutdownOnUIThread() { 559 void PrefProvider::ShutdownOnUIThread() {
560 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 560 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
561 DCHECK(prefs_); 561 DCHECK(prefs_);
562 RemoveAllObservers(); 562 RemoveAllObservers();
563 pref_change_registrar_.RemoveAll(); 563 pref_change_registrar_.RemoveAll();
564 prefs_ = NULL; 564 prefs_ = NULL;
565 } 565 }
566 566
567 void PrefProvider::AssertLockNotHeld() const { 567 void PrefProvider::AssertLockNotHeld() const {
568 #if !defined(NDEBUG) 568 #if !defined(NDEBUG)
569 // |Lock::Acquire()| will assert if the lock is held by this thread. 569 // |Lock::Acquire()| will assert if the lock is held by this thread.
570 lock_.Acquire(); 570 lock_.Acquire();
571 lock_.Release(); 571 lock_.Release();
572 #endif 572 #endif
573 } 573 }
574 574
575 } // namespace content_settings 575 } // namespace content_settings
OLDNEW
« no previous file with comments | « chrome/browser/content_settings/content_settings_policy_provider.cc ('k') | chrome/browser/drive/fake_drive_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698