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

Side by Side Diff: content/renderer/pepper/host_array_buffer_var.cc

Issue 1154613006: Update pepper to not assume that SharedMemoryHandle is an int. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another nits pass. Created 5 years, 6 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
OLDNEW
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/renderer/pepper/host_array_buffer_var.h" 5 #include "content/renderer/pepper/host_array_buffer_var.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
13 #include "base/process/process_handle.h" 13 #include "base/process/process_handle.h"
14 #include "content/common/pepper_file_util.h" 14 #include "content/common/pepper_file_util.h"
15 #include "content/common/sandbox_util.h" 15 #include "content/common/sandbox_util.h"
16 #include "content/renderer/pepper/host_globals.h" 16 #include "content/renderer/pepper/host_globals.h"
17 #include "content/renderer/pepper/plugin_module.h" 17 #include "content/renderer/pepper/plugin_module.h"
18 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
18 #include "content/renderer/render_thread_impl.h" 19 #include "content/renderer/render_thread_impl.h"
19 #include "ppapi/c/pp_instance.h" 20 #include "ppapi/c/pp_instance.h"
20 21
21 using ppapi::ArrayBufferVar; 22 using ppapi::ArrayBufferVar;
22 using blink::WebArrayBuffer; 23 using blink::WebArrayBuffer;
23 24
24 namespace content { 25 namespace content {
25 26
26 HostArrayBufferVar::HostArrayBufferVar(uint32 size_in_bytes) 27 HostArrayBufferVar::HostArrayBufferVar(uint32 size_in_bytes)
27 : buffer_(WebArrayBuffer::create(size_in_bytes, 1 /* element_size */)), 28 : buffer_(WebArrayBuffer::create(size_in_bytes, 1 /* element_size */)),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return false; 68 return false;
68 69
69 shm->Map(ByteLength()); 70 shm->Map(ByteLength());
70 memcpy(shm->memory(), Map(), ByteLength()); 71 memcpy(shm->memory(), Map(), ByteLength());
71 shm->Unmap(); 72 shm->Unmap();
72 73
73 // Duplicate the handle here; the SharedMemory destructor closes 74 // Duplicate the handle here; the SharedMemory destructor closes
74 // its handle on us. 75 // its handle on us.
75 HostGlobals* hg = HostGlobals::Get(); 76 HostGlobals* hg = HostGlobals::Get();
76 PluginModule* pm = hg->GetModule(hg->GetModuleForInstance(instance)); 77 PluginModule* pm = hg->GetModule(hg->GetModuleForInstance(instance));
77 base::ProcessId p = pm->GetPeerProcessId();
78 if (p == base::kNullProcessId) {
79 // In-process, clone for ourselves.
80 p = base::GetCurrentProcId();
81 }
82 78
83 base::PlatformFile platform_file = 79 *plugin_shm_handle =
84 PlatformFileFromSharedMemoryHandle(shm->handle()); 80 pm->renderer_ppapi_host()->ShareSharedMemoryHandleWithRemote(
85 81 shm->handle());
86 *plugin_shm_handle = BrokerGetFileHandleForProcess(platform_file, p, false);
87 *host_shm_handle_id = -1; 82 *host_shm_handle_id = -1;
88 return true; 83 return true;
89 } 84 }
90 85
91 } // namespace content 86 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698