Commit c5739b9e authored by jsbell@chromium.org's avatar jsbell@chromium.org

Tear down IndexedDB dispatcher before WebKit is torn down

Ensure callback objects held by the Indexed DB dispatcher are released
before WebKit and V8 are torn down, since the callback objects hold V8
handles.

This is the same patch as crrev.com/50333004 which landed as r232620
but reverted as r232649 due to timeouts on XP - I just tweaked the
test constants slightly.

BUG=308988
TBR=marja@chromium.org,jamesr@chromium.org,dgrogan@chromium.org

Review URL: https://codereview.chromium.org/58113002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233505 0039d316-1c4b-4281-b951-d872f2087c98
parent 94de8cb9
...@@ -431,4 +431,16 @@ IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ForceCloseEventTest) { ...@@ -431,4 +431,16 @@ IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ForceCloseEventTest) {
EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
} }
class IndexedDBBrowserTestSingleProcess : public IndexedDBBrowserTest {
public:
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
command_line->AppendSwitch(switches::kSingleProcess);
}
};
IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess,
RenderThreadShutdownTest) {
SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html"));
}
} // namespace content } // namespace content
...@@ -450,6 +450,10 @@ void RenderThreadImpl::Shutdown() { ...@@ -450,6 +450,10 @@ void RenderThreadImpl::Shutdown() {
input_event_filter_ = NULL; input_event_filter_ = NULL;
} }
// Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might
// hold pointers to V8 objects (e.g., via pending requests).
main_thread_indexed_db_dispatcher_.reset();
if (webkit_platform_support_) if (webkit_platform_support_)
WebKit::shutdown(); WebKit::shutdown();
......
<!DOCTYPE html>
<html>
<!--
Copyright 2013 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.
-->
<head>
<title>IndexedDB shutdown test</title>
<script type="text/javascript" src="common.js"></script>
<script>
function populate()
{
debug('Populating object store');
var db = event.target.result;
var store = db.createObjectStore('store');
for (var i = 0; i < 100; ++i) {
store.put({id: i, rand: Math.random()}, i);
}
// Ensure there is work being done by the back end...
for (var j = 0; j < 10; ++j) {
store.createIndex('idx' + j, 'rand');
}
// And complete the test, which will exercise IDB vs. V8 shutdown order.
done();
}
function test() {
indexedDBTest(populate);
}
</script>
</head>
<body onLoad="test()">
<div id="status">Starting...</div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment