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

Side by Side Diff: chrome/renderer/benchmarking_extension.cc

Issue 1103273009: Use v8::Local inplace of v8::Handle in src/chrome/* (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
« no previous file with comments | « no previous file | chrome/renderer/extensions/app_bindings.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/renderer/benchmarking_extension.h" 5 #include "chrome/renderer/benchmarking_extension.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_switches.h"
10 #include "content/public/renderer/render_thread.h" 10 #include "content/public/renderer/render_thread.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 " };" 43 " };"
44 " this.microseconds = function() {" 44 " this.microseconds = function() {"
45 " var stop = stop_;" 45 " var stop = stop_;"
46 " if (stop == 0 && start_ != 0)" 46 " if (stop == 0 && start_ != 0)"
47 " stop = HiResTime();" 47 " stop = HiResTime();"
48 " return Math.ceil(stop - start_);" 48 " return Math.ceil(stop - start_);"
49 " };" 49 " };"
50 "}" 50 "}"
51 ) {} 51 ) {}
52 52
53 v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( 53 v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
54 v8::Isolate* isolate, 54 v8::Isolate* isolate,
55 v8::Handle<v8::String> name) override { 55 v8::Local<v8::String> name) override {
56 if (name->Equals(v8::String::NewFromUtf8(isolate, "IsSingleProcess"))) { 56 if (name->Equals(v8::String::NewFromUtf8(isolate, "IsSingleProcess"))) {
57 return v8::FunctionTemplate::New(isolate, IsSingleProcess); 57 return v8::FunctionTemplate::New(isolate, IsSingleProcess);
58 } else if (name->Equals(v8::String::NewFromUtf8(isolate, "HiResTime"))) { 58 } else if (name->Equals(v8::String::NewFromUtf8(isolate, "HiResTime"))) {
59 return v8::FunctionTemplate::New(isolate, HiResTime); 59 return v8::FunctionTemplate::New(isolate, HiResTime);
60 } 60 }
61 61
62 return v8::Handle<v8::FunctionTemplate>(); 62 return v8::Local<v8::FunctionTemplate>();
63 } 63 }
64 64
65 static void IsSingleProcess(const v8::FunctionCallbackInfo<v8::Value>& args) { 65 static void IsSingleProcess(const v8::FunctionCallbackInfo<v8::Value>& args) {
66 args.GetReturnValue().Set(base::CommandLine::ForCurrentProcess()->HasSwitch( 66 args.GetReturnValue().Set(base::CommandLine::ForCurrentProcess()->HasSwitch(
67 switches::kSingleProcess)); 67 switches::kSingleProcess));
68 } 68 }
69 69
70 static void HiResTime(const v8::FunctionCallbackInfo<v8::Value>& args) { 70 static void HiResTime(const v8::FunctionCallbackInfo<v8::Value>& args) {
71 args.GetReturnValue().Set( 71 args.GetReturnValue().Set(
72 static_cast<double>(base::TimeTicks::Now().ToInternalValue())); 72 static_cast<double>(base::TimeTicks::Now().ToInternalValue()));
73 } 73 }
74 }; 74 };
75 75
76 v8::Extension* BenchmarkingExtension::Get() { 76 v8::Extension* BenchmarkingExtension::Get() {
77 return new BenchmarkingWrapper(); 77 return new BenchmarkingWrapper();
78 } 78 }
79 79
80 } // namespace extensions_v8 80 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/extensions/app_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698