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

Side by Side Diff: sync/js/sync_js_controller.cc

Issue 23190045: Switch ObserverList::size() to ObserverList::might_have_observers() Pt.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge Created 7 years, 3 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 | « net/dns/mdns_client_impl.cc ('k') | ui/compositor/layer_animator_unittest.cc » ('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/js/sync_js_controller.h" 5 #include "sync/js/sync_js_controller.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "sync/js/js_backend.h" 8 #include "sync/js/js_backend.h"
9 #include "sync/js/js_event_details.h" 9 #include "sync/js/js_event_details.h"
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 FOR_EACH_OBSERVER(JsEventHandler, js_event_handlers_, 66 FOR_EACH_OBSERVER(JsEventHandler, js_event_handlers_,
67 HandleJsEvent(name, details)); 67 HandleJsEvent(name, details));
68 } 68 }
69 69
70 void SyncJsController::UpdateBackendEventHandler() { 70 void SyncJsController::UpdateBackendEventHandler() {
71 if (js_backend_.IsInitialized()) { 71 if (js_backend_.IsInitialized()) {
72 // To avoid making the backend send useless events, we clear the 72 // To avoid making the backend send useless events, we clear the
73 // event handler we pass to it if we don't have any event 73 // event handler we pass to it if we don't have any event
74 // handlers. 74 // handlers.
75 WeakHandle<JsEventHandler> backend_event_handler = 75 WeakHandle<JsEventHandler> backend_event_handler =
76 (js_event_handlers_.size() > 0) ? 76 js_event_handlers_.might_have_observers() ?
77 MakeWeakHandle(AsWeakPtr()) : WeakHandle<SyncJsController>(); 77 MakeWeakHandle(AsWeakPtr()) : WeakHandle<SyncJsController>();
78 js_backend_.Call(FROM_HERE, &JsBackend::SetJsEventHandler, 78 js_backend_.Call(FROM_HERE, &JsBackend::SetJsEventHandler,
79 backend_event_handler); 79 backend_event_handler);
80 } 80 }
81 } 81 }
82 82
83 } // namespace syncer 83 } // namespace syncer
OLDNEW
« no previous file with comments | « net/dns/mdns_client_impl.cc ('k') | ui/compositor/layer_animator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698