diff options
74 files changed, 260 insertions, 366 deletions
diff --git a/chrome/renderer/chrome_ppb_pdf_impl.cc b/chrome/renderer/chrome_ppb_pdf_impl.cc index c5d0261..a237ca2 100644 --- a/chrome/renderer/chrome_ppb_pdf_impl.cc +++ b/chrome/renderer/chrome_ppb_pdf_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -48,7 +48,9 @@ namespace chrome { #if defined(OS_LINUX) || defined(OS_OPENBSD) class PrivateFontFile : public ppapi::Resource { public: - PrivateFontFile(PP_Instance instance, int fd) : Resource(instance), fd_(fd) { + PrivateFontFile(PP_Instance instance, int fd) + : Resource(ppapi::OBJECT_IS_IMPL, instance), + fd_(fd) { } virtual ~PrivateFontFile() { } diff --git a/ppapi/proxy/mock_resource.cc b/ppapi/proxy/mock_resource.cc index 06b2292..9662bad 100644 --- a/ppapi/proxy/mock_resource.cc +++ b/ppapi/proxy/mock_resource.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,7 +7,8 @@ namespace ppapi { namespace proxy { -MockResource::MockResource(const HostResource& resource) : Resource(resource) { +MockResource::MockResource(const HostResource& resource) + : Resource(OBJECT_IS_PROXY, resource) { } MockResource::~MockResource() { diff --git a/ppapi/proxy/ppb_audio_input_proxy.cc b/ppapi/proxy/ppb_audio_input_proxy.cc index 5126f7d..d689192 100644 --- a/ppapi/proxy/ppb_audio_input_proxy.cc +++ b/ppapi/proxy/ppb_audio_input_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -65,7 +65,7 @@ AudioInput::AudioInput(const HostResource& audio_input_id, PP_Resource config_id, PPB_AudioInput_Callback callback, void* user_data) - : Resource(audio_input_id), + : Resource(OBJECT_IS_PROXY, audio_input_id), config_(config_id) { SetCallback(callback, user_data); PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc index 8e64c85..fe890ae 100644 --- a/ppapi/proxy/ppb_audio_proxy.cc +++ b/ppapi/proxy/ppb_audio_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -64,7 +64,7 @@ Audio::Audio(const HostResource& audio_id, PP_Resource config_id, PPB_Audio_Callback callback, void* user_data) - : Resource(audio_id), + : Resource(OBJECT_IS_PROXY, audio_id), config_(config_id) { SetCallback(callback, user_data); PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); diff --git a/ppapi/proxy/ppb_broker_proxy.cc b/ppapi/proxy/ppb_broker_proxy.cc index 18065bb..b9549e0 100644 --- a/ppapi/proxy/ppb_broker_proxy.cc +++ b/ppapi/proxy/ppb_broker_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -54,7 +54,7 @@ class Broker : public PPB_Broker_API, public Resource { }; Broker::Broker(const HostResource& resource) - : Resource(resource), + : Resource(OBJECT_IS_PROXY, resource), called_connect_(false), socket_handle_(base::kInvalidPlatformFileValue) { } diff --git a/ppapi/proxy/ppb_buffer_proxy.cc b/ppapi/proxy/ppb_buffer_proxy.cc index c7aba70..03a57d5 100644 --- a/ppapi/proxy/ppb_buffer_proxy.cc +++ b/ppapi/proxy/ppb_buffer_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,7 +26,7 @@ namespace proxy { Buffer::Buffer(const HostResource& resource, const base::SharedMemoryHandle& shm_handle, uint32_t size) - : Resource(resource), + : Resource(OBJECT_IS_PROXY, resource), shm_(shm_handle, false), size_(size), mapped_data_(NULL), diff --git a/ppapi/proxy/ppb_file_chooser_proxy.cc b/ppapi/proxy/ppb_file_chooser_proxy.cc index c3914ef..fa8df55 100644 --- a/ppapi/proxy/ppb_file_chooser_proxy.cc +++ b/ppapi/proxy/ppb_file_chooser_proxy.cc @@ -73,7 +73,8 @@ class FileChooser : public Resource, DISALLOW_COPY_AND_ASSIGN(FileChooser); }; -FileChooser::FileChooser(const HostResource& resource) : Resource(resource) { +FileChooser::FileChooser(const HostResource& resource) + : Resource(OBJECT_IS_PROXY, resource) { } FileChooser::~FileChooser() { diff --git a/ppapi/proxy/ppb_file_ref_proxy.cc b/ppapi/proxy/ppb_file_ref_proxy.cc index 7c12ea3..9298eb2 100644 --- a/ppapi/proxy/ppb_file_ref_proxy.cc +++ b/ppapi/proxy/ppb_file_ref_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -76,7 +76,7 @@ class FileRef : public PPB_FileRef_Shared { }; FileRef::FileRef(const PPB_FileRef_CreateInfo& info) - : PPB_FileRef_Shared(PPB_FileRef_Shared::InitAsProxy(), info), + : PPB_FileRef_Shared(OBJECT_IS_PROXY, info), next_callback_id_(1) { } diff --git a/ppapi/proxy/ppb_file_system_proxy.cc b/ppapi/proxy/ppb_file_system_proxy.cc index 48942ee..993c468 100644 --- a/ppapi/proxy/ppb_file_system_proxy.cc +++ b/ppapi/proxy/ppb_file_system_proxy.cc @@ -63,7 +63,7 @@ class FileSystem : public Resource, public PPB_FileSystem_API { FileSystem::FileSystem(const HostResource& host_resource, PP_FileSystemType type) - : Resource(host_resource), + : Resource(OBJECT_IS_PROXY, host_resource), type_(type), called_open_(false) { } diff --git a/ppapi/proxy/ppb_flash_menu_proxy.cc b/ppapi/proxy/ppb_flash_menu_proxy.cc index d2ef2a3..d7f5f16 100644 --- a/ppapi/proxy/ppb_flash_menu_proxy.cc +++ b/ppapi/proxy/ppb_flash_menu_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -43,7 +43,7 @@ class FlashMenu : public PPB_Flash_Menu_API, public Resource { }; FlashMenu::FlashMenu(const HostResource& resource) - : Resource(resource), + : Resource(OBJECT_IS_PROXY, resource), selected_id_ptr_(NULL) { } diff --git a/ppapi/proxy/ppb_flash_message_loop_proxy.cc b/ppapi/proxy/ppb_flash_message_loop_proxy.cc index a06e8c8..2124e5a 100644 --- a/ppapi/proxy/ppb_flash_message_loop_proxy.cc +++ b/ppapi/proxy/ppb_flash_message_loop_proxy.cc @@ -40,7 +40,7 @@ class FlashMessageLoop : public PPB_Flash_MessageLoop_API, public Resource { }; FlashMessageLoop::FlashMessageLoop(const HostResource& resource) - : Resource(resource) { + : Resource(OBJECT_IS_PROXY, resource) { } FlashMessageLoop::~FlashMessageLoop() { diff --git a/ppapi/proxy/ppb_flash_net_connector_proxy.cc b/ppapi/proxy/ppb_flash_net_connector_proxy.cc index feaba6a..0b7ba10 100644 --- a/ppapi/proxy/ppb_flash_net_connector_proxy.cc +++ b/ppapi/proxy/ppb_flash_net_connector_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -79,7 +79,7 @@ class FlashNetConnector : public PPB_Flash_NetConnector_API, }; FlashNetConnector::FlashNetConnector(const HostResource& resource) - : Resource(resource), + : Resource(OBJECT_IS_PROXY, resource), socket_out_(NULL), local_addr_out_(NULL), remote_addr_out_(NULL) { diff --git a/ppapi/proxy/ppb_graphics_2d_proxy.cc b/ppapi/proxy/ppb_graphics_2d_proxy.cc index b719a6b..0cbd388 100644 --- a/ppapi/proxy/ppb_graphics_2d_proxy.cc +++ b/ppapi/proxy/ppb_graphics_2d_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -68,7 +68,7 @@ class Graphics2D : public Resource, public thunk::PPB_Graphics2D_API { Graphics2D::Graphics2D(const HostResource& host_resource, const PP_Size& size, PP_Bool is_always_opaque) - : Resource(host_resource), + : Resource(OBJECT_IS_PROXY, host_resource), size_(size), is_always_opaque_(is_always_opaque) { } diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc index bdbeb3f..b380be2 100644 --- a/ppapi/proxy/ppb_image_data_proxy.cc +++ b/ppapi/proxy/ppb_image_data_proxy.cc @@ -29,7 +29,7 @@ namespace proxy { ImageData::ImageData(const HostResource& resource, const PP_ImageDataDesc& desc, ImageHandle handle) - : Resource(resource), + : Resource(OBJECT_IS_PROXY, resource), desc_(desc) { #if defined(OS_WIN) transport_dib_.reset(TransportDIB::CreateWithHandle(handle)); diff --git a/ppapi/proxy/ppb_message_loop_proxy.cc b/ppapi/proxy/ppb_message_loop_proxy.cc index 927e42f..12a48bb 100644 --- a/ppapi/proxy/ppb_message_loop_proxy.cc +++ b/ppapi/proxy/ppb_message_loop_proxy.cc @@ -86,7 +86,7 @@ class MessageLoopResource : public Resource, public PPB_MessageLoop_API { }; MessageLoopResource::MessageLoopResource(PP_Instance instance) - : Resource(HostResource::MakeInstanceOnly(instance)), + : Resource(OBJECT_IS_PROXY, instance), nested_invocations_(0), destroyed_(false), should_destroy_(false) { diff --git a/ppapi/proxy/ppb_pdf_proxy.cc b/ppapi/proxy/ppb_pdf_proxy.cc index 7866e41..aee308f 100644 --- a/ppapi/proxy/ppb_pdf_proxy.cc +++ b/ppapi/proxy/ppb_pdf_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -27,7 +27,8 @@ namespace proxy { class PrivateFontFile : public Resource, public PPB_PDFFont_API { public: - PrivateFontFile(const HostResource& resource) : Resource(resource) { + PrivateFontFile(const HostResource& resource) + : Resource(OBJECT_IS_PROXY, resource) { } virtual ~PrivateFontFile() {} diff --git a/ppapi/proxy/ppb_testing_proxy.cc b/ppapi/proxy/ppb_testing_proxy.cc index 32d5215..9c0a14b 100644 --- a/ppapi/proxy/ppb_testing_proxy.cc +++ b/ppapi/proxy/ppb_testing_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -189,9 +189,7 @@ void PPB_Testing_Proxy::OnMsgSimulateInputEvent( PP_Instance instance, const InputEventData& input_event) { scoped_refptr<PPB_InputEvent_Shared> input_event_impl( - new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), - instance, - input_event)); + new PPB_InputEvent_Shared(OBJECT_IS_PROXY, instance, input_event)); ppb_testing_impl_->SimulateInputEvent(instance, input_event_impl->pp_resource()); } diff --git a/ppapi/proxy/ppb_url_loader_proxy.cc b/ppapi/proxy/ppb_url_loader_proxy.cc index c896050..5303e42 100644 --- a/ppapi/proxy/ppb_url_loader_proxy.cc +++ b/ppapi/proxy/ppb_url_loader_proxy.cc @@ -157,7 +157,7 @@ class URLLoader : public Resource, public PPB_URLLoader_API { }; URLLoader::URLLoader(const HostResource& resource) - : Resource(resource), + : Resource(OBJECT_IS_PROXY, resource), bytes_sent_(-1), total_bytes_to_be_sent_(-1), bytes_received_(-1), diff --git a/ppapi/proxy/ppb_url_response_info_proxy.cc b/ppapi/proxy/ppb_url_response_info_proxy.cc index c9da1ef7..c2f0942 100644 --- a/ppapi/proxy/ppb_url_response_info_proxy.cc +++ b/ppapi/proxy/ppb_url_response_info_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -39,7 +39,7 @@ class URLResponseInfo : public Resource, public PPB_URLResponseInfo_API { }; URLResponseInfo::URLResponseInfo(const HostResource& resource) - : Resource(resource) { + : Resource(OBJECT_IS_PROXY, resource) { } URLResponseInfo::~URLResponseInfo() { diff --git a/ppapi/proxy/ppb_video_capture_proxy.cc b/ppapi/proxy/ppb_video_capture_proxy.cc index 3df4de8..af39587 100644 --- a/ppapi/proxy/ppb_video_capture_proxy.cc +++ b/ppapi/proxy/ppb_video_capture_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -249,7 +249,7 @@ class VideoCapture : public ppapi::thunk::PPB_VideoCapture_API, }; VideoCapture::VideoCapture(const HostResource& resource) - : Resource(resource), + : Resource(OBJECT_IS_PROXY, resource), status_(PP_VIDEO_CAPTURE_STATUS_STOPPED) { } diff --git a/ppapi/proxy/ppp_input_event_proxy.cc b/ppapi/proxy/ppp_input_event_proxy.cc index cfce397..be58b3ce 100644 --- a/ppapi/proxy/ppp_input_event_proxy.cc +++ b/ppapi/proxy/ppp_input_event_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -97,7 +97,7 @@ bool PPP_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) { void PPP_InputEvent_Proxy::OnMsgHandleInputEvent(PP_Instance instance, const InputEventData& data) { scoped_refptr<PPB_InputEvent_Shared> resource(new PPB_InputEvent_Shared( - PPB_InputEvent_Shared::InitAsProxy(), instance, data)); + OBJECT_IS_PROXY, instance, data)); ppp_input_event_impl_->HandleInputEvent(instance, resource->pp_resource()); } @@ -106,7 +106,7 @@ void PPP_InputEvent_Proxy::OnMsgHandleFilteredInputEvent( const InputEventData& data, PP_Bool* result) { scoped_refptr<PPB_InputEvent_Shared> resource(new PPB_InputEvent_Shared( - PPB_InputEvent_Shared::InitAsProxy(), instance, data)); + OBJECT_IS_PROXY, instance, data)); *result = ppp_input_event_impl_->HandleInputEvent(instance, resource->pp_resource()); } diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc index 8ad8ae4..083cc91 100644 --- a/ppapi/proxy/ppp_instance_proxy.cc +++ b/ppapi/proxy/ppp_instance_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -239,7 +239,7 @@ void PPP_Instance_Proxy::OnPluginMsgDidChangeView( ScopedPPResource resource( ScopedPPResource::PassRef(), - (new PPB_View_Shared(PPB_View_Shared::InitAsProxy(), + (new PPB_View_Shared(OBJECT_IS_PROXY, instance, new_data))->GetReference()); combined_interface_->DidChangeView(instance, resource, diff --git a/ppapi/proxy/ppp_instance_proxy_unittest.cc b/ppapi/proxy/ppp_instance_proxy_unittest.cc index 6e53023..199cc51 100644 --- a/ppapi/proxy/ppp_instance_proxy_unittest.cc +++ b/ppapi/proxy/ppp_instance_proxy_unittest.cc @@ -164,7 +164,7 @@ TEST_F(PPP_Instance_ProxyTest, PPPInstance1_0) { ResetReceived(); ScopedPPResource view_resource( ScopedPPResource::PassRef(), - (new PPB_View_Shared(PPB_View_Shared::InitAsImpl(), + (new PPB_View_Shared(OBJECT_IS_IMPL, expected_instance, data))->GetReference()); ppp_instance->DidChangeView(expected_instance, view_resource); did_change_view_called.Wait(); diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc index c77e3c6..5d8cd4d 100644 --- a/ppapi/proxy/resource_creation_proxy.cc +++ b/ppapi/proxy/resource_creation_proxy.cc @@ -76,8 +76,8 @@ PP_Resource ResourceCreationProxy::CreateAudioConfig( PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t sample_frame_count) { - return PPB_AudioConfig_Shared::CreateAsProxy( - instance, sample_rate, sample_frame_count); + return PPB_AudioConfig_Shared::Create( + OBJECT_IS_PROXY, instance, sample_rate, sample_frame_count); } PP_Resource ResourceCreationProxy::CreateAudioTrusted(PP_Instance instance) { @@ -162,8 +162,8 @@ PP_Resource ResourceCreationProxy::CreateFontObject( PluginDispatcher::GetForInstance(instance); if (!dispatcher) return 0; - return PPB_Font_Shared::CreateAsProxy(instance, *description, - dispatcher->preferences()); + return PPB_Font_Shared::Create(OBJECT_IS_PROXY, instance, *description, + dispatcher->preferences()); } PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance, @@ -205,7 +205,7 @@ PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent( data.character_text = text_str->value(); } - return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), + return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY, instance, data))->GetReference(); } @@ -234,7 +234,7 @@ PP_Resource ResourceCreationProxy::CreateMouseInputEvent( data.mouse_click_count = click_count; data.mouse_movement = *mouse_movement; - return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), + return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY, instance, data))->GetReference(); } @@ -260,7 +260,7 @@ PP_Resource ResourceCreationProxy::CreateResourceArray( const PP_Resource elements[], uint32_t size) { PPB_ResourceArray_Shared* object = new PPB_ResourceArray_Shared( - PPB_ResourceArray_Shared::InitAsProxy(), instance, elements, size); + OBJECT_IS_PROXY, instance, elements, size); return object->GetReference(); } @@ -294,8 +294,8 @@ PP_Resource ResourceCreationProxy::CreateURLLoader(PP_Instance instance) { PP_Resource ResourceCreationProxy::CreateURLRequestInfo( PP_Instance instance, const PPB_URLRequestInfo_Data& data) { - return (new PPB_URLRequestInfo_Shared( - HostResource::MakeInstanceOnly(instance), data))->GetReference(); + return (new PPB_URLRequestInfo_Shared(OBJECT_IS_PROXY, + instance, data))->GetReference(); } PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) { @@ -337,7 +337,7 @@ PP_Resource ResourceCreationProxy::CreateWheelInputEvent( data.wheel_ticks = *wheel_ticks; data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); - return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), + return (new PPB_InputEvent_Shared(OBJECT_IS_PROXY, instance, data))->GetReference(); } diff --git a/ppapi/shared_impl/ppb_audio_config_shared.cc b/ppapi/shared_impl/ppb_audio_config_shared.cc index 78df9ad..a866d79 100644 --- a/ppapi/shared_impl/ppb_audio_config_shared.cc +++ b/ppapi/shared_impl/ppb_audio_config_shared.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,15 +6,9 @@ namespace ppapi { -PPB_AudioConfig_Shared::PPB_AudioConfig_Shared(PP_Instance instance) - : Resource(instance), - sample_rate_(PP_AUDIOSAMPLERATE_NONE), - sample_frame_count_(0) { -} - -PPB_AudioConfig_Shared::PPB_AudioConfig_Shared( - const HostResource& host_resource) - : Resource(host_resource), +PPB_AudioConfig_Shared::PPB_AudioConfig_Shared(ResourceObjectType type, + PP_Instance instance) + : Resource(type, instance), sample_rate_(PP_AUDIOSAMPLERATE_NONE), sample_frame_count_(0) { } @@ -22,25 +16,13 @@ PPB_AudioConfig_Shared::PPB_AudioConfig_Shared( PPB_AudioConfig_Shared::~PPB_AudioConfig_Shared() { } -// static -PP_Resource PPB_AudioConfig_Shared::CreateAsImpl( +PP_Resource PPB_AudioConfig_Shared::Create( + ResourceObjectType type, PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t sample_frame_count) { scoped_refptr<PPB_AudioConfig_Shared> object( - new PPB_AudioConfig_Shared(instance)); - if (!object->Init(sample_rate, sample_frame_count)) - return 0; - return object->GetReference(); -} - -// static -PP_Resource PPB_AudioConfig_Shared::CreateAsProxy( - PP_Instance instance, - PP_AudioSampleRate sample_rate, - uint32_t sample_frame_count) { - scoped_refptr<PPB_AudioConfig_Shared> object(new PPB_AudioConfig_Shared( - HostResource::MakeInstanceOnly(instance))); + new PPB_AudioConfig_Shared(type, instance)); if (!object->Init(sample_rate, sample_frame_count)) return 0; return object->GetReference(); diff --git a/ppapi/shared_impl/ppb_audio_config_shared.h b/ppapi/shared_impl/ppb_audio_config_shared.h index 65e3b2b..410a32a8b 100644 --- a/ppapi/shared_impl/ppb_audio_config_shared.h +++ b/ppapi/shared_impl/ppb_audio_config_shared.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,12 +18,10 @@ class PPAPI_SHARED_EXPORT PPB_AudioConfig_Shared public: virtual ~PPB_AudioConfig_Shared(); - static PP_Resource CreateAsImpl(PP_Instance instance, - PP_AudioSampleRate sample_rate, - uint32_t sample_frame_count); - static PP_Resource CreateAsProxy(PP_Instance instance, - PP_AudioSampleRate sample_rate, - uint32_t sample_frame_count); + static PP_Resource Create(ResourceObjectType type, + PP_Instance instance, + PP_AudioSampleRate sample_rate, + uint32_t sample_frame_count); // Resource overrides. virtual thunk::PPB_AudioConfig_API* AsPPB_AudioConfig_API() OVERRIDE; @@ -34,10 +32,8 @@ class PPAPI_SHARED_EXPORT PPB_AudioConfig_Shared private: // You must call Init before using this object. - // Construct as implementation. - explicit PPB_AudioConfig_Shared(PP_Instance instance); - // Construct as proxy. - explicit PPB_AudioConfig_Shared(const HostResource& host_resource); + explicit PPB_AudioConfig_Shared(ResourceObjectType type, + PP_Instance instance); // Returns false if the arguments are invalid, the object should not be // used in this case. diff --git a/ppapi/shared_impl/ppb_device_ref_shared.cc b/ppapi/shared_impl/ppb_device_ref_shared.cc index edd01f2..43f758f 100644 --- a/ppapi/shared_impl/ppb_device_ref_shared.cc +++ b/ppapi/shared_impl/ppb_device_ref_shared.cc @@ -15,17 +15,10 @@ DeviceRefData::DeviceRefData() : type(PP_DEVICETYPE_DEV_INVALID) { } -PPB_DeviceRef_Shared::PPB_DeviceRef_Shared(const InitAsImpl&, +PPB_DeviceRef_Shared::PPB_DeviceRef_Shared(ResourceObjectType type, PP_Instance instance, const DeviceRefData& data) - : Resource(instance), - data_(data) { -} - -PPB_DeviceRef_Shared::PPB_DeviceRef_Shared(const InitAsProxy&, - PP_Instance instance, - const DeviceRefData& data) - : Resource(HostResource::MakeInstanceOnly(instance)), + : Resource(type, instance), data_(data) { } diff --git a/ppapi/shared_impl/ppb_device_ref_shared.h b/ppapi/shared_impl/ppb_device_ref_shared.h index bbdda72..908cace 100644 --- a/ppapi/shared_impl/ppb_device_ref_shared.h +++ b/ppapi/shared_impl/ppb_device_ref_shared.h @@ -29,15 +29,7 @@ class PPAPI_SHARED_EXPORT PPB_DeviceRef_Shared : public Resource, public thunk::PPB_DeviceRef_API { public: - struct InitAsImpl {}; - struct InitAsProxy {}; - - // The dummy arguments control which version of Resource's constructor is - // called for this base class. - PPB_DeviceRef_Shared(const InitAsImpl&, - PP_Instance instance, - const DeviceRefData& data); - PPB_DeviceRef_Shared(const InitAsProxy&, + PPB_DeviceRef_Shared(ResourceObjectType type, PP_Instance instance, const DeviceRefData& data); diff --git a/ppapi/shared_impl/ppb_file_io_shared.cc b/ppapi/shared_impl/ppb_file_io_shared.cc index 7eeab92..63945b5 100644 --- a/ppapi/shared_impl/ppb_file_io_shared.cc +++ b/ppapi/shared_impl/ppb_file_io_shared.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,14 +36,14 @@ PPB_FileIO_Shared::CallbackEntry::~CallbackEntry() { } PPB_FileIO_Shared::PPB_FileIO_Shared(PP_Instance instance) - : Resource(instance), + : Resource(OBJECT_IS_IMPL, instance), file_system_type_(PP_FILESYSTEMTYPE_INVALID), file_open_(false), pending_op_(OPERATION_NONE) { } PPB_FileIO_Shared::PPB_FileIO_Shared(const HostResource& host_resource) - : Resource(host_resource), + : Resource(OBJECT_IS_PROXY, host_resource), file_system_type_(PP_FILESYSTEMTYPE_INVALID), file_open_(false), pending_op_(OPERATION_NONE) { diff --git a/ppapi/shared_impl/ppb_file_ref_shared.cc b/ppapi/shared_impl/ppb_file_ref_shared.cc index 64268b3..b273364 100644 --- a/ppapi/shared_impl/ppb_file_ref_shared.cc +++ b/ppapi/shared_impl/ppb_file_ref_shared.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,23 +9,16 @@ namespace ppapi { -PPB_FileRef_Shared::PPB_FileRef_Shared(const InitAsImpl&, +PPB_FileRef_Shared::PPB_FileRef_Shared(ResourceObjectType type, const PPB_FileRef_CreateInfo& info) - : Resource(info.resource.instance()), - create_info_(info) { - // Should not have been passed a host resource for the trusted constructor. - DCHECK(info.resource.is_null()); - - // Resource's constructor assigned a PP_Resource, so we can fill out our - // host resource now. - create_info_.resource = host_resource(); - DCHECK(!create_info_.resource.is_null()); -} - -PPB_FileRef_Shared::PPB_FileRef_Shared(const InitAsProxy&, - const PPB_FileRef_CreateInfo& info) - : Resource(info.resource), + : Resource(type, info.resource), create_info_(info) { + if (type == OBJECT_IS_IMPL) { + // Resource's constructor assigned a PP_Resource, so we can fill out our + // host resource now. + create_info_.resource = host_resource(); + DCHECK(!create_info_.resource.is_null()); + } } PPB_FileRef_Shared::~PPB_FileRef_Shared() { diff --git a/ppapi/shared_impl/ppb_file_ref_shared.h b/ppapi/shared_impl/ppb_file_ref_shared.h index 3d0a9f8..5decd7f 100644 --- a/ppapi/shared_impl/ppb_file_ref_shared.h +++ b/ppapi/shared_impl/ppb_file_ref_shared.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,11 +33,8 @@ class PPAPI_SHARED_EXPORT PPB_FileRef_Shared : public Resource, public thunk::PPB_FileRef_API { public: - struct InitAsImpl {}; - struct InitAsProxy {}; - - PPB_FileRef_Shared(const InitAsImpl&, const PPB_FileRef_CreateInfo& info); - PPB_FileRef_Shared(const InitAsProxy&, const PPB_FileRef_CreateInfo& info); + PPB_FileRef_Shared(ResourceObjectType type, + const PPB_FileRef_CreateInfo& info); virtual ~PPB_FileRef_Shared(); // Resource overrides. diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/ppapi/shared_impl/ppb_graphics_3d_shared.cc index e21b77e..13184eb 100644 --- a/ppapi/shared_impl/ppb_graphics_3d_shared.cc +++ b/ppapi/shared_impl/ppb_graphics_3d_shared.cc @@ -13,11 +13,11 @@ namespace ppapi { PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(PP_Instance instance) - : Resource(instance) { + : Resource(OBJECT_IS_IMPL, instance) { } PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(const HostResource& host_resource) - : Resource(host_resource) { + : Resource(OBJECT_IS_PROXY, host_resource) { } PPB_Graphics3D_Shared::~PPB_Graphics3D_Shared() { diff --git a/ppapi/shared_impl/ppb_input_event_shared.cc b/ppapi/shared_impl/ppb_input_event_shared.cc index 2cffa0f..4f1a4d0 100644 --- a/ppapi/shared_impl/ppb_input_event_shared.cc +++ b/ppapi/shared_impl/ppb_input_event_shared.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -32,17 +32,10 @@ InputEventData::InputEventData() InputEventData::~InputEventData() { } -PPB_InputEvent_Shared::PPB_InputEvent_Shared(const InitAsImpl&, +PPB_InputEvent_Shared::PPB_InputEvent_Shared(ResourceObjectType type, PP_Instance instance, const InputEventData& data) - : Resource(instance), - data_(data) { -} - -PPB_InputEvent_Shared::PPB_InputEvent_Shared(const InitAsProxy&, - PP_Instance instance, - const InputEventData& data) - : Resource(HostResource::MakeInstanceOnly(instance)), + : Resource(type, instance), data_(data) { } diff --git a/ppapi/shared_impl/ppb_input_event_shared.h b/ppapi/shared_impl/ppb_input_event_shared.h index 1a29750..c9ab572 100644 --- a/ppapi/shared_impl/ppb_input_event_shared.h +++ b/ppapi/shared_impl/ppb_input_event_shared.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -55,15 +55,7 @@ class PPAPI_SHARED_EXPORT PPB_InputEvent_Shared : public Resource, public thunk::PPB_InputEvent_API { public: - struct InitAsImpl {}; - struct InitAsProxy {}; - - // The dummy arguments control which version of Resource's constructor is - // called for this base class. - PPB_InputEvent_Shared(const InitAsImpl&, - PP_Instance instance, - const InputEventData& data); - PPB_InputEvent_Shared(const InitAsProxy&, + PPB_InputEvent_Shared(ResourceObjectType type, PP_Instance instance, const InputEventData& data); diff --git a/ppapi/shared_impl/ppb_resource_array_shared.cc b/ppapi/shared_impl/ppb_resource_array_shared.cc index 9949fd5..f7353f1 100644 --- a/ppapi/shared_impl/ppb_resource_array_shared.cc +++ b/ppapi/shared_impl/ppb_resource_array_shared.cc @@ -12,20 +12,20 @@ using ppapi::thunk::PPB_ResourceArray_API; namespace ppapi { -PPB_ResourceArray_Shared::PPB_ResourceArray_Shared(const InitAsImpl&, +PPB_ResourceArray_Shared::PPB_ResourceArray_Shared(ResourceObjectType type, PP_Instance instance, const PP_Resource elements[], uint32_t size) - : Resource(instance) { - Initialize(elements, size); -} + : Resource(type, instance) { + DCHECK(resources_.empty()); -PPB_ResourceArray_Shared::PPB_ResourceArray_Shared(const InitAsProxy&, - PP_Instance instance, - const PP_Resource elements[], - uint32_t size) - : Resource(HostResource::MakeInstanceOnly(instance)) { - Initialize(elements, size); + resources_.reserve(size); + for (uint32_t index = 0; index < size; ++index) { + PP_Resource element = elements[index]; + if (element) + PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(element); + resources_.push_back(element); + } } PPB_ResourceArray_Shared::~PPB_ResourceArray_Shared() { @@ -48,17 +48,4 @@ PP_Resource PPB_ResourceArray_Shared::GetAt(uint32_t index) { return index < resources_.size() ? resources_[index] : 0; } -void PPB_ResourceArray_Shared::Initialize(const PP_Resource elements[], - uint32_t size) { - DCHECK(resources_.empty()); - - resources_.reserve(size); - for (uint32_t index = 0; index < size; ++index) { - PP_Resource element = elements[index]; - if (element) - PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(element); - resources_.push_back(element); - } -} - } // namespace ppapi diff --git a/ppapi/shared_impl/ppb_resource_array_shared.h b/ppapi/shared_impl/ppb_resource_array_shared.h index 55342e0..e3d6750 100644 --- a/ppapi/shared_impl/ppb_resource_array_shared.h +++ b/ppapi/shared_impl/ppb_resource_array_shared.h @@ -18,20 +18,10 @@ class PPAPI_SHARED_EXPORT PPB_ResourceArray_Shared : public Resource, public thunk::PPB_ResourceArray_API { public: - struct InitAsImpl {}; - struct InitAsProxy {}; - - // The dummy arguments control which version of Resource's constructor is - // called for this base class. - PPB_ResourceArray_Shared(const InitAsImpl&, - PP_Instance instance, - const PP_Resource elements[], - uint32_t size); - PPB_ResourceArray_Shared(const InitAsProxy&, + PPB_ResourceArray_Shared(ResourceObjectType type, PP_Instance instance, const PP_Resource elements[], uint32_t size); - virtual ~PPB_ResourceArray_Shared(); // Resource overrides. @@ -42,8 +32,6 @@ class PPAPI_SHARED_EXPORT PPB_ResourceArray_Shared virtual PP_Resource GetAt(uint32_t index) OVERRIDE; private: - void Initialize(const PP_Resource elements[], uint32_t size); - std::vector<PP_Resource> resources_; DISALLOW_IMPLICIT_CONSTRUCTORS(PPB_ResourceArray_Shared); diff --git a/ppapi/shared_impl/ppb_url_request_info_shared.cc b/ppapi/shared_impl/ppb_url_request_info_shared.cc index f582eac..d7a3ea2 100644 --- a/ppapi/shared_impl/ppb_url_request_info_shared.cc +++ b/ppapi/shared_impl/ppb_url_request_info_shared.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -71,16 +71,10 @@ PPB_URLRequestInfo_Data::~PPB_URLRequestInfo_Data() { } PPB_URLRequestInfo_Shared::PPB_URLRequestInfo_Shared( + ResourceObjectType type, PP_Instance instance, const PPB_URLRequestInfo_Data& data) - : Resource(instance), - data_(data) { -} - -PPB_URLRequestInfo_Shared::PPB_URLRequestInfo_Shared( - const HostResource& host_resource, - const PPB_URLRequestInfo_Data& data) - : Resource(host_resource), + : Resource(type, instance), data_(data) { } diff --git a/ppapi/shared_impl/ppb_url_request_info_shared.h b/ppapi/shared_impl/ppb_url_request_info_shared.h index c07b9c9..7876d23 100644 --- a/ppapi/shared_impl/ppb_url_request_info_shared.h +++ b/ppapi/shared_impl/ppb_url_request_info_shared.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -90,11 +90,9 @@ class PPAPI_SHARED_EXPORT PPB_URLRequestInfo_Shared : public ::ppapi::Resource, public ::ppapi::thunk::PPB_URLRequestInfo_API { public: - // This constructor initializes the object as a proxy object with the given - // host resource. - PPB_URLRequestInfo_Shared(const HostResource& host_resource, - const PPB_URLRequestInfo_Data& data); - + PPB_URLRequestInfo_Shared(ResourceObjectType type, + PP_Instance instance, + const PPB_URLRequestInfo_Data& data); ~PPB_URLRequestInfo_Shared(); // Resource overrides. diff --git a/ppapi/shared_impl/ppb_video_decoder_shared.cc b/ppapi/shared_impl/ppb_video_decoder_shared.cc index 39a4088..b61567b 100644 --- a/ppapi/shared_impl/ppb_video_decoder_shared.cc +++ b/ppapi/shared_impl/ppb_video_decoder_shared.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,14 +13,14 @@ namespace ppapi { PPB_VideoDecoder_Shared::PPB_VideoDecoder_Shared(PP_Instance instance) - : Resource(instance), + : Resource(OBJECT_IS_IMPL, instance), graphics_context_(0), gles2_impl_(NULL) { } PPB_VideoDecoder_Shared::PPB_VideoDecoder_Shared( const HostResource& host_resource) - : Resource(host_resource), + : Resource(OBJECT_IS_PROXY, host_resource), graphics_context_(0), gles2_impl_(NULL) { } diff --git a/ppapi/shared_impl/ppb_view_shared.cc b/ppapi/shared_impl/ppb_view_shared.cc index 8b2f339..1e024a6 100644 --- a/ppapi/shared_impl/ppb_view_shared.cc +++ b/ppapi/shared_impl/ppb_view_shared.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -27,17 +27,10 @@ bool ViewData::Equals(const ViewData& other) const { clip_rect.size.height == other.clip_rect.size.height; } -PPB_View_Shared::PPB_View_Shared(const InitAsImpl&, +PPB_View_Shared::PPB_View_Shared(ResourceObjectType type, PP_Instance instance, const ViewData& data) - : Resource(instance), - data_(data) { -} - -PPB_View_Shared::PPB_View_Shared(const InitAsProxy&, - PP_Instance instance, - const ViewData& data) - : Resource(HostResource::MakeInstanceOnly(instance)), + : Resource(type, instance), data_(data) { } diff --git a/ppapi/shared_impl/ppb_view_shared.h b/ppapi/shared_impl/ppb_view_shared.h index ecfb1a0..59b8e72 100644 --- a/ppapi/shared_impl/ppb_view_shared.h +++ b/ppapi/shared_impl/ppb_view_shared.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -31,15 +31,7 @@ class PPAPI_SHARED_EXPORT PPB_View_Shared : public Resource, public thunk::PPB_View_API { public: - struct InitAsImpl {}; - struct InitAsProxy {}; - - // The dummy arguments control which version of Resource's constructor is - // called for this base class. - PPB_View_Shared(const InitAsImpl&, - PP_Instance instance, - const ViewData& data); - PPB_View_Shared(const InitAsProxy&, + PPB_View_Shared(ResourceObjectType type, PP_Instance instance, const ViewData& data); virtual ~PPB_View_Shared(); diff --git a/ppapi/shared_impl/private/ppb_font_shared.cc b/ppapi/shared_impl/private/ppb_font_shared.cc index 3b4f04b..3918088 100644 --- a/ppapi/shared_impl/private/ppb_font_shared.cc +++ b/ppapi/shared_impl/private/ppb_font_shared.cc @@ -302,41 +302,24 @@ bool PPB_Font_Shared::IsPPFontDescriptionValid( } // static -PP_Resource PPB_Font_Shared::CreateAsImpl( - PP_Instance instance, - const PP_FontDescription_Dev& description, - const ::ppapi::Preferences& prefs) { +PP_Resource PPB_Font_Shared::Create(ResourceObjectType type, + PP_Instance instance, + const PP_FontDescription_Dev& description, + const ::ppapi::Preferences& prefs) { if (!::ppapi::PPB_Font_Shared::IsPPFontDescriptionValid(description)) return 0; - return (new PPB_Font_Shared(InitAsImpl(), instance, description, + return (new PPB_Font_Shared(type, instance, description, prefs))->GetReference(); } -// static -PP_Resource PPB_Font_Shared::CreateAsProxy( - PP_Instance instance, - const PP_FontDescription_Dev& description, - const ::ppapi::Preferences& prefs) { - if (!::ppapi::PPB_Font_Shared::IsPPFontDescriptionValid(description)) - return 0; - return (new PPB_Font_Shared(InitAsProxy(), instance, description, - prefs))->GetReference(); -} - -PPB_Font_Shared::PPB_Font_Shared(const InitAsImpl&, - PP_Instance pp_instance, - const PP_FontDescription_Dev& desc, - const ::ppapi::Preferences& prefs) - : Resource(pp_instance) { - Initialize(desc, prefs); -} - -PPB_Font_Shared::PPB_Font_Shared(const InitAsProxy&, - PP_Instance pp_instance, +PPB_Font_Shared::PPB_Font_Shared(ResourceObjectType type, + PP_Instance instance, const PP_FontDescription_Dev& desc, const ::ppapi::Preferences& prefs) - : Resource(HostResource::MakeInstanceOnly(pp_instance)) { - Initialize(desc, prefs); + : Resource(type, instance) { + StringVar* face_name = StringVar::FromPPVar(desc.face); + font_impl_.reset(new FontImpl( + desc, face_name ? face_name->value() : std::string(), prefs)); } PPB_Font_Shared::~PPB_Font_Shared() { @@ -425,13 +408,5 @@ int32_t PPB_Font_Shared::PixelOffsetForCharacter(const PP_TextRun_Dev* text, return result; } -void PPB_Font_Shared::Initialize(const PP_FontDescription_Dev& desc, - const ::ppapi::Preferences& prefs) { - StringVar* face_name = StringVar::FromPPVar(desc.face); - - font_impl_.reset(new FontImpl( - desc, face_name ? face_name->value() : std::string(), prefs)); -} - } // namespace ppapi diff --git a/ppapi/shared_impl/private/ppb_font_shared.h b/ppapi/shared_impl/private/ppb_font_shared.h index ec34215..8e5bebb 100644 --- a/ppapi/shared_impl/private/ppb_font_shared.h +++ b/ppapi/shared_impl/private/ppb_font_shared.h @@ -33,12 +33,10 @@ class PPAPI_SHARED_EXPORT PPB_Font_Shared virtual ~PPB_Font_Shared(); - static PP_Resource CreateAsImpl(PP_Instance instance, - const PP_FontDescription_Dev& description, - const ::ppapi::Preferences& prefs); - static PP_Resource CreateAsProxy(PP_Instance instance, - const PP_FontDescription_Dev& description, - const ::ppapi::Preferences& prefs); + static PP_Resource Create(ResourceObjectType type, + PP_Instance instance, + const PP_FontDescription_Dev& description, + const ::ppapi::Preferences& prefs); // Resource. virtual ::ppapi::thunk::PPB_Font_API* AsPPB_Font_API() OVERRIDE; @@ -59,23 +57,11 @@ class PPAPI_SHARED_EXPORT PPB_Font_Shared uint32_t char_offset) OVERRIDE; private: - struct InitAsImpl {}; - struct InitAsProxy {}; - - // The dummy arguments control which version of Resource's constructor is - // called for this base class. - PPB_Font_Shared(const InitAsImpl&, - PP_Instance instance, - const PP_FontDescription_Dev& desc, - const ::ppapi::Preferences& prefs); - PPB_Font_Shared(const InitAsProxy&, + PPB_Font_Shared(ResourceObjectType type, PP_Instance instance, const PP_FontDescription_Dev& desc, const ::ppapi::Preferences& prefs); - void Initialize(const PP_FontDescription_Dev& desc, - const ::ppapi::Preferences& prefs); - scoped_ptr< ::ppapi::WebKitForwarding::Font> font_impl_; DISALLOW_COPY_AND_ASSIGN(PPB_Font_Shared); diff --git a/ppapi/shared_impl/private/tcp_socket_private_impl.cc b/ppapi/shared_impl/private/tcp_socket_private_impl.cc index a268801..de99e20 100644 --- a/ppapi/shared_impl/private/tcp_socket_private_impl.cc +++ b/ppapi/shared_impl/private/tcp_socket_private_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,13 +22,13 @@ const int32_t TCPSocketPrivateImpl::kMaxWriteSize = 1024 * 1024; TCPSocketPrivateImpl::TCPSocketPrivateImpl(PP_Instance instance, uint32 socket_id) - : Resource(instance) { + : Resource(OBJECT_IS_IMPL, instance) { Init(socket_id); } TCPSocketPrivateImpl::TCPSocketPrivateImpl(const HostResource& resource, uint32 socket_id) - : Resource(resource) { + : Resource(OBJECT_IS_PROXY, resource) { Init(socket_id); } diff --git a/ppapi/shared_impl/private/udp_socket_private_impl.cc b/ppapi/shared_impl/private/udp_socket_private_impl.cc index 23f125d..d596b02 100644 --- a/ppapi/shared_impl/private/udp_socket_private_impl.cc +++ b/ppapi/shared_impl/private/udp_socket_private_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,13 +22,13 @@ const int32_t UDPSocketPrivateImpl::kMaxWriteSize = 1024 * 1024; UDPSocketPrivateImpl::UDPSocketPrivateImpl(const HostResource& resource, uint32 socket_id) - : Resource(resource) { + : Resource(OBJECT_IS_PROXY, resource) { Init(socket_id); } UDPSocketPrivateImpl::UDPSocketPrivateImpl(PP_Instance instance, uint32 socket_id) - : Resource(instance) { + : Resource(OBJECT_IS_IMPL, instance) { Init(socket_id); } diff --git a/ppapi/shared_impl/resource.cc b/ppapi/shared_impl/resource.cc index 35add15..b8dd315 100644 --- a/ppapi/shared_impl/resource.cc +++ b/ppapi/shared_impl/resource.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,23 +10,34 @@ namespace ppapi { -Resource::Resource(PP_Instance instance) { +Resource::Resource(ResourceObjectType type, PP_Instance instance) + : host_resource_(HostResource::MakeInstanceOnly(instance)) { // The instance should always be valid (nonzero). DCHECK(instance); - // For the in-process case, the host resource and resource are the same. - // - // AddResource needs our instance() getter to work, and that goes through - // the host resource, so we need to fill that first even though we don't - // have a resource ID yet, then fill the resource in later. - host_resource_ = HostResource::MakeInstanceOnly(instance); pp_resource_ = PpapiGlobals::Get()->GetResourceTracker()->AddResource(this); - host_resource_.SetHostResource(instance, pp_resource_); + if (type == OBJECT_IS_IMPL) { + // For the in-process case, the host resource and resource are the same. + // + // Note that we need to have set the instance above (in the initializer + // list) since AddResource needs our instance() getter to work, and that + // goes through the host resource. When we get the "real" resource ID, + // we re-set the host_resource. + host_resource_.SetHostResource(instance, pp_resource_); + } } -Resource::Resource(const HostResource& host_resource) +Resource::Resource(ResourceObjectType type, const HostResource& host_resource) : host_resource_(host_resource) { pp_resource_ = PpapiGlobals::Get()->GetResourceTracker()->AddResource(this); + if (type == OBJECT_IS_IMPL) { + // When using this constructor for the implementation, the resource ID + // should not have been passed in. + DCHECK(host_resource_.host_resource() == 0); + + // See previous constructor. + host_resource_.SetHostResource(host_resource.instance(), pp_resource_); + } } Resource::~Resource() { diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h index 4b26d28..b0876a2 100644 --- a/ppapi/shared_impl/resource.h +++ b/ppapi/shared_impl/resource.h @@ -69,17 +69,44 @@ FOR_ALL_PPAPI_RESOURCE_APIS(DECLARE_RESOURCE_CLASS) #undef DECLARE_RESOURCE_CLASS } // namespace thunk +// Resources have slightly different registration behaviors when the're an +// in-process ("impl") resource in the host (renderer) process, or when they're +// a proxied resource in the plugin process. This enum differentiates those +// cases. +enum ResourceObjectType { + OBJECT_IS_IMPL, + OBJECT_IS_PROXY +}; + class PPAPI_SHARED_EXPORT Resource : public base::RefCounted<Resource> { public: - // For constructing non-proxied objects. This just takes the associated - // instance, and generates a new resource ID. The host resource will be the - // same as the newly-generated resource ID. - explicit Resource(PP_Instance instance); - - // For constructing proxied objects. This takes the resource generated in - // the host side, stores it, and allocates a "local" resource ID for use in - // the current process. - explicit Resource(const HostResource& host_resource); + // Constructor for impl and non-proxied, instance-only objects. + // + // For constructing "impl" (non-proxied) objects, this just takes the + // associated instance, and generates a new resource ID. The host resource + // will be the same as the newly-generated resource ID. For all objects in + // the renderer (host) process, you'll use this constructor and call it with + // OBJECT_IS_IMPL. + // + // For proxied objects, this will create an "instance-only" object which + // lives only in the plugin and doesn't have a corresponding object in the + // host. If you have a host resource ID, use the constructor below which + // takes that HostResource value. + explicit Resource(ResourceObjectType type, PP_Instance instance); + + // For constructing given a host resource. + // + // For OBJECT_IS_PROXY objects, this takes the resource generated in the host + // side, stores it, and allocates a "local" resource ID for use in the + // current process. + // + // For OBJECT_IS_IMPL, the host resource ID must be 0, since there should be + // no host resource generated (impl objects should generate their own). The + // reason for supporting this constructor at all for the IMPL case is that + // some shared objects use a host resource for both modes to keep things the + // same. + explicit Resource(ResourceObjectType type, + const HostResource& host_resource); virtual ~Resource(); diff --git a/ppapi/shared_impl/resource_tracker_unittest.cc b/ppapi/shared_impl/resource_tracker_unittest.cc index a77dc78..26d02c3 100644 --- a/ppapi/shared_impl/resource_tracker_unittest.cc +++ b/ppapi/shared_impl/resource_tracker_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,7 +19,7 @@ int instance_was_deleted_count = 0; class MyMockResource : public Resource { public: - MyMockResource(PP_Instance instance) : Resource(instance) { + MyMockResource(PP_Instance instance) : Resource(OBJECT_IS_IMPL, instance) { mock_resource_alive_count++; } virtual ~MyMockResource() { diff --git a/ppapi/shared_impl/tracked_callback_unittest.cc b/ppapi/shared_impl/tracked_callback_unittest.cc index 62da396..ca4d3b1 100644 --- a/ppapi/shared_impl/tracked_callback_unittest.cc +++ b/ppapi/shared_impl/tracked_callback_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -80,7 +80,7 @@ class CallbackShutdownTest : public TrackedCallbackTest { // Tests that callbacks are properly aborted on module shutdown. TEST_F(CallbackShutdownTest, AbortOnShutdown) { - scoped_refptr<Resource> resource(new Resource(pp_instance())); + scoped_refptr<Resource> resource(new Resource(OBJECT_IS_IMPL, pp_instance())); // Set up case (1) (see above). EXPECT_EQ(0U, info_did_run().run_count); @@ -133,7 +133,8 @@ class CallbackResourceTest : public TrackedCallbackTest { class CallbackMockResource : public Resource { public: - CallbackMockResource(PP_Instance instance) : Resource(instance) {} + CallbackMockResource(PP_Instance instance) + : Resource(OBJECT_IS_IMPL, instance) {} ~CallbackMockResource() {} PP_Resource SetupForTest() { diff --git a/webkit/plugins/ppapi/mock_resource.h b/webkit/plugins/ppapi/mock_resource.h index 3db87f6..01f7fb6 100644 --- a/webkit/plugins/ppapi/mock_resource.h +++ b/webkit/plugins/ppapi/mock_resource.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,7 +15,8 @@ namespace ppapi { // static_cast to get its own implementation. class MockResource : public ::ppapi::Resource { public: - MockResource(PP_Instance instance) : Resource(instance) {} + MockResource(PP_Instance instance) + : Resource(::ppapi::OBJECT_IS_IMPL, instance) {} virtual ~MockResource() {} }; diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index fc7fb75..a1f541a 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -596,8 +596,7 @@ bool PluginInstance::SendCompositionEventWithUnderlineInformationToPlugin( else handled = true; // Unfiltered events are assumed to be handled. scoped_refptr<PPB_InputEvent_Shared> event_resource( - new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), - pp_instance(), event)); + new PPB_InputEvent_Shared(::ppapi::OBJECT_IS_IMPL, pp_instance(), event)); handled |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( pp_instance(), event_resource->pp_resource())); return handled; @@ -697,7 +696,7 @@ bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event, else rv = true; // Unfiltered events are assumed to be handled. scoped_refptr<PPB_InputEvent_Shared> event_resource( - new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), + new PPB_InputEvent_Shared(::ppapi::OBJECT_IS_IMPL, pp_instance(), events[i])); rv |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent( @@ -1054,7 +1053,7 @@ void PluginInstance::SendDidChangeView(const ViewData& previous_view) { sent_initial_did_change_view_ = true; ScopedPPResource resource( ScopedPPResource::PassRef(), - (new PPB_View_Shared(PPB_View_Shared::InitAsImpl(), + (new PPB_View_Shared(::ppapi::OBJECT_IS_IMPL, pp_instance(), view_data_))->GetReference()); instance_interface_->DidChangeView(pp_instance(), resource, diff --git a/webkit/plugins/ppapi/ppb_audio_impl.cc b/webkit/plugins/ppapi/ppb_audio_impl.cc index 9408897..152c4f5 100644 --- a/webkit/plugins/ppapi/ppb_audio_impl.cc +++ b/webkit/plugins/ppapi/ppb_audio_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -28,7 +28,7 @@ namespace ppapi { // PPB_Audio_Impl -------------------------------------------------------------- PPB_Audio_Impl::PPB_Audio_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), audio_(NULL) { } diff --git a/webkit/plugins/ppapi/ppb_audio_input_impl.cc b/webkit/plugins/ppapi/ppb_audio_input_impl.cc index 3f2a672..ff9cb06 100644 --- a/webkit/plugins/ppapi/ppb_audio_input_impl.cc +++ b/webkit/plugins/ppapi/ppb_audio_input_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -28,7 +28,7 @@ namespace ppapi { // PPB_AudioInput_Impl --------------------------------------------------------- PPB_AudioInput_Impl::PPB_AudioInput_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), audio_input_(NULL) { } diff --git a/webkit/plugins/ppapi/ppb_broker_impl.cc b/webkit/plugins/ppapi/ppb_broker_impl.cc index 42273a1..6f69e8d 100644 --- a/webkit/plugins/ppapi/ppb_broker_impl.cc +++ b/webkit/plugins/ppapi/ppb_broker_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,7 +20,7 @@ namespace ppapi { // PPB_Broker_Impl ------------------------------------------------------ PPB_Broker_Impl::PPB_Broker_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), broker_(NULL), connect_callback_(), pipe_handle_(PlatformFileToInt(base::kInvalidPlatformFileValue)) { diff --git a/webkit/plugins/ppapi/ppb_buffer_impl.cc b/webkit/plugins/ppapi/ppb_buffer_impl.cc index dc3e70f..9a9ccbb 100644 --- a/webkit/plugins/ppapi/ppb_buffer_impl.cc +++ b/webkit/plugins/ppapi/ppb_buffer_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,7 +22,7 @@ namespace webkit { namespace ppapi { PPB_Buffer_Impl::PPB_Buffer_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), size_(0), map_count_(0) { } diff --git a/webkit/plugins/ppapi/ppb_directory_reader_impl.cc b/webkit/plugins/ppapi/ppb_directory_reader_impl.cc index 7992ce7..2f38121 100644 --- a/webkit/plugins/ppapi/ppb_directory_reader_impl.cc +++ b/webkit/plugins/ppapi/ppb_directory_reader_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -56,7 +56,7 @@ FilePath::StringType UTF8StringToFilePathString(const std::string& str) { PPB_DirectoryReader_Impl::PPB_DirectoryReader_Impl( PPB_FileRef_Impl* directory_ref) - : Resource(directory_ref->pp_instance()), + : Resource(::ppapi::OBJECT_IS_IMPL, directory_ref->pp_instance()), directory_ref_(directory_ref), has_more_(true), entry_(NULL) { diff --git a/webkit/plugins/ppapi/ppb_file_chooser_impl.cc b/webkit/plugins/ppapi/ppb_file_chooser_impl.cc index 38e8f16..522007c 100644 --- a/webkit/plugins/ppapi/ppb_file_chooser_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_chooser_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -69,7 +69,7 @@ PPB_FileChooser_Impl::PPB_FileChooser_Impl( PP_Instance instance, PP_FileChooserMode_Dev mode, const char* accept_mime_types) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), mode_(mode), next_chosen_file_index_(0) { if (accept_mime_types) diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.cc b/webkit/plugins/ppapi/ppb_file_ref_impl.cc index 4e9abc5..cdd044b 100644 --- a/webkit/plugins/ppapi/ppb_file_ref_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_ref_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -80,14 +80,14 @@ std::string GetNameForVirtualFilePath(const std::string& path) { PPB_FileRef_Impl::PPB_FileRef_Impl(const PPB_FileRef_CreateInfo& info, PPB_FileSystem_Impl* file_system) - : PPB_FileRef_Shared(PPB_FileRef_Shared::InitAsImpl(), info), + : PPB_FileRef_Shared(::ppapi::OBJECT_IS_IMPL, info), file_system_(file_system), external_file_system_path_() { } PPB_FileRef_Impl::PPB_FileRef_Impl(const PPB_FileRef_CreateInfo& info, const FilePath& external_file_path) - : PPB_FileRef_Shared(PPB_FileRef_Shared::InitAsImpl(), info), + : PPB_FileRef_Shared(::ppapi::OBJECT_IS_IMPL, info), file_system_(), external_file_system_path_(external_file_path) { } diff --git a/webkit/plugins/ppapi/ppb_file_system_impl.cc b/webkit/plugins/ppapi/ppb_file_system_impl.cc index 6d6df5d..9428e3a 100644 --- a/webkit/plugins/ppapi/ppb_file_system_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_system_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -27,7 +27,7 @@ namespace ppapi { PPB_FileSystem_Impl::PPB_FileSystem_Impl(PP_Instance instance, PP_FileSystemType type) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), type_(type), opened_(false), called_open_(false) { diff --git a/webkit/plugins/ppapi/ppb_flash_menu_impl.cc b/webkit/plugins/ppapi/ppb_flash_menu_impl.cc index 6c181d0..aa3f768 100644 --- a/webkit/plugins/ppapi/ppb_flash_menu_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_menu_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -97,7 +97,7 @@ bool ConvertMenuData(const PP_Flash_Menu* in_menu, } // namespace PPB_Flash_Menu_Impl::PPB_Flash_Menu_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), selected_id_out_(NULL) { } diff --git a/webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc b/webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc index ccefd18..8a3ff48 100644 --- a/webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc @@ -41,7 +41,7 @@ class PPB_Flash_MessageLoop_Impl::State }; PPB_Flash_MessageLoop_Impl::PPB_Flash_MessageLoop_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), state_(new State()) { } diff --git a/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc b/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc index 62ad9b9..b3db5ac 100644 --- a/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,7 +19,7 @@ namespace webkit { namespace ppapi { PPB_Flash_NetConnector_Impl::PPB_Flash_NetConnector_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), socket_out_(NULL), local_addr_out_(NULL), remote_addr_out_(NULL) { diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc index 5384b0f..9be560a 100644 --- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc +++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc @@ -154,7 +154,7 @@ struct PPB_Graphics2D_Impl::QueuedOperation { }; PPB_Graphics2D_Impl::PPB_Graphics2D_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), bound_instance_(NULL), offscreen_flush_pending_(false), is_always_opaque_(false), diff --git a/webkit/plugins/ppapi/ppb_image_data_impl.cc b/webkit/plugins/ppapi/ppb_image_data_impl.cc index fa30601..ea5f2c6 100644 --- a/webkit/plugins/ppapi/ppb_image_data_impl.cc +++ b/webkit/plugins/ppapi/ppb_image_data_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,7 +26,7 @@ namespace webkit { namespace ppapi { PPB_ImageData_Impl::PPB_ImageData_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), format_(PP_IMAGEDATAFORMAT_BGRA_PREMUL), width_(0), height_(0) { diff --git a/webkit/plugins/ppapi/ppb_layer_compositor_impl.cc b/webkit/plugins/ppapi/ppb_layer_compositor_impl.cc index 43b5dc0..542feb1 100644 --- a/webkit/plugins/ppapi/ppb_layer_compositor_impl.cc +++ b/webkit/plugins/ppapi/ppb_layer_compositor_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,7 +13,7 @@ namespace webkit { namespace ppapi { PPB_LayerCompositor_Impl::PPB_LayerCompositor_Impl(PP_Instance instance) - : Resource(instance) { + : Resource(::ppapi::OBJECT_IS_IMPL, instance) { } PPB_LayerCompositor_Impl::~PPB_LayerCompositor_Impl() { diff --git a/webkit/plugins/ppapi/ppb_transport_impl.cc b/webkit/plugins/ppapi/ppb_transport_impl.cc index e0d90ad..caa60e4 100644 --- a/webkit/plugins/ppapi/ppb_transport_impl.cc +++ b/webkit/plugins/ppapi/ppb_transport_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -69,7 +69,7 @@ WebKit::WebFrame* GetFrameForResource(const ::ppapi::Resource* resource) { } // namespace PPB_Transport_Impl::PPB_Transport_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), type_(PP_TRANSPORTTYPE_DATAGRAM), started_(false), writable_(false) { diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.cc b/webkit/plugins/ppapi/ppb_url_loader_impl.cc index eccdfe5..7e4fdef 100644 --- a/webkit/plugins/ppapi/ppb_url_loader_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_loader_impl.cc @@ -67,7 +67,7 @@ WebFrame* GetFrameForResource(const Resource* resource) { PPB_URLLoader_Impl::PPB_URLLoader_Impl(PP_Instance instance, bool main_document_loader) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), main_document_loader_(main_document_loader), pending_callback_(), bytes_sent_(0), diff --git a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc index 421b39a..2d8af89 100644 --- a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc @@ -49,7 +49,7 @@ const int32_t kDefaultPrefetchBufferLowerThreshold = 50 * 1000 * 1000; PPB_URLRequestInfo_Impl::PPB_URLRequestInfo_Impl( PP_Instance instance, const PPB_URLRequestInfo_Data& data) - : PPB_URLRequestInfo_Shared(instance, data) { + : PPB_URLRequestInfo_Shared(::ppapi::OBJECT_IS_IMPL, instance, data) { } PPB_URLRequestInfo_Impl::~PPB_URLRequestInfo_Impl() { diff --git a/webkit/plugins/ppapi/ppb_url_response_info_impl.cc b/webkit/plugins/ppapi/ppb_url_response_info_impl.cc index cb96f8e..20950fe 100644 --- a/webkit/plugins/ppapi/ppb_url_response_info_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_response_info_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -51,7 +51,7 @@ bool IsRedirect(int32_t status) { } // namespace PPB_URLResponseInfo_Impl::PPB_URLResponseInfo_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), status_code_(-1) { } diff --git a/webkit/plugins/ppapi/ppb_video_capture_impl.cc b/webkit/plugins/ppapi/ppb_video_capture_impl.cc index f2cb26c..63a19a4 100644 --- a/webkit/plugins/ppapi/ppb_video_capture_impl.cc +++ b/webkit/plugins/ppapi/ppb_video_capture_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -37,7 +37,7 @@ namespace webkit { namespace ppapi { PPB_VideoCapture_Impl::PPB_VideoCapture_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), buffer_count_hint_(0), ppp_videocapture_(NULL), status_(PP_VIDEO_CAPTURE_STATUS_STOPPED), diff --git a/webkit/plugins/ppapi/ppb_video_layer_impl.cc b/webkit/plugins/ppapi/ppb_video_layer_impl.cc index aa90f13..5b9a8a962 100644 --- a/webkit/plugins/ppapi/ppb_video_layer_impl.cc +++ b/webkit/plugins/ppapi/ppb_video_layer_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,7 +14,7 @@ namespace webkit { namespace ppapi { PPB_VideoLayer_Impl::PPB_VideoLayer_Impl(PP_Instance instance) - : Resource(instance) { + : Resource(::ppapi::OBJECT_IS_IMPL, instance) { } PPB_VideoLayer_Impl::~PPB_VideoLayer_Impl() { diff --git a/webkit/plugins/ppapi/ppb_websocket_impl.cc b/webkit/plugins/ppapi/ppb_websocket_impl.cc index 61d6bc1..0a55e52 100644 --- a/webkit/plugins/ppapi/ppb_websocket_impl.cc +++ b/webkit/plugins/ppapi/ppb_websocket_impl.cc @@ -78,7 +78,7 @@ namespace webkit { namespace ppapi { PPB_WebSocket_Impl::PPB_WebSocket_Impl(PP_Instance instance) - : Resource(instance), + : Resource(::ppapi::OBJECT_IS_IMPL, instance), state_(PP_WEBSOCKETREADYSTATE_INVALID), error_was_received_(false), receive_callback_var_(NULL), diff --git a/webkit/plugins/ppapi/ppb_widget_impl.cc b/webkit/plugins/ppapi/ppb_widget_impl.cc index c071067..306a1b5 100644 --- a/webkit/plugins/ppapi/ppb_widget_impl.cc +++ b/webkit/plugins/ppapi/ppb_widget_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,7 +22,7 @@ namespace webkit { namespace ppapi { PPB_Widget_Impl::PPB_Widget_Impl(PP_Instance instance) - : Resource(instance) { + : Resource(::ppapi::OBJECT_IS_IMPL, instance) { memset(&location_, 0, sizeof(location_)); } diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc index 36b652c..e0ca2fe 100644 --- a/webkit/plugins/ppapi/resource_creation_impl.cc +++ b/webkit/plugins/ppapi/resource_creation_impl.cc @@ -70,8 +70,8 @@ PP_Resource ResourceCreationImpl::CreateAudioConfig( PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t sample_frame_count) { - return ::ppapi::PPB_AudioConfig_Shared::CreateAsImpl(instance, sample_rate, - sample_frame_count); + return ::ppapi::PPB_AudioConfig_Shared::Create( + ::ppapi::OBJECT_IS_IMPL, instance, sample_rate, sample_frame_count); } PP_Resource ResourceCreationImpl::CreateAudioTrusted( @@ -152,8 +152,9 @@ PP_Resource ResourceCreationImpl::CreateFontObject( ResourceHelper::PPInstanceToPluginInstance(instance); if (!plugin_instance) return 0; - return ::ppapi::PPB_Font_Shared::CreateAsImpl( - instance, *description, plugin_instance->delegate()->GetPreferences()); + return ::ppapi::PPB_Font_Shared::Create( + ::ppapi::OBJECT_IS_IMPL, instance, *description, + plugin_instance->delegate()->GetPreferences()); } PP_Resource ResourceCreationImpl::CreateGraphics2D( @@ -209,7 +210,7 @@ PP_Resource ResourceCreationImpl::CreateKeyboardInputEvent( data.character_text = string_var->value(); } - return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), + return (new PPB_InputEvent_Shared(::ppapi::OBJECT_IS_IMPL, instance, data))->GetReference(); } @@ -238,7 +239,7 @@ PP_Resource ResourceCreationImpl::CreateMouseInputEvent( data.mouse_click_count = click_count; data.mouse_movement = *mouse_movement; - return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), + return (new PPB_InputEvent_Shared(::ppapi::OBJECT_IS_IMPL, instance, data))->GetReference(); } @@ -252,7 +253,7 @@ PP_Resource ResourceCreationImpl::CreateResourceArray( const PP_Resource elements[], uint32_t size) { PPB_ResourceArray_Shared* object = new PPB_ResourceArray_Shared( - PPB_ResourceArray_Shared::InitAsImpl(), instance, elements, size); + ::ppapi::OBJECT_IS_IMPL, instance, elements, size); return object->GetReference(); } @@ -323,7 +324,7 @@ PP_Resource ResourceCreationImpl::CreateWheelInputEvent( data.wheel_ticks = *wheel_ticks; data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); - return (new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsImpl(), + return (new PPB_InputEvent_Shared(::ppapi::OBJECT_IS_IMPL, instance, data))->GetReference(); } |