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

Side by Side Diff: ppapi/proxy/ppb_file_chooser_proxy.cc

Issue 6543028: Implement the filesystem proxy. This allows the FileRef tests to pass in the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 #include "ppapi/proxy/ppb_file_chooser_proxy.h" 5 #include "ppapi/proxy/ppb_file_chooser_proxy.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "ppapi/c/dev/ppb_file_chooser_dev.h" 9 #include "ppapi/c/dev/ppb_file_chooser_dev.h"
10 #include "ppapi/c/pp_errors.h" 10 #include "ppapi/c/pp_errors.h"
(...skipping 27 matching lines...) Expand all
38 DISALLOW_COPY_AND_ASSIGN(FileChooser); 38 DISALLOW_COPY_AND_ASSIGN(FileChooser);
39 }; 39 };
40 40
41 FileChooser::FileChooser(const HostResource& resource) 41 FileChooser::FileChooser(const HostResource& resource)
42 : PluginResource(resource), 42 : PluginResource(resource),
43 current_show_callback_(PP_MakeCompletionCallback(NULL, NULL)) { 43 current_show_callback_(PP_MakeCompletionCallback(NULL, NULL)) {
44 } 44 }
45 45
46 FileChooser::~FileChooser() { 46 FileChooser::~FileChooser() {
47 // Always need to fire completion callbacks to prevent a leak in the plugin. 47 // Always need to fire completion callbacks to prevent a leak in the plugin.
48 if (current_show_callback_.func) 48 if (current_show_callback_.func) {
49 PP_RunCompletionCallback(&current_show_callback_, PP_ERROR_ABORTED); 49 // TODO(brettw) the callbacks at this level should be refactored with a
50 // more automatic tracking system like we have in the renderer.
51 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableFunction(
52 current_show_callback_.func, current_show_callback_.user_data,
53 static_cast<int32_t>(PP_ERROR_ABORTED)));
54 }
50 55
51 // Any existing files we haven't transferred ownership to the plugin need 56 // Any existing files we haven't transferred ownership to the plugin need
52 // to be freed. 57 // to be freed.
53 PluginResourceTracker* tracker = PluginResourceTracker::GetInstance(); 58 PluginResourceTracker* tracker = PluginResourceTracker::GetInstance();
54 while (!file_queue_.empty()) { 59 while (!file_queue_.empty()) {
55 tracker->ReleaseResource(file_queue_.front()); 60 tracker->ReleaseResource(file_queue_.front());
56 file_queue_.pop(); 61 file_queue_.pop();
57 } 62 }
58 } 63 }
59 64
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 files.push_back(cur_create_info); 242 files.push_back(cur_create_info);
238 } 243 }
239 } 244 }
240 245
241 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete( 246 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete(
242 INTERFACE_ID_PPB_FILE_CHOOSER, chooser, result, files)); 247 INTERFACE_ID_PPB_FILE_CHOOSER, chooser, result, files));
243 } 248 }
244 249
245 } // namespace proxy 250 } // namespace proxy
246 } // namespace pp 251 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698