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

Unified Diff: content/renderer/memory_benchmarking_extension.cc

Issue 611483002: Fix for crash when attaching a frame in WebUI renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: As suggested, factored out the solution and used in other extensions. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/chrome_object_extensions_utils.cc ('k') | content/renderer/skia_benchmarking_extension.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/memory_benchmarking_extension.cc
diff --git a/content/renderer/memory_benchmarking_extension.cc b/content/renderer/memory_benchmarking_extension.cc
index f6b9c7df375faeafedd419bb35deb8c3ded3848b..0f5320daa06084b5dcd37f0aa0469750a3070cd7 100644
--- a/content/renderer/memory_benchmarking_extension.cc
+++ b/content/renderer/memory_benchmarking_extension.cc
@@ -5,6 +5,7 @@
#include "content/renderer/memory_benchmarking_extension.h"
#include "content/common/memory_benchmark_messages.h"
+#include "content/renderer/chrome_object_extensions_utils.h"
#include "content/renderer/render_thread_impl.h"
#include "gin/arguments.h"
#include "gin/handle.h"
@@ -35,13 +36,8 @@ void MemoryBenchmarkingExtension::Install(blink::WebFrame* frame) {
if (controller.IsEmpty())
return;
- v8::Handle<v8::Object> global = context->Global();
- v8::Handle<v8::Object> chrome =
- global->Get(gin::StringToV8(isolate, "chrome"))->ToObject();
- if (chrome.IsEmpty()) {
- chrome = v8::Object::New(isolate);
- global->Set(gin::StringToV8(isolate, "chrome"), chrome);
- }
+ v8::Handle<v8::Object> chrome = GetOrCreateChromeObject(isolate,
+ context->Global());
chrome->Set(gin::StringToV8(isolate, "memoryBenchmarking"),
controller.ToV8());
}
« no previous file with comments | « content/renderer/chrome_object_extensions_utils.cc ('k') | content/renderer/skia_benchmarking_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698