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

Side by Side Diff: chrome/browser/policy/asynchronous_policy_loader.cc

Issue 5748002: Fix memory leaks in AsynchronousPolicyProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: now with the fix Created 10 years 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
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/policy/asynchronous_policy_loader.h" 5 #include "chrome/browser/policy/asynchronous_policy_loader.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "chrome/browser/browser_thread.h" 9 #include "chrome/browser/browser_thread.h"
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 DictionaryValue* new_policy = delegate_->Load(); 53 DictionaryValue* new_policy = delegate_->Load();
54 PostUpdatePolicyTask(new_policy); 54 PostUpdatePolicyTask(new_policy);
55 } 55 }
56 } 56 }
57 57
58 void AsynchronousPolicyLoader::PostUpdatePolicyTask( 58 void AsynchronousPolicyLoader::PostUpdatePolicyTask(
59 DictionaryValue* new_policy) { 59 DictionaryValue* new_policy) {
60 origin_loop_->PostTask(FROM_HERE, new UpdatePolicyTask(this, new_policy)); 60 origin_loop_->PostTask(FROM_HERE, new UpdatePolicyTask(this, new_policy));
61 } 61 }
62 62
63 void AsynchronousPolicyLoader::UpdatePolicy(DictionaryValue* new_policy_raw) { 63 void AsynchronousPolicyLoader::UpdatePolicy(DictionaryValue* new_policy_raw) {
jochen (gone - plz use gerrit) 2010/12/10 10:51:21 since this method is protected, and so classes der
danno 2010/12/10 11:05:28 Done.
64 scoped_ptr<DictionaryValue> new_policy(new_policy_raw);
64 DCHECK(policy_.get()); 65 DCHECK(policy_.get());
65 if (!policy_->Equals(new_policy_raw)) { 66 if (!policy_->Equals(new_policy.get())) {
66 policy_.reset(new_policy_raw); 67 policy_.reset(new_policy.release());
67 // TODO(danno): Change the notification between the provider and the 68 // TODO(danno): Change the notification between the provider and the
68 // PrefStore into a notification mechanism, removing the need for the 69 // PrefStore into a notification mechanism, removing the need for the
69 // WeakPtr for the provider. 70 // WeakPtr for the provider.
70 if (provider_) 71 if (provider_)
71 provider_->NotifyStoreOfPolicyChange(); 72 provider_->NotifyStoreOfPolicyChange();
72 } 73 }
73 } 74 }
74 75
75 } // namespace policy 76 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698