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

Unified Diff: net/base/directory_lister.h

Issue 11293: Port directory lister to posix. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_util_win.cc ('k') | net/base/directory_lister.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/directory_lister.h
===================================================================
--- net/base/directory_lister.h (revision 5643)
+++ net/base/directory_lister.h (working copy)
@@ -5,9 +5,10 @@
#ifndef NET_BASE_DIRECTORY_LISTER_H__
#define NET_BASE_DIRECTORY_LISTER_H__
-#include <windows.h>
#include <string>
+#include "base/file_util.h"
+#include "base/platform_thread.h"
#include "base/ref_counted.h"
class MessageLoop;
@@ -21,16 +22,18 @@
// structs over to the main application thread. The consumer of this class
// is insulated from any of the multi-threading details.
//
-class DirectoryLister : public base::RefCountedThreadSafe<DirectoryLister> {
+class DirectoryLister : public base::RefCountedThreadSafe<DirectoryLister>,
+ public PlatformThread::Delegate {
public:
// Implement this class to receive directory entries.
- class Delegate {
+ class DirectoryListerDelegate {
public:
- virtual void OnListFile(const WIN32_FIND_DATA& data) = 0;
+ virtual void OnListFile(
+ const file_util::FileEnumerator::FindInfo& data) = 0;
virtual void OnListDone(int error) = 0;
};
- DirectoryLister(const std::wstring& dir, Delegate* delegate);
+ DirectoryLister(const std::wstring& dir, DirectoryListerDelegate* delegate);
~DirectoryLister();
// Call this method to start the directory enumeration thread.
@@ -42,8 +45,8 @@
void Cancel();
// The delegate pointer may be modified at any time.
- Delegate* delegate() const { return delegate_; }
- void set_delegate(Delegate* d) { delegate_ = d; }
+ DirectoryListerDelegate* delegate() const { return delegate_; }
+ void set_delegate(DirectoryListerDelegate* d) { delegate_ = d; }
// Returns the directory being enumerated.
const std::wstring& directory() const { return dir_; }
@@ -51,18 +54,21 @@
// Returns true if the directory enumeration was canceled.
bool was_canceled() const { return canceled_; }
+ // PlatformThread::Delegate implementation
+ void ThreadMain();
+
private:
friend class DirectoryDataEvent;
+ friend class ThreadDelegate;
- void OnReceivedData(const WIN32_FIND_DATA* data, int count);
+ void OnReceivedData(const file_util::FileEnumerator::FindInfo* data,
+ int count);
void OnDone(int error);
- static unsigned __stdcall ThreadFunc(void* param);
-
std::wstring dir_;
- Delegate* delegate_;
+ DirectoryListerDelegate* delegate_;
MessageLoop* message_loop_;
- HANDLE thread_;
+ PlatformThreadHandle thread_;
bool canceled_;
};
« no previous file with comments | « base/file_util_win.cc ('k') | net/base/directory_lister.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698