Chromium Code Reviews| 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/ppapi_thread.h" | 5 #include "content/ppapi_plugin/ppapi_thread.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/crash_logging.h" | 10 #include "base/debug/crash_logging.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | |
| 12 #include "base/process_util.h" | 13 #include "base/process_util.h" |
| 13 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
| 14 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
| 15 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
| 16 #include "base/time.h" | 17 #include "base/time.h" |
| 17 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 18 #include "content/common/child_process.h" | 19 #include "content/common/child_process.h" |
| 19 #include "content/common/child_process_messages.h" | 20 #include "content/common/child_process_messages.h" |
| 20 #include "content/common/sandbox_util.h" | 21 #include "content/common/sandbox_util.h" |
| 21 #include "content/ppapi_plugin/broker_process_dispatcher.h" | 22 #include "content/ppapi_plugin/broker_process_dispatcher.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 33 #include "ppapi/c/pp_errors.h" | 34 #include "ppapi/c/pp_errors.h" |
| 34 #include "ppapi/c/ppp.h" | 35 #include "ppapi/c/ppp.h" |
| 35 #include "ppapi/proxy/plugin_globals.h" | 36 #include "ppapi/proxy/plugin_globals.h" |
| 36 #include "ppapi/proxy/ppapi_messages.h" | 37 #include "ppapi/proxy/ppapi_messages.h" |
| 37 #include "ppapi/proxy/interface_list.h" | 38 #include "ppapi/proxy/interface_list.h" |
| 38 #include "ppapi/shared_impl/api_id.h" | 39 #include "ppapi/shared_impl/api_id.h" |
| 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| 40 #include "ui/base/ui_base_switches.h" | 41 #include "ui/base/ui_base_switches.h" |
| 41 #include "webkit/plugins/plugin_switches.h" | 42 #include "webkit/plugins/plugin_switches.h" |
| 42 | 43 |
| 44 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | |
| 45 | |
| 43 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
| 44 #include "base/win/win_util.h" | 47 #include "base/win/win_util.h" |
| 45 #include "sandbox/win/src/sandbox.h" | 48 #include "sandbox/win/src/sandbox.h" |
| 46 #elif defined(OS_MACOSX) | 49 #elif defined(OS_MACOSX) |
| 47 #include "content/common/sandbox_init_mac.h" | 50 #include "content/common/sandbox_init_mac.h" |
| 48 #endif | 51 #endif |
| 49 | 52 |
| 50 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
| 51 extern sandbox::TargetServices* g_target_services; | 54 extern sandbox::TargetServices* g_target_services; |
| 52 #else | 55 #else |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 plugin_entry_points_ = plugins[i].internal_entry_points; | 252 plugin_entry_points_ = plugins[i].internal_entry_points; |
| 250 } | 253 } |
| 251 } | 254 } |
| 252 | 255 |
| 253 // If the plugin isn't internal then load it from |path|. | 256 // If the plugin isn't internal then load it from |path|. |
| 254 base::ScopedNativeLibrary library; | 257 base::ScopedNativeLibrary library; |
| 255 if (plugin_entry_points_.initialize_module == NULL) { | 258 if (plugin_entry_points_.initialize_module == NULL) { |
| 256 // Load the plugin from the specified library. | 259 // Load the plugin from the specified library. |
| 257 std::string error; | 260 std::string error; |
| 258 library.Reset(base::LoadNativeLibrary(path, &error)); | 261 library.Reset(base::LoadNativeLibrary(path, &error)); |
| 259 if (!library.is_valid()) { | 262 bool success = library.is_valid(); |
| 263 | |
| 264 #if defined(WIDEVINE_CDM_AVAILABLE) | |
| 265 if (path.BaseName().value() == kWidevineCdmPluginFileName) | |
| 266 UMA_HISTOGRAM_BOOLEAN("PluginLoad.Widevine", success); | |
| 267 #endif // defined(WIDEVINE_CDM_AVAILABLE) | |
| 268 | |
|
ddorwin
2013/04/04 19:30:14
Should we add other Pepper plugins as well? There
xhwang
2013/04/04 19:42:45
I'd like to see if this works well before we add m
| |
| 269 if (!success) { | |
| 260 LOG(ERROR) << "Failed to load Pepper module from " | 270 LOG(ERROR) << "Failed to load Pepper module from " |
| 261 << path.value() << " (error: " << error << ")"; | 271 << path.value() << " (error: " << error << ")"; |
| 262 return; | 272 return; |
| 263 } | 273 } |
| 264 | 274 |
| 265 // Get the GetInterface function (required). | 275 // Get the GetInterface function (required). |
| 266 plugin_entry_points_.get_interface = | 276 plugin_entry_points_.get_interface = |
| 267 reinterpret_cast<PP_GetInterface_Func>( | 277 reinterpret_cast<PP_GetInterface_Func>( |
| 268 library.GetFunctionPointer("PPP_GetInterface")); | 278 library.GetFunctionPointer("PPP_GetInterface")); |
| 269 if (!plugin_entry_points_.get_interface) { | 279 if (!plugin_entry_points_.get_interface) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 | 471 |
| 462 // plugin() is NULL when in-process. Which is fine, because this is | 472 // plugin() is NULL when in-process. Which is fine, because this is |
| 463 // just a hook for setting the process name. | 473 // just a hook for setting the process name. |
| 464 if (GetContentClient()->plugin()) { | 474 if (GetContentClient()->plugin()) { |
| 465 GetContentClient()->plugin()->PluginProcessStarted( | 475 GetContentClient()->plugin()->PluginProcessStarted( |
| 466 path.BaseName().RemoveExtension().LossyDisplayName()); | 476 path.BaseName().RemoveExtension().LossyDisplayName()); |
| 467 } | 477 } |
| 468 } | 478 } |
| 469 | 479 |
| 470 } // namespace content | 480 } // namespace content |
| OLD | NEW |