OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/plugin_process_host.h" | 5 #include "chrome/browser/plugin_process_host.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 RequestPluginChannel(pending_requests_[i]); | 312 RequestPluginChannel(pending_requests_[i]); |
313 } | 313 } |
314 | 314 |
315 pending_requests_.clear(); | 315 pending_requests_.clear(); |
316 } | 316 } |
317 | 317 |
318 void PluginProcessHost::OnChannelError() { | 318 void PluginProcessHost::OnChannelError() { |
319 CancelRequests(); | 319 CancelRequests(); |
320 } | 320 } |
321 | 321 |
| 322 bool PluginProcessHost::CanShutdown() { |
| 323 return sent_requests_.empty(); |
| 324 } |
| 325 |
322 void PluginProcessHost::CancelRequests() { | 326 void PluginProcessHost::CancelRequests() { |
323 for (size_t i = 0; i < pending_requests_.size(); ++i) | 327 for (size_t i = 0; i < pending_requests_.size(); ++i) |
324 pending_requests_[i]->OnError(); | 328 pending_requests_[i]->OnError(); |
325 pending_requests_.clear(); | 329 pending_requests_.clear(); |
326 | 330 |
327 while (!sent_requests_.empty()) { | 331 while (!sent_requests_.empty()) { |
328 sent_requests_.front()->OnError(); | 332 sent_requests_.front()->OnError(); |
329 sent_requests_.pop(); | 333 sent_requests_.pop(); |
330 } | 334 } |
331 } | 335 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 const std::vector<uint8>& data) { | 446 const std::vector<uint8>& data) { |
443 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 447 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
444 | 448 |
445 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 449 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
446 if (chrome_plugin) { | 450 if (chrome_plugin) { |
447 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 451 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
448 uint32 data_len = static_cast<uint32>(data.size()); | 452 uint32 data_len = static_cast<uint32>(data.size()); |
449 chrome_plugin->functions().on_message(data_ptr, data_len); | 453 chrome_plugin->functions().on_message(data_ptr, data_len); |
450 } | 454 } |
451 } | 455 } |
OLD | NEW |