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

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

Issue 1143333008: Getting rid of more webview memory leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. 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_TEST_GUEST_VIEW_MANAGER_H_ 5 #ifndef COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_
6 #define COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_ 6 #define COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_
7 7
8 #include "base/memory/linked_ptr.h" 8 #include "base/memory/linked_ptr.h"
9 #include "components/guest_view/browser/guest_view_manager.h" 9 #include "components/guest_view/browser/guest_view_manager.h"
10 #include "components/guest_view/browser/guest_view_manager_factory.h" 10 #include "components/guest_view/browser/guest_view_manager_factory.h"
(...skipping 18 matching lines...) Expand all
29 content::WebContents* GetLastGuestCreated(); 29 content::WebContents* GetLastGuestCreated();
30 30
31 // Returns the number of guests currently still alive at the time of calling 31 // Returns the number of guests currently still alive at the time of calling
32 // this method. 32 // this method.
33 size_t GetNumGuestsActive() const; 33 size_t GetNumGuestsActive() const;
34 34
35 // Returns the size of the set of removed instance IDs. 35 // Returns the size of the set of removed instance IDs.
36 size_t GetNumRemovedInstanceIDs() const; 36 size_t GetNumRemovedInstanceIDs() const;
37 37
38 using GuestViewCreateFunction = 38 using GuestViewCreateFunction =
39 base::Callback<GuestViewBase*(content::WebContents*)>;; 39 base::Callback<GuestViewBase*(content::WebContents*)>;
40 40
41 template <typename T> 41 template <typename T>
42 void RegisterTestGuestViewType(GuestViewCreateFunction create_function) { 42 void RegisterTestGuestViewType(
43 guest_view_registry_[T::Type] = create_function; 43 const GuestViewCreateFunction& create_function) {
44 auto registry_entry = std::make_pair(
45 T::Type,
46 GuestViewData(create_function, base::Bind(&T::CleanUp)));
47 guest_view_registry_.insert(registry_entry);
44 } 48 }
45 49
46 // Returns the number of guests that have been created since the creation of 50 // Returns the number of guests that have been created since the creation of
47 // this GuestViewManager. 51 // this GuestViewManager.
48 int num_guests_created() const { return num_guests_created_; } 52 int num_guests_created() const { return num_guests_created_; }
49 53
50 // Returns the number of GuestViews that have been garbage collected in 54 // Returns the number of GuestViews that have been garbage collected in
51 // JavaScript since the creation of this GuestViewManager. 55 // JavaScript since the creation of this GuestViewManager.
52 int num_views_garbage_collected() const { 56 int num_views_garbage_collected() const {
53 return num_views_garbage_collected_; 57 return num_views_garbage_collected_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 101
98 private: 102 private:
99 TestGuestViewManager* test_guest_view_manager_; 103 TestGuestViewManager* test_guest_view_manager_;
100 104
101 DISALLOW_COPY_AND_ASSIGN(TestGuestViewManagerFactory); 105 DISALLOW_COPY_AND_ASSIGN(TestGuestViewManagerFactory);
102 }; 106 };
103 107
104 } // namespace guest_view 108 } // namespace guest_view
105 109
106 #endif // COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_ 110 #endif // COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_
OLDNEW
« no previous file with comments | « components/guest_view/browser/guest_view_message_filter.cc ('k') | components/guest_view/browser/test_guest_view_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698