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

Side by Side Diff: ios/web/webui/mojo_facade.mm

Issue 2623263005: Tag some of Mojo heap allocations for the heap profiler. (Closed)
Patch Set: Synced Created 3 years, 10 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 | « ios/web/webui/mojo_facade.h ('k') | ipc/ipc_mojo_bootstrap.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #import "ios/web/webui/mojo_facade.h" 5 #import "ios/web/webui/mojo_facade.h"
6 6
7 #include <utility>
8
7 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
8 10
9 #import "base/ios/block_types.h" 11 #import "base/ios/block_types.h"
10 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
11 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
12 #import "base/mac/bind_objc_block.h" 14 #import "base/mac/bind_objc_block.h"
15 #include "base/memory/ptr_util.h"
13 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
14 #include "base/values.h" 17 #include "base/values.h"
15 #import "ios/web/public/web_state/js/crw_js_injection_evaluator.h" 18 #import "ios/web/public/web_state/js/crw_js_injection_evaluator.h"
16 #include "ios/web/public/web_thread.h" 19 #include "ios/web/public/web_thread.h"
17 #include "mojo/public/cpp/system/core.h" 20 #include "mojo/public/cpp/system/core.h"
18 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" 21 #include "services/service_manager/public/interfaces/interface_provider.mojom.h"
19 22
20 #if !defined(__has_feature) || !__has_feature(objc_arc) 23 #if !defined(__has_feature) || !__has_feature(objc_arc)
21 #error "This file requires ARC support." 24 #error "This file requires ARC support."
22 #endif 25 #endif
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 int callback_id; 252 int callback_id;
250 CHECK(args->GetInteger("callbackId", &callback_id)); 253 CHECK(args->GetInteger("callbackId", &callback_id));
251 254
252 mojo::Watcher::ReadyCallback callback = base::BindBlockArc(^( 255 mojo::Watcher::ReadyCallback callback = base::BindBlockArc(^(
253 MojoResult result) { 256 MojoResult result) {
254 NSString* script = 257 NSString* script =
255 [NSString stringWithFormat:@"__crWeb.mojo.signalWatch(%d, %d)", 258 [NSString stringWithFormat:@"__crWeb.mojo.signalWatch(%d, %d)",
256 callback_id, result]; 259 callback_id, result];
257 [script_evaluator_ executeJavaScript:script completionHandler:nil]; 260 [script_evaluator_ executeJavaScript:script completionHandler:nil];
258 }); 261 });
259 262 mojo::Watcher* watcher = new mojo::Watcher(FROM_HERE);
260 mojo::Watcher& watcher = watchers_[++last_watch_id_]; 263 watchers_.insert(std::make_pair(++last_watch_id_, base::WrapUnique(watcher)));
261 watcher.Start(static_cast<mojo::Handle>(handle), signals, callback); 264 watcher->Start(static_cast<mojo::Handle>(handle), signals, callback);
262 return ValueFromInteger(last_watch_id_); 265 return ValueFromInteger(last_watch_id_);
263 } 266 }
264 267
265 std::unique_ptr<base::Value> MojoFacade::HandleSupportCancelWatch( 268 std::unique_ptr<base::Value> MojoFacade::HandleSupportCancelWatch(
266 const base::DictionaryValue* args) { 269 const base::DictionaryValue* args) {
267 int watch_id = 0; 270 int watch_id = 0;
268 CHECK(args->GetInteger("watchId", &watch_id)); 271 CHECK(args->GetInteger("watchId", &watch_id));
269 watchers_.erase(watch_id); 272 watchers_.erase(watch_id);
270 return nullptr; 273 return nullptr;
271 } 274 }
272 275
273 } // namespace web 276 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/webui/mojo_facade.h ('k') | ipc/ipc_mojo_bootstrap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698