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

Side by Side Diff: mojo/edk/js/waiting_callback.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/edk/js/drain_data.cc ('k') | mojo/edk/system/data_pipe_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/edk/js/waiting_callback.h" 5 #include "mojo/edk/js/waiting_callback.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "gin/per_context_data.h" 9 #include "gin/per_context_data.h"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 void WaitingCallback::Cancel() { 47 void WaitingCallback::Cancel() {
48 if (watcher_.IsWatching()) 48 if (watcher_.IsWatching())
49 watcher_.Cancel(); 49 watcher_.Cancel();
50 } 50 }
51 51
52 WaitingCallback::WaitingCallback(v8::Isolate* isolate, 52 WaitingCallback::WaitingCallback(v8::Isolate* isolate,
53 v8::Handle<v8::Function> callback, 53 v8::Handle<v8::Function> callback,
54 bool one_shot) 54 bool one_shot)
55 : one_shot_(one_shot), 55 : one_shot_(one_shot),
56 watcher_(FROM_HERE),
56 weak_factory_(this) { 57 weak_factory_(this) {
57 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); 58 v8::Handle<v8::Context> context = isolate->GetCurrentContext();
58 runner_ = gin::PerContextData::From(context)->runner()->GetWeakPtr(); 59 runner_ = gin::PerContextData::From(context)->runner()->GetWeakPtr();
59 GetWrapper(isolate) 60 GetWrapper(isolate)
60 ->SetPrivate(context, GetHiddenPropertyName(isolate), callback) 61 ->SetPrivate(context, GetHiddenPropertyName(isolate), callback)
61 .FromJust(); 62 .FromJust();
62 } 63 }
63 64
64 WaitingCallback::~WaitingCallback() { 65 WaitingCallback::~WaitingCallback() {
65 Cancel(); 66 Cancel();
(...skipping 19 matching lines...) Expand all
85 86
86 if (one_shot_ || result == MOJO_RESULT_CANCELLED) { 87 if (one_shot_ || result == MOJO_RESULT_CANCELLED) {
87 runner_.reset(); 88 runner_.reset();
88 Cancel(); 89 Cancel();
89 } 90 }
90 } 91 }
91 92
92 } // namespace js 93 } // namespace js
93 } // namespace edk 94 } // namespace edk
94 } // namespace mojo 95 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/js/drain_data.cc ('k') | mojo/edk/system/data_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698