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

Side by Side Diff: Source/modules/filesystem/DirectoryReader.cpp

Issue 314333002: Enable Oilpan by default in modules/filesystem/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove consts from conversion ctor + copy assignment op Created 6 years, 6 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 22 matching lines...) Expand all
33 33
34 #include "core/fileapi/FileError.h" 34 #include "core/fileapi/FileError.h"
35 #include "modules/filesystem/EntriesCallback.h" 35 #include "modules/filesystem/EntriesCallback.h"
36 #include "modules/filesystem/Entry.h" 36 #include "modules/filesystem/Entry.h"
37 #include "modules/filesystem/ErrorCallback.h" 37 #include "modules/filesystem/ErrorCallback.h"
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 class DirectoryReader::EntriesCallbackHelper : public EntriesCallback { 41 class DirectoryReader::EntriesCallbackHelper : public EntriesCallback {
42 public: 42 public:
43 EntriesCallbackHelper(PassRefPtrWillBeRawPtr<DirectoryReader> reader) 43 explicit EntriesCallbackHelper(DirectoryReader* reader)
44 : m_reader(reader) 44 : m_reader(reader)
45 { 45 {
46 } 46 }
47 47
48 virtual void handleEvent(const EntryHeapVector& entries) OVERRIDE 48 virtual void handleEvent(const EntryHeapVector& entries) OVERRIDE
49 { 49 {
50 m_reader->addEntries(entries); 50 m_reader->addEntries(entries);
51 } 51 }
52 52
53 private: 53 private:
54 // FIXME: This RefPtr keeps the reader alive until all of the readDirectory results are received. crbug.com/350285 54 // FIXME: This Persistent keeps the reader alive until all of the readDirect ory results are received. crbug.com/350285
55 RefPtrWillBePersistent<DirectoryReader> m_reader; 55 Persistent<DirectoryReader> m_reader;
56 }; 56 };
57 57
58 class DirectoryReader::ErrorCallbackHelper : public ErrorCallback { 58 class DirectoryReader::ErrorCallbackHelper : public ErrorCallback {
59 public: 59 public:
60 ErrorCallbackHelper(PassRefPtrWillBeRawPtr<DirectoryReader> reader) 60 explicit ErrorCallbackHelper(DirectoryReader* reader)
61 : m_reader(reader) 61 : m_reader(reader)
62 { 62 {
63 } 63 }
64 64
65 virtual void handleEvent(FileError* error) OVERRIDE 65 virtual void handleEvent(FileError* error) OVERRIDE
66 { 66 {
67 m_reader->onError(error); 67 m_reader->onError(error);
68 } 68 }
69 69
70 private: 70 private:
71 RefPtrWillBePersistent<DirectoryReader> m_reader; 71 Persistent<DirectoryReader> m_reader;
72 }; 72 };
73 73
74 DirectoryReader::DirectoryReader(PassRefPtrWillBeRawPtr<DOMFileSystemBase> fileS ystem, const String& fullPath) 74 DirectoryReader::DirectoryReader(DOMFileSystemBase* fileSystem, const String& fu llPath)
75 : DirectoryReaderBase(fileSystem, fullPath) 75 : DirectoryReaderBase(fileSystem, fullPath)
76 , m_isReading(false) 76 , m_isReading(false)
77 { 77 {
78 ScriptWrappable::init(this); 78 ScriptWrappable::init(this);
79 } 79 }
80 80
81 DirectoryReader::~DirectoryReader() 81 DirectoryReader::~DirectoryReader()
82 { 82 {
83 } 83 }
84 84
85 void DirectoryReader::readEntries(PassOwnPtr<EntriesCallback> entriesCallback, P assOwnPtr<ErrorCallback> errorCallback) 85 void DirectoryReader::readEntries(PassOwnPtr<EntriesCallback> entriesCallback, P assOwnPtr<ErrorCallback> errorCallback)
86 { 86 {
87 if (!m_isReading) { 87 if (!m_isReading) {
88 m_isReading = true; 88 m_isReading = true;
89 filesystem()->readDirectory(this, m_fullPath, adoptPtr(new EntriesCallba ckHelper(this)), adoptPtr(new ErrorCallbackHelper(this))); 89 filesystem()->readDirectory(this, m_fullPath, adoptPtr(new EntriesCallba ckHelper(this)), adoptPtr(new ErrorCallbackHelper(this)));
90 } 90 }
91 91
92 if (m_error) { 92 if (m_error) {
93 filesystem()->scheduleCallback(errorCallback, m_error.get()); 93 filesystem()->scheduleCallback(errorCallback, PassRefPtrWillBeRawPtr<Fil eError>(m_error.get()));
94 return; 94 return;
95 } 95 }
96 96
97 if (m_entriesCallback) { 97 if (m_entriesCallback) {
98 // Non-null m_entriesCallback means multiple readEntries() calls are mad e concurrently. We don't allow doing it. 98 // Non-null m_entriesCallback means multiple readEntries() calls are mad e concurrently. We don't allow doing it.
99 filesystem()->scheduleCallback(errorCallback, FileError::create(FileErro r::INVALID_STATE_ERR)); 99 filesystem()->scheduleCallback(errorCallback, FileError::create(FileErro r::INVALID_STATE_ERR));
100 return; 100 return;
101 } 101 }
102 102
103 if (!m_hasMoreEntries || !m_entries.isEmpty()) { 103 if (!m_hasMoreEntries || !m_entries.isEmpty()) {
(...skipping 29 matching lines...) Expand all
133 } 133 }
134 134
135 void DirectoryReader::trace(Visitor* visitor) 135 void DirectoryReader::trace(Visitor* visitor)
136 { 136 {
137 visitor->trace(m_entries); 137 visitor->trace(m_entries);
138 visitor->trace(m_error); 138 visitor->trace(m_error);
139 DirectoryReaderBase::trace(visitor); 139 DirectoryReaderBase::trace(visitor);
140 } 140 }
141 141
142 } 142 }
OLDNEW
« no previous file with comments | « Source/modules/filesystem/DirectoryReader.h ('k') | Source/modules/filesystem/DirectoryReader.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698