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

Side by Side Diff: chrome/browser/ui/webui/chrome_url_data_manager.h

Issue 7282054: Remove more unnecessary ChromeURLRequestContext members. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright and chormeos tests. Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "base/task.h" 13 #include "base/task.h"
13 #include "content/browser/browser_thread.h" 14 #include "content/browser/browser_thread.h"
14 15
15 class ChromeURLDataManagerBackend; 16 class ChromeURLDataManagerBackend;
16 class FilePath; 17 class FilePath;
17 class MessageLoop; 18 class MessageLoop;
18 class Profile; 19 class Profile;
19 class RefCountedMemory; 20 class RefCountedMemory;
20 21
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // This field is set and maintained by ChromeURLDataManagerBackend. It is 134 // This field is set and maintained by ChromeURLDataManagerBackend. It is
134 // set when the DataSource is added, and unset if the DataSource is removed. 135 // set when the DataSource is added, and unset if the DataSource is removed.
135 // A DataSource can be removed in two ways: the ChromeURLDataManagerBackend 136 // A DataSource can be removed in two ways: the ChromeURLDataManagerBackend
136 // is deleted, or another DataSource is registered with the same 137 // is deleted, or another DataSource is registered with the same
137 // name. backend_ should only be accessed on the IO thread. 138 // name. backend_ should only be accessed on the IO thread.
138 // This reference can't be via a scoped_refptr else there would be a cycle 139 // This reference can't be via a scoped_refptr else there would be a cycle
139 // between the backend and data source. 140 // between the backend and data source.
140 ChromeURLDataManagerBackend* backend_; 141 ChromeURLDataManagerBackend* backend_;
141 }; 142 };
142 143
143 explicit ChromeURLDataManager(Profile* profile); 144 explicit ChromeURLDataManager(
145 const base::Callback<ChromeURLDataManagerBackend*(void)>& backend);
144 ~ChromeURLDataManager(); 146 ~ChromeURLDataManager();
145 147
146 // Adds a DataSource to the collection of data sources. This *must* be invoked 148 // Adds a DataSource to the collection of data sources. This *must* be invoked
147 // on the UI thread. 149 // on the UI thread.
148 // 150 //
149 // If |AddDataSource| is called more than once for a particular name it will 151 // If |AddDataSource| is called more than once for a particular name it will
150 // release the old |DataSource|, most likely resulting in it getting deleted 152 // release the old |DataSource|, most likely resulting in it getting deleted
151 // as there are no other references to it. |DataSource| uses the 153 // as there are no other references to it. |DataSource| uses the
152 // |DeleteOnUIThread| trait to insure that the destructor is called on the UI 154 // |DeleteOnUIThread| trait to insure that the destructor is called on the UI
153 // thread. This is necessary as some |DataSource|s notably |FileIconSource| 155 // thread. This is necessary as some |DataSource|s notably |FileIconSource|
(...skipping 10 matching lines...) Expand all
164 166
165 // If invoked on the UI thread the DataSource is deleted immediatlye, 167 // If invoked on the UI thread the DataSource is deleted immediatlye,
166 // otherwise it is added to |data_sources_| and a task is scheduled to handle 168 // otherwise it is added to |data_sources_| and a task is scheduled to handle
167 // deletion on the UI thread. See note abouve DeleteDataSource for more info. 169 // deletion on the UI thread. See note abouve DeleteDataSource for more info.
168 static void DeleteDataSource(const DataSource* data_source); 170 static void DeleteDataSource(const DataSource* data_source);
169 171
170 // Returns true if |data_source| is scheduled for deletion (|DeleteDataSource| 172 // Returns true if |data_source| is scheduled for deletion (|DeleteDataSource|
171 // was invoked). 173 // was invoked).
172 static bool IsScheduledForDeletion(const DataSource* data_source); 174 static bool IsScheduledForDeletion(const DataSource* data_source);
173 175
174 Profile* profile_; 176 // A callback that returns the ChromeURLDataManagerBackend. Only accessible on
177 // the IO thread. This is necessary because ChromeURLDataManager is created on
178 // the UI thread, but ChromeURLDataManagerBackend lives on the IO thread.
179 const base::Callback<ChromeURLDataManagerBackend*(void)> backend_;
175 180
176 // Lock used when accessing |data_sources_|. 181 // Lock used when accessing |data_sources_|.
177 static base::Lock delete_lock_; 182 static base::Lock delete_lock_;
178 183
179 // |data_sources_| that are no longer referenced and scheduled for deletion. 184 // |data_sources_| that are no longer referenced and scheduled for deletion.
180 static DataSources* data_sources_; 185 static DataSources* data_sources_;
181 186
182 DISALLOW_COPY_AND_ASSIGN(ChromeURLDataManager); 187 DISALLOW_COPY_AND_ASSIGN(ChromeURLDataManager);
183 }; 188 };
184 189
185 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_ 190 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698