| 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/ppapi_plugin/broker_process_dispatcher.h" | 5 #include "content/ppapi_plugin/broker_process_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "content/common/child_process.h" | 10 #include "content/common/child_process.h" |
| 11 #include "ppapi/c/private/ppp_flash_browser_operations.h" | 11 #include "ppapi/c/private/ppp_flash_browser_operations.h" |
| 12 #include "ppapi/proxy/ppapi_messages.h" | 12 #include "ppapi/proxy/ppapi_messages.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // How long we wait before releasing the broker process. | 16 // How long we wait before releasing the broker process. |
| 17 const int kBrokerReleaseTimeSeconds = 30; | 17 const int kBrokerReleaseTimeSeconds = 30; |
| 18 | 18 |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 BrokerProcessDispatcher::BrokerProcessDispatcher( | 21 BrokerProcessDispatcher::BrokerProcessDispatcher( |
| 22 base::ProcessHandle remote_process_handle, | |
| 23 PP_GetInterface_Func get_plugin_interface, | 22 PP_GetInterface_Func get_plugin_interface, |
| 24 PP_ConnectInstance_Func connect_instance) | 23 PP_ConnectInstance_Func connect_instance) |
| 25 : ppapi::proxy::BrokerSideDispatcher(remote_process_handle, | 24 : ppapi::proxy::BrokerSideDispatcher(connect_instance), |
| 26 connect_instance), | |
| 27 get_plugin_interface_(get_plugin_interface) { | 25 get_plugin_interface_(get_plugin_interface) { |
| 28 ChildProcess::current()->AddRefProcess(); | 26 ChildProcess::current()->AddRefProcess(); |
| 29 } | 27 } |
| 30 | 28 |
| 31 BrokerProcessDispatcher::~BrokerProcessDispatcher() { | 29 BrokerProcessDispatcher::~BrokerProcessDispatcher() { |
| 32 DVLOG(1) << "BrokerProcessDispatcher::~BrokerProcessDispatcher()"; | 30 DVLOG(1) << "BrokerProcessDispatcher::~BrokerProcessDispatcher()"; |
| 33 // Don't free the process right away. This timer allows the child process | 31 // Don't free the process right away. This timer allows the child process |
| 34 // to be re-used if the user rapidly goes to a new page that requires this | 32 // to be re-used if the user rapidly goes to a new page that requires this |
| 35 // plugin. This is the case for common plugins where they may be used on a | 33 // plugin. This is the case for common plugins where they may be used on a |
| 36 // source and destination page of a navigation. We don't want to tear down | 34 // source and destination page of a navigation. We don't want to tear down |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 #else | 75 #else |
| 78 std::string data_str = plugin_data_path.value(); | 76 std::string data_str = plugin_data_path.value(); |
| 79 #endif | 77 #endif |
| 80 | 78 |
| 81 browser_interface->ClearSiteData(data_str.c_str(), | 79 browser_interface->ClearSiteData(data_str.c_str(), |
| 82 site.empty() ? NULL : site.c_str(), | 80 site.empty() ? NULL : site.c_str(), |
| 83 flags, max_age); | 81 flags, max_age); |
| 84 return true; | 82 return true; |
| 85 } | 83 } |
| 86 | 84 |
| OLD | NEW |