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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2312633002: For debugging, split worker ref count into service worker and shared worker counts (Closed)
Patch Set: size_t Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 6920 matching lines...) Expand 10 before | Expand all | Expand 10 after
6931 root->child_at(0)->current_frame_host()->GetRoutingID())); 6931 root->child_at(0)->current_frame_host()->GetRoutingID()));
6932 6932
6933 // Prevent b.com process from terminating right away once the subframe 6933 // Prevent b.com process from terminating right away once the subframe
6934 // navigates away from b.com below. This is necessary so that the renderer 6934 // navigates away from b.com below. This is necessary so that the renderer
6935 // process has time to process the closings of RenderWidget and RenderView, 6935 // process has time to process the closings of RenderWidget and RenderView,
6936 // which is where the original bug was triggered. Incrementing worker 6936 // which is where the original bug was triggered. Incrementing worker
6937 // RefCount will cause RenderProcessHostImpl::Cleanup to forego process 6937 // RefCount will cause RenderProcessHostImpl::Cleanup to forego process
6938 // termination. 6938 // termination.
6939 RenderProcessHost* subframe_process = 6939 RenderProcessHost* subframe_process =
6940 root->child_at(0)->current_frame_host()->GetProcess(); 6940 root->child_at(0)->current_frame_host()->GetProcess();
6941 subframe_process->IncrementWorkerRefCount(); 6941 subframe_process->IncrementSharedWorkerRefCount();
6942 6942
6943 // Navigate the subframe away from b.com. Since this is the last active 6943 // Navigate the subframe away from b.com. Since this is the last active
6944 // frame in the b.com process, this causes the RenderWidget and RenderView to 6944 // frame in the b.com process, this causes the RenderWidget and RenderView to
6945 // be closed. If this succeeds without crashing, the renderer will release 6945 // be closed. If this succeeds without crashing, the renderer will release
6946 // the process and send a ChildProcessHostMsg_ShutdownRequest to the browser 6946 // the process and send a ChildProcessHostMsg_ShutdownRequest to the browser
6947 // process to ask whether it's ok to terminate. Thus, wait for this message 6947 // process to ask whether it's ok to terminate. Thus, wait for this message
6948 // to ensure that the RenderView and widget were closed without crashing. 6948 // to ensure that the RenderView and widget were closed without crashing.
6949 scoped_refptr<ShutdownRequestMessageFilter> filter = 6949 scoped_refptr<ShutdownRequestMessageFilter> filter =
6950 new ShutdownRequestMessageFilter(); 6950 new ShutdownRequestMessageFilter();
6951 subframe_process->AddFilter(filter.get()); 6951 subframe_process->AddFilter(filter.get());
6952 NavigateFrameToURL(root->child_at(0), 6952 NavigateFrameToURL(root->child_at(0),
6953 embedded_test_server()->GetURL("a.com", "/title1.html")); 6953 embedded_test_server()->GetURL("a.com", "/title1.html"));
6954 filter->Wait(); 6954 filter->Wait();
6955 6955
6956 // TODO(alexmos): Navigating the subframe back to b.com at this point would 6956 // TODO(alexmos): Navigating the subframe back to b.com at this point would
6957 // trigger the race in https://crbug.com/535246, where the browser process 6957 // trigger the race in https://crbug.com/535246, where the browser process
6958 // tries to reuse the b.com process thinking it's still initialized, whereas 6958 // tries to reuse the b.com process thinking it's still initialized, whereas
6959 // the process has actually been destroyed by the renderer (but the browser 6959 // the process has actually been destroyed by the renderer (but the browser
6960 // process hasn't heard the OnChannelError yet). This race will need to be 6960 // process hasn't heard the OnChannelError yet). This race will need to be
6961 // fixed. 6961 // fixed.
6962 6962
6963 subframe_process->DecrementWorkerRefCount(); 6963 subframe_process->DecrementSharedWorkerRefCount();
6964 } 6964 }
6965 6965
6966 // Tests that an input event targeted to a out-of-process iframe correctly 6966 // Tests that an input event targeted to a out-of-process iframe correctly
6967 // triggers a user interaction notification for WebContentsObservers. 6967 // triggers a user interaction notification for WebContentsObservers.
6968 // This is used for browser features such as download request limiting and 6968 // This is used for browser features such as download request limiting and
6969 // launching multiple external protocol handlers, which can block repeated 6969 // launching multiple external protocol handlers, which can block repeated
6970 // actions from a page when a user is not interacting with the page. 6970 // actions from a page when a user is not interacting with the page.
6971 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, 6971 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
6972 UserInteractionForChildFrameTest) { 6972 UserInteractionForChildFrameTest) {
6973 GURL main_url(embedded_test_server()->GetURL( 6973 GURL main_url(embedded_test_server()->GetURL(
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
7995 child_rfh->OnDispatchLoad(); 7995 child_rfh->OnDispatchLoad();
7996 7996
7997 // In the bug, OnDispatchLoad killed the b.com renderer. Ensure that this is 7997 // In the bug, OnDispatchLoad killed the b.com renderer. Ensure that this is
7998 // not the case. Note that the process kill doesn't happen immediately, so 7998 // not the case. Note that the process kill doesn't happen immediately, so
7999 // IsRenderFrameLive() can't be checked here (yet). Instead, check that 7999 // IsRenderFrameLive() can't be checked here (yet). Instead, check that
8000 // JavaScript can still execute in b.com using the popup. 8000 // JavaScript can still execute in b.com using the popup.
8001 EXPECT_TRUE(ExecuteScript(popup_shell->web_contents(), "true")); 8001 EXPECT_TRUE(ExecuteScript(popup_shell->web_contents(), "true"));
8002 } 8002 }
8003 8003
8004 } // namespace content 8004 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/shared_worker/shared_worker_service_impl.cc ('k') | content/public/browser/render_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698