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

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: Add new valgrind sigs 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 DictionaryValue; 17 class DictionaryValue;
17 class FilePath; 18 class FilePath;
18 class MessageLoop; 19 class MessageLoop;
19 class Profile; 20 class Profile;
20 class RefCountedMemory; 21 class RefCountedMemory;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // This field is set and maintained by ChromeURLDataManagerBackend. It is 130 // This field is set and maintained by ChromeURLDataManagerBackend. It is
130 // set when the DataSource is added, and unset if the DataSource is removed. 131 // set when the DataSource is added, and unset if the DataSource is removed.
131 // A DataSource can be removed in two ways: the ChromeURLDataManagerBackend 132 // A DataSource can be removed in two ways: the ChromeURLDataManagerBackend
132 // is deleted, or another DataSource is registered with the same 133 // is deleted, or another DataSource is registered with the same
133 // name. backend_ should only be accessed on the IO thread. 134 // name. backend_ should only be accessed on the IO thread.
134 // This reference can't be via a scoped_refptr else there would be a cycle 135 // This reference can't be via a scoped_refptr else there would be a cycle
135 // between the backend and data source. 136 // between the backend and data source.
136 ChromeURLDataManagerBackend* backend_; 137 ChromeURLDataManagerBackend* backend_;
137 }; 138 };
138 139
139 explicit ChromeURLDataManager(Profile* profile); 140 explicit ChromeURLDataManager(
141 const base::Callback<ChromeURLDataManagerBackend*(void)>& backend);
140 ~ChromeURLDataManager(); 142 ~ChromeURLDataManager();
141 143
142 // Adds a DataSource to the collection of data sources. This *must* be invoked 144 // Adds a DataSource to the collection of data sources. This *must* be invoked
143 // on the UI thread. 145 // on the UI thread.
144 // 146 //
145 // If |AddDataSource| is called more than once for a particular name it will 147 // If |AddDataSource| is called more than once for a particular name it will
146 // release the old |DataSource|, most likely resulting in it getting deleted 148 // release the old |DataSource|, most likely resulting in it getting deleted
147 // as there are no other references to it. |DataSource| uses the 149 // as there are no other references to it. |DataSource| uses the
148 // |DeleteOnUIThread| trait to insure that the destructor is called on the UI 150 // |DeleteOnUIThread| trait to insure that the destructor is called on the UI
149 // thread. This is necessary as some |DataSource|s notably |FileIconSource| 151 // thread. This is necessary as some |DataSource|s notably |FileIconSource|
(...skipping 10 matching lines...) Expand all
160 162
161 // If invoked on the UI thread the DataSource is deleted immediatlye, 163 // If invoked on the UI thread the DataSource is deleted immediatlye,
162 // otherwise it is added to |data_sources_| and a task is scheduled to handle 164 // otherwise it is added to |data_sources_| and a task is scheduled to handle
163 // deletion on the UI thread. See note abouve DeleteDataSource for more info. 165 // deletion on the UI thread. See note abouve DeleteDataSource for more info.
164 static void DeleteDataSource(const DataSource* data_source); 166 static void DeleteDataSource(const DataSource* data_source);
165 167
166 // Returns true if |data_source| is scheduled for deletion (|DeleteDataSource| 168 // Returns true if |data_source| is scheduled for deletion (|DeleteDataSource|
167 // was invoked). 169 // was invoked).
168 static bool IsScheduledForDeletion(const DataSource* data_source); 170 static bool IsScheduledForDeletion(const DataSource* data_source);
169 171
170 Profile* profile_; 172 const base::Callback<ChromeURLDataManagerBackend*(void)> backend_;
Evan Stade 2011/07/06 20:27:54 comment
171 173
172 // Lock used when accessing |data_sources_|. 174 // Lock used when accessing |data_sources_|.
173 static base::Lock delete_lock_; 175 static base::Lock delete_lock_;
174 176
175 // |data_sources_| that are no longer referenced and scheduled for deletion. 177 // |data_sources_| that are no longer referenced and scheduled for deletion.
176 static DataSources* data_sources_; 178 static DataSources* data_sources_;
177 179
178 DISALLOW_COPY_AND_ASSIGN(ChromeURLDataManager); 180 DISALLOW_COPY_AND_ASSIGN(ChromeURLDataManager);
179 }; 181 };
180 182
181 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_ 183 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_URL_DATA_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/chrome_render_message_filter.cc ('k') | chrome/browser/ui/webui/chrome_url_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698