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

Side by Side Diff: components/guest_view/browser/guest_view_base.h

Issue 1143333008: Getting rid of more webview memory leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ 5 #ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_
6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ 6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 public: 53 public:
54 // Returns a *ViewGuest if this GuestView is of the given view type. 54 // Returns a *ViewGuest if this GuestView is of the given view type.
55 template <typename T> 55 template <typename T>
56 T* As() { 56 T* As() {
57 if (IsViewType(T::Type)) 57 if (IsViewType(T::Type))
58 return static_cast<T*>(this); 58 return static_cast<T*>(this);
59 59
60 return nullptr; 60 return nullptr;
61 } 61 }
62 62
63 // Clean up state when this GuestView is being destroyed. Note that this
lazyboy 2015/06/05 23:09:55 nits: Cleans up ... "Note that .. " goes to next l
paulmeyer 2015/06/08 17:53:58 Done.
64 // cannot be done in the destructor since a GuestView could potentially be
65 // created and destroyed in JavaScript before getting a GuestViewBase
66 // instance. This method can be hidden in a derived class, in which case the
lazyboy 2015/06/05 23:09:55 I'm not sure I understand the hidden part immediat
paulmeyer 2015/06/08 17:53:58 Done.
67 // derived method should call this one.
68 static void CleanUp(int embedder_process_id, int view_instance_id);
69
63 static GuestViewBase* FromWebContents( 70 static GuestViewBase* FromWebContents(
64 const content::WebContents* web_contents); 71 const content::WebContents* web_contents);
65 72
66 static GuestViewBase* From(int owner_process_id, int instance_id); 73 static GuestViewBase* From(int owner_process_id, int instance_id);
67 74
68 // Given a |web_contents|, returns the top level owner WebContents. If 75 // Given a |web_contents|, returns the top level owner WebContents. If
69 // |web_contents| does not belong to a GuestView, it will be returned 76 // |web_contents| does not belong to a GuestView, it will be returned
70 // unchanged. 77 // unchanged.
71 static content::WebContents* GetTopLevelWebContents( 78 static content::WebContents* GetTopLevelWebContents(
72 content::WebContents* web_contents); 79 content::WebContents* web_contents);
(...skipping 12 matching lines...) Expand all
85 // This method is called after this GuestViewBase has been initiated. 92 // This method is called after this GuestViewBase has been initiated.
86 // 93 //
87 // This gives the derived class an opportunity to perform additional 94 // This gives the derived class an opportunity to perform additional
88 // initialization. 95 // initialization.
89 virtual void DidInitialize(const base::DictionaryValue& create_params) {} 96 virtual void DidInitialize(const base::DictionaryValue& create_params) {}
90 97
91 // This method is called when the initial set of frames within the page have 98 // This method is called when the initial set of frames within the page have
92 // completed loading. 99 // completed loading.
93 virtual void GuestViewDidStopLoading() {} 100 virtual void GuestViewDidStopLoading() {}
94 101
95 // This method is called before the embedder is destroyed.
96 // |owner_web_contents_| should still be valid during this call. This
97 // allows the derived class to perform some cleanup related to the embedder
98 // web contents.
99 virtual void EmbedderWillBeDestroyed() {}
100
101 // This method is called when the embedder's zoom changes. 102 // This method is called when the embedder's zoom changes.
102 virtual void EmbedderZoomChanged(double old_zoom_level, 103 virtual void EmbedderZoomChanged(double old_zoom_level,
103 double new_zoom_level) {} 104 double new_zoom_level) {}
104 105
105 // This method is called when the guest WebContents has been destroyed. This 106 // This method is called when the guest WebContents has been destroyed. This
106 // object will be destroyed after this call returns. 107 // object will be destroyed after this call returns.
107 // 108 //
108 // This gives the derived class an opportunity to perform some cleanup. 109 // This gives the derived class an opportunity to perform some cleanup.
109 virtual void GuestDestroyed() {} 110 virtual void GuestDestroyed() {}
110 111
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // This is used to ensure pending tasks will not fire after this object is 458 // This is used to ensure pending tasks will not fire after this object is
458 // destroyed. 459 // destroyed.
459 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; 460 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_;
460 461
461 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); 462 DISALLOW_COPY_AND_ASSIGN(GuestViewBase);
462 }; 463 };
463 464
464 } // namespace guest_view 465 } // namespace guest_view
465 466
466 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ 467 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_
OLDNEW
« no previous file with comments | « no previous file | components/guest_view/browser/guest_view_base.cc » ('j') | components/guest_view/browser/guest_view_base.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698