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

Side by Side Diff: mojo/public/cpp/bindings/lib/connector.cc

Issue 2623263005: Tag some of Mojo heap allocations for the heap profiler. (Closed)
Patch Set: Synced Created 3 years, 11 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
« no previous file with comments | « mojo/public/cpp/bindings/connector.h ('k') | mojo/public/cpp/bindings/lib/multiplex_router.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "mojo/public/cpp/bindings/connector.h" 5 #include "mojo/public/cpp/bindings/connector.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 if (error_) 173 if (error_)
174 return false; 174 return false;
175 175
176 ResumeIncomingMethodCallProcessing(); 176 ResumeIncomingMethodCallProcessing();
177 177
178 EnsureSyncWatcherExists(); 178 EnsureSyncWatcherExists();
179 return sync_watcher_->SyncWatch(should_stop); 179 return sync_watcher_->SyncWatch(should_stop);
180 } 180 }
181 181
182 void Connector::SetWatcherHeapProfilerTag(const char* tag) {
183 heap_profiler_tag_ = tag;
184 if (handle_watcher_) {
185 handle_watcher_->set_heap_profiler_tag(tag);
186 }
187 }
188
182 void Connector::OnWatcherHandleReady(MojoResult result) { 189 void Connector::OnWatcherHandleReady(MojoResult result) {
183 OnHandleReadyInternal(result); 190 OnHandleReadyInternal(result);
184 } 191 }
185 192
186 void Connector::OnSyncHandleWatcherHandleReady(MojoResult result) { 193 void Connector::OnSyncHandleWatcherHandleReady(MojoResult result) {
187 base::WeakPtr<Connector> weak_self(weak_self_); 194 base::WeakPtr<Connector> weak_self(weak_self_);
188 195
189 sync_handle_watcher_callback_count_++; 196 sync_handle_watcher_callback_count_++;
190 OnHandleReadyInternal(result); 197 OnHandleReadyInternal(result);
191 // At this point, this object might have been deleted. 198 // At this point, this object might have been deleted.
(...skipping 11 matching lines...) Expand all
203 return; 210 return;
204 } 211 }
205 ReadAllAvailableMessages(); 212 ReadAllAvailableMessages();
206 // At this point, this object might have been deleted. Return. 213 // At this point, this object might have been deleted. Return.
207 } 214 }
208 215
209 void Connector::WaitToReadMore() { 216 void Connector::WaitToReadMore() {
210 CHECK(!paused_); 217 CHECK(!paused_);
211 DCHECK(!handle_watcher_); 218 DCHECK(!handle_watcher_);
212 219
213 handle_watcher_.reset(new Watcher(task_runner_)); 220 handle_watcher_.reset(new Watcher(FROM_HERE, task_runner_));
221 handle_watcher_->set_heap_profiler_tag(heap_profiler_tag_);
214 MojoResult rv = handle_watcher_->Start( 222 MojoResult rv = handle_watcher_->Start(
215 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, 223 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE,
216 base::Bind(&Connector::OnWatcherHandleReady, base::Unretained(this))); 224 base::Bind(&Connector::OnWatcherHandleReady, base::Unretained(this)));
217 225
218 if (rv != MOJO_RESULT_OK) { 226 if (rv != MOJO_RESULT_OK) {
219 // If the watch failed because the handle is invalid or its conditions can 227 // If the watch failed because the handle is invalid or its conditions can
220 // no longer be met, we signal the error asynchronously to avoid reentry. 228 // no longer be met, we signal the error asynchronously to avoid reentry.
221 task_runner_->PostTask( 229 task_runner_->PostTask(
222 FROM_HERE, 230 FROM_HERE,
223 base::Bind(&Connector::OnWatcherHandleReady, weak_self_, rv)); 231 base::Bind(&Connector::OnWatcherHandleReady, weak_self_, rv));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 void Connector::EnsureSyncWatcherExists() { 333 void Connector::EnsureSyncWatcherExists() {
326 if (sync_watcher_) 334 if (sync_watcher_)
327 return; 335 return;
328 sync_watcher_.reset(new SyncHandleWatcher( 336 sync_watcher_.reset(new SyncHandleWatcher(
329 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, 337 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE,
330 base::Bind(&Connector::OnSyncHandleWatcherHandleReady, 338 base::Bind(&Connector::OnSyncHandleWatcherHandleReady,
331 base::Unretained(this)))); 339 base::Unretained(this))));
332 } 340 }
333 341
334 } // namespace mojo 342 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/connector.h ('k') | mojo/public/cpp/bindings/lib/multiplex_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698