1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_HAS_WEAK_BROWSER_POINTER_H_
6 #define CHROME_BROWSER_UI_COCOA_HAS_WEAK_BROWSER_POINTER_H_
8 // This allows reference counted objects holding a Browser* to be
9 // notified that the Browser will be destroyed so they can invalidate their
10 // Browser*, perform any necessary cleanup, and pass the notification onto any
11 // objects they retain that also implement this protocol. This helps to prevent
12 // use-after-free of Browser*, or anything else tied to the Browser's lifetime,
13 // by objects that may be retained beyond the lifetime of their associated
14 // Browser (e.g. NSViewControllers).
15 @protocol HasWeakBrowserPointer
17 // This is usually called by BrowserWindowController but can be called by any
18 // object that's certain of Browser's destruction.
19 - (void)browserWillBeDestroyed
;
22 #endif // CHROME_BROWSER_UI_COCOA_HAS_WEAK_BROWSER_POINTER_H_