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

Side by Side Diff: content/shell/renderer/test_runner/test_runner.cc

Issue 259993003: Make sure gin Handles exist before using them (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/shell/renderer/test_runner/test_runner.h" 5 #include "content/shell/renderer/test_runner/test_runner.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/shell/common/test_runner/test_preferences.h" 10 #include "content/shell/common/test_runner/test_preferences.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 v8::Isolate* isolate = blink::mainThreadIsolate(); 277 v8::Isolate* isolate = blink::mainThreadIsolate();
278 v8::HandleScope handle_scope(isolate); 278 v8::HandleScope handle_scope(isolate);
279 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); 279 v8::Handle<v8::Context> context = frame->mainWorldScriptContext();
280 if (context.IsEmpty()) 280 if (context.IsEmpty())
281 return; 281 return;
282 282
283 v8::Context::Scope context_scope(context); 283 v8::Context::Scope context_scope(context);
284 284
285 gin::Handle<TestRunnerBindings> bindings = 285 gin::Handle<TestRunnerBindings> bindings =
286 gin::CreateHandle(isolate, new TestRunnerBindings(runner)); 286 gin::CreateHandle(isolate, new TestRunnerBindings(runner));
287 if (bindings.IsEmpty())
288 return;
287 v8::Handle<v8::Object> global = context->Global(); 289 v8::Handle<v8::Object> global = context->Global();
288 v8::Handle<v8::Value> v8_bindings = bindings.ToV8(); 290 v8::Handle<v8::Value> v8_bindings = bindings.ToV8();
289 global->Set(gin::StringToV8(isolate, "testRunner"), v8_bindings); 291 global->Set(gin::StringToV8(isolate, "testRunner"), v8_bindings);
290 global->Set(gin::StringToV8(isolate, "layoutTestController"), v8_bindings); 292 global->Set(gin::StringToV8(isolate, "layoutTestController"), v8_bindings);
291 } 293 }
292 294
293 TestRunnerBindings::TestRunnerBindings(base::WeakPtr<TestRunner> runner) 295 TestRunnerBindings::TestRunnerBindings(base::WeakPtr<TestRunner> runner)
294 : runner_(runner) {} 296 : runner_(runner) {}
295 297
296 TestRunnerBindings::~TestRunnerBindings() {} 298 TestRunnerBindings::~TestRunnerBindings() {}
(...skipping 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 } 2642 }
2641 2643
2642 void TestRunner::DidLosePointerLockInternal() { 2644 void TestRunner::DidLosePointerLockInternal() {
2643 bool was_locked = pointer_locked_; 2645 bool was_locked = pointer_locked_;
2644 pointer_locked_ = false; 2646 pointer_locked_ = false;
2645 if (was_locked) 2647 if (was_locked)
2646 web_view_->didLosePointerLock(); 2648 web_view_->didLosePointerLock();
2647 } 2649 }
2648 2650
2649 } // namespace content 2651 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/gamepad_controller.cc ('k') | content/shell/renderer/test_runner/text_input_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698