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

Side by Side Diff: chrome/browser/chrome_to_mobile_service.h

Issue 10914136: Fix URLFetcher leaks in ChromeToMobileService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
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 CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_
6 #define CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_ 6 #define CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
17 #include "base/string16.h" 18 #include "base/string16.h"
18 #include "base/timer.h" 19 #include "base/timer.h"
19 #include "base/values.h" 20 #include "base/values.h"
20 #include "chrome/browser/profiles/profile_keyed_service.h" 21 #include "chrome/browser/profiles/profile_keyed_service.h"
21 #include "chrome/browser/sessions/session_id.h" 22 #include "chrome/browser/sessions/session_id.h"
22 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h" 23 #include "chrome/common/net/gaia/oauth2_access_token_consumer.h"
23 #include "content/public/browser/notification_observer.h" 24 #include "content/public/browser/notification_observer.h"
24 #include "content/public/browser/notification_registrar.h" 25 #include "content/public/browser/notification_registrar.h"
25 #include "googleurl/src/gurl.h" 26 #include "googleurl/src/gurl.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // The feature state is automatically derived from internal conditions. 174 // The feature state is automatically derived from internal conditions.
174 void UpdateCommandState() const; 175 void UpdateCommandState() const;
175 176
176 // Handle the attempted creation of a temporary file for snapshot generation. 177 // Handle the attempted creation of a temporary file for snapshot generation.
177 // Alert the observer of failure or generate MHTML with an observer callback. 178 // Alert the observer of failure or generate MHTML with an observer callback.
178 void SnapshotFileCreated(base::WeakPtr<Observer> observer, 179 void SnapshotFileCreated(base::WeakPtr<Observer> observer,
179 SessionID::id_type browser_id, 180 SessionID::id_type browser_id,
180 const FilePath& path, 181 const FilePath& path,
181 bool success); 182 bool success);
182 183
183 // Create a cloud print job submission request for a URL or snapshot. 184 // Create a cloud print job submission request for a URL or snapshot. Caller
185 // owns lifetime of request created.
184 net::URLFetcher* CreateRequest(); 186 net::URLFetcher* CreateRequest();
185 187
186 // Initialize cloud print URLFetcher requests. 188 // Initialize cloud print URLFetcher requests.
187 void InitRequest(net::URLFetcher* request); 189 void InitRequest(net::URLFetcher* request);
188 190
189 // Submit a cloud print job request with the requisite data. 191 // Submit a cloud print job request with the requisite data.
190 void SendRequest(net::URLFetcher* request, const JobData& data); 192 void SendRequest(net::URLFetcher* request, const JobData& data);
191 193
192 // Send the OAuth2AccessTokenFetcher request. 194 // Send the OAuth2AccessTokenFetcher request.
193 // Virtual for unit test mocking. 195 // Virtual for unit test mocking.
(...skipping 29 matching lines...) Expand all
223 RequestObserverMap; 225 RequestObserverMap;
224 RequestObserverMap request_observer_map_; 226 RequestObserverMap request_observer_map_;
225 227
226 // The pending OAuth access token request and a timer for retrying on failure. 228 // The pending OAuth access token request and a timer for retrying on failure.
227 scoped_ptr<OAuth2AccessTokenFetcher> access_token_fetcher_; 229 scoped_ptr<OAuth2AccessTokenFetcher> access_token_fetcher_;
228 base::OneShotTimer<ChromeToMobileService> auth_retry_timer_; 230 base::OneShotTimer<ChromeToMobileService> auth_retry_timer_;
229 231
230 // A queue of tasks to perform after an access token is lazily initialized. 232 // A queue of tasks to perform after an access token is lazily initialized.
231 std::queue<base::Closure> task_queue_; 233 std::queue<base::Closure> task_queue_;
232 234
235 // Used to manage the lifetime of various URLFetchers.
236 scoped_ptr<net::URLFetcher> submit_url_;
237 scoped_ptr<net::URLFetcher> search_request_;
238 scoped_ptr<net::URLFetcher> submit_snapshot_;
239
233 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileService); 240 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileService);
234 }; 241 };
235 242
236 #endif // CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_ 243 #endif // CHROME_BROWSER_CHROME_TO_MOBILE_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_to_mobile_service.cc » ('j') | chrome/browser/chrome_to_mobile_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698