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

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

Issue 2923053002: Move MainWorldScriptContext accessor/method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Rebasing... Created 3 years, 6 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/skia_benchmarking_extension.h" 5 #include "content/renderer/skia_benchmarking_extension.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "cc/base/math_util.h" 13 #include "cc/base/math_util.h"
14 #include "content/public/child/v8_value_converter.h" 14 #include "content/public/child/v8_value_converter.h"
15 #include "content/public/renderer/chrome_object_extensions_utils.h" 15 #include "content/public/renderer/chrome_object_extensions_utils.h"
16 #include "content/renderer/render_thread_impl.h" 16 #include "content/renderer/render_thread_impl.h"
17 #include "gin/arguments.h" 17 #include "gin/arguments.h"
18 #include "gin/data_object_builder.h" 18 #include "gin/data_object_builder.h"
19 #include "gin/handle.h" 19 #include "gin/handle.h"
20 #include "gin/object_template_builder.h" 20 #include "gin/object_template_builder.h"
21 #include "skia/ext/benchmarking_canvas.h" 21 #include "skia/ext/benchmarking_canvas.h"
22 #include "third_party/WebKit/public/web/WebArrayBuffer.h" 22 #include "third_party/WebKit/public/web/WebArrayBuffer.h"
23 #include "third_party/WebKit/public/web/WebArrayBufferConverter.h" 23 #include "third_party/WebKit/public/web/WebArrayBufferConverter.h"
24 #include "third_party/WebKit/public/web/WebFrame.h"
25 #include "third_party/WebKit/public/web/WebKit.h" 24 #include "third_party/WebKit/public/web/WebKit.h"
25 #include "third_party/WebKit/public/web/WebLocalFrame.h"
26 #include "third_party/skia/include/core/SkCanvas.h" 26 #include "third_party/skia/include/core/SkCanvas.h"
27 #include "third_party/skia/include/core/SkColorPriv.h" 27 #include "third_party/skia/include/core/SkColorPriv.h"
28 #include "third_party/skia/include/core/SkGraphics.h" 28 #include "third_party/skia/include/core/SkGraphics.h"
29 #include "third_party/skia/include/core/SkImageDeserializer.h" 29 #include "third_party/skia/include/core/SkImageDeserializer.h"
30 #include "third_party/skia/include/core/SkPicture.h" 30 #include "third_party/skia/include/core/SkPicture.h"
31 #include "third_party/skia/include/core/SkStream.h" 31 #include "third_party/skia/include/core/SkStream.h"
32 #include "ui/gfx/codec/jpeg_codec.h" 32 #include "ui/gfx/codec/jpeg_codec.h"
33 #include "ui/gfx/codec/png_codec.h" 33 #include "ui/gfx/codec/png_codec.h"
34 #include "ui/gfx/geometry/rect_conversions.h" 34 #include "ui/gfx/geometry/rect_conversions.h"
35 #include "ui/gfx/skia_util.h" 35 #include "ui/gfx/skia_util.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 private: 137 private:
138 const skia::BenchmarkingCanvas& canvas_; 138 const skia::BenchmarkingCanvas& canvas_;
139 size_t playback_count_; 139 size_t playback_count_;
140 }; 140 };
141 141
142 } // namespace 142 } // namespace
143 143
144 gin::WrapperInfo SkiaBenchmarking::kWrapperInfo = {gin::kEmbedderNativeGin}; 144 gin::WrapperInfo SkiaBenchmarking::kWrapperInfo = {gin::kEmbedderNativeGin};
145 145
146 // static 146 // static
147 void SkiaBenchmarking::Install(blink::WebFrame* frame) { 147 void SkiaBenchmarking::Install(blink::WebLocalFrame* frame) {
148 v8::Isolate* isolate = blink::MainThreadIsolate(); 148 v8::Isolate* isolate = blink::MainThreadIsolate();
149 v8::HandleScope handle_scope(isolate); 149 v8::HandleScope handle_scope(isolate);
150 v8::Local<v8::Context> context = frame->MainWorldScriptContext(); 150 v8::Local<v8::Context> context = frame->MainWorldScriptContext();
151 if (context.IsEmpty()) 151 if (context.IsEmpty())
152 return; 152 return;
153 153
154 v8::Context::Scope context_scope(context); 154 v8::Context::Scope context_scope(context);
155 155
156 gin::Handle<SkiaBenchmarking> controller = 156 gin::Handle<SkiaBenchmarking> controller =
157 gin::CreateHandle(isolate, new SkiaBenchmarking()); 157 gin::CreateHandle(isolate, new SkiaBenchmarking());
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 v8::Local<v8::Object> result = v8::Object::New(isolate); 342 v8::Local<v8::Object> result = v8::Object::New(isolate);
343 result->Set(v8::String::NewFromUtf8(isolate, "width"), 343 result->Set(v8::String::NewFromUtf8(isolate, "width"),
344 v8::Number::New(isolate, picture->layer_rect.width())); 344 v8::Number::New(isolate, picture->layer_rect.width()));
345 result->Set(v8::String::NewFromUtf8(isolate, "height"), 345 result->Set(v8::String::NewFromUtf8(isolate, "height"),
346 v8::Number::New(isolate, picture->layer_rect.height())); 346 v8::Number::New(isolate, picture->layer_rect.height()));
347 347
348 args->Return(result); 348 args->Return(result);
349 } 349 }
350 350
351 } // namespace content 351 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/skia_benchmarking_extension.h ('k') | content/renderer/stats_collection_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698