| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/ppapi_plugin_process_host.h" | 5 #include "content/browser/ppapi_plugin_process_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 iter->host_impl_->DeleteInstance(pp_instance); | 192 iter->host_impl_->DeleteInstance(pp_instance); |
| 193 return; | 193 return; |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 // Note: It's possible that the plugin process has already been deleted by | 196 // Note: It's possible that the plugin process has already been deleted by |
| 197 // the time this message is received. For example, it could have crashed. | 197 // the time this message is received. For example, it could have crashed. |
| 198 // That's OK, we can just ignore this message. | 198 // That's OK, we can just ignore this message. |
| 199 } | 199 } |
| 200 | 200 |
| 201 // static | 201 // static |
| 202 void PpapiPluginProcessHost::OnPluginInstanceThrottleStateChange( |
| 203 int plugin_process_id, |
| 204 int32 pp_instance, |
| 205 bool is_throttled) { |
| 206 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) { |
| 207 if (iter->process_.get() && |
| 208 iter->process_->GetData().id == plugin_process_id) { |
| 209 // Found the plugin. |
| 210 iter->host_impl_->OnThrottleStateChanged(pp_instance, is_throttled); |
| 211 return; |
| 212 } |
| 213 } |
| 214 // Note: It's possible that the plugin process has already been deleted by |
| 215 // the time this message is received. For example, it could have crashed. |
| 216 // That's OK, we can just ignore this message. |
| 217 } |
| 218 |
| 219 // static |
| 202 void PpapiPluginProcessHost::FindByName( | 220 void PpapiPluginProcessHost::FindByName( |
| 203 const base::string16& name, | 221 const base::string16& name, |
| 204 std::vector<PpapiPluginProcessHost*>* hosts) { | 222 std::vector<PpapiPluginProcessHost*>* hosts) { |
| 205 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) { | 223 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) { |
| 206 if (iter->process_.get() && iter->process_->GetData().name == name) | 224 if (iter->process_.get() && iter->process_->GetData().name == name) |
| 207 hosts->push_back(*iter); | 225 hosts->push_back(*iter); |
| 208 } | 226 } |
| 209 } | 227 } |
| 210 | 228 |
| 211 bool PpapiPluginProcessHost::Send(IPC::Message* message) { | 229 bool PpapiPluginProcessHost::Send(IPC::Message* message) { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 // sent_requests_ queue should be the one that the plugin just created. | 484 // sent_requests_ queue should be the one that the plugin just created. |
| 467 Client* client = sent_requests_.front(); | 485 Client* client = sent_requests_.front(); |
| 468 sent_requests_.pop(); | 486 sent_requests_.pop(); |
| 469 | 487 |
| 470 const ChildProcessData& data = process_->GetData(); | 488 const ChildProcessData& data = process_->GetData(); |
| 471 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 489 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
| 472 data.id); | 490 data.id); |
| 473 } | 491 } |
| 474 | 492 |
| 475 } // namespace content | 493 } // namespace content |
| OLD | NEW |