Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Unified Diff: content/ppapi_plugin/ppapi_thread.cc

Issue 2548423002: Hosting the discardable memory service in the mus process (Closed)
Patch Set: WIP Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/ppapi_plugin/ppapi_thread.cc
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index 85b2c6cb1995e66e9669e38a5b6e769f717a3f9c..efdbbc32a8e4baef39eff7f24c9129bcef61095b 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -36,6 +36,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/pepper_plugin_info.h"
#include "content/public/common/sandbox_init.h"
+#include "content/public/common/service_manager_connection.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_platform_file.h"
#include "ipc/ipc_sync_channel.h"
@@ -48,7 +49,9 @@
#include "ppapi/proxy/plugin_message_filter.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/resource_reply_thread_registrar.h"
+#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/ui/public/interfaces/constants.mojom.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "ui/base/ui_base_switches.h"
@@ -102,6 +105,13 @@ static void WarmupWindowsLocales(const ppapi::PpapiPermissions& permissions) {
#endif
+#if defined(USE_AURA)
+static bool IsRunningInMash() {
+ const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
+ return cmdline->HasSwitch(switches::kIsRunningInMash);
+}
+#endif
+
namespace content {
typedef int32_t (*InitializeBrokerFunc)
@@ -133,8 +143,18 @@ PpapiThread::PpapiThread(const base::CommandLine& command_line, bool is_broker)
// allocator.
if (!command_line.HasSwitch(switches::kSingleProcess)) {
discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr;
- ChildThread::Get()->GetRemoteInterfaces()->GetInterface(
- mojo::GetProxy(&manager_ptr));
+ bool manager_initialized = false;
+#if defined(USE_AURA)
+ if (IsRunningInMash()) {
+ GetServiceManagerConnection()->GetConnector()->ConnectToInterface(
+ ui::mojom::kServiceName, &manager_ptr);
+ manager_initialized = true;
+ }
+#endif
+ if (!manager_initialized) {
+ ChildThread::Get()->GetRemoteInterfaces()->GetInterface(
+ mojo::GetProxy(&manager_ptr));
+ }
discardable_shared_memory_manager_ = base::MakeUnique<
discardable_memory::ClientDiscardableSharedMemoryManager>(
std::move(manager_ptr), GetIOTaskRunner());

Powered by Google App Engine
This is Rietveld 408576698