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

Side by Side Diff: content/renderer/memory_benchmarking_extension.cc

Issue 1113783002: Use Local instead of Handle in src/content/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/renderer/memory_benchmarking_extension.h" 5 #include "content/renderer/memory_benchmarking_extension.h"
6 6
7 #include "content/common/memory_benchmark_messages.h" 7 #include "content/common/memory_benchmark_messages.h"
8 #include "content/renderer/chrome_object_extensions_utils.h" 8 #include "content/renderer/chrome_object_extensions_utils.h"
9 #include "content/renderer/render_thread_impl.h" 9 #include "content/renderer/render_thread_impl.h"
10 #include "gin/arguments.h" 10 #include "gin/arguments.h"
11 #include "gin/handle.h" 11 #include "gin/handle.h"
12 #include "gin/object_template_builder.h" 12 #include "gin/object_template_builder.h"
13 #include "third_party/WebKit/public/web/WebFrame.h" 13 #include "third_party/WebKit/public/web/WebFrame.h"
14 #include "third_party/WebKit/public/web/WebKit.h" 14 #include "third_party/WebKit/public/web/WebKit.h"
15 15
16 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) 16 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID))
17 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 17 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
18 #endif 18 #endif
19 19
20 namespace content { 20 namespace content {
21 21
22 gin::WrapperInfo MemoryBenchmarkingExtension::kWrapperInfo = { 22 gin::WrapperInfo MemoryBenchmarkingExtension::kWrapperInfo = {
23 gin::kEmbedderNativeGin}; 23 gin::kEmbedderNativeGin};
24 24
25 // static 25 // static
26 void MemoryBenchmarkingExtension::Install(blink::WebFrame* frame) { 26 void MemoryBenchmarkingExtension::Install(blink::WebFrame* frame) {
27 v8::Isolate* isolate = blink::mainThreadIsolate(); 27 v8::Isolate* isolate = blink::mainThreadIsolate();
28 v8::HandleScope handle_scope(isolate); 28 v8::HandleScope handle_scope(isolate);
29 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); 29 v8::Local<v8::Context> context = frame->mainWorldScriptContext();
30 if (context.IsEmpty()) 30 if (context.IsEmpty())
31 return; 31 return;
32 32
33 v8::Context::Scope context_scope(context); 33 v8::Context::Scope context_scope(context);
34 gin::Handle<MemoryBenchmarkingExtension> controller = 34 gin::Handle<MemoryBenchmarkingExtension> controller =
35 gin::CreateHandle(isolate, new MemoryBenchmarkingExtension()); 35 gin::CreateHandle(isolate, new MemoryBenchmarkingExtension());
36 if (controller.IsEmpty()) 36 if (controller.IsEmpty())
37 return; 37 return;
38 38
39 v8::Handle<v8::Object> chrome = GetOrCreateChromeObject(isolate, 39 v8::Local<v8::Object> chrome = GetOrCreateChromeObject(isolate,
40 context->Global()); 40 context->Global());
41 chrome->Set(gin::StringToV8(isolate, "memoryBenchmarking"), 41 chrome->Set(gin::StringToV8(isolate, "memoryBenchmarking"),
42 controller.ToV8()); 42 controller.ToV8());
43 } 43 }
44 44
45 MemoryBenchmarkingExtension::MemoryBenchmarkingExtension() {} 45 MemoryBenchmarkingExtension::MemoryBenchmarkingExtension() {}
46 46
47 MemoryBenchmarkingExtension::~MemoryBenchmarkingExtension() {} 47 MemoryBenchmarkingExtension::~MemoryBenchmarkingExtension() {}
48 48
49 gin::ObjectTemplateBuilder 49 gin::ObjectTemplateBuilder
(...skipping 28 matching lines...) Expand all
78 if (process_type == "browser") { 78 if (process_type == "browser") {
79 content::RenderThreadImpl::current()->Send( 79 content::RenderThreadImpl::current()->Send(
80 new MemoryBenchmarkHostMsg_HeapProfilerDump(reason)); 80 new MemoryBenchmarkHostMsg_HeapProfilerDump(reason));
81 } else { 81 } else {
82 ::HeapProfilerDump(reason.c_str()); 82 ::HeapProfilerDump(reason.c_str());
83 } 83 }
84 #endif 84 #endif
85 } 85 }
86 86
87 } // namespace content 87 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/java/gin_java_function_invocation_helper.cc ('k') | content/renderer/pepper/host_var_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698