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

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

Issue 232773008: More removal of GTK code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove base/ so I don't need another stamp. Created 6 years, 8 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/test/base/interactive_test_utils.h ('k') | ppapi/proxy/serialized_structs.h » ('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) 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 "ppapi/proxy/ppb_image_data_proxy.h" 5 #include "ppapi/proxy/ppb_image_data_proxy.h"
6 6
7 #include <string.h> // For memcpy 7 #include <string.h> // For memcpy
8 8
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 409 }
410 410
411 SkCanvas* PlatformImageData::GetCanvas() { 411 SkCanvas* PlatformImageData::GetCanvas() {
412 return mapped_canvas_.get(); 412 return mapped_canvas_.get();
413 } 413 }
414 414
415 // static 415 // static
416 ImageHandle PlatformImageData::NullHandle() { 416 ImageHandle PlatformImageData::NullHandle() {
417 #if defined(OS_WIN) 417 #if defined(OS_WIN)
418 return NULL; 418 return NULL;
419 #elif defined(TOOLKIT_GTK)
420 return 0;
421 #else 419 #else
422 return ImageHandle(); 420 return ImageHandle();
423 #endif 421 #endif
424 } 422 }
425 423
426 ImageHandle PlatformImageData::HandleFromInt(int32_t i) { 424 ImageHandle PlatformImageData::HandleFromInt(int32_t i) {
427 #if defined(OS_WIN) 425 #if defined(OS_WIN)
428 return reinterpret_cast<ImageHandle>(i); 426 return reinterpret_cast<ImageHandle>(i);
429 #elif defined(TOOLKIT_GTK)
430 return static_cast<ImageHandle>(i);
431 #else 427 #else
432 return ImageHandle(i, false); 428 return ImageHandle(i, false);
433 #endif 429 #endif
434 } 430 }
435 #endif // !defined(OS_NACL) 431 #endif // !defined(OS_NACL)
436 432
437 // SimpleImageData ------------------------------------------------------------- 433 // SimpleImageData -------------------------------------------------------------
438 434
439 SimpleImageData::SimpleImageData(const HostResource& resource, 435 SimpleImageData::SimpleImageData(const HostResource& resource,
440 const PP_ImageDataDesc& desc, 436 const PP_ImageDataDesc& desc,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 int local_fd = 0; 596 int local_fd = 0;
601 if (enter_resource.object()->GetSharedMemory(&local_fd, 597 if (enter_resource.object()->GetSharedMemory(&local_fd,
602 byte_count) != PP_OK) { 598 byte_count) != PP_OK) {
603 DVLOG(1) << "CreateImageData failed: could not GetSharedMemory"; 599 DVLOG(1) << "CreateImageData failed: could not GetSharedMemory";
604 return 0; 600 return 0;
605 } 601 }
606 602
607 #if defined(OS_WIN) 603 #if defined(OS_WIN)
608 *image_handle = dispatcher->ShareHandleWithRemote( 604 *image_handle = dispatcher->ShareHandleWithRemote(
609 reinterpret_cast<HANDLE>(static_cast<intptr_t>(local_fd)), false); 605 reinterpret_cast<HANDLE>(static_cast<intptr_t>(local_fd)), false);
610 #elif defined(TOOLKIT_GTK)
611 // On X Windows, a PlatformImageData is backed by a SysV shared memory key,
612 // so embed that in a fake PlatformFileForTransit and don't share it across
613 // processes.
614 if (type == PPB_ImageData_Shared::PLATFORM)
615 *image_handle = IPC::PlatformFileForTransit(local_fd, false);
616 else
617 *image_handle = dispatcher->ShareHandleWithRemote(local_fd, false);
618 #elif defined(OS_POSIX) 606 #elif defined(OS_POSIX)
619 *image_handle = dispatcher->ShareHandleWithRemote(local_fd, false); 607 *image_handle = dispatcher->ShareHandleWithRemote(local_fd, false);
620 #else 608 #else
621 #error Not implemented. 609 #error Not implemented.
622 #endif 610 #endif
623 611
624 return resource.Release(); 612 return resource.Release();
625 } 613 }
626 614
627 void PPB_ImageData_Proxy::OnHostMsgCreatePlatform( 615 void PPB_ImageData_Proxy::OnHostMsgCreatePlatform(
628 PP_Instance instance, 616 PP_Instance instance,
629 int32_t format, 617 int32_t format,
630 const PP_Size& size, 618 const PP_Size& size,
631 PP_Bool init_to_zero, 619 PP_Bool init_to_zero,
632 HostResource* result, 620 HostResource* result,
633 PP_ImageDataDesc* desc, 621 PP_ImageDataDesc* desc,
634 ImageHandle* result_image_handle) { 622 ImageHandle* result_image_handle) {
635 IPC::PlatformFileForTransit image_handle; 623 IPC::PlatformFileForTransit image_handle;
636 uint32_t byte_count; 624 uint32_t byte_count;
637 PP_Resource resource = 625 PP_Resource resource =
638 CreateImageData(instance, 626 CreateImageData(instance,
639 PPB_ImageData_Shared::PLATFORM, 627 PPB_ImageData_Shared::PLATFORM,
640 static_cast<PP_ImageDataFormat>(format), 628 static_cast<PP_ImageDataFormat>(format),
641 size, 629 size,
642 true /* init_to_zero */, 630 true /* init_to_zero */,
643 desc, &image_handle, &byte_count); 631 desc, &image_handle, &byte_count);
644 result->SetHostResource(instance, resource); 632 result->SetHostResource(instance, resource);
645 if (resource) { 633 if (resource) {
646 #if defined(TOOLKIT_GTK)
647 // On X Windows ImageHandle is a SysV shared memory key.
648 *result_image_handle = image_handle.fd;
649 #else
650 *result_image_handle = image_handle; 634 *result_image_handle = image_handle;
651 #endif
652 } else { 635 } else {
653 *result_image_handle = PlatformImageData::NullHandle(); 636 *result_image_handle = PlatformImageData::NullHandle();
654 } 637 }
655 } 638 }
656 639
657 void PPB_ImageData_Proxy::OnHostMsgCreateSimple( 640 void PPB_ImageData_Proxy::OnHostMsgCreateSimple(
658 PP_Instance instance, 641 PP_Instance instance,
659 int32_t format, 642 int32_t format,
660 const PP_Size& size, 643 const PP_Size& size,
661 PP_Bool init_to_zero, 644 PP_Bool init_to_zero,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // still cached in our process, the proxy still holds a reference so we can 681 // still cached in our process, the proxy still holds a reference so we can
699 // remove the one the renderer just sent is. If the proxy no longer holds a 682 // remove the one the renderer just sent is. If the proxy no longer holds a
700 // reference, we released everything and we should also release the one the 683 // reference, we released everything and we should also release the one the
701 // renderer just sent us. 684 // renderer just sent us.
702 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( 685 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
703 API_ID_PPB_CORE, old_image_data)); 686 API_ID_PPB_CORE, old_image_data));
704 } 687 }
705 688
706 } // namespace proxy 689 } // namespace proxy
707 } // namespace ppapi 690 } // namespace ppapi
OLDNEW
« no previous file with comments | « chrome/test/base/interactive_test_utils.h ('k') | ppapi/proxy/serialized_structs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698