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

Side by Side Diff: ppapi/proxy/video_decoder_resource_unittest.cc

Issue 2852803002: Remove base::SharedMemory::ShareToProcess. (Closed)
Patch Set: Compile error. Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <GLES2/gl2.h> 5 #include <GLES2/gl2.h>
6 #include <stddef.h> 6 #include <stddef.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 int32_t CallDecode(PP_Resource pp_decoder, 140 int32_t CallDecode(PP_Resource pp_decoder,
141 MockCompletionCallback* cb, 141 MockCompletionCallback* cb,
142 const PpapiHostMsg_VideoDecoder_GetShm* expected_shm_msg) { 142 const PpapiHostMsg_VideoDecoder_GetShm* expected_shm_msg) {
143 // Set up a handler in case the resource sends a sync message to create 143 // Set up a handler in case the resource sends a sync message to create
144 // shared memory. 144 // shared memory.
145 PpapiPluginMsg_VideoDecoder_GetShmReply shm_msg_reply(kShmSize); 145 PpapiPluginMsg_VideoDecoder_GetShmReply shm_msg_reply(kShmSize);
146 ResourceSyncCallHandler shm_msg_handler( 146 ResourceSyncCallHandler shm_msg_handler(
147 &sink(), PpapiHostMsg_VideoDecoder_GetShm::ID, PP_OK, shm_msg_reply); 147 &sink(), PpapiHostMsg_VideoDecoder_GetShm::ID, PP_OK, shm_msg_reply);
148 sink().AddFilter(&shm_msg_handler); 148 sink().AddFilter(&shm_msg_handler);
149 149
150 std::unique_ptr<base::SharedMemoryHandle> shm_handle;
151 std::unique_ptr<SerializedHandle> serialized_handle; 150 std::unique_ptr<SerializedHandle> serialized_handle;
152 base::SharedMemory shm; 151 base::SharedMemory shm;
153 if (expected_shm_msg) { 152 if (expected_shm_msg) {
154 shm.CreateAnonymous(kShmSize); 153 shm.CreateAnonymous(kShmSize);
155 shm_handle.reset(new base::SharedMemoryHandle()); 154 base::SharedMemoryHandle shm_handle = shm.handle().Duplicate();
156 shm.ShareToProcess(base::GetCurrentProcessHandle(), shm_handle.get()); 155 serialized_handle.reset(new SerializedHandle(shm_handle, kShmSize));
157 serialized_handle.reset(new SerializedHandle(*shm_handle, kShmSize));
158 shm_msg_handler.set_serialized_handle(serialized_handle.get()); 156 shm_msg_handler.set_serialized_handle(serialized_handle.get());
159 } 157 }
160 158
161 memset(decode_buffer_, 0x55, kDecodeBufferSize); 159 memset(decode_buffer_, 0x55, kDecodeBufferSize);
162 int32_t result = 160 int32_t result =
163 decoder_iface()->Decode(pp_decoder, 161 decoder_iface()->Decode(pp_decoder,
164 kDecodeId, 162 kDecodeId,
165 kDecodeBufferSize, 163 kDecodeBufferSize,
166 decode_buffer_, 164 decode_buffer_,
167 PP_MakeOptionalCompletionCallback( 165 PP_MakeOptionalCompletionCallback(
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 ASSERT_FALSE(uncalled_cb.called()); 582 ASSERT_FALSE(uncalled_cb.called());
585 ASSERT_EQ(PP_ERROR_RESOURCE_FAILED, CallFlush(decoder.get(), &uncalled_cb)); 583 ASSERT_EQ(PP_ERROR_RESOURCE_FAILED, CallFlush(decoder.get(), &uncalled_cb));
586 ASSERT_FALSE(uncalled_cb.called()); 584 ASSERT_FALSE(uncalled_cb.called());
587 ASSERT_EQ(PP_ERROR_RESOURCE_FAILED, CallReset(decoder.get(), &uncalled_cb)); 585 ASSERT_EQ(PP_ERROR_RESOURCE_FAILED, CallReset(decoder.get(), &uncalled_cb));
588 ASSERT_FALSE(uncalled_cb.called()); 586 ASSERT_FALSE(uncalled_cb.called());
589 } 587 }
590 #endif // !defined(OS_WIN) || !defined(ARCH_CPU_64_BITS) 588 #endif // !defined(OS_WIN) || !defined(ARCH_CPU_64_BITS)
591 589
592 } // namespace proxy 590 } // namespace proxy
593 } // namespace ppapi 591 } // namespace ppapi
OLDNEW
« no previous file with comments | « media/gpu/video_encode_accelerator_unittest.cc ('k') | ppapi/proxy/video_encoder_resource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698