OLD | NEW |
---|---|
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/public/test/render_view_test.h" | 5 #include "content/public/test/render_view_test.h" |
6 | 6 |
7 #include <cctype> | 7 #include <cctype> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 | 286 |
287 void RenderViewTest::TearDown() { | 287 void RenderViewTest::TearDown() { |
288 // Run the loop so the release task from the renderwidget executes. | 288 // Run the loop so the release task from the renderwidget executes. |
289 ProcessPendingMessages(); | 289 ProcessPendingMessages(); |
290 | 290 |
291 render_thread_->SendCloseMessage(); | 291 render_thread_->SendCloseMessage(); |
292 | 292 |
293 scoped_ptr<blink::WebLeakDetector> leak_detector = | 293 scoped_ptr<blink::WebLeakDetector> leak_detector = |
294 make_scoped_ptr(blink::WebLeakDetector::create(this)); | 294 make_scoped_ptr(blink::WebLeakDetector::create(this)); |
295 | 295 |
296 leak_detector->delayFinalGarbageCollection(); | |
haraken
2015/11/24 23:54:51
Would you elaborate on why we need to delay the GC
sof
2015/11/25 06:20:50
Clearing view_ below will trigger a close() on the
haraken
2015/11/25 07:39:38
Doesn't it mean just that we need to trigger anoth
| |
296 leak_detector->collectGarbageAndGetDOMCounts(GetMainFrame()); | 297 leak_detector->collectGarbageAndGetDOMCounts(GetMainFrame()); |
297 | 298 |
298 view_ = NULL; | 299 view_ = NULL; |
299 mock_process_.reset(); | 300 mock_process_.reset(); |
300 | 301 |
301 // After telling the view to close and resetting mock_process_ we may get | 302 // After telling the view to close and resetting mock_process_ we may get |
302 // some new tasks which need to be processed before shutting down WebKit | 303 // some new tasks which need to be processed before shutting down WebKit |
303 // (http://crbug.com/21508). | 304 // (http://crbug.com/21508). |
304 base::RunLoop().RunUntilIdle(); | 305 base::RunLoop().RunUntilIdle(); |
305 | 306 |
306 #if defined(OS_MACOSX) | 307 #if defined(OS_MACOSX) |
307 // Needs to run before blink::shutdown(). | 308 // Needs to run before blink::shutdown(). |
308 autorelease_pool_.reset(NULL); | 309 autorelease_pool_.reset(NULL); |
309 #endif | 310 #endif |
310 | 311 |
312 leak_detector->collectFinalGarbage(); | |
313 | |
311 blink_platform_impl_.Shutdown(); | 314 blink_platform_impl_.Shutdown(); |
312 blink::shutdown(); | 315 blink::shutdown(); |
313 | 316 |
314 platform_->PlatformUninitialize(); | 317 platform_->PlatformUninitialize(); |
315 platform_.reset(); | 318 platform_.reset(); |
316 params_.reset(); | 319 params_.reset(); |
317 command_line_.reset(); | 320 command_line_.reset(); |
318 } | 321 } |
319 | 322 |
320 void RenderViewTest::onLeakDetectionComplete(const Result& result) { | 323 void RenderViewTest::onLeakDetectionComplete(const Result& result) { |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
612 TestRenderFrame* frame = | 615 TestRenderFrame* frame = |
613 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 616 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
614 frame->Navigate(common_params, StartNavigationParams(), request_params); | 617 frame->Navigate(common_params, StartNavigationParams(), request_params); |
615 | 618 |
616 // The load actually happens asynchronously, so we pump messages to process | 619 // The load actually happens asynchronously, so we pump messages to process |
617 // the pending continuation. | 620 // the pending continuation. |
618 FrameLoadWaiter(frame).Wait(); | 621 FrameLoadWaiter(frame).Wait(); |
619 } | 622 } |
620 | 623 |
621 } // namespace content | 624 } // namespace content |
OLD | NEW |