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

Side by Side Diff: chrome/browser/android/offline_pages/background_loader_offliner.h

Issue 2866643005: [Offline pages] Stop observing web contents and reset to null after use. Only create a new web cont… (Closed)
Patch Set: Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/android/application_status_listener.h" 10 #include "base/android/application_status_listener.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 content::NavigationHandle* navigation_handle) override; 56 content::NavigationHandle* navigation_handle) override;
57 57
58 // SnapshotController::Client implementation. 58 // SnapshotController::Client implementation.
59 void StartSnapshot() override; 59 void StartSnapshot() override;
60 60
61 void SetSnapshotControllerForTest( 61 void SetSnapshotControllerForTest(
62 std::unique_ptr<SnapshotController> controller); 62 std::unique_ptr<SnapshotController> controller);
63 void OnNetworkBytesChanged(int64_t bytes); 63 void OnNetworkBytesChanged(int64_t bytes);
64 64
65 protected: 65 protected:
66 // Called to reset internal loader and observer state. 66 // Called to reset the loader.
67 virtual void ResetState(); 67 virtual void ResetLoader();
68 68
69 private: 69 private:
70 friend class TestBackgroundLoaderOffliner; 70 friend class TestBackgroundLoaderOffliner;
71 71
72 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; 72 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE };
73 enum PageLoadState { SUCCESS, RETRIABLE, NONRETRIABLE, DELAY_RETRY }; 73 enum PageLoadState { SUCCESS, RETRIABLE, NONRETRIABLE, DELAY_RETRY };
74 74
75 // Called when the page has been saved. 75 // Called when the page has been saved.
76 void OnPageSaved(SavePageResult save_result, int64_t offline_id); 76 void OnPageSaved(SavePageResult save_result, int64_t offline_id);
77 77
78 // Called to reset internal loader and observer state.
79 void ResetState();
80
81 // Called to attach 'this' as the observer to the loader.
82 void AttachObservers();
83
78 // Called when application state has changed. 84 // Called when application state has changed.
79 void OnApplicationStateChange( 85 void OnApplicationStateChange(
80 base::android::ApplicationState application_state); 86 base::android::ApplicationState application_state);
81 87
82 // Called to remember at what time we started loading. 88 // Called to remember at what time we started loading.
83 void MarkLoadStartTime(); 89 void MarkLoadStartTime();
84 90
85 // Called to add a loading signal as we observe it. 91 // Called to add a loading signal as we observe it.
86 void AddLoadingSignal(const char* signal_name); 92 void AddLoadingSignal(const char* signal_name);
87 93
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 134
129 // Callback for cancel. 135 // Callback for cancel.
130 CancelCallback cancel_callback_; 136 CancelCallback cancel_callback_;
131 137
132 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; 138 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_;
133 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); 139 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner);
134 }; 140 };
135 141
136 } // namespace offline_pages 142 } // namespace offline_pages
137 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ 143 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698