| OLD | NEW |
| 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/browser/plugin_process_host.h" | 5 #include "content/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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // We already have an open channel, send a request right away to plugin. | 327 // We already have an open channel, send a request right away to plugin. |
| 328 RequestPluginChannel(client); | 328 RequestPluginChannel(client); |
| 329 } | 329 } |
| 330 | 330 |
| 331 void PluginProcessHost::RequestPluginChannel(Client* client) { | 331 void PluginProcessHost::RequestPluginChannel(Client* client) { |
| 332 // We can't send any sync messages from the browser because it might lead to | 332 // We can't send any sync messages from the browser because it might lead to |
| 333 // a hang. However this async messages must be answered right away by the | 333 // a hang. However this async messages must be answered right away by the |
| 334 // plugin process (i.e. unblocks a Send() call like a sync message) otherwise | 334 // plugin process (i.e. unblocks a Send() call like a sync message) otherwise |
| 335 // a deadlock can occur if the plugin creation request from the renderer is | 335 // a deadlock can occur if the plugin creation request from the renderer is |
| 336 // a result of a sync message by the plugin process. | 336 // a result of a sync message by the plugin process. |
| 337 // TODO(mirandac): add param whether to persist settings here. |
| 337 PluginProcessMsg_CreateChannel* msg = | 338 PluginProcessMsg_CreateChannel* msg = |
| 338 new PluginProcessMsg_CreateChannel(client->ID(), | 339 new PluginProcessMsg_CreateChannel(client->ID(), |
| 340 client->SaveLocalState(), |
| 339 client->OffTheRecord()); | 341 client->OffTheRecord()); |
| 340 msg->set_unblock(true); | 342 msg->set_unblock(true); |
| 341 if (Send(msg)) { | 343 if (Send(msg)) { |
| 342 sent_requests_.push(client); | 344 sent_requests_.push(client); |
| 343 } else { | 345 } else { |
| 344 client->OnError(); | 346 client->OnError(); |
| 345 } | 347 } |
| 346 } | 348 } |
| 347 | 349 |
| 348 void PluginProcessHost::OnChannelCreated( | 350 void PluginProcessHost::OnChannelCreated( |
| 349 const IPC::ChannelHandle& channel_handle) { | 351 const IPC::ChannelHandle& channel_handle) { |
| 350 Client* client = sent_requests_.front(); | 352 Client* client = sent_requests_.front(); |
| 351 | 353 |
| 352 client->OnChannelOpened(channel_handle); | 354 client->OnChannelOpened(channel_handle); |
| 353 sent_requests_.pop(); | 355 sent_requests_.pop(); |
| 354 } | 356 } |
| OLD | NEW |