forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split out the extensions gin::Runner implementation into a separate c…
…lass. The gin::Runner should be destroyed when the JS context is so that its weak pointers are invalidated and any outstanding callbacks that interact with the JS context can detect its destruction. Currently, ScriptContext implements gin::Runner but is not immediately destroyed when the JS context is. This CL moves this gin::Runner implementation into a separate class which is destroyed when the ScriptContext is invalidated. Review URL: https://codereview.chromium.org/831423005 Cr-Commit-Position: refs/heads/master@{#311358}
- Loading branch information
Showing
6 changed files
with
75 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "extensions/renderer/module_system_test.h" | ||
#include "extensions/renderer/script_context.h" | ||
#include "gin/per_context_data.h" | ||
#include "gin/runner.h" | ||
|
||
namespace extensions { | ||
|
||
using ScriptContextTest = ModuleSystemTest; | ||
|
||
TEST_F(ScriptContextTest, GinRunnerLifetime) { | ||
ExpectNoAssertionsMade(); | ||
base::WeakPtr<gin::Runner> weak_runner = | ||
gin::PerContextData::From(env()->context()->v8_context()) | ||
->runner() | ||
->GetWeakPtr(); | ||
env()->ShutdownModuleSystem(); | ||
EXPECT_FALSE(weak_runner); | ||
} | ||
|
||
} // namespace extensions |