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

Side by Side Diff: chrome/ppapi_plugin/ppapi_thread.cc

Issue 6628019: Ensure that PP_Instance values are unique within a plugin process in addition... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/ppapi_plugin/ppapi_thread.h ('k') | chrome/renderer/pepper_plugin_delegate_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/ppapi_plugin/ppapi_thread.h" 5 #include "chrome/ppapi_plugin/ppapi_thread.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 30 matching lines...) Expand all
41 // browser process. Messages from the renderer process are sent via a different 41 // browser process. Messages from the renderer process are sent via a different
42 // channel that ends up at Dispatcher::OnMessageReceived. 42 // channel that ends up at Dispatcher::OnMessageReceived.
43 bool PpapiThread::OnMessageReceived(const IPC::Message& msg) { 43 bool PpapiThread::OnMessageReceived(const IPC::Message& msg) {
44 IPC_BEGIN_MESSAGE_MAP(PpapiThread, msg) 44 IPC_BEGIN_MESSAGE_MAP(PpapiThread, msg)
45 IPC_MESSAGE_HANDLER(PpapiMsg_LoadPlugin, OnMsgLoadPlugin) 45 IPC_MESSAGE_HANDLER(PpapiMsg_LoadPlugin, OnMsgLoadPlugin)
46 IPC_MESSAGE_HANDLER(PpapiMsg_CreateChannel, OnMsgCreateChannel) 46 IPC_MESSAGE_HANDLER(PpapiMsg_CreateChannel, OnMsgCreateChannel)
47 IPC_END_MESSAGE_MAP() 47 IPC_END_MESSAGE_MAP()
48 return true; 48 return true;
49 } 49 }
50 50
51 MessageLoop* PpapiThread::GetIPCMessageLoop() {
52 return ChildProcess::current()->io_message_loop();
53 }
54
55 base::WaitableEvent* PpapiThread::GetShutdownEvent() {
56 return ChildProcess::current()->GetShutDownEvent();
57 }
58
59 std::set<PP_Instance>* PpapiThread::GetGloballySeenInstanceIDSet() {
60 return &globally_seen_instance_ids_;
61 }
62
51 void PpapiThread::OnMsgLoadPlugin(const FilePath& path) { 63 void PpapiThread::OnMsgLoadPlugin(const FilePath& path) {
52 base::ScopedNativeLibrary library(base::LoadNativeLibrary(path)); 64 base::ScopedNativeLibrary library(base::LoadNativeLibrary(path));
53 if (!library.is_valid()) 65 if (!library.is_valid())
54 return; 66 return;
55 67
56 // Get the GetInterface function (required). 68 // Get the GetInterface function (required).
57 get_plugin_interface_ = 69 get_plugin_interface_ =
58 reinterpret_cast<pp::proxy::Dispatcher::GetInterfaceFunc>( 70 reinterpret_cast<pp::proxy::Dispatcher::GetInterfaceFunc>(
59 library.GetFunctionPointer("PPP_GetInterface")); 71 library.GetFunctionPointer("PPP_GetInterface"));
60 if (!get_plugin_interface_) { 72 if (!get_plugin_interface_) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 108
97 bool PpapiThread::SetupRendererChannel(base::ProcessHandle host_process_handle, 109 bool PpapiThread::SetupRendererChannel(base::ProcessHandle host_process_handle,
98 int renderer_id, 110 int renderer_id,
99 IPC::ChannelHandle* handle) { 111 IPC::ChannelHandle* handle) {
100 PluginProcessDispatcher* dispatcher = new PluginProcessDispatcher( 112 PluginProcessDispatcher* dispatcher = new PluginProcessDispatcher(
101 host_process_handle, get_plugin_interface_); 113 host_process_handle, get_plugin_interface_);
102 114
103 IPC::ChannelHandle plugin_handle; 115 IPC::ChannelHandle plugin_handle;
104 plugin_handle.name = StringPrintf("%d.r%d", base::GetCurrentProcId(), 116 plugin_handle.name = StringPrintf("%d.r%d", base::GetCurrentProcId(),
105 renderer_id); 117 renderer_id);
106 if (!dispatcher->InitWithChannel( 118 if (!dispatcher->InitWithChannel(this, plugin_handle, false))
107 ChildProcess::current()->io_message_loop(),
108 plugin_handle, false,
109 ChildProcess::current()->GetShutDownEvent()))
110 return false; 119 return false;
111 120
112 handle->name = plugin_handle.name; 121 handle->name = plugin_handle.name;
113 #if defined(OS_POSIX) 122 #if defined(OS_POSIX)
114 // On POSIX, pass the renderer-side FD. 123 // On POSIX, pass the renderer-side FD.
115 handle->socket = base::FileDescriptor(dispatcher->GetRendererFD(), false); 124 handle->socket = base::FileDescriptor(dispatcher->GetRendererFD(), false);
116 #endif 125 #endif
117 126
118 return true; 127 return true;
119 } 128 }
120 129
OLDNEW
« no previous file with comments | « chrome/ppapi_plugin/ppapi_thread.h ('k') | chrome/renderer/pepper_plugin_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698