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

Side by Side Diff: content/renderer/pepper_plugin_delegate_impl.cc

Issue 8231004: Remaining cleanup (base::Bind): Replacing FileUtilProxy calls with new callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: got it building 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
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 "content/renderer/pepper_plugin_delegate_impl.h" 5 #include "content/renderer/pepper_plugin_delegate_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 base::PlatformFileError error_code, 1034 base::PlatformFileError error_code,
1035 base::PlatformFile file, 1035 base::PlatformFile file,
1036 int message_id) { 1036 int message_id) {
1037 AsyncOpenFileCallback* callback = 1037 AsyncOpenFileCallback* callback =
1038 pending_async_open_files_.Lookup(message_id); 1038 pending_async_open_files_.Lookup(message_id);
1039 DCHECK(callback); 1039 DCHECK(callback);
1040 pending_async_open_files_.Remove(message_id); 1040 pending_async_open_files_.Remove(message_id);
1041 callback->Run(error_code, base::PassPlatformFile(&file)); 1041 callback->Run(error_code, base::PassPlatformFile(&file));
1042 // Make sure we won't leak file handle if the requester has died. 1042 // Make sure we won't leak file handle if the requester has died.
1043 if (file != base::kInvalidPlatformFileValue) 1043 if (file != base::kInvalidPlatformFileValue)
1044 base::FileUtilProxy::Close(GetFileThreadMessageLoopProxy(), file, NULL); 1044 GetFileThreadMessageLoopProxy()->PostTask(
1045 FROM_HERE,
1046 base::IgnoreReturn(base::Callback<bool(void)>(
1047 base::Bind(&base::ClosePlatformFile, file))));
1045 delete callback; 1048 delete callback;
1046 } 1049 }
1047 1050
1048 void PepperPluginDelegateImpl::OnSetFocus(bool has_focus) { 1051 void PepperPluginDelegateImpl::OnSetFocus(bool has_focus) {
1049 for (std::set<webkit::ppapi::PluginInstance*>::iterator i = 1052 for (std::set<webkit::ppapi::PluginInstance*>::iterator i =
1050 active_instances_.begin(); 1053 active_instances_.begin();
1051 i != active_instances_.end(); ++i) 1054 i != active_instances_.end(); ++i)
1052 (*i)->SetContentAreaFocus(has_focus); 1055 (*i)->SetContentAreaFocus(has_focus);
1053 } 1056 }
1054 1057
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 virtual void DidWrite(int64 bytes, bool complete) { 1250 virtual void DidWrite(int64 bytes, bool complete) {
1248 NOTREACHED(); 1251 NOTREACHED();
1249 } 1252 }
1250 1253
1251 virtual void DidOpenFile( 1254 virtual void DidOpenFile(
1252 base::PlatformFile file, 1255 base::PlatformFile file,
1253 base::ProcessHandle unused) { 1256 base::ProcessHandle unused) {
1254 callback_.Run(base::PLATFORM_FILE_OK, base::PassPlatformFile(&file)); 1257 callback_.Run(base::PLATFORM_FILE_OK, base::PassPlatformFile(&file));
1255 // Make sure we won't leak file handle if the requester has died. 1258 // Make sure we won't leak file handle if the requester has died.
1256 if (file != base::kInvalidPlatformFileValue) { 1259 if (file != base::kInvalidPlatformFileValue) {
1257 base::FileUtilProxy::Close(RenderThreadImpl::current()-> 1260 RenderThreadImpl::current()->GetFileThreadMessageLoopProxy()->PostTask(
1258 GetFileThreadMessageLoopProxy(), file, NULL); 1261 FROM_HERE,
1262 base::IgnoreReturn(base::Callback<bool(void)>(
1263 base::Bind(&base::ClosePlatformFile, file))));
1259 } 1264 }
1260 } 1265 }
1261 1266
1262 private: // TODO(ericu): Delete this? 1267 private: // TODO(ericu): Delete this?
1263 webkit::ppapi::PluginDelegate::AsyncOpenFileCallback callback_; 1268 webkit::ppapi::PluginDelegate::AsyncOpenFileCallback callback_;
1264 }; 1269 };
1265 1270
1266 bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL( 1271 bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL(
1267 const GURL& path, int flags, const AsyncOpenFileCallback& callback) { 1272 const GURL& path, int flags, const AsyncOpenFileCallback& callback) {
1268 1273
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 1649
1645 int PepperPluginDelegateImpl::GetRoutingId() const { 1650 int PepperPluginDelegateImpl::GetRoutingId() const {
1646 return render_view_->routing_id(); 1651 return render_view_->routing_id();
1647 } 1652 }
1648 1653
1649 void PepperPluginDelegateImpl::PublishInitialPolicy( 1654 void PepperPluginDelegateImpl::PublishInitialPolicy(
1650 scoped_refptr<webkit::ppapi::PluginInstance> instance, 1655 scoped_refptr<webkit::ppapi::PluginInstance> instance,
1651 const std::string& policy) { 1656 const std::string& policy) {
1652 instance->HandlePolicyUpdate(policy); 1657 instance->HandlePolicyUpdate(policy);
1653 } 1658 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698