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 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 bool OnMessageReceived(const IPC::Message& message) override; | 427 bool OnMessageReceived(const IPC::Message& message) override; |
428 | 428 |
429 void ReceivedFrameSwap(); | 429 void ReceivedFrameSwap(); |
430 | 430 |
431 int frames_to_wait_; | 431 int frames_to_wait_; |
432 base::Closure quit_; | 432 base::Closure quit_; |
433 | 433 |
434 DISALLOW_COPY_AND_ASSIGN(FrameWatcher); | 434 DISALLOW_COPY_AND_ASSIGN(FrameWatcher); |
435 }; | 435 }; |
436 | 436 |
| 437 // This observer keeps track of the last deleted RenderFrame to avoid |
| 438 // accessing it and causing use-after-free condition. |
| 439 class RenderFrameDeletedObserver : public WebContentsObserver { |
| 440 public: |
| 441 RenderFrameDeletedObserver(RenderFrameHost* rfh); |
| 442 ~RenderFrameDeletedObserver() override; |
| 443 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; |
| 444 bool deleted(); |
| 445 void WaitUntilDeleted(); |
| 446 |
| 447 private: |
| 448 int process_id_; |
| 449 int routing_id_; |
| 450 bool deleted_; |
| 451 scoped_ptr<base::RunLoop> runner_; |
| 452 |
| 453 DISALLOW_COPY_AND_ASSIGN(RenderFrameDeletedObserver); |
| 454 }; |
| 455 |
437 } // namespace content | 456 } // namespace content |
438 | 457 |
439 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 458 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
OLD | NEW |