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

Side by Side Diff: sync/internal_api/js_sync_manager_observer.cc

Issue 10821091: Fix leak in JsSyncManagerObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove another suppression Created 8 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
« 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) 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 "sync/internal_api/js_sync_manager_observer.h" 5 #include "sync/internal_api/js_sync_manager_observer.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 void JsSyncManagerObserver::OnInitializationComplete( 125 void JsSyncManagerObserver::OnInitializationComplete(
126 const WeakHandle<JsBackend>& js_backend, 126 const WeakHandle<JsBackend>& js_backend,
127 bool success, syncer::ModelTypeSet restored_types) { 127 bool success, syncer::ModelTypeSet restored_types) {
128 if (!event_handler_.IsInitialized()) { 128 if (!event_handler_.IsInitialized()) {
129 return; 129 return;
130 } 130 }
131 // Ignore the |js_backend| argument; it's not really convertible to 131 // Ignore the |js_backend| argument; it's not really convertible to
132 // JSON anyway. 132 // JSON anyway.
133 133
134 DictionaryValue* details = new DictionaryValue(); 134 DictionaryValue details;
135 details->Set("restoredTypes", ModelTypeSetToValue(restored_types)); 135 details.Set("restoredTypes", ModelTypeSetToValue(restored_types));
136 136
137 HandleJsEvent(FROM_HERE, "onInitializationComplete", JsEventDetails(details)); 137 HandleJsEvent(FROM_HERE,
138 "onInitializationComplete",
139 JsEventDetails(&details));
138 } 140 }
139 141
140 void JsSyncManagerObserver::OnStopSyncingPermanently() { 142 void JsSyncManagerObserver::OnStopSyncingPermanently() {
141 if (!event_handler_.IsInitialized()) { 143 if (!event_handler_.IsInitialized()) {
142 return; 144 return;
143 } 145 }
144 HandleJsEvent(FROM_HERE, "onStopSyncingPermanently", JsEventDetails()); 146 HandleJsEvent(FROM_HERE, "onStopSyncingPermanently", JsEventDetails());
145 } 147 }
146 148
147 void JsSyncManagerObserver::HandleJsEvent( 149 void JsSyncManagerObserver::HandleJsEvent(
148 const tracked_objects::Location& from_here, 150 const tracked_objects::Location& from_here,
149 const std::string& name, const JsEventDetails& details) { 151 const std::string& name, const JsEventDetails& details) {
150 if (!event_handler_.IsInitialized()) { 152 if (!event_handler_.IsInitialized()) {
151 NOTREACHED(); 153 NOTREACHED();
152 return; 154 return;
153 } 155 }
154 event_handler_.Call(from_here, 156 event_handler_.Call(from_here,
155 &JsEventHandler::HandleJsEvent, name, details); 157 &JsEventHandler::HandleJsEvent, name, details);
156 } 158 }
157 159
158 } // namespace syncer 160 } // namespace syncer
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