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

Side by Side Diff: webkit/plugins/ppapi/ppb_directory_reader_impl.cc

Issue 8342016: Revert 106142 - Add a new globals object for PPAPI tracking information. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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
Property Changes:
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/src/webkit/plugins/ppapi/ppb_directory_reader_impl.cc:r3734-4217,4606-5108,5177-5263
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 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" 5 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "ppapi/c/pp_completion_callback.h" 9 #include "ppapi/c/pp_completion_callback.h"
10 #include "ppapi/c/pp_errors.h" 10 #include "ppapi/c/pp_errors.h"
11 #include "ppapi/c/dev/ppb_directory_reader_dev.h" 11 #include "ppapi/c/dev/ppb_directory_reader_dev.h"
12 #include "ppapi/shared_impl/ppapi_globals.h"
13 #include "ppapi/thunk/enter.h" 12 #include "ppapi/thunk/enter.h"
14 #include "ppapi/thunk/ppb_file_ref_api.h" 13 #include "ppapi/thunk/ppb_file_ref_api.h"
15 #include "webkit/plugins/ppapi/common.h" 14 #include "webkit/plugins/ppapi/common.h"
16 #include "webkit/plugins/ppapi/file_callbacks.h" 15 #include "webkit/plugins/ppapi/file_callbacks.h"
17 #include "webkit/plugins/ppapi/plugin_delegate.h" 16 #include "webkit/plugins/ppapi/plugin_delegate.h"
18 #include "webkit/plugins/ppapi/plugin_module.h" 17 #include "webkit/plugins/ppapi/plugin_module.h"
19 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 18 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
20 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" 19 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
21 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" 20 #include "webkit/plugins/ppapi/ppb_file_system_impl.h"
22 #include "webkit/plugins/ppapi/resource_helper.h" 21 #include "webkit/plugins/ppapi/resource_helper.h"
23 #include "webkit/plugins/ppapi/resource_tracker.h" 22 #include "webkit/plugins/ppapi/resource_tracker.h"
24 23
25 using ::ppapi::PpapiGlobals;
26 using ::ppapi::thunk::EnterResourceNoLock; 24 using ::ppapi::thunk::EnterResourceNoLock;
27 using ::ppapi::thunk::PPB_DirectoryReader_API; 25 using ::ppapi::thunk::PPB_DirectoryReader_API;
28 using ::ppapi::thunk::PPB_FileRef_API; 26 using ::ppapi::thunk::PPB_FileRef_API;
29 27
30 namespace webkit { 28 namespace webkit {
31 namespace ppapi { 29 namespace ppapi {
32 30
33 namespace { 31 namespace {
34 32
35 std::string FilePathStringToUTF8String(const FilePath::StringType& str) { 33 std::string FilePathStringToUTF8String(const FilePath::StringType& str) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 121
124 FillUpEntry(); 122 FillUpEntry();
125 entry_ = NULL; 123 entry_ = NULL;
126 } 124 }
127 125
128 bool PPB_DirectoryReader_Impl::FillUpEntry() { 126 bool PPB_DirectoryReader_Impl::FillUpEntry() {
129 DCHECK(entry_); 127 DCHECK(entry_);
130 if (!entries_.empty()) { 128 if (!entries_.empty()) {
131 base::FileUtilProxy::Entry dir_entry = entries_.front(); 129 base::FileUtilProxy::Entry dir_entry = entries_.front();
132 entries_.pop(); 130 entries_.pop();
133 if (entry_->file_ref) { 131 if (entry_->file_ref)
134 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource( 132 ResourceTracker::Get()->ReleaseResource(entry_->file_ref);
135 entry_->file_ref);
136 }
137 133
138 PPB_FileRef_Impl* file_ref = PPB_FileRef_Impl::CreateInternal( 134 PPB_FileRef_Impl* file_ref = PPB_FileRef_Impl::CreateInternal(
139 directory_ref_->file_system()->pp_resource(), 135 directory_ref_->file_system()->pp_resource(),
140 FilePathStringToUTF8String(dir_entry.name)); 136 FilePathStringToUTF8String(dir_entry.name));
141 if (!file_ref) 137 if (!file_ref)
142 return false; 138 return false;
143 entry_->file_ref = file_ref->GetReference(); 139 entry_->file_ref = file_ref->GetReference();
144 entry_->file_type = 140 entry_->file_type =
145 (dir_entry.is_directory ? PP_FILETYPE_DIRECTORY : PP_FILETYPE_REGULAR); 141 (dir_entry.is_directory ? PP_FILETYPE_DIRECTORY : PP_FILETYPE_REGULAR);
146 return true; 142 return true;
147 } 143 }
148 144
149 if (!has_more_) { 145 if (!has_more_) {
150 entry_->file_ref = 0; 146 entry_->file_ref = 0;
151 return true; 147 return true;
152 } 148 }
153 149
154 return false; 150 return false;
155 } 151 }
156 152
157 } // namespace ppapi 153 } // namespace ppapi
158 } // namespace webkit 154 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_audio_impl.cc ('k') | webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698