From b13d97055622647b8fc4b3f465817c95c7e681f2 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Wed, 11 Dec 2019 15:59:06 +0530 Subject: [PATCH 01/16] [M76 Migration] Remove EWK_BRINGUP in client_native_pixmap_factory_efl.cc Reference: https://review.tizen.org/gerrit/#/c/200795/ Change-Id: Icf7bc9d89650fa842331a15828a0b2acddf03f03 Signed-off-by: Chandan Padhi (cherry picked from commit 4c0b4519a409ef83204cd5803176d609d316823d) (cherry picked from commit 449ee01c7ee49893b6b79a67bc719d3396c7f425) --- .../ui/ozone/client_native_pixmap_factory_efl.cc | 6 ------ .../ui/ozone/client_native_pixmap_factory_efl.h | 15 ++++++++------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/tizen_src/chromium_impl/ui/ozone/client_native_pixmap_factory_efl.cc b/tizen_src/chromium_impl/ui/ozone/client_native_pixmap_factory_efl.cc index f7c3262..246a1b1 100644 --- a/tizen_src/chromium_impl/ui/ozone/client_native_pixmap_factory_efl.cc +++ b/tizen_src/chromium_impl/ui/ozone/client_native_pixmap_factory_efl.cc @@ -9,13 +9,7 @@ namespace ui { gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryEfl() { - //#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // [m63_3239] - // error: cannot convert ‘gfx::ClientNativePixmapFactory*’ to - // ‘ui::ClientNativePixmapFactory* return CreateStubClientNativePixmapFactory(); - //#endif } } // namespace ui - diff --git a/tizen_src/chromium_impl/ui/ozone/client_native_pixmap_factory_efl.h b/tizen_src/chromium_impl/ui/ozone/client_native_pixmap_factory_efl.h index 39b2570..82da9e41 100644 --- a/tizen_src/chromium_impl/ui/ozone/client_native_pixmap_factory_efl.h +++ b/tizen_src/chromium_impl/ui/ozone/client_native_pixmap_factory_efl.h @@ -2,17 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef OZONE_PIXMAP_FACTORY_EFL_H_ -#define OZONE_PIXMAP_FACTORY_EFL_H_ +#ifndef UI_OZONE_CLIENT_NATIVE_PIXMAP_FACTORY_EFL_H_ +#define UI_OZONE_CLIENT_NATIVE_PIXMAP_FACTORY_EFL_H_ namespace gfx { - class ClientNativePixmapFactory; +} -// Constructor hook for use in constructor_list.cc -ClientNativePixmapFactory* CreateClientNativePixmapFactoryEfl(); +namespace ui { -} // namespace gfx +// Constructor hook for use in constructor_list.cc +gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryEfl(); -#endif // OZONE_PIXMAP_FACTORY_EFL_H_ +} // namespace ui +#endif // UI_OZONE_CLIENT_NATIVE_PIXMAP_FACTORY_EFL_H_ -- 2.7.4 From 3078be1ac51c7a49535ce2def37661c616479af1 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Mon, 16 Dec 2019 15:53:27 +0530 Subject: [PATCH 02/16] [M76 Migration] Remove EvasGLOutputSurfaceClient Based on upstream changes, an OutputSurfaceClient is no longer mandatory for an OutputSurface. EvasGLRenderer doesn't need one. Hence, removing the same. Reference: https://review.tizen.org/gerrit/#/c/195584/ Change-Id: Idc83e8ae86b29c28290feb857e921bc79135c22e Signed-off-by: Chandan Padhi (cherry picked from commit 6fc6959918df5643a9bc6f9d1e1f412b305014e2) --- .../compositor/evasgl_delegated_frame_host.cc | 3 --- .../compositor/evasgl_delegated_frame_host.h | 2 -- .../compositor/evasgl_output_surface_client.h | 31 ---------------------- 3 files changed, 36 deletions(-) delete mode 100644 tizen_src/chromium_impl/content/browser/compositor/evasgl_output_surface_client.h diff --git a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc index b260f29..d48539a 100644 --- a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc +++ b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc @@ -9,7 +9,6 @@ #include "components/viz/service/display/display_resource_provider.h" #include "components/viz/service/display/gl_renderer.h" #include "content/browser/compositor/evasgl_output_surface.h" -#include "content/browser/compositor/evasgl_output_surface_client.h" #include "ui/display/device_display_info_efl.h" namespace content { @@ -28,10 +27,8 @@ void EvasGLDelegatedFrameHost::Initialize() { context_provider_ = scoped_refptr( new EvasGLContextProvider(client_->GetEvasGLAPI())); - output_surface_client_.reset(new EvasGLOutputSurfaceClient); output_surface_ = std::unique_ptr( new EvasGLOutputSurface(context_provider_)); - output_surface_->BindToClient(output_surface_client_.get()); resource_provider_ = std::make_unique( viz::DisplayResourceProvider::kGpu, output_surface_->context_provider(), diff --git a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h index 2f3d108..5df4e13 100644 --- a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h +++ b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h @@ -23,7 +23,6 @@ class DisplayResourceProvider; namespace content { class EvasGLContextProvider; -class EvasGLOutputSurfaceClient; class CONTENT_EXPORT EvasGLDelegatedFrameHostClient { public: @@ -59,7 +58,6 @@ class CONTENT_EXPORT EvasGLDelegatedFrameHost EvasGLDelegatedFrameHostClient* client_; // TODO(prashant.n): Decouple context provider and surface from this class. scoped_refptr context_provider_; - std::unique_ptr output_surface_client_; std::unique_ptr output_surface_; viz::RendererSettings settings_; std::unique_ptr resource_provider_; diff --git a/tizen_src/chromium_impl/content/browser/compositor/evasgl_output_surface_client.h b/tizen_src/chromium_impl/content/browser/compositor/evasgl_output_surface_client.h deleted file mode 100644 index 43f2c15..0000000 --- a/tizen_src/chromium_impl/content/browser/compositor/evasgl_output_surface_client.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_COMPOSITOR_EVASGL_OUTPUT_SURFACE_CLIENT_H_ -#define CONTENT_BROWSER_COMPOSITOR_EVASGL_OUTPUT_SURFACE_CLIENT_H_ - -#include "components/viz/service/display/output_surface_client.h" - -namespace content { - -class EvasGLOutputSurfaceClient : public viz::OutputSurfaceClient { - public: - EvasGLOutputSurfaceClient() = default; - - void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override {} - void DidReceiveSwapBuffersAck() override {} - void DidReceiveTextureInUseResponses( - const gpu::TextureInUseResponses& responses) override {} - void DidReceiveCALayerParams( - const gfx::CALayerParams& ca_layer_params) override {} - void DidSwapWithSize(const gfx::Size& pixel_size) override {} - void DidFinishLatencyInfo( - const std::vector& latency_info) override {} - void DidReceivePresentationFeedback( - const gfx::PresentationFeedback& feedback) override {} -}; - -} // namespace content - -#endif // CONTENT_BROWSER_COMPOSITOR_EVASGL_OUTPUT_SURFACE_CLIENT_H_ -- 2.7.4 From b3deaef379755a754e479cc51b5ba571e98631a0 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Mon, 16 Dec 2019 18:33:48 +0530 Subject: [PATCH 03/16] [M76 Migration] Remove redundant glGetIntegerv call glGetIntegerv call is expensive and its usage is generally not recommended. As we already know the value of |current_program|, glGetIntegerv call becomes redundant and can be avoided. Reference: https://review.tizen.org/gerrit/#/c/195981/ Change-Id: I406a6af1452d3a49fbeffbf402db4f2864435af8 Signed-off-by: Chandan Padhi (cherry picked from commit 11dce8ecc6c073019b3002b679358511a37d9ce4) --- .../command_buffer/client/gles2_implementation_efl.cc | 18 +++++++----------- .../command_buffer/client/gles2_implementation_efl.h | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tizen_src/chromium_impl/gpu/command_buffer/client/gles2_implementation_efl.cc b/tizen_src/chromium_impl/gpu/command_buffer/client/gles2_implementation_efl.cc index a13af8b..ced0a1c 100644 --- a/tizen_src/chromium_impl/gpu/command_buffer/client/gles2_implementation_efl.cc +++ b/tizen_src/chromium_impl/gpu/command_buffer/client/gles2_implementation_efl.cc @@ -84,8 +84,6 @@ bool GLES2ImplementationEfl::HasGrContextSupport() const { GLES2ImplementationEfl::ProgramData& GLES2ImplementationEfl::GetProgramData( GLint program) { - if (program == -1) - program = current_program_; auto it_program = program_map_.find(program); DCHECK(it_program != program_map_.end()); return it_program->second; @@ -93,16 +91,15 @@ GLES2ImplementationEfl::ProgramData& GLES2ImplementationEfl::GetProgramData( GLuint GLES2ImplementationEfl::DoCreateProgram() { GLuint program = evas_gl_api_->glCreateProgram(); - program_map_[program] = ProgramData(); - auto it_program = program_map_.find(program); - DCHECK(it_program != program_map_.end()); - it_program->second.service_id_ = program; + ProgramData program_data; + program_data.service_id_ = program; + program_map_[program] = program_data; return program; } void GLES2ImplementationEfl::DoUseProgram(GLuint program) { evas_gl_api_->glUseProgram(program); - evas_gl_api_->glGetIntegerv(GL_CURRENT_PROGRAM, ¤t_program_); + current_program_ = program; } void GLES2ImplementationEfl::DoDeleteProgram(GLuint program) { @@ -111,15 +108,14 @@ void GLES2ImplementationEfl::DoDeleteProgram(GLuint program) { } GLint GLES2ImplementationEfl::GetBoundUniformLocation(GLint location) { - const ProgramData& program_data = GetProgramData(); + const ProgramData& program_data = GetProgramData(current_program_); auto it_location = program_data.uniform_location_map_.find(location); DCHECK(it_location != program_data.uniform_location_map_.end()); const std::string& name = it_location->second; - GLint newloc = evas_gl_api_->glGetUniformLocation(program_data.service_id_, - name.c_str()); - return newloc; + return evas_gl_api_->glGetUniformLocation(program_data.service_id_, + name.c_str()); } void GLES2ImplementationEfl::DoBindUniformLocationCHROMIUM(GLuint program, diff --git a/tizen_src/chromium_impl/gpu/command_buffer/client/gles2_implementation_efl.h b/tizen_src/chromium_impl/gpu/command_buffer/client/gles2_implementation_efl.h index aff5f11..e41f46b 100644 --- a/tizen_src/chromium_impl/gpu/command_buffer/client/gles2_implementation_efl.h +++ b/tizen_src/chromium_impl/gpu/command_buffer/client/gles2_implementation_efl.h @@ -158,7 +158,7 @@ class GLES2_IMPL_EXPORT GLES2ImplementationEfl : public ContextSupport, std::set textures_; GLint GetBoundUniformLocation(GLint location); - ProgramData& GetProgramData(GLint program = -1); + ProgramData& GetProgramData(GLint program); }; } // namespace gles2 -- 2.7.4 From 730947ce5da119ba158a5ee74bea9a26490c20b3 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Fri, 20 Dec 2019 12:08:48 +0530 Subject: [PATCH 04/16] [M76 Migration] Fix Pinch Zoom id is missed in ui::TouchEvent object. This patch fills ui::PointerDetails with id and POINTER_TYPE_TOUCH. Reference: https://review.tizen.org/gerrit/#/c/200850/ Change-Id: I5f7781c8d8a3a8433f731625b06f75bb8f1dd9ba Signed-off-by: Chandan Padhi (cherry picked from commit e34acd8c055ea97c8c48838a9ce534c9ee07fdd0) --- .../content/browser/renderer_host/web_event_factory_efl.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/web_event_factory_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/web_event_factory_efl.cc index e3223f4..7a7ddf3 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/web_event_factory_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/web_event_factory_efl.cc @@ -525,10 +525,10 @@ ui::TouchEvent MakeTouchEvent(Evas_Coord_Point pt, if (timestamp == 0) event_timestamp = ui::EventTimeForNow(); - // FIXME: M63 bring up. Fill up pointer details - return ui::TouchEvent(EvasTouchEventTypeToUI(state), - gfx::Point(pt.x / scale, pt.y / scale), event_timestamp, - ui::PointerDetails()); + return ui::TouchEvent( + EvasTouchEventTypeToUI(state), gfx::Point(pt.x / scale, pt.y / scale), + event_timestamp, + ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, id)); } template WebGestureEvent MakeGestureEvent( -- 2.7.4 From c8ad7abbb98b1ce38ae338de11977b55c768c0e3 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Fri, 20 Dec 2019 14:20:51 +0530 Subject: [PATCH 05/16] [M76 Migration][Rendering] Fix scale factor for wearable Currently, device scale factor for wearable profile is calculated similar to that for mobile profile. But in case of wearable profile, device scale factor should be "1.0". Reference: https://review.tizen.org/gerrit/#/c/200822/ Change-Id: I43dd3a79aaed61834138f0a6f5604c5ccd6961de Signed-off-by: Chandan Padhi (cherry picked from commit 8ac80870195691dbc4bae901db444358564015a6) --- tizen_src/chromium_impl/ui/display/device_display_info_efl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc b/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc index f65fde8..8d522c0 100644 --- a/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc +++ b/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc @@ -169,7 +169,7 @@ int DeviceDisplayInfoEfl::GetDisplayHeight() const { } double DeviceDisplayInfoEfl::ComputeDIPScale(int dpi) const { - if (IsMobileProfile() || IsWearableProfile()) { + if (IsMobileProfile()) { double dip_scale = static_cast(GetDensityRange(dpi)); DCHECK(dip_scale); dip_scale /= kBaselineDPIDensity; -- 2.7.4 From 7054b13c6cc7fc42fd6398d3034bb445ed36bc93 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Fri, 20 Dec 2019 14:14:38 +0530 Subject: [PATCH 06/16] [M76 Migration] Remove pixmap related files This commit removes pixmap related files as we no longer use X11. Reference: https://review.tizen.org/gerrit/c/200799/ Change-Id: Idc30180aa041954b9dbba3f4c3a7fe74f1c51087 Signed-off-by: Chandan Padhi (cherry picked from commit 35cdc5074febf42bc3865e1406aac11b8e0ee396) --- .../gpu/client/gpu_memory_buffer_impl_efl.cc | 134 ----- .../client/gpu_memory_buffer_impl_efl_pixmap.cc | 202 ------- .../gpu/client/gpu_memory_buffer_impl_efl_pixmap.h | 69 --- .../common/gpu/gpu_memory_buffer_factory_efl.cc | 112 ---- .../gpu/gpu_memory_buffer_factory_efl_pixmap.cc | 61 --- .../gpu/gpu_memory_buffer_factory_efl_pixmap.h | 52 -- tizen_src/chromium_impl/ui/gl/efl_pixmap.cc | 578 --------------------- tizen_src/chromium_impl/ui/gl/efl_pixmap.h | 109 ---- .../chromium_impl/ui/gl/gl_image_efl_pixmap.cc | 144 ----- .../chromium_impl/ui/gl/gl_image_efl_pixmap.h | 60 --- 10 files changed, 1521 deletions(-) delete mode 100644 tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl.cc delete mode 100644 tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.cc delete mode 100644 tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.h delete mode 100644 tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl.cc delete mode 100644 tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.cc delete mode 100644 tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.h delete mode 100644 tizen_src/chromium_impl/ui/gl/efl_pixmap.cc delete mode 100644 tizen_src/chromium_impl/ui/gl/efl_pixmap.h delete mode 100644 tizen_src/chromium_impl/ui/gl/gl_image_efl_pixmap.cc delete mode 100644 tizen_src/chromium_impl/ui/gl/gl_image_efl_pixmap.h diff --git a/tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl.cc b/tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl.cc deleted file mode 100644 index 15c7559..0000000 --- a/tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl.cc +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - - -#include "base/command_line.h" -#include "content/common/gpu/client/gpu_memory_buffer_impl.h" -#include "content/public/common/content_switches.h" - - -#include "content/common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.h" -#include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" - -#include "base/process/process.h" -#include "base/threading/platform_thread.h" - -namespace content { - -namespace { -static bool IsZeroCopyEnabled() { - static bool zero_copy_enabled = - CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableZeroCopy); - return zero_copy_enabled; -} -} - -// static -void GpuMemoryBufferImpl::Create(gfx::GpuMemoryBufferId id, - const gfx::Size& size, - Format format, - Usage usage, - int client_id, - const CreationCallback& callback) { - // TODO: Rendering TG will implement following for Wayland. -#if !defined(WAYLAND_BRINGUP) - if (IsZeroCopyEnabled() && - GpuMemoryBufferImplEflPixmap::IsConfigurationSupported(format, usage)) { - GpuMemoryBufferImplEflPixmap::Create(id, size, format, client_id, callback); - return; - } -#else - NOTIMPLEMENTED(); -#endif - - if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, format, usage)) { - GpuMemoryBufferImplSharedMemory::Create(id, size, format, callback); - return; - } - - callback.Run(scoped_ptr()); -} - -// static -void GpuMemoryBufferImpl::AllocateForChildProcess( - gfx::GpuMemoryBufferId id, - const gfx::Size& size, - Format format, - Usage usage, - base::ProcessHandle child_process, - int child_client_id, - const AllocationCallback& callback) { - // TODO: Rendering TG will implement following for Wayland. -#if !defined(WAYLAND_BRINGUP) - if (IsZeroCopyEnabled() && - GpuMemoryBufferImplEflPixmap::IsConfigurationSupported(format, usage)) { - GpuMemoryBufferImplEflPixmap::AllocateForChildProcess( - id, size, format, child_client_id, callback); - return; - } -#else - NOTIMPLEMENTED(); -#endif - - if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, format, usage)) { - GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( - id, size, format, child_process, callback); - return; - } - - callback.Run(gfx::GpuMemoryBufferHandle()); -} - -// static -void GpuMemoryBufferImpl::DeletedByChildProcess( - gfx::GpuMemoryBufferType type, - gfx::GpuMemoryBufferId id, - base::ProcessHandle child_process, - int child_client_id, - uint32 sync_point) { - switch (type) { - case gfx::SHARED_MEMORY_BUFFER: - break; - case gfx::EFL_PIXMAP_BUFFER: - // TODO: Rendering TG will implement following for Wayland. -#if !defined(WAYLAND_BRINGUP) - GpuMemoryBufferImplEflPixmap::DeletedByChildProcess( - id, child_client_id, sync_point); -#else - NOTIMPLEMENTED(); -#endif - break; - default: - NOTREACHED(); - break; - } -} - -// static -scoped_ptr GpuMemoryBufferImpl::CreateFromHandle( - const gfx::GpuMemoryBufferHandle& handle, - const gfx::Size& size, - Format format, - const DestructionCallback& callback) { - switch (handle.type) { - case gfx::SHARED_MEMORY_BUFFER: - return GpuMemoryBufferImplSharedMemory::CreateFromHandle( - handle, size, format, callback); - case gfx::EFL_PIXMAP_BUFFER: - // TODO: Rendering TG will implement following for Wayland. -#if !defined(WAYLAND_BRINGUP) - return GpuMemoryBufferImplEflPixmap::CreateFromHandle( - handle, size, format, callback); -#else - NOTIMPLEMENTED(); - return NULL; -#endif - default: - return scoped_ptr(); - } -} - -} // namespace content diff --git a/tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.cc b/tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.cc deleted file mode 100644 index b4e7faf..0000000 --- a/tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.cc +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.h" - -#include "base/atomic_sequence_num.h" -#include "base/bind.h" -#include "base/trace_event/trace_event.h" -#include "base/logging.h" -#include "base/numerics/safe_math.h" -#include "content/common/gpu/client/gpu_memory_buffer_factory_host.h" -#include "ui/gl/efl_pixmap.h" -#include "ui/gl/gl_bindings.h" - -namespace content { -namespace { - -// TODO(prashant.n): Move this to browser side code as per m41. -//base::StaticAtomicSequenceNumber g_next_buffer_id; - - -void GpuMemoryBufferDeleted(gfx::GpuMemoryBufferId id, - int client_id, - uint32 sync_point) { - GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer( - gfx::EFL_PIXMAP_BUFFER, id, client_id, sync_point); -} - - -void GpuMemoryBufferCreated( - const gfx::Size& size, - gfx::GpuMemoryBuffer::Format format, - int client_id, - const GpuMemoryBufferImpl::CreationCallback& callback, - const gfx::GpuMemoryBufferHandle& handle) { - if (handle.is_null()) { - callback.Run(scoped_ptr()); - return; - } - DCHECK_EQ(gfx::EFL_PIXMAP_BUFFER, handle.type); - callback.Run(GpuMemoryBufferImplEflPixmap::CreateFromHandle( - handle, size, format, base::Bind(&GpuMemoryBufferDeleted, handle.id, client_id))); -} - -void GpuMemoryBufferCreatedForChildProcess( - const GpuMemoryBufferImpl::AllocationCallback& callback, - const gfx::GpuMemoryBufferHandle& handle) { - DCHECK_EQ(gfx::EFL_PIXMAP_BUFFER, handle.type); - callback.Run(handle); -} - -} // namespace - -GpuMemoryBufferImplEflPixmap::GpuMemoryBufferImplEflPixmap( - gfx::GpuMemoryBufferId id, - const gfx::Size& size, - Format format, - const DestructionCallback& callback, - scoped_ptr efl_pixmap) - : GpuMemoryBufferImpl(id, size, format, callback), - efl_pixmap_(efl_pixmap.Pass()), - stride_(0u) { -}//Need to check - -GpuMemoryBufferImplEflPixmap::~GpuMemoryBufferImplEflPixmap() { -} - -// static -void GpuMemoryBufferImplEflPixmap::Create( - gfx::GpuMemoryBufferId id, - const gfx::Size& size, - Format format, - int client_id, - const CreationCallback& callback) { - GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer( - gfx::EFL_PIXMAP_BUFFER, - id, - size, - format, - MAP, - client_id, - base::Bind(&GpuMemoryBufferCreated, size, format, client_id, callback)); -} - -// static -void GpuMemoryBufferImplEflPixmap::AllocateForChildProcess( - gfx::GpuMemoryBufferId id, - const gfx::Size& size, - Format format, - int child_client_id, - const AllocationCallback& callback) { - GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer( - gfx::EFL_PIXMAP_BUFFER, - id, - size, - format, - MAP, - child_client_id, - base::Bind(&GpuMemoryBufferCreatedForChildProcess, callback)); -} -// static -scoped_ptr GpuMemoryBufferImplEflPixmap::CreateFromHandle( - const gfx::GpuMemoryBufferHandle& handle, - const gfx::Size& size, - Format format, - const DestructionCallback& callback) { - DCHECK(IsFormatSupported(format)); - DCHECK(handle.efl_pixmap_id); - // TODO: Rendering TG will implement following for Wayland. -#if !defined(WAYLAND_BRINGUP) - return make_scoped_ptr(new GpuMemoryBufferImplEflPixmap( - handle.id, size, format, callback,make_scoped_ptr(new gfx::EflPixmapImpl( - gfx::EflPixmapBase::BUFFER, handle.efl_pixmap_id)))); -#else - NOTIMPLEMENTED(); - return NULL; -#endif -} - -void GpuMemoryBufferImplEflPixmap::DeletedByChildProcess( - gfx::GpuMemoryBufferId id, - int child_client_id, - uint32_t sync_point) { - GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer( - gfx::EFL_PIXMAP_BUFFER, id, child_client_id, sync_point); -} - -// static -bool GpuMemoryBufferImplEflPixmap::IsFormatSupported(Format format) { - switch (format) { - case RGBA_8888: - case BGRA_8888: - return true; - case RGBX_8888: - return false; - } - - NOTREACHED(); - return false; -} - -// static -bool GpuMemoryBufferImplEflPixmap::IsUsageSupported(Usage usage) { - switch (usage) { - case MAP: - return true; - case SCANOUT: - return false; - } - - NOTREACHED(); - return false; -} - -// static -bool GpuMemoryBufferImplEflPixmap::IsLayoutSupported(const gfx::Size& size, - Format format) { - if (!IsFormatSupported(format)) - return false; - - return true; -} - -// static -bool GpuMemoryBufferImplEflPixmap::IsConfigurationSupported(Format format, - Usage usage) { - return IsFormatSupported(format) && IsUsageSupported(usage); -} - -void* GpuMemoryBufferImplEflPixmap::Map() { - TRACE_EVENT0("gpu", "GpuMemoryBufferImplEflPixmap::Map"); - DCHECK(efl_pixmap_); - DCHECK(!mapped_); - mapped_ = true; - void* buffer = efl_pixmap_->Map(); - stride_ = efl_pixmap_->GetStride(); - - return buffer; -} - -void GpuMemoryBufferImplEflPixmap::Unmap() { - TRACE_EVENT0("gpu", "GpuMemoryBufferImplEflPixmap::Unmap"); - DCHECK(efl_pixmap_); - DCHECK(mapped_); - efl_pixmap_->UnMap(); - mapped_ = false; -} - -uint32 GpuMemoryBufferImplEflPixmap::GetStride() const { - return stride_; -} - -gfx::GpuMemoryBufferHandle GpuMemoryBufferImplEflPixmap::GetHandle() const { - gfx::GpuMemoryBufferHandle handle; - handle.type = gfx::EFL_PIXMAP_BUFFER; - handle.id = id_; - handle.efl_pixmap_id = efl_pixmap_->GetId(); - return handle; -} - -} // namespace content diff --git a/tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.h b/tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.h deleted file mode 100644 index 26afa55..0000000 --- a/tizen_src/chromium_impl/content/common/gpu/client/gpu_memory_buffer_impl_efl_pixmap.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_EFL_PIXMAP_H_ -#define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_EFL_PIXMAP_H_ - -#include "content/common/gpu/client/gpu_memory_buffer_impl.h" - -namespace gfx { -class EflPixmapImpl; -} - -namespace content { - -// Implementation of GPU memory buffer based on efl pixmap. -class GpuMemoryBufferImplEflPixmap : public GpuMemoryBufferImpl { - public: - static void Create(gfx::GpuMemoryBufferId id, - const gfx::Size& size, - Format format, - int client_id, - const CreationCallback& callback); - - static void AllocateForChildProcess(gfx::GpuMemoryBufferId id, - const gfx::Size& size, - Format format, - int child_client_id, - const AllocationCallback& callback); - - static scoped_ptr CreateFromHandle( - const gfx::GpuMemoryBufferHandle& handle, - const gfx::Size& size, - Format format, - const DestructionCallback& callback); - - static void DeletedByChildProcess(gfx::GpuMemoryBufferId id, - int child_client_id, - uint32_t sync_point); - - static bool IsFormatSupported(Format format); - static bool IsUsageSupported(Usage usage); - static bool IsLayoutSupported(const gfx::Size& size, Format format); - static bool IsConfigurationSupported(Format format, Usage usage); - - // Overridden from gfx::GpuMemoryBuffer: - virtual void* Map() override; - virtual void Unmap() override; - virtual uint32 GetStride() const override; - virtual gfx::GpuMemoryBufferHandle GetHandle() const override; - - private: - GpuMemoryBufferImplEflPixmap(gfx::GpuMemoryBufferId id, - const gfx::Size& size, - Format format, - const DestructionCallback& callback, - scoped_ptr efl_pixmap); - virtual ~GpuMemoryBufferImplEflPixmap(); - - gfx::GpuMemoryBufferId id_; - scoped_ptr efl_pixmap_; - size_t stride_; - - DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplEflPixmap); -}; - -} // namespace content - -#endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_EFL_PIXMAP_H_ diff --git a/tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl.cc b/tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl.cc deleted file mode 100644 index 6ea39ed..0000000 --- a/tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl.cc +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/common/gpu/gpu_memory_buffer_factory.h" - -#include "base/logging.h" -#include "content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.h" -#include "gpu/command_buffer/service/image_factory.h" -#include "ui/gl/gl_image.h" -#include "ui/gl/gl_image_efl_pixmap.h" -#include "ui/gl/gl_image_shared_memory.h" - -namespace content { -namespace { - -class GpuMemoryBufferFactoryImpl: - public GpuMemoryBufferFactory , - public gpu::ImageFactory { - public: - // Overridden from GpuMemoryBufferFactory: - virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( - gfx::GpuMemoryBufferType type, - gfx::GpuMemoryBufferId id, - const gfx::Size& size, - gfx::GpuMemoryBuffer::Format format, - gfx::GpuMemoryBuffer::Usage usage, - int client_id) override { - switch (type) { - case gfx::EFL_PIXMAP_BUFFER: { - // TODO: Rendering TG will implement following for Wayland. -#if !defined(WAYLAND_BRINGUP) - return efl_pixmap_factory_.CreateGpuMemoryBuffer( - id, size, format,client_id); -#else - NOTIMPLEMENTED(); - return NULL; -#endif - } - default: - NOTREACHED(); - return gfx::GpuMemoryBufferHandle(); - } - } - virtual void DestroyGpuMemoryBuffer( - gfx::GpuMemoryBufferType type, - gfx::GpuMemoryBufferId id, - int client_id) override { - switch (type) { - case gfx::EFL_PIXMAP_BUFFER: - // TODO: Rendering TG will implement following for Wayland. -#if !defined(WAYLAND_BRINGUP) - efl_pixmap_factory_.DestroyGpuMemoryBuffer(id, client_id); -#else - NOTIMPLEMENTED(); -#endif - break; - default: - NOTREACHED(); - break; - } - } - - virtual gpu::ImageFactory* AsImageFactory() override { return this; } - virtual scoped_refptr CreateImageForGpuMemoryBuffer( - const gfx::GpuMemoryBufferHandle& handle, - const gfx::Size& size, - gfx::GpuMemoryBuffer::Format format, - unsigned internalformat, - int client_id) override { - switch (handle.type) { - case gfx::SHARED_MEMORY_BUFFER: { - scoped_refptr image( - new gfx::GLImageSharedMemory(size, internalformat)); - if (!image->Initialize(handle, format)) - return NULL; - - return image; - } - case gfx::EFL_PIXMAP_BUFFER: { - // TODO: Rendering TG will implement following for Wayland. -#if !defined(WAYLAND_BRINGUP) - return efl_pixmap_factory_.CreateImageForGpuMemoryBuffer( - handle.efl_pixmap_id, size, internalformat,client_id); -#else - NOTIMPLEMENTED(); - return NULL; -#endif - } - default: - NOTREACHED(); - return scoped_refptr(); - } - } - -#if !defined(WAYLAND_BRINGUP) - private: - // TODO: Rendering TG will implement following for Wayland. - GpuMemoryBufferFactoryEflPixmap efl_pixmap_factory_; -#endif -}; - -} // namespace - -// static -scoped_ptr GpuMemoryBufferFactory::Create() { - return make_scoped_ptr( - new GpuMemoryBufferFactoryImpl); -} - - -} // namespace content diff --git a/tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.cc b/tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.cc deleted file mode 100644 index 8eafbfe..0000000 --- a/tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.cc +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.h" - -#include "ui/gl/efl_pixmap.h" -#include "ui/gl/gl_image_efl_pixmap.h" - -namespace content { - -GpuMemoryBufferFactoryEflPixmap::GpuMemoryBufferFactoryEflPixmap() { -} - -GpuMemoryBufferFactoryEflPixmap::~GpuMemoryBufferFactoryEflPixmap() { -} - -gfx::GpuMemoryBufferHandle -GpuMemoryBufferFactoryEflPixmap::CreateGpuMemoryBuffer( - gfx::GpuMemoryBufferId id, - const gfx::Size& size, - unsigned internalformat, - int client_id) { - scoped_refptr efl_pixmap = - gfx::EflPixmap::Create(gfx::EflPixmap::BUFFER, size); - if (!efl_pixmap.get()) - return gfx::GpuMemoryBufferHandle(); - - EflPixmapMapKey key(id, client_id); - DCHECK(efl_pixmaps_.find(key) == efl_pixmaps_.end()); - efl_pixmaps_[key] = efl_pixmap; - - gfx::GpuMemoryBufferHandle handle; - handle.type = gfx::EFL_PIXMAP_BUFFER; - handle.id = id; - handle.efl_pixmap_id = efl_pixmap->GetId(); - return handle; -} - -void GpuMemoryBufferFactoryEflPixmap::DestroyGpuMemoryBuffer( - gfx::GpuMemoryBufferId id,int client_id) { - EflPixmapMapKey key(id, client_id); - EflPixmapMap::iterator it = efl_pixmaps_.find(key); - if (it != efl_pixmaps_.end()) - efl_pixmaps_.erase(it); -} - -scoped_refptr -GpuMemoryBufferFactoryEflPixmap::CreateImageForGpuMemoryBuffer( - unsigned long frame_pixmap_id, - const gfx::Size& size, - unsigned internalformat, - int client_id ) { - scoped_refptr image(new gfx::GLImageEflPixmap(size)); - if (!image->Initialize(frame_pixmap_id)) - return scoped_refptr(); - - return image; -} - -} // namespace content diff --git a/tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.h b/tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.h deleted file mode 100644 index 43545e10..0000000 --- a/tizen_src/chromium_impl/content/common/gpu/gpu_memory_buffer_factory_efl_pixmap.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_EFL_PIXMAP_H_ -#define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_EFL_PIXMAP_H_ - -#include "base/containers/hash_tables.h" -#include "base/memory/ref_counted.h" -#include "ui/gfx/geometry/size.h" -#include "ui/gfx/gpu_memory_buffer.h" - -namespace gfx { -class GLImage; -class EflPixmap; -} - -namespace content { - -class GpuMemoryBufferFactoryEflPixmap { - public: - GpuMemoryBufferFactoryEflPixmap(); - ~GpuMemoryBufferFactoryEflPixmap(); - - // Creates a efl pixmap backed GPU memory buffer with |size| and - // |internalformat|. A valid handle is returned on success. - gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( - gfx::GpuMemoryBufferId id, - const gfx::Size& size, - unsigned internalformat, - int client_id); - - // Destroy a previously created GPU memory buffer. - void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferId id,int client_id); - - // Creates a GLImage instance for a GPU memory buffer. - scoped_refptr CreateImageForGpuMemoryBuffer( - unsigned long frame_pixmap_id, - const gfx::Size& size, - unsigned internalformat, - int client_id); - - private: - typedef std::pair EflPixmapMapKey; - typedef base::hash_map> EflPixmapMap; - EflPixmapMap efl_pixmaps_; -}; - -} // namespace content - -#endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_EFL_PIXMAP_H_ diff --git a/tizen_src/chromium_impl/ui/gl/efl_pixmap.cc b/tizen_src/chromium_impl/ui/gl/efl_pixmap.cc deleted file mode 100644 index 458f0d6..0000000 --- a/tizen_src/chromium_impl/ui/gl/efl_pixmap.cc +++ /dev/null @@ -1,578 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - - -extern "C" { -#include -#include -#include -#include -#include -#include -#include -#include -#include -} - -#include "ui/gl/efl_pixmap.h" -#include "base/containers/scoped_ptr_hash_map.h" -#include "base/logging.h" -#include "ui/gl/egl_util.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace gl { - -// Helper classes implementation. -class NativeDisplayConnection { - public: - NativeDisplayConnection() { - display_ = XOpenDisplay(0); - if (!display_) { - LOG(ERROR) << "Failed to make connection with X"; - exit(0); - } - } - - ~NativeDisplayConnection() { XCloseDisplay(display_); } - - Display* GetDisplay() { return display_; } - - private: - Display* display_; -}; - -class EGLDisplayConnection { - public: - EGLDisplayConnection(Display* native_display) { - if (native_display) { - egl_display_ = - eglGetDisplay(reinterpret_cast(native_display)); - } else { - LOG(ERROR) << "EGLDisplayConnection failed - Invalid native display."; - return; - } - - if (egl_display_ == EGL_NO_DISPLAY) { - LOG(ERROR) << "EGLDisplayConnection failed - " - << ui::GetLastEGLErrorString(); - return; - } - - EGLint major, minor; - if (eglInitialize(egl_display_, &major, &minor) != EGL_TRUE) { - Terminate(); - LOG(ERROR) << "EGLDisplayConnection failed - " - << ui::GetLastEGLErrorString(); - } - } - - ~EGLDisplayConnection() { Terminate(); } - - EGLDisplay GetDisplay() { return egl_display_; } - - private: - void Terminate() { - if (egl_display_ == EGL_NO_DISPLAY) - return; - - eglTerminate(egl_display_); - egl_display_ = EGL_NO_DISPLAY; - } - - EGLDisplay egl_display_; -}; - -class OffScreenRootWindow { - public: - OffScreenRootWindow(Display* native_display) { - window_ = 0; - - if (!native_display) { - LOG(ERROR) << "OffScreenRootWindow failed - Invalid native display."; - return; - } - - native_display_ = native_display; - XSetWindowAttributes attributes; - attributes.override_redirect = true; - window_ = XCreateSimpleWindow( - native_display, XDefaultRootWindow(native_display), -1, -1, 1, 1, 0, - BlackPixel(native_display, 0), WhitePixel(native_display, 0)); - XChangeWindowAttributes(native_display, window_, CWOverrideRedirect, - &attributes); - XMapWindow(native_display, window_); - - if (!window_) - LOG(ERROR) << "OffScreenRootWindow failed to create window."; - } - - ~OffScreenRootWindow() { - if (!native_display_) - return; - - if (window_) { - XUnmapWindow(native_display_, window_); - XDestroyWindow(native_display_, window_); - window_ = 0; - } - } - - Window GetRootWindow() { return window_; } - - private: - Window window_; - Display* native_display_; -}; - -Window GetOffscreenRootWindow() { - static OffScreenRootWindow offscreen_root_window( - EflPixmap::GetNativeDisplay()); - return offscreen_root_window.GetRootWindow(); -} - -// Tizen buffer implementation. -struct TbmInfo { - int fd; - tbm_bufmgr bufmgr; - - TbmInfo() : fd(-1), bufmgr(0) {} -}; - -TbmInfo g_tbm_info; - -class NativeBufferManager { - public: - static void AddRef() { - ++s_ref; - - if (s_native_buffer_manager == NULL) - s_native_buffer_manager = new NativeBufferManager; - } - - static void RemoveRef() { - DCHECK(s_ref > 0); - --s_ref; - - if (s_ref == 0) { - delete s_native_buffer_manager; - s_native_buffer_manager = NULL; - } - } - - private: - NativeBufferManager() { Initialize(); } - ~NativeBufferManager() { Finalize(); } - - bool Initialize() { - int event_base = 0; - int error_base = 0; - int dri2_major = 0; - int dri2_minor = 0; - char* driver_name = 0; - char* device_name = 0; - drm_magic_t magic = 0; - int fd = -1; - - Display* dpy = EflPixmap::GetNativeDisplay(); - int screen = XDefaultScreen(dpy); - if (!DRI2QueryExtension(dpy, &event_base, &error_base)) { - LOG(ERROR) << "'DRI2QueryExtension' failed to get dri2 extension."; - goto error; - } - - if (!DRI2QueryVersion(dpy, &dri2_major, &dri2_minor)) { - LOG(ERROR) << "'DRI2QueryVersion' failed to get dri2 version."; - goto error; - } - - if (!DRI2Connect(dpy, RootWindow(dpy, screen), &driver_name, - &device_name)) { - LOG(ERROR) << "'DRI2Connect' failed to get dri2 connect."; - goto error; - } - - fd = open(device_name, O_RDWR); - if (fd < 0) { - LOG(ERROR) << "'DRM] couldn't open : "; - goto error; - } - - if (drmGetMagic(fd, &magic)) { - LOG(ERROR) << "'drmGetMagic' failed to get magic."; - goto error; - } - - if (!DRI2Authenticate(dpy, RootWindow(dpy, screen), (unsigned int)magic)) { - LOG(ERROR) << "'DRI2Authenticate' failed to get authentication."; - goto error; - } - - g_tbm_info.fd = fd; - - setenv("BUFMGR_LOCK_TYPE", "always", 1); - setenv("BUFMGR_MAP_CACHE", "true", 1); - g_tbm_info.bufmgr = tbm_bufmgr_init(fd); - - free(driver_name); - free(device_name); - return true; - - error: - free(driver_name); - free(device_name); - if (fd > -1) - close(fd); - return false; - } - - void Finalize() { - if (g_tbm_info.bufmgr) - tbm_bufmgr_deinit(g_tbm_info.bufmgr); - - if (g_tbm_info.fd > -1) { - close(g_tbm_info.fd); - g_tbm_info.fd = -1; - } - } - - static int s_ref; - static NativeBufferManager* s_native_buffer_manager; -}; - -int NativeBufferManager::s_ref = 0; -NativeBufferManager* NativeBufferManager::s_native_buffer_manager = NULL; - -class NativeBuffer { - public: - NativeBuffer(); - ~NativeBuffer(); - - void CreateDrawable(unsigned long pixmap_id); - void DestroyDrawable(unsigned long pixmap_id); - void* Lock(unsigned long pixmap_id, int count); - bool Unlock(); - int GetStride(unsigned long pixmap_id); - - private: - int pixmap_; - DRI2Buffer* buffer_; - tbm_bo buffer_object_; -}; - -NativeBuffer::NativeBuffer() : buffer_(NULL), - buffer_object_(NULL) { - NativeBufferManager::AddRef(); -} - -NativeBuffer::~NativeBuffer() { - if (buffer_) { - XFree(buffer_); - buffer_ = NULL; - } - - NativeBufferManager::RemoveRef(); -} - -void NativeBuffer::CreateDrawable(unsigned long pixmap_id) { - DRI2CreateDrawable(EflPixmap::GetNativeDisplay(), pixmap_id); -} - -void NativeBuffer::DestroyDrawable(unsigned long pixmap_id) { - DRI2DestroyDrawable(EflPixmap::GetNativeDisplay(), pixmap_id); -} - -void* NativeBuffer::Lock(unsigned long pixmap_id, int count) { - tbm_bo_handle handle; - unsigned int attach = DRI2BufferFrontLeft; - int num = -1, width = 0, height = 0; - - DCHECK(pixmap_id); - - if (!buffer_) { - DRI2Buffer* buffer = DRI2GetBuffers(EflPixmap::GetNativeDisplay(), - pixmap_id, - &width, - &height, - &attach, - 1, - &num); - if (!buffer || !buffer->name) { - LOG(ERROR) << "'DRI2GetBuffers' failed to get dri2 buffers count :" - << count << "buf :" << buffer << "buf->name" << buffer->name; - XFree(buffer); - return NULL; - } - - buffer_ = buffer; - } - - if (!buffer_object_) { - buffer_object_ = tbm_bo_import(g_tbm_info.bufmgr, buffer_->name); - if (!buffer_object_) { - LOG(ERROR) << "'tbm_bo_import' failed to import buffer"; - return NULL; - } - } - - handle = tbm_bo_map(buffer_object_, - TBM_DEVICE_CPU, - TBM_OPTION_READ | TBM_OPTION_WRITE); - - if (!handle.ptr) { - LOG(ERROR) << "'tbm_bo_map' failed to map tbm buffer for GPU"; - return NULL; - } - - return handle.ptr; -} - -bool NativeBuffer::Unlock() { - if (!buffer_object_) - return false; - - tbm_bo_unmap(buffer_object_); - tbm_bo_unref(buffer_object_); - buffer_object_ = NULL; - return true; -} - -int NativeBuffer::GetStride(unsigned long pixmap_id) { - DCHECK(buffer_); - return buffer_->pitch; -} - -// EflPixmapBase implemetation. -int EflPixmapBase::s_pixmap_surface_count = 0; - -EflPixmapBase::EflPixmapBase(UsageType usage_type) - : usage_type_(usage_type), - pixmap_id_(0), - native_buffer_(NULL) { - native_buffer_ = new NativeBuffer; -} - -EflPixmapBase::~EflPixmapBase() { - DCHECK(native_buffer_); - delete native_buffer_; - native_buffer_ = NULL; - pixmap_id_ = 0; -} - -void* EflPixmapBase::Map() { - DCHECK(usage_type_ == BUFFER); - return native_buffer_->Lock(pixmap_id_, - EflPixmapBase::s_pixmap_surface_count); -} - -bool EflPixmapBase::UnMap() { - DCHECK(usage_type_ == BUFFER); - return native_buffer_->Unlock(); -} - -int EflPixmapBase::GetStride() { - DCHECK(usage_type_ == BUFFER); - return native_buffer_->GetStride(pixmap_id_); -} - - -// EflPixmap implemetation. -// static -scoped_refptr EflPixmap::Create(UsageType usage_type, - const gfx::Size& size) { - EflPixmap* efl_pixmap = new EflPixmap(usage_type, size); - - if (!efl_pixmap->Initialize()) { - LOG(ERROR) << "EflPixmap creation failed."; - - delete efl_pixmap; - efl_pixmap = NULL; - } - - return make_scoped_refptr(efl_pixmap); -} - -EflPixmap::EflPixmap(UsageType usage_type, const gfx::Size& size) - : EflPixmapBase(usage_type), - size_(size), - surface_(EGL_NO_SURFACE), - used_(false) { - EflPixmapBase::s_pixmap_surface_count++; -} - -EflPixmap::~EflPixmap() { - DCHECK(GetDisplay()); - - if (surface_ != EGL_NO_SURFACE) { - DestroySurface(surface_); - surface_ = EGL_NO_SURFACE; - } - - if (pixmap_id_) { - native_buffer_->DestroyDrawable(pixmap_id_); - FreePixmap(pixmap_id_); - pixmap_id_ = 0; - } - - delete native_buffer_; - native_buffer_ = NULL; - - EflPixmapBase::s_pixmap_surface_count--; -} - -// static -const char* EflPixmap::GetEglExtensions() { - return eglQueryString(GetNativeDisplay(), EGL_EXTENSIONS); -} - -// static -Display* EflPixmap::GetNativeDisplay() { - static NativeDisplayConnection native_display_connection; - return native_display_connection.GetDisplay(); -} - -// static -EGLDisplay EflPixmap::GetDisplay() { - static EGLDisplayConnection egl_display_connection(GetNativeDisplay()); - return egl_display_connection.GetDisplay(); -} - -// static -EGLConfig EflPixmap::GetConfig() { - static EGLConfig config = EflPixmap::ChooseConfig(); - return config; -} - -bool EflPixmap::Initialize() { - if (size_.IsEmpty() || !GetDisplay() || !GetConfig()) - return false; - - pixmap_id_ = CreatePixmap(size_); - if (!pixmap_id_) - return false; - - native_buffer_->CreateDrawable(pixmap_id_); - - if (usage_type_ == SURFACE) { - surface_ = CreateSurface(pixmap_id_); - - if (surface_ == EGL_NO_SURFACE) - return false; - } - - XSync(GetNativeDisplay(), false); - - return true; -} - -// static -EGLConfig EflPixmap::ChooseConfig() { - EGLint config_attributes_list[] = { - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, - EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT | EGL_PIXMAP_BIT, - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_DEPTH_SIZE, 24, - EGL_STENCIL_SIZE, 8, - EGL_SAMPLES, 2, - EGL_NONE - }; - - EGLConfig config = NULL; - EGLint config_count = 0; - if ((eglChooseConfig(GetDisplay(), - config_attributes_list, - &config, - 1, - &config_count) != EGL_TRUE) && config_count) { - LOG(ERROR) << "eglChooseConfig failed - " << ui::GetLastEGLErrorString(); - return NULL; - } - - return config; -} - -EGLSurface EflPixmap::CreateSurface(unsigned long pixmap_id) { - DCHECK(GetDisplay()); - DCHECK(GetConfig()); - DCHECK(pixmap_id); - - EGLSurface surface = - eglCreatePixmapSurface(GetDisplay(), GetConfig(), pixmap_id, 0); - - if (surface == EGL_NO_SURFACE) { - LOG(ERROR) << "eglCreatePixmapSurface failed - " - << ui::GetLastEGLErrorString(); - } else { - eglSurfaceAttrib(GetDisplay(), - surface, - EGL_SWAP_BEHAVIOR, - EGL_BUFFER_PRESERVED); - } - - return surface; -} - -void EflPixmap::DestroySurface(EGLSurface surface) { - DCHECK(GetDisplay()); - DCHECK(surface); - - if (eglMakeCurrent(GetDisplay(), - EGL_NO_SURFACE, - EGL_NO_SURFACE, - EGL_NO_CONTEXT) != EGL_TRUE) { - LOG(ERROR) << "eglMakeCurrent failed - " << ui::GetLastEGLErrorString(); - } - - eglDestroySurface(GetDisplay(), surface); -} - -unsigned long EflPixmap::CreatePixmap(const gfx::Size& size) { - DCHECK(!size.IsEmpty()); - - // FIXME(prashant.n): Get depth (value 24) from xvisuals or geometry. - unsigned long pixmap_id = XCreatePixmap(GetNativeDisplay(), - GetOffscreenRootWindow(), - size.width(), - size.height(), - 24); - XFlush(GetNativeDisplay()); - return pixmap_id; -} - -void EflPixmap::FreePixmap(unsigned long pixmap_id) { - DCHECK(pixmap_id); - XFreePixmap(GetNativeDisplay(), pixmap_id); -} - -// EflPixmapImpl implementation. -EflPixmapImpl::EflPixmapImpl(UsageType usage_type, unsigned long pixmap_id) - : EflPixmapBase(usage_type) { - DCHECK(usage_type_ == BUFFER); - DCHECK(pixmap_id); - pixmap_id_ = pixmap_id; - native_buffer_->CreateDrawable(pixmap_id_); -} - -EflPixmapImpl::~EflPixmapImpl() { - native_buffer_->DestroyDrawable(pixmap_id_); - pixmap_id_ = 0; - -} - -} // namespace gl diff --git a/tizen_src/chromium_impl/ui/gl/efl_pixmap.h b/tizen_src/chromium_impl/ui/gl/efl_pixmap.h deleted file mode 100644 index 9871098..0000000 --- a/tizen_src/chromium_impl/ui/gl/efl_pixmap.h +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_GL_EFL_PIXMAP_H_ -#define UI_GL_EFL_PIXMAP_H_ - -#include "base/containers/hash_tables.h" -#include "base/memory/ref_counted.h" -#include "ui/gfx/geometry/size.h" -#include "ui/gl/gl_bindings.h" - -#if !defined(WAYLAND_BRINGUP) -#include -#endif - -namespace gl { - -class NativeBuffer; - -// TODO(prashant.n): Refactor the code into different files. -// Basic Pixmap implementation. -class GL_EXPORT EflPixmapBase { - public: - enum UsageType { - BUFFER, - SURFACE - }; - - virtual unsigned long GetId() { return pixmap_id_; } - - virtual void* Map(); - virtual bool UnMap(); - virtual int GetStride(); - - protected: - EflPixmapBase(UsageType usage_type); - virtual ~EflPixmapBase(); - - UsageType usage_type_; - unsigned long pixmap_id_; - NativeBuffer* native_buffer_; - - static int s_pixmap_surface_count; -}; - -// Pixmap implementation - to be used in GPU process/thread. -class GL_EXPORT EflPixmap : public EflPixmapBase, - public base::RefCountedThreadSafe { - public: - static scoped_refptr Create(UsageType usage_type, - const gfx::Size& size); - virtual ~EflPixmap(); - - static const char* GetEglExtensions(); - // TODO: Rendering TG will implement following for Wayland. -#if !defined(WAYLAND_BRINGUP) - static Display* GetNativeDisplay(); -#endif - static EGLDisplay GetDisplay(); - static EGLConfig GetConfig(); - - const gfx::Size GetSize() const { return size_; } - bool Used() { return used_; } - void SetUsed(bool used) { used_ = used; } - EGLSurface GetSurface() { return surface_; } - - // EflPixmapBase functions: - using EflPixmapBase::GetId; - using EflPixmapBase::Map; - using EflPixmapBase::UnMap; - using EflPixmapBase::GetStride; - - private: - EflPixmap(UsageType usage_type, const gfx::Size& size); - bool Initialize(); - static EGLConfig ChooseConfig(); - - EGLSurface CreateSurface(unsigned long pixmap_id); - void DestroySurface(EGLSurface surface); - unsigned long CreatePixmap(const gfx::Size& size); - void FreePixmap(unsigned long pixmap_id); - - gfx::Size size_; - EGLSurface surface_; - bool used_; - - DISALLOW_COPY_AND_ASSIGN(EflPixmap); -}; - -// Pixmap implementation - to be used in renderer and browser processes. -class GL_EXPORT EflPixmapImpl : public EflPixmapBase { - public: - explicit EflPixmapImpl(UsageType usage_type, unsigned long pixmap_id); - ~EflPixmapImpl(); - - // EflPixmapBase functions: - using EflPixmapBase::GetId; - using EflPixmapBase::Map; - using EflPixmapBase::UnMap; - using EflPixmapBase::GetStride; - - private: - DISALLOW_COPY_AND_ASSIGN(EflPixmapImpl); -}; - -} // namespace gl - -#endif // UI_GL_EFL_PIXMAP_H_ diff --git a/tizen_src/chromium_impl/ui/gl/gl_image_efl_pixmap.cc b/tizen_src/chromium_impl/ui/gl/gl_image_efl_pixmap.cc deleted file mode 100644 index 1b700a6..0000000 --- a/tizen_src/chromium_impl/ui/gl/gl_image_efl_pixmap.cc +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/gl/gl_image_efl_pixmap.h" - -#include "base/trace_event/trace_event.h" -#include "base/process/process_handle.h" -#include "ui/gl/efl_pixmap.h" -#include "ui/gl/egl_util.h" - -namespace { - -PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHRPfn = 0; -PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOESPfn = 0; -PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHRPfn = 0; - -EGLDisplay g_display = NULL; - -void EnsureGLImageFunctions() { - if (!g_display) { - g_display = eglGetCurrentDisplay(); - eglCreateImageKHRPfn = - (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR"); - glEGLImageTargetTexture2DOESPfn = - (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress( - "glEGLImageTargetTexture2DOES"); - eglDestroyImageKHRPfn = - (PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress("eglDestroyImageKHR"); - } -} - -} // namespace - -namespace gl { - -GLImageEflPixmap::GLImageEflPixmap(gfx::Size size) - : size_(size), - in_use_(false), - egl_image_(EGL_NO_IMAGE_KHR), - target_(0) { -} - -GLImageEflPixmap::~GLImageEflPixmap() { -} - -bool GLImageEflPixmap::Initialize(unsigned long efl_pixmap_id) { - EnsureGLImageFunctions(); - efl_pixmap_id_ = efl_pixmap_id; - egl_image_ = eglCreateImageKHRPfn(g_display, EGL_NO_CONTEXT, - EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer)(efl_pixmap_id_), - NULL); - - if (egl_image_ == EGL_NO_IMAGE_KHR) - LOG(ERROR) << "eglCreateImageKHR failed - " << ui::GetLastEGLErrorString(); - - return true; -} - -#if !defined(EWK_BRINGUP) -void GLImageEflPixmap::Destroy(bool have_context) { - if (egl_image_ == EGL_NO_IMAGE_KHR) - return; - - EGLBoolean success = eglDestroyImageKHRPfn(g_display, egl_image_); - - if (success == EGL_FALSE) - LOG(ERROR) << "eglDestroyImageKHR failed - " << ui::GetLastEGLErrorString(); - - efl_pixmap_id_ = 0; - egl_image_ = EGL_NO_IMAGE_KHR; -} - -gfx::Size GLImageEflPixmap::GetSize() { - return size_; -} -#endif - -unsigned GLImageEflPixmap::GetInternalFormat() { - // FIXME: Check this for pixmap. - return -1; -} - -bool GLImageEflPixmap::BindTexImage(unsigned target) { - TRACE_EVENT0("gpu", "GLImageEflPixmap::BindTexImage"); - - if (egl_image_ == EGL_NO_IMAGE_KHR) { - LOG(ERROR) << "NULL EGLImage - " << ui::GetLastEGLErrorString(); - return false; - } - - if (target_ && target_ != target) { - LOG(ERROR) << "EGLImage can only be bound to one target"; - return false; - } - target_ = target; - - if (in_use_) - return true; - - glEGLImageTargetTexture2DOESPfn(target_, (EGLClientBuffer)egl_image_); - EGLint error = eglGetError(); - if (error != EGL_SUCCESS) { - LOG(ERROR) << "glEGLImageTargetTexture2DOES failed - " - << ui::GetLastEGLErrorString(); - } - - DCHECK_EQ(static_cast(GL_NO_ERROR), glGetError()); - in_use_ = true; - return true; -} - -void GLImageEflPixmap::ReleaseTexImage(unsigned target) {} - -bool GLImageEflPixmap::CopyTexImage(unsigned target) { - return false; -} - -bool GLImageEflPixmap::CopyTexSubImage(unsigned target, - const gfx::Point& offset, - const gfx::Rect& rect) { - return false; -} - -bool GLImageEflPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, - int z_order, - gfx::OverlayTransform transform, - const gfx::Rect& bounds_rect, - const gfx::RectF& crop_rect) { - return false; -} - -void GLImageEflPixmap::Flush() {} - -void GLImageEflPixmap::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, - uint64_t process_tracing_id, - const std::string& dump_name) {} - -GLImage::Type GLImageEflPixmap::GetType() const { - return Type::DXGI_IMAGE; -} - -} // namespace gl diff --git a/tizen_src/chromium_impl/ui/gl/gl_image_efl_pixmap.h b/tizen_src/chromium_impl/ui/gl/gl_image_efl_pixmap.h deleted file mode 100644 index cfc9eb7..0000000 --- a/tizen_src/chromium_impl/ui/gl/gl_image_efl_pixmap.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_GL_GL_IMAGE_EFL_PIXMAP_H_ -#define UI_GL_GL_IMAGE_EFL_PIXMAP_H_ - -#include "ui/gl/gl_image.h" -#include "ui/gfx/gpu_memory_buffer.h" -#include "ui/gl/gl_bindings.h" - - -namespace gl { - -class GL_EXPORT GLImageEflPixmap : public GLImage { - public: - GLImageEflPixmap(gfx::Size size); - - bool Initialize(unsigned long efl_pixmap_id); - - // Overridden from GLImage: -#if !defined(EWK_BRINGUP) - // This API is removed. Just keeping for reference. - void Destroy(bool have_context) override; -#endif - gfx::Size GetSize() override; - unsigned GetInternalFormat() override; - bool BindTexImage(unsigned target) override; - void ReleaseTexImage(unsigned target) override; - bool CopyTexImage(unsigned target) override; - bool CopyTexSubImage(unsigned target, - const gfx::Point& offset, - const gfx::Rect& rect) override; - bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, - int z_order, - gfx::OverlayTransform transform, - const gfx::Rect& bounds_rect, - const gfx::RectF& crop_rect) override; - void Flush() override; - void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, - uint64_t process_tracing_id, - const std::string& dump_name) override; - Type GetType() const override; - - protected: - ~GLImageEflPixmap(); - - private: - unsigned long efl_pixmap_id_; - const gfx::Size size_; - bool in_use_; - EGLImageKHR egl_image_; - unsigned target_; - - DISALLOW_COPY_AND_ASSIGN(GLImageEflPixmap); -}; - -} // namespace gl - -#endif // UI_GL_GL_IMAGE_EFL_PIXMAP_H_ -- 2.7.4 From 8f59cc973260daddd8446cc3a983cab338994c28 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Thu, 26 Dec 2019 11:37:21 +0530 Subject: [PATCH 07/16] [M76 Migration] Set default DIP scale as 1.0 DIP scale value can not be 0 and if this value is used before initialization from |RWHVEfl::InitializeDeviceDisplayInfo|, it causes layout error. Reference: https://review.tizen.org/gerrit/#/c//202076/ Change-Id: I62d2f79542470fb3e3fdde8a542c61f5fd992e29 Signed-off-by: Chandan Padhi (cherry picked from commit 6ce2eead7fe78dfab9ced4a4673ccbd5436dd7e8) (cherry picked from commit 391156033f20840a83b5f999cb9f89b850a725f9) --- tizen_src/chromium_impl/ui/display/device_display_info_efl.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc b/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc index 8d522c0..22846cf 100644 --- a/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc +++ b/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc @@ -139,11 +139,10 @@ int DeviceDisplayInfoEflImpl::GetRotationDegrees() const { } DeviceDisplayInfoEflImpl::DeviceDisplayInfoEflImpl() - : display_width_(0), - display_height_(0), - dip_scale_(0), - rotation_degrees_(kInvalidRotationDegrees) { -} + : display_width_(0), + display_height_(0), + dip_scale_(1.0), + rotation_degrees_(kInvalidRotationDegrees) {} // DeviceDisplayInfoEfl DeviceDisplayInfoEfl::DeviceDisplayInfoEfl() { -- 2.7.4 From 208c8c81d394b5adcd613f2d9c3ca7da96220f51 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Thu, 26 Dec 2019 11:47:58 +0530 Subject: [PATCH 08/16] [M76 Migration] Fix crash during destruction of EvasGLDelegatedFrameHost This change ensures that EvasGLDelegatedFrameHost member variables are accessed only when its initialization is done. Reference: https://review.tizen.org/gerrit/#/c/201648/ Change-Id: Ie0ab831f019ecb8584132254b73569b160bc9152 Signed-off-by: Chandan Padhi (cherry picked from commit ed4706b13d59527e90b03c0090570d456acbab1b) (cherry picked from commit ab3f131e756c49e0e8afc4fbf1cd0e4ad2e46204) --- .../content/browser/compositor/evasgl_delegated_frame_host.cc | 11 ++++++++++- .../content/browser/compositor/evasgl_delegated_frame_host.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc index d48539a..c477f64 100644 --- a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc +++ b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc @@ -15,9 +15,11 @@ namespace content { EvasGLDelegatedFrameHost::EvasGLDelegatedFrameHost( EvasGLDelegatedFrameHostClient* client) - : client_(client), weak_ptr_factory_(this) {} + : client_(client), is_initialized_(false), weak_ptr_factory_(this) {} EvasGLDelegatedFrameHost::~EvasGLDelegatedFrameHost() { + if (!is_initialized_) + return; ClearRenderPasses(); ClearChildId(); } @@ -43,11 +45,15 @@ void EvasGLDelegatedFrameHost::Initialize() { &settings_, output_surface_.get(), resource_provider_.get(), nullptr); renderer_->Initialize(); renderer_->SetVisible(true); + is_initialized_ = true; } void EvasGLDelegatedFrameHost::SwapDelegatedFrame( const viz::LocalSurfaceId& local_surface_id, viz::CompositorFrame frame) { + if (!is_initialized_) + return; + DCHECK(renderer_); DCHECK(resource_provider_); DCHECK(!frame.render_pass_list.empty()); @@ -93,6 +99,9 @@ void EvasGLDelegatedFrameHost::SwapDelegatedFrame( } void EvasGLDelegatedFrameHost::RenderDelegatedFrame(const gfx::Rect& bounds) { + if (!is_initialized_) + return; + DCHECK(renderer_); if (render_pass_list_.empty()) diff --git a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h index 5df4e13..eca2efa 100644 --- a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h +++ b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h @@ -56,6 +56,7 @@ class CONTENT_EXPORT EvasGLDelegatedFrameHost void ClearChildId(); EvasGLDelegatedFrameHostClient* client_; + bool is_initialized_; // TODO(prashant.n): Decouple context provider and surface from this class. scoped_refptr context_provider_; std::unique_ptr output_surface_; -- 2.7.4 From 14978745569ec5ffbadd9437ff5812ae03c1b76e Mon Sep 17 00:00:00 2001 From: "suyambu.rm" Date: Mon, 6 Jan 2020 02:32:03 -0800 Subject: [PATCH 09/16] Move GetUserAgent() from ContentClientEfl to ContentBrowserClientEfl. This change moves overriden methods GetUserAgent, GetProduct to ContentBrowserClientEfl, as per M76 upstream. This helps setting useragent properly in chromium-efl. Change-Id: I2a66ca3f4dc356203ae2c0c199d06fbb261e4fe0 Signed-off-by: suyambu.rm --- tizen_src/ewk/efl_integration/common/content_client_efl.cc | 9 --------- tizen_src/ewk/efl_integration/common/content_client_efl.h | 2 -- tizen_src/ewk/efl_integration/content_browser_client_efl.cc | 10 ++++++++++ tizen_src/ewk/efl_integration/content_browser_client_efl.h | 3 +++ 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tizen_src/ewk/efl_integration/common/content_client_efl.cc b/tizen_src/ewk/efl_integration/common/content_client_efl.cc index da63c02..ac0e580 100644 --- a/tizen_src/ewk/efl_integration/common/content_client_efl.cc +++ b/tizen_src/ewk/efl_integration/common/content_client_efl.cc @@ -4,19 +4,10 @@ #include "common/content_client_efl.h" -#include "common/version_info.h" #include "ipc/ipc_message.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/l10n/l10n_util.h" -std::string ContentClientEfl::GetProduct() const { - return EflWebView::VersionInfo::GetInstance()->ProductNameAndVersionForUserAgent(); -} - -std::string ContentClientEfl::GetUserAgent() const { - return EflWebView::VersionInfo::GetInstance()->DefaultUserAgent(); -} - base::string16 ContentClientEfl::GetLocalizedString(int message_id) const { // TODO(boliu): Used only by WebKit, so only bundle those resources for // Android WebView. diff --git a/tizen_src/ewk/efl_integration/common/content_client_efl.h b/tizen_src/ewk/efl_integration/common/content_client_efl.h index 8d4a924..d36062e 100644 --- a/tizen_src/ewk/efl_integration/common/content_client_efl.h +++ b/tizen_src/ewk/efl_integration/common/content_client_efl.h @@ -16,8 +16,6 @@ namespace IPC { class ContentClientEfl : public content::ContentClient { public: // ContentClient implementation. - std::string GetProduct() const; - std::string GetUserAgent() const; virtual base::string16 GetLocalizedString(int message_id) const override; virtual base::StringPiece GetDataResource( int resource_id, diff --git a/tizen_src/ewk/efl_integration/content_browser_client_efl.cc b/tizen_src/ewk/efl_integration/content_browser_client_efl.cc index ac19277..e912fd5 100644 --- a/tizen_src/ewk/efl_integration/content_browser_client_efl.cc +++ b/tizen_src/ewk/efl_integration/content_browser_client_efl.cc @@ -26,6 +26,7 @@ #include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" +#include "common/version_info.h" #include "common/web_contents_utils.h" #if defined(OS_TIZEN) @@ -352,4 +353,13 @@ scoped_refptr ContentBrowserClientEfl::CreateQuotaPermissionContext() { return new QuotaPermissionContextEfl(); } + +std::string ContentBrowserClientEfl::GetProduct() const { + return EflWebView::VersionInfo::GetInstance()->ProductNameAndVersionForUserAgent(); +} + +std::string ContentBrowserClientEfl::GetUserAgent() const { + return EflWebView::VersionInfo::GetInstance()->DefaultUserAgent(); +} + } diff --git a/tizen_src/ewk/efl_integration/content_browser_client_efl.h b/tizen_src/ewk/efl_integration/content_browser_client_efl.h index 25a8059..1864567 100644 --- a/tizen_src/ewk/efl_integration/content_browser_client_efl.h +++ b/tizen_src/ewk/efl_integration/content_browser_client_efl.h @@ -113,6 +113,9 @@ class ContentBrowserClientEfl : public ContentBrowserClient { browser_context_efl_ = context; } + std::string GetProduct() const override; + std::string GetUserAgent() const override; + private: static void SetCertificatePemOnUIThread(int render_process_id, int render_view_id, -- 2.7.4 From d3b7a2f6df3c39f33eb69a72bd33180356dccc74 Mon Sep 17 00:00:00 2001 From: "suyambu.rm" Date: Sun, 29 Dec 2019 22:24:31 -0800 Subject: [PATCH 10/16] [M76 Migration] Enable MSAA sample count for Canvas2D. This helps skia to use accelerated rendering for canvas2d. This change also removes unwanted canvas command line flags. Reference: https://review.tizen.org/gerrit/c/platform/framework/web/chromium-efl/+/203296 Change-Id: I8ef938f68b77a1e72ac7eb57e12679da633fa8dc Signed-off-by: suyambu.rm (cherry picked from commit fe15cb8a166b69b9d74e9a210310d37c32357a3a) --- tizen_src/chromium_impl/efl/init.cc | 4 ---- tizen_src/ewk/efl_integration/command_line_efl.cc | 9 ++------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/tizen_src/chromium_impl/efl/init.cc b/tizen_src/chromium_impl/efl/init.cc index 2941cc1..2bdfa61 100644 --- a/tizen_src/chromium_impl/efl/init.cc +++ b/tizen_src/chromium_impl/efl/init.cc @@ -100,10 +100,6 @@ void AppendPortParams(base::CommandLine& cmdline) { #if !defined(OS_TIZEN) cmdline.AppendSwitch(switches::kIgnoreGpuBlacklist); #endif - - if (IsTvProfile()) { - cmdline.AppendSwitchASCII(switches::kAcceleratedCanvas2dMSAASampleCount, "4"); - } } } // namespace efl diff --git a/tizen_src/ewk/efl_integration/command_line_efl.cc b/tizen_src/ewk/efl_integration/command_line_efl.cc index 573710e..d95fe15 100644 --- a/tizen_src/ewk/efl_integration/command_line_efl.cc +++ b/tizen_src/ewk/efl_integration/command_line_efl.cc @@ -64,14 +64,12 @@ content::MainFunctionParams CommandLineEfl::GetDefaultPortParams() { #endif #if defined(OS_TIZEN) + p_command_line->AppendSwitchASCII( + switches::kAcceleratedCanvas2dMSAASampleCount, "4"); #if !defined(EWK_BRINGUP) p_command_line->AppendSwitch(switches::kEnableGestureTapHighlight); p_command_line->AppendSwitch(switches::kEnableSpatialNavigation); p_command_line->AppendSwitch(switches::kMainFrameResizesAreOrientationChanges); - p_command_line->AppendSwitch(switches::kForceAccelerated2dCanvas); -// [M44_2403] Temporary disabling the codes for switching to new chromium -// FIXME: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=14040 - p_command_line->AppendSwitch(cc::switches::kEnableParallelCanvasMode); #endif // EWK_BRINGUP #endif @@ -82,9 +80,6 @@ content::MainFunctionParams CommandLineEfl::GetDefaultPortParams() { switches::kTouchEventFeatureDetectionEnabled); #if !defined(EWK_BRINGUP) p_command_line->AppendSwitch(switches::kEnablePinch); - // [M42_2231] FIXME: Need Parallel Canvas patch for S-Chromium/S-Blink/S-Skia - p_command_line->AppendSwitchASCII( - switches::kAcceleratedCanvas2dMSAASampleCount, "4"); #endif } -- 2.7.4 From 43d73cffb917841bfa43b8c80dff43e18a1c762e Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Fri, 10 Jan 2020 11:05:34 +0530 Subject: [PATCH 11/16] [M76 Migration] Replace elm naviframe with elm layout A naviframe is an element which holds and manages views. It allows to create special effects when one view is being changed to another one. But chromium-efl does not use such special effects because naviframe contains only one view at a time and the transition between views does not occur. This patch replaces elm naviframe with elm layout. 3D Memory for google.com on TM1 target: With Patch : 1644 Without Patch : 5372 Reference: https://review.tizen.org/gerrit/#/c/202482/ Change-Id: I236adc97ec98059b96c660765090d0d4096d7c74 Signed-off-by: Chandan Padhi --- .../renderer_host/render_widget_host_view_efl.cc | 1 + .../browser/web_contents/web_contents_view_efl.cc | 23 ++++++++++------------ tizen_src/chromium_impl/edje_resources/BUILD.gn | 1 + .../chromium_impl/edje_resources/MainLayout.edc | 20 +++++++++++++++++++ 4 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 tizen_src/chromium_impl/edje_resources/MainLayout.edc diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc index 89768a4..8abd4fa 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc @@ -173,6 +173,7 @@ RenderWidgetHostViewEfl::RenderWidgetHostViewEfl(RenderWidgetHost* widget_host, void RenderWidgetHostViewEfl::InitAsChild(gfx::NativeView /* parent_view */) { content_image_elm_host_ = elm_bg_add(parent_view_); + elm_object_part_content_set(parent_view_, "content", content_image_elm_host_); content_image_ = evas_object_image_filled_add(evas_); elm_object_part_content_set(content_image_elm_host_, "overlay", content_image_); diff --git a/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.cc b/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.cc index 0589ac5..5fc7fab 100644 --- a/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.cc +++ b/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.cc @@ -8,12 +8,15 @@ #include #include "base/command_line.h" +#include "base/files/file_path.h" #include "base/logging.h" +#include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "content/browser/renderer_host/render_widget_host_view_efl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_drag_dest_efl.h" #include "content/browser/web_contents/web_drag_source_efl.h" +#include "content/common/paths_efl.h" #include "content/common/view_messages.h" #include "content/public/browser/interstitial_page.h" #include "content/public/browser/render_view_host.h" @@ -68,13 +71,14 @@ void WebContentsViewEfl::CreateView(const gfx::Size& initial_size, gfx::NativeView context) { Evas_Object* root_window = efl::WindowFactory::GetHostWindow(web_contents_); - native_view_ = elm_naviframe_add(root_window); - elm_naviframe_content_preserve_on_pop_set(native_view_, EINA_TRUE); + native_view_ = elm_layout_add(root_window); - if (!initial_size.IsEmpty()) - evas_object_resize(native_view_, initial_size.width(), - initial_size.height()); - evas_object_show(native_view_); + base::FilePath edj_dir; + base::PathService::Get(PathsEfl::EDJE_RESOURCE_DIR, &edj_dir); + + base::FilePath main_edj = edj_dir.Append(FILE_PATH_LITERAL("MainLayout.edj")); + elm_layout_file_set(native_view_, main_edj.AsUTF8Unsafe().c_str(), + "main_layout"); GLSharedContextEfl::Initialize(root_window); @@ -88,13 +92,6 @@ RenderWidgetHostViewBase* WebContentsViewEfl::CreateViewForWidget( RenderWidgetHostViewEfl* view = new RenderWidgetHostViewEfl(render_widget_host, *web_contents_); view->InitAsChild(nullptr); - - elm_naviframe_item_pop(native_view_); - Evas_Object* content_view = static_cast(view->GetNativeView()); - Elm_Object_Item* item = elm_naviframe_item_push(native_view_, NULL, NULL, - NULL, content_view, NULL); - elm_naviframe_item_title_enabled_set(item, EINA_FALSE, EINA_FALSE); - view->SetTouchEventsEnabled(touch_enabled_); view->Show(); diff --git a/tizen_src/chromium_impl/edje_resources/BUILD.gn b/tizen_src/chromium_impl/edje_resources/BUILD.gn index 9c03ac4..8174d55 100644 --- a/tizen_src/chromium_impl/edje_resources/BUILD.gn +++ b/tizen_src/chromium_impl/edje_resources/BUILD.gn @@ -33,6 +33,7 @@ edje_res_efl("edje_resources_efl") { "DisambiguationPopup.edc", "Edge.edc", "Magnifier.edc", + "MainLayout.edc", "SelectionHandles.edc", ] } diff --git a/tizen_src/chromium_impl/edje_resources/MainLayout.edc b/tizen_src/chromium_impl/edje_resources/MainLayout.edc new file mode 100644 index 0000000..3c4c1ac --- /dev/null +++ b/tizen_src/chromium_impl/edje_resources/MainLayout.edc @@ -0,0 +1,20 @@ +collections { base_scale: 2.0; + group { + name: "main_layout"; + parts { + part { + name: "content"; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + visible: 1; + fixed: 1 1; + align: 0.0 0.0; + rel1 { relative: 0.0 0.0; } + rel2 { relative: 1.0 1.0; } + } + } + } + } +} -- 2.7.4 From 1a6b215ca1f3d0cae1d84e0ad4c3a54009529733 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Mon, 13 Jan 2020 14:37:19 +0530 Subject: [PATCH 12/16] Remove EWK_BRINGUP in gpu_info_collector_efl.cc This patch removes unused code in gpu_info_collector_efl.cc. Change-Id: I77c094db81919ca5025eaadcfbb21c7defca4bcb Signed-off-by: Chandan Padhi --- .../gpu/config/gpu_info_collector_efl.cc | 44 ---------------------- 1 file changed, 44 deletions(-) diff --git a/tizen_src/chromium_impl/gpu/config/gpu_info_collector_efl.cc b/tizen_src/chromium_impl/gpu/config/gpu_info_collector_efl.cc index 41d15c4..d2b33b5 100644 --- a/tizen_src/chromium_impl/gpu/config/gpu_info_collector_efl.cc +++ b/tizen_src/chromium_impl/gpu/config/gpu_info_collector_efl.cc @@ -4,10 +4,6 @@ #include "gpu/config/gpu_info_collector.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/string_piece.h" -#include "base/strings/string_split.h" -#include "base/strings/string_util.h" #include "gpu/config/gpu_preferences.h" #include "gpu/config/scoped_restore_non_owned_egl_context.h" @@ -17,37 +13,6 @@ #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h" #endif -namespace { - -std::string GetDriverVersionFromString(const std::string& version_string) { - // Extract driver version from the second number in a string like: - // "OpenGL ES 2.0 V@6.0 AU@ (CL@2946718)" - - // Exclude first "2.0". - size_t begin = version_string.find_first_of("0123456789"); - if (begin == std::string::npos) - return "0"; - size_t end = version_string.find_first_not_of("01234567890.", begin); - - // Extract number of the form "%d.%d" - begin = version_string.find_first_of("0123456789", end); - if (begin == std::string::npos) - return "0"; - end = version_string.find_first_not_of("01234567890.", begin); - std::string sub_string; - if (end != std::string::npos) - sub_string = version_string.substr(begin, end - begin); - else - sub_string = version_string.substr(begin); - std::vector pieces = base::SplitString( - sub_string, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - if (pieces.size() < 2) - return "0"; - return pieces[0] + "." + pieces[1]; -} - -} // namespace - namespace gpu { bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { @@ -75,13 +40,4 @@ bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { return success; } -void CollectDriverInfoGL(GPUInfo* gpu_info) { - DCHECK(gpu_info); -#if !defined(EWK_BRINGUP) - gpu_info->driver_version = GetDriverVersionFromString(gpu_info->gl_version); -#endif - gpu_info->gpu.vendor_string = gpu_info->gl_vendor; - gpu_info->gpu.device_string = gpu_info->gl_renderer; -} - } // namespace gpu -- 2.7.4 From d4a10babe0c097e64c5842672e214562b409c942 Mon Sep 17 00:00:00 2001 From: Gajendra N Date: Tue, 31 Dec 2019 11:34:04 +0530 Subject: [PATCH 13/16] Cleanup old device_sensors code After M63, DataFetcher* classes were removed and replaced by generic_sensor. Hence, code related to device_sensors can be removed. This patch does the same. Change-Id: I979326056b36319c7623746ca9bd518726ad197c Signed-off-by: Gajendra N (cherry picked from commit eb347d19aa7dfafd774f867267f3a766fb56f3b2) --- .../device_sensors/data_fetcher_impl_tizen.cc | 262 --------------------- .../device_sensors/data_fetcher_impl_tizen.h | 65 ----- .../data_fetcher_shared_memory_tizen.cc | 67 ------ 3 files changed, 394 deletions(-) delete mode 100644 tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_impl_tizen.cc delete mode 100644 tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_impl_tizen.h delete mode 100644 tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_shared_memory_tizen.cc diff --git a/tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_impl_tizen.cc b/tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_impl_tizen.cc deleted file mode 100644 index 5ac64bf..0000000 --- a/tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_impl_tizen.cc +++ /dev/null @@ -1,262 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/device_sensors/data_fetcher_impl_tizen.h" - -#include "base/logging.h" -#include "base/memory/singleton.h" -#include "build/tizen_version.h" - -namespace content { - -static sensor_h sensor_orientation_; -static sensor_h sensor_accelerometer_; -static sensor_h sensor_gyroscope_; -static sensor_listener_h listener_orientation_; -static sensor_listener_h listener_accelerometer_; -static sensor_listener_h listener_gyroscope_; - -DataFetcherImplTizen::DataFetcherImplTizen() - : device_motion_buffer_(NULL), - device_orientation_buffer_(NULL), - has_last_motion_data_(false), - last_motion_timestamp_(0), - is_orientation_buffer_ready_(false) { - sensor_get_default_sensor(SENSOR_ORIENTATION, &sensor_orientation_); - sensor_get_default_sensor(SENSOR_ACCELEROMETER, &sensor_accelerometer_); - sensor_get_default_sensor(SENSOR_GYROSCOPE, &sensor_gyroscope_); - - sensor_create_listener(sensor_orientation_, &listener_orientation_); - sensor_create_listener(sensor_accelerometer_, &listener_accelerometer_); - sensor_create_listener(sensor_gyroscope_, &listener_gyroscope_); -} - -DataFetcherImplTizen::~DataFetcherImplTizen() { - sensor_listener_unset_event_cb(listener_orientation_); - sensor_listener_stop(listener_orientation_); - sensor_destroy_listener(listener_orientation_); - - sensor_listener_unset_event_cb(listener_accelerometer_); - sensor_listener_stop(listener_accelerometer_); - sensor_destroy_listener(listener_accelerometer_); - - sensor_listener_stop(listener_gyroscope_); - sensor_destroy_listener(listener_gyroscope_); -} - -DataFetcherImplTizen* DataFetcherImplTizen::GetInstance() { - return base::Singleton >::get(); -} - -bool DataFetcherImplTizen::StartFetchingDeviceMotionData( - DeviceMotionHardwareBuffer* buffer) { - DCHECK(buffer); - { - base::AutoLock autolock(motion_buffer_lock_); - device_motion_buffer_ = buffer; - } - sensor_listener_set_event_cb( - listener_accelerometer_, kDeviceSensorIntervalMicroseconds / 1000, - DataFetcherImplTizen::onAccelerationChanged, this); - return Start(CONSUMER_TYPE_MOTION); -} - -void DataFetcherImplTizen::StopFetchingDeviceMotionData() { - Stop(CONSUMER_TYPE_MOTION); - { - base::AutoLock autolock(motion_buffer_lock_); - if (device_motion_buffer_) { - sensor_listener_unset_event_cb(listener_accelerometer_); - device_motion_buffer_ = NULL; - } - } -} - -bool DataFetcherImplTizen::StartFetchingDeviceOrientationData( - DeviceOrientationHardwareBuffer* buffer) { - DCHECK(buffer); - { - base::AutoLock autolock(orientation_buffer_lock_); - device_orientation_buffer_ = buffer; - } - sensor_listener_set_event_cb( - listener_orientation_, kDeviceSensorIntervalMicroseconds / 1000, - DataFetcherImplTizen::onOrientationChanged, this); - bool success = Start(CONSUMER_TYPE_ORIENTATION); - - { - base::AutoLock autolock(orientation_buffer_lock_); - // If Start() was unsuccessful then set the buffer ready flag to true - // to start firing all-null events. - SetOrientationBufferReadyStatus(!success); - } - return success; -} - -void DataFetcherImplTizen::StopFetchingDeviceOrientationData() { - Stop(CONSUMER_TYPE_ORIENTATION); - { - base::AutoLock autolock(orientation_buffer_lock_); - if (device_orientation_buffer_) { - SetOrientationBufferReadyStatus(false); - sensor_listener_unset_event_cb(listener_orientation_); - device_orientation_buffer_ = NULL; - } - } -} - -bool DataFetcherImplTizen::Start(ConsumerType type) { - switch(type) { - case CONSUMER_TYPE_ORIENTATION: - return (SENSOR_ERROR_NONE == sensor_listener_start(listener_orientation_)); - case CONSUMER_TYPE_MOTION: - if (SENSOR_ERROR_NONE != sensor_listener_start(listener_accelerometer_)) { - return false; - } - return (SENSOR_ERROR_NONE == sensor_listener_start(listener_gyroscope_)); - default: - NOTREACHED(); - return false; - } - -} - -void DataFetcherImplTizen::Stop(ConsumerType type) { - switch(type) { - case CONSUMER_TYPE_ORIENTATION: - sensor_listener_stop(listener_orientation_); - return; - case CONSUMER_TYPE_MOTION: - sensor_listener_stop(listener_accelerometer_); - sensor_listener_stop(listener_gyroscope_); - memset(&last_motion_data_, 0, sizeof(last_motion_data_)); - has_last_motion_data_ = false; - return; - default: - NOTREACHED(); - return; - } -} - -//static -void DataFetcherImplTizen::onOrientationChanged(sensor_h sensor, - sensor_event_s *event, void* userData) { - DataFetcherImplTizen *fetcher = static_cast(userData); - base::AutoLock autolock(fetcher->orientation_buffer_lock_); - - if (!fetcher->device_orientation_buffer_) - return; - - fetcher->device_orientation_buffer_->seqlock.WriteBegin(); - - float azimuth = event->values[0]; - float pitch = event->values[1]; - float roll = event->values[2]; - - fetcher->device_orientation_buffer_->data.alpha = azimuth; - fetcher->device_orientation_buffer_->data.has_alpha = true; - fetcher->device_orientation_buffer_->data.beta = pitch; - fetcher->device_orientation_buffer_->data.has_beta = true; - fetcher->device_orientation_buffer_->data.gamma = roll; - fetcher->device_orientation_buffer_->data.has_gamma = true; - fetcher->device_orientation_buffer_->seqlock.WriteEnd(); - - if (!fetcher->is_orientation_buffer_ready_) - fetcher->SetOrientationBufferReadyStatus(true); -} - -//static -void DataFetcherImplTizen::onAccelerationChanged(sensor_h sensor, - sensor_event_s *event, void* userData) { - DataFetcherImplTizen *self = static_cast(userData); - - float x = event->values[0]; - float y = event->values[1]; - float z = event->values[2]; - - float gravityX = x * 0.2f; - float gravityY = y * 0.2f; - float gravityZ = z * 0.2f; - bool accelerationAvailable = false; - - unsigned long long timestamp = event->timestamp; - - double interval = static_cast( - self->last_motion_timestamp_ - ? (timestamp - self->last_motion_timestamp_) / 1000 - : kDeviceSensorIntervalMicroseconds / 1000); - self->last_motion_timestamp_ = timestamp; - - if (self->has_last_motion_data_) { - const DeviceMotionHardwareBuffer* m = self->last_motion_data_; - gravityX += - (m->data.acceleration_including_gravity_x - m->data.acceleration_x) * - 0.8f; - gravityY += - (m->data.acceleration_including_gravity_x - m->data.acceleration_y) * - 0.8f; - gravityZ += - (m->data.acceleration_including_gravity_z - m->data.acceleration_z) * - 0.8f; - accelerationAvailable = true; - } - - float alpha, beta, gamma; - bool rotationRateAvailable = false; - - sensor_event_s event_gyroscope; - if (!sensor_listener_read_data(listener_gyroscope_, &event_gyroscope)) - rotationRateAvailable = true; - - alpha = event_gyroscope.values[0]; - beta = event_gyroscope.values[1]; - gamma = event_gyroscope.values[2]; - - self->device_motion_buffer_->seqlock.WriteBegin(); - - self->device_motion_buffer_->data.acceleration_including_gravity_x = x; - self->device_motion_buffer_->data.has_acceleration_including_gravity_x = true; - self->device_motion_buffer_->data.acceleration_including_gravity_x = y; - self->device_motion_buffer_->data.has_acceleration_including_gravity_x = true; - self->device_motion_buffer_->data.acceleration_including_gravity_z = z; - self->device_motion_buffer_->data.has_acceleration_including_gravity_z = true; - - self->device_motion_buffer_->data.acceleration_x = x - gravityX; - self->device_motion_buffer_->data.has_acceleration_x = accelerationAvailable; - self->device_motion_buffer_->data.acceleration_y = y - gravityY; - self->device_motion_buffer_->data.has_acceleration_y = accelerationAvailable; - self->device_motion_buffer_->data.acceleration_z = z - gravityZ; - self->device_motion_buffer_->data.has_acceleration_z = accelerationAvailable; - - self->device_motion_buffer_->data.rotation_rate_alpha = alpha; - self->device_motion_buffer_->data.has_rotation_rate_alpha = - rotationRateAvailable; - self->device_motion_buffer_->data.rotation_rate_beta = beta; - self->device_motion_buffer_->data.has_rotation_rate_beta = - rotationRateAvailable; - self->device_motion_buffer_->data.rotation_rate_gamma = gamma; - self->device_motion_buffer_->data.has_rotation_rate_gamma = - rotationRateAvailable; - - self->device_motion_buffer_->data.all_available_sensors_are_active = - (accelerationAvailable && rotationRateAvailable); - - self->last_motion_data_ = self->device_motion_buffer_; - self->has_last_motion_data_ = true; - - self->device_motion_buffer_->data.interval = interval; - - self->device_motion_buffer_->seqlock.WriteEnd(); -} - -void DataFetcherImplTizen::SetOrientationBufferReadyStatus(bool ready) { - device_orientation_buffer_->seqlock.WriteBegin(); - device_orientation_buffer_->data.absolute = ready; - device_orientation_buffer_->data.all_available_sensors_are_active = ready; - device_orientation_buffer_->seqlock.WriteEnd(); - is_orientation_buffer_ready_ = ready; -} - -} // namespace content diff --git a/tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_impl_tizen.h b/tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_impl_tizen.h deleted file mode 100644 index 18a259d..0000000 --- a/tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_impl_tizen.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef DATA_FETCHER_IMPL_TIZEN_H_ -#define DATA_FETCHER_IMPL_TIZEN_H_ - -#include - -#include "base/synchronization/lock.h" -#include "device/sensors/device_sensors_consts.h" -#include "device/sensors/public/cpp/device_motion_hardware_buffer.h" -#include "device/sensors/public/cpp/device_orientation_hardware_buffer.h" - -namespace base { -template struct DefaultSingletonTraits; -} - -namespace content { - -using namespace device; - -// FIXME: This class should be moved to device namespace. -class DataFetcherImplTizen { - public: - static DataFetcherImplTizen* GetInstance(); - - // Shared memory related methods. - bool StartFetchingDeviceMotionData(DeviceMotionHardwareBuffer* buffer); - void StopFetchingDeviceMotionData(); - - bool StartFetchingDeviceOrientationData( - DeviceOrientationHardwareBuffer* buffer); - void StopFetchingDeviceOrientationData(); - - virtual bool Start(ConsumerType); - virtual void Stop(ConsumerType); - - protected: - DataFetcherImplTizen(); - virtual ~DataFetcherImplTizen(); - static void onOrientationChanged(sensor_h sensor, sensor_event_s *event, void* userData); - static void onAccelerationChanged(sensor_h sensor, sensor_event_s *event, void* userData); - - private: - friend struct base::DefaultSingletonTraits; - - void SetOrientationBufferReadyStatus(bool ready); - - DeviceMotionHardwareBuffer* device_motion_buffer_; - DeviceOrientationHardwareBuffer* device_orientation_buffer_; - DeviceMotionHardwareBuffer* last_motion_data_; - bool has_last_motion_data_; - unsigned long long last_motion_timestamp_; - bool is_orientation_buffer_ready_; - - base::Lock motion_buffer_lock_; - base::Lock orientation_buffer_lock_; - - DISALLOW_COPY_AND_ASSIGN(DataFetcherImplTizen); -}; - -} // namespace content - -#endif // DATA_FETCHER_IMPL_TIZEN_H_ diff --git a/tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_shared_memory_tizen.cc b/tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_shared_memory_tizen.cc deleted file mode 100644 index 29e1cc2..0000000 --- a/tizen_src/chromium_impl/content/browser/device_sensors/data_fetcher_shared_memory_tizen.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#if defined(OS_TIZEN) -#include "content/browser/device_sensors/data_fetcher_impl_tizen.h" -#endif - -#include "base/logging.h" -#include "content/browser/device_sensors/data_fetcher_shared_memory.h" -#include "device/sensors/public/cpp/device_motion_hardware_buffer.h" -#include "device/sensors/public/cpp/device_orientation_hardware_buffer.h" -#include "tizen/system_info.h" - -namespace content { - -DataFetcherSharedMemory::DataFetcherSharedMemory() { -} - -DataFetcherSharedMemory::~DataFetcherSharedMemory() { -} - -bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { - if (!(IsMobileProfile() || IsWearableProfile())) - return false; - - DCHECK(buffer); - - switch (consumer_type) { - case CONSUMER_TYPE_MOTION: - return DataFetcherImplTizen::GetInstance()-> - StartFetchingDeviceMotionData( - static_cast(buffer)); - case CONSUMER_TYPE_ORIENTATION: - return DataFetcherImplTizen::GetInstance()-> - StartFetchingDeviceOrientationData( - static_cast(buffer)); - default: - NOTREACHED(); - } - return false; -} - -bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { - if (!(IsMobileProfile() || IsWearableProfile())) - return false; - - switch (consumer_type) { - case CONSUMER_TYPE_MOTION: - DataFetcherImplTizen::GetInstance()->StopFetchingDeviceMotionData(); - return true; - case CONSUMER_TYPE_ORIENTATION: - DataFetcherImplTizen::GetInstance()->StopFetchingDeviceOrientationData(); - return true; - default: - NOTREACHED(); - } - return false; -} - -#if !defined(EWK_BRINGUP) -DataFetcherSharedMemory::FetcherType DataFetcherSharedMemory::GetType() const { - return FETCHER_TYPE_SEPARATE_THREAD; -} -#endif - -} // namespace content -- 2.7.4 From b1f5d81a0ca6d6f45ecbde49f35465613f4786ad Mon Sep 17 00:00:00 2001 From: "suyambu.rm" Date: Tue, 28 Jan 2020 04:38:38 -0800 Subject: [PATCH 14/16] [M76 Migration] Handle fling gesture events in the browser process for EFL port Fling events handling has been moved from renderer to browser in upstream chromium as per [1]. Fling scroll was not working in M69 as fling events were not handled in the browser for chromium-efl. With this change, DidStopFlinging gets called naturally when fling ends which fixes hidden contextmenu not shown issue in [2]. Reference: https://review.tizen.org/gerrit/c/platform/framework/web/chromium-efl/+/217340 Change-Id: Ie601be59ab05ef51c762c9ebd1cdc20dd67ce36e Signed-off-by: suyambu.rm --- .../browser/compositor/evasgl_delegated_frame_host.cc | 3 +-- .../browser/compositor/evasgl_delegated_frame_host.h | 2 +- .../browser/renderer_host/render_widget_host_view_efl.cc | 13 +++++++++++-- .../browser/renderer_host/render_widget_host_view_efl.h | 4 +++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc index c477f64..e483ac9 100644 --- a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc +++ b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc @@ -93,8 +93,7 @@ void EvasGLDelegatedFrameHost::SwapDelegatedFrame( ClearRenderPasses(resources_in_frame); DCHECK(!invalid_frame); - client_->DelegatedFrameHostSendReclaimCompositorResources( - local_surface_id, returned_resources_); + client_->DidReceiveCompositorFrameAck(local_surface_id, returned_resources_); returned_resources_.clear(); } diff --git a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h index eca2efa..ff87648 100644 --- a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h +++ b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.h @@ -30,7 +30,7 @@ class CONTENT_EXPORT EvasGLDelegatedFrameHostClient { // and surface from EvasGLDelegatedFrameHost. virtual Evas_GL_API* GetEvasGLAPI() = 0; virtual Evas_GL* GetEvasGL() = 0; - virtual void DelegatedFrameHostSendReclaimCompositorResources( + virtual void DidReceiveCompositorFrameAck( const viz::LocalSurfaceId& local_surface_id, const std::vector& resources) = 0; }; diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc index 8abd4fa..8127a23 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc @@ -331,10 +331,12 @@ Evas_GL* RenderWidgetHostViewEfl::GetEvasGL() { return evas_gl_; } -void RenderWidgetHostViewEfl::DelegatedFrameHostSendReclaimCompositorResources( +void RenderWidgetHostViewEfl::DidReceiveCompositorFrameAck( const viz::LocalSurfaceId& local_surface_id, const std::vector& resources) { renderer_compositor_frame_sink_->DidReceiveCompositorFrameAck(resources); + if (needs_begin_frames_) + host_->ProgressFlingIfNeeded(base::TimeTicks::Now()); } void RenderWidgetHostViewEfl::InitializeDeviceDisplayInfo() { @@ -963,7 +965,14 @@ bool RenderWidgetHostViewEfl::RequestSnapshotAsync( void RenderWidgetHostViewEfl::SetWantsAnimateOnlyBeginFrames() {} -void RenderWidgetHostViewEfl::SetNeedsBeginFrames(bool needs_begin_frames) {} +void RenderWidgetHostViewEfl::SetNeedsBeginFrames(bool needs_begin_frames) { + if (needs_begin_frames_ == needs_begin_frames) + return; + + needs_begin_frames_ = needs_begin_frames; + if (needs_begin_frames_) + host_->ProgressFlingIfNeeded(base::TimeTicks::Now()); +} void RenderWidgetHostViewEfl::DidOverscroll( const ui::DidOverscrollParams& params) { diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h index a9bdf83..6dc4ad9 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h +++ b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h @@ -244,7 +244,7 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl // EvasGLDelegatedFrameHostClient implementation. Evas_GL_API* GetEvasGLAPI() override; - void DelegatedFrameHostSendReclaimCompositorResources( + void DidReceiveCompositorFrameAck( const viz::LocalSurfaceId& local_surface_id, const std::vector& resources) override; Evas_GL* GetEvasGL() override; @@ -361,6 +361,8 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink_ = nullptr; + bool needs_begin_frames_ = false; + base::WeakPtrFactory weak_factory_; DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewEfl); -- 2.7.4 From 87f721a48e3618075719bc6b392b434fa9d2ce59 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Mon, 2 Mar 2020 16:29:07 +0530 Subject: [PATCH 15/16] [SVACE] Fix SVACE issues This commit also includes changes from https://review.tizen.org/gerrit/#/c/212346/. Change-Id: I7dc953af267b09c31106dd146f6f40da7aa17c12 Signed-off-by: Chandan Padhi --- .../compositor/evasgl_delegated_frame_host.cc | 5 +- .../renderer_host/disambiguation_popup_efl.cc | 14 ++-- .../content/browser/renderer_host/edge_effect.cc | 4 +- .../renderer_host/render_widget_host_view_efl.cc | 1 + .../browser/selection/selection_controller_efl.cc | 3 - .../browser/selection/selection_controller_efl.h | 1 + .../media/base/tizen/media_player_bridge_capi.h | 2 - .../ewk/efl_integration/autofill_popup_view_efl.cc | 12 ++-- .../browser/autofill/autofill_client_efl.cc | 4 +- .../browser/browsing_data_remover_efl.cc | 75 ++++++++++++++-------- .../password_manager/password_store_factory.cc | 5 +- .../password_manager/password_store_factory.h | 6 +- .../common/navigation_policy_params.cc | 4 +- .../efl_integration/context_menu_controller_efl.cc | 10 +++ .../efl_integration/context_menu_controller_efl.h | 12 +--- .../ewk/efl_integration/devtools_delegate_efl.cc | 3 +- .../ewk/efl_integration/devtools_delegate_efl.h | 2 - tizen_src/ewk/efl_integration/eweb_view.cc | 3 + .../efl_integration/private/ewk_settings_private.h | 1 - .../private/ewk_user_media_private.cc | 4 +- tizen_src/ewk/efl_integration/public/ewk_view.cc | 5 +- .../url_request_context_getter_efl.cc | 18 +++--- .../efl_integration/web_contents_delegate_efl.cc | 8 +-- tizen_src/ewk/efl_webview_app/app.c | 22 +++---- 24 files changed, 122 insertions(+), 102 deletions(-) diff --git a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc index e483ac9..4e06095 100644 --- a/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc +++ b/tizen_src/chromium_impl/content/browser/compositor/evasgl_delegated_frame_host.cc @@ -15,7 +15,10 @@ namespace content { EvasGLDelegatedFrameHost::EvasGLDelegatedFrameHost( EvasGLDelegatedFrameHostClient* client) - : client_(client), is_initialized_(false), weak_ptr_factory_(this) {} + : client_(client), + is_initialized_(false), + child_id_(0), + weak_ptr_factory_(this) {} EvasGLDelegatedFrameHost::~EvasGLDelegatedFrameHost() { if (!is_initialized_) diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/disambiguation_popup_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/disambiguation_popup_efl.cc index aaad053..e6c6fa9 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/disambiguation_popup_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/disambiguation_popup_efl.cc @@ -55,12 +55,14 @@ void TouchedOnOutterArea(void* data, Evas*, Evas_Object* image, void* event_info } // namespace -DisambiguationPopupEfl::DisambiguationPopupEfl( - Evas_Object* parent_view, RenderWidgetHostViewEfl* rwhv) - : rwhv_(rwhv) - , parent_view_(parent_view) - , content_image_(NULL) - , popup_(NULL) { +DisambiguationPopupEfl::DisambiguationPopupEfl(Evas_Object* parent_view, + RenderWidgetHostViewEfl* rwhv) + : rwhv_(rwhv), + parent_view_(parent_view), + content_image_(nullptr), + popup_(nullptr), + height_(0), + width_(0) { CHECK(parent_view); CHECK(rwhv); diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/edge_effect.cc b/tizen_src/chromium_impl/content/browser/renderer_host/edge_effect.cc index 806c19d..a4e3648 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/edge_effect.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/edge_effect.cc @@ -123,7 +123,7 @@ void EdgeEffect::Show(const std::string& source) { else if (source.find("right") != std::string::npos) state = edje_object_part_state_get(edge_object_, "edge_effect_right", &ret); - if (!strcmp(state, "visible")) + if (state && !strcmp(state, "visible")) return; edje_object_signal_emit(edge_object_, "edge,show", source.c_str()); @@ -141,7 +141,7 @@ void EdgeEffect::Hide(const std::string& source) { else if (source.find("right") != std::string::npos) state = edje_object_part_state_get(edge_object_, "edge_effect_right", &ret); - if (strcmp(state, "visible")) + if (state && strcmp(state, "visible")) return; edje_object_signal_emit(edge_object_, "edge,hide", source.c_str()); diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc index 8127a23..585037a 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc @@ -145,6 +145,7 @@ RenderWidgetHostViewEfl::RenderWidgetHostViewEfl(RenderWidgetHost* widget_host, evas_gl_surface_(NULL), handling_disambiguation_popup_gesture_(false), touch_events_enabled_(false), + background_color_(SK_ColorWHITE), web_contents_(web_contents), weak_factory_(this) { parent_view_ = static_cast(web_contents.GetNativeView()); diff --git a/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.cc b/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.cc index 59c0370..861a7b7 100644 --- a/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.cc +++ b/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.cc @@ -24,7 +24,6 @@ namespace content { static const int menuHeight = 140;// The Height fo the context menu. static const int menuPadding = 60;// This is padding for deciding when to modify context menu position. static const int spacePadding = 0; // 24;// This is for making context menu closer to the handles. -static const int textSelectionScrollSize = 50;// Scroll step when selection handler is moving out of viewport. bool IsRectEmpty(const gfx::Rect& rect) { return rect == gfx::Rect(); @@ -51,7 +50,6 @@ SelectionControllerEfl::SelectionControllerEfl(Evas_Object* parent_view, WebCont start_handle_(new SelectionHandleEfl(*this, SelectionHandleEfl::HANDLE_TYPE_LEFT, parent_view)), end_handle_(new SelectionHandleEfl(*this, SelectionHandleEfl::HANDLE_TYPE_RIGHT, parent_view)), input_handle_(new SelectionHandleEfl(*this, SelectionHandleEfl::HANDLE_TYPE_INPUT, parent_view)), - magnifier_(new SelectionMagnifierEfl(this, web_contents)), is_selection_visible_(false), handle_being_dragged_(false), @@ -59,7 +57,6 @@ SelectionControllerEfl::SelectionControllerEfl(Evas_Object* parent_view, WebCont web_contents_(web_contents), selection_mode_(None) { evas_object_event_callback_add(parent_view_, EVAS_CALLBACK_MOVE, &EvasParentViewMoveCallback, this); - #if defined(OS_TIZEN) vconf_notify_key_changed(VCONFKEY_LANGSET, PlatformLanguageChanged, this); #endif diff --git a/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.h b/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.h index 417c6d7..1847407 100644 --- a/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.h +++ b/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.h @@ -202,6 +202,7 @@ class CONTENT_EXPORT SelectionControllerEfl { SelectionHandleEfl* stationary_handle_; bool is_selection_visible_; + bool handle_being_dragged_; bool selection_on_empty_form_control_; diff --git a/tizen_src/chromium_impl/media/base/tizen/media_player_bridge_capi.h b/tizen_src/chromium_impl/media/base/tizen/media_player_bridge_capi.h index a632176..0acf828d 100644 --- a/tizen_src/chromium_impl/media/base/tizen/media_player_bridge_capi.h +++ b/tizen_src/chromium_impl/media/base/tizen/media_player_bridge_capi.h @@ -86,8 +86,6 @@ class MEDIA_EXPORT MediaPlayerBridgeCapi GURL url_; double volume_; - int media_type_; - bool is_end_reached_; bool is_file_url_; bool is_paused_; diff --git a/tizen_src/ewk/efl_integration/autofill_popup_view_efl.cc b/tizen_src/ewk/efl_integration/autofill_popup_view_efl.cc index 97f79c6..602ec04 100644 --- a/tizen_src/ewk/efl_integration/autofill_popup_view_efl.cc +++ b/tizen_src/ewk/efl_integration/autofill_popup_view_efl.cc @@ -33,10 +33,11 @@ enum AutofillSavePassword { }; AutofillPopupViewEfl::AutofillPopupViewEfl(EWebView* view) - : webview_(view) - , autofill_popup_(NULL) - , autofill_list_(NULL) - , password_popup_(NULL) { + : webview_(view), + autofill_popup_(nullptr), + autofill_list_(nullptr), + password_popup_(nullptr), + selected_line_(-1) { Evas_Object* widgetWin_ = elm_object_top_widget_get( elm_object_parent_widget_get(view->evas_object())); if (!widgetWin_) @@ -197,7 +198,7 @@ void AutofillPopupViewEfl::UpdateFormDataPopup(const gfx::RectF& bounds) evas_object_propagate_events_set(autofill_popup_, false); } -bool isAutofillSpecial(autofill::Suggestion suggestion) { +bool isAutofillSpecial(const autofill::Suggestion& suggestion) { return suggestion.frontend_id != POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY && suggestion.frontend_id != POPUP_ITEM_ID_DATALIST_ENTRY; } @@ -223,7 +224,6 @@ void AutofillPopupViewEfl::InitFormData( labels_[i].resize(AUTOFILL_POPUP_LABEL_LEN); } delegate_ = delegate; - selected_line_ = -1; } void AutofillPopupViewEfl::AcceptSuggestion(size_t index) diff --git a/tizen_src/ewk/efl_integration/browser/autofill/autofill_client_efl.cc b/tizen_src/ewk/efl_integration/browser/autofill/autofill_client_efl.cc index 49ed53c..772746c 100644 --- a/tizen_src/ewk/efl_integration/browser/autofill/autofill_client_efl.cc +++ b/tizen_src/ewk/efl_integration/browser/autofill/autofill_client_efl.cc @@ -49,7 +49,7 @@ void AutofillClientEfl::TabActivated() { } PersonalDataManager* AutofillClientEfl::GetPersonalDataManager() { - if (webview_) { + if (webview_ && webview_->context()) { content::BrowserContextEfl* ctx = webview_->context()->GetImpl()->browser_context(); @@ -67,7 +67,7 @@ scoped_refptr AutofillClientEfl::GetDatabase() { } PrefService* AutofillClientEfl::GetPrefs() { - if(webview_) { + if (webview_ && webview_->context()) { content::BrowserContextEfl* ctx = webview_->context()->GetImpl()->browser_context(); return user_prefs::UserPrefs::Get(ctx); diff --git a/tizen_src/ewk/efl_integration/browser/browsing_data_remover_efl.cc b/tizen_src/ewk/efl_integration/browser/browsing_data_remover_efl.cc index 9a2390e..1d141c9 100644 --- a/tizen_src/ewk/efl_integration/browser/browsing_data_remover_efl.cc +++ b/tizen_src/ewk/efl_integration/browser/browsing_data_remover_efl.cc @@ -1,4 +1,4 @@ -// Copyright 2014 Samsung Electronics. All rights reserved. +// Copyright 2014 Samsung Eaectronics. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -52,21 +52,26 @@ int BrowsingDataRemoverEfl::GenerateQuotaClientMask(int remove_mask) { return quota_client_mask; } -BrowsingDataRemoverEfl::BrowsingDataRemoverEfl(content::BrowserContext* browser_context, base::Time delete_begin, - base::Time delete_end) - : browser_context_(browser_context) - , app_cache_service_(NULL) - , quota_manager_(NULL) - , dom_storage_context_(NULL) - , delete_begin_(delete_begin) - , delete_end_(delete_end) - , next_cache_state_(STATE_NONE) - , cache_(NULL) - , main_context_getter_(NULL) - , media_context_getter_(NULL) - , waiting_for_clear_cache_(false) - , waiting_for_clear_local_storage_(false) - , waiting_for_clear_quota_managed_data_(false) { +BrowsingDataRemoverEfl::BrowsingDataRemoverEfl( + content::BrowserContext* browser_context, + base::Time delete_begin, + base::Time delete_end) + : browser_context_(browser_context), + app_cache_service_(nullptr), + quota_manager_(nullptr), + dom_storage_context_(nullptr), + delete_begin_(delete_begin), + delete_end_(delete_end), + next_cache_state_(STATE_NONE), + cache_(nullptr), + main_context_getter_(nullptr), + media_context_getter_(nullptr), + waiting_for_clear_cache_(false), + waiting_for_clear_local_storage_(false), + waiting_for_clear_quota_managed_data_(false), + quota_managed_origins_to_delete_count_(0), + quota_managed_storage_types_to_delete_count_(0), + remove_mask_(0) { if (browser_context_) { app_cache_service_ = browser_context->GetStoragePartition(browser_context_, NULL)->GetAppCacheService(); main_context_getter_ = @@ -111,18 +116,32 @@ void BrowsingDataRemoverEfl::DoClearCache(int rv) { case STATE_CREATE_MAIN: case STATE_CREATE_MEDIA: { // Get a pointer to the cache. - net::URLRequestContextGetter* getter = - (next_cache_state_ == STATE_CREATE_MAIN) - ? main_context_getter_.get() - : media_context_getter_.get(); - net::HttpTransactionFactory* factory = - getter->GetURLRequestContext()->http_transaction_factory(); - - next_cache_state_ = (next_cache_state_ == STATE_CREATE_MAIN) ? - STATE_DELETE_MAIN : STATE_DELETE_MEDIA; - rv = factory->GetCache()->GetBackend( - &cache_, base::Bind(&BrowsingDataRemoverEfl::DoClearCache, - base::Unretained(this))); + net::URLRequestContextGetter* getter = nullptr; + if (next_cache_state_ == STATE_CREATE_MAIN) { + if (main_context_getter_) + getter = main_context_getter_.get(); + } else { + if (media_context_getter_) + getter = media_context_getter_.get(); + } + if (getter && getter->GetURLRequestContext()) { + net::HttpTransactionFactory* factory = + getter->GetURLRequestContext()->http_transaction_factory(); + if (factory) { + next_cache_state_ = (next_cache_state_ == STATE_CREATE_MAIN) + ? STATE_DELETE_MAIN + : STATE_DELETE_MEDIA; + rv = factory->GetCache()->GetBackend( + &cache_, base::Bind(&BrowsingDataRemoverEfl::DoClearCache, + base::Unretained(this))); + } else { + LOG(ERROR) << "Could not get HttpTransactionFactory."; + next_cache_state_ = STATE_NONE; + } + } else { + LOG(ERROR) << "Could not get URLRequestContext."; + next_cache_state_ = STATE_NONE; + } break; } case STATE_DELETE_MAIN: diff --git a/tizen_src/ewk/efl_integration/browser/password_manager/password_store_factory.cc b/tizen_src/ewk/efl_integration/browser/password_manager/password_store_factory.cc index eb4cdc3..af9cf1f 100644 --- a/tizen_src/ewk/efl_integration/browser/password_manager/password_store_factory.cc +++ b/tizen_src/ewk/efl_integration/browser/password_manager/password_store_factory.cc @@ -53,8 +53,7 @@ PasswordStoreFactory* PasswordStoreFactory::GetInstance() return base::Singleton::get(); } -PasswordStoreFactory::PasswordStoreFactory() - : service_(NULL) { +PasswordStoreFactory::PasswordStoreFactory() { WebDataServiceFactory::GetInstance(); Init(); } @@ -87,7 +86,7 @@ void PasswordStoreFactory::Init() return; } - service_ = new PasswordStoreService(ps); + service_ = std::make_unique(ps); } #endif // TIZEN_AUTOFILL_SUPPORT diff --git a/tizen_src/ewk/efl_integration/browser/password_manager/password_store_factory.h b/tizen_src/ewk/efl_integration/browser/password_manager/password_store_factory.h index ac21ae4..93321ef 100644 --- a/tizen_src/ewk/efl_integration/browser/password_manager/password_store_factory.h +++ b/tizen_src/ewk/efl_integration/browser/password_manager/password_store_factory.h @@ -36,15 +36,15 @@ class PasswordStoreFactory { static scoped_refptr GetPasswordStore(); static PasswordStoreFactory* GetInstance(); - PasswordStoreService* GetService() { return service_; } + PasswordStoreService* GetService() { return service_.get(); } private: friend struct base::DefaultSingletonTraits; - void Init(); PasswordStoreFactory(); virtual ~PasswordStoreFactory(); + void Init(); - PasswordStoreService* service_; + std::unique_ptr service_; DISALLOW_COPY_AND_ASSIGN(PasswordStoreFactory); }; diff --git a/tizen_src/ewk/efl_integration/common/navigation_policy_params.cc b/tizen_src/ewk/efl_integration/common/navigation_policy_params.cc index 56ec05b4..19d24c74 100644 --- a/tizen_src/ewk/efl_integration/common/navigation_policy_params.cc +++ b/tizen_src/ewk/efl_integration/common/navigation_policy_params.cc @@ -8,9 +8,7 @@ NavigationPolicyParams::NavigationPolicyParams() : render_view_id(-1), -#if !defined(EWK_BRINGUP) // FIXME: m73 bringup - policy(blink::kWebNavigationPolicyIgnore), -#endif + policy(blink::kWebNavigationPolicyCurrentTab), type(blink::kWebNavigationTypeOther), should_replace_current_entry(false), is_main_frame(false), diff --git a/tizen_src/ewk/efl_integration/context_menu_controller_efl.cc b/tizen_src/ewk/efl_integration/context_menu_controller_efl.cc index dd54ef2..991222c 100644 --- a/tizen_src/ewk/efl_integration/context_menu_controller_efl.cc +++ b/tizen_src/ewk/efl_integration/context_menu_controller_efl.cc @@ -42,6 +42,16 @@ int ContextMenuControllerEfl::_popup_item_height = 96; bool ContextMenuControllerEfl::_context_menu_resized = false; std::vector ContextMenuControllerEfl::_context_menu_listdata; +ContextMenuControllerEfl::ContextMenuControllerEfl(EWebView* wv, + WebContents& web_contents) + : webview_(wv), + native_view_(static_cast(web_contents.GetNativeView())), + popup_(nullptr), + menu_items_(nullptr), + web_contents_(web_contents), + is_text_selection_(false), + weak_ptr_factory_(this) {} + ContextMenuControllerEfl::~ContextMenuControllerEfl() { for (std::set::iterator it = clipboard_download_items_.begin(); diff --git a/tizen_src/ewk/efl_integration/context_menu_controller_efl.h b/tizen_src/ewk/efl_integration/context_menu_controller_efl.h index 67e735e..49773b8 100644 --- a/tizen_src/ewk/efl_integration/context_menu_controller_efl.h +++ b/tizen_src/ewk/efl_integration/context_menu_controller_efl.h @@ -67,15 +67,7 @@ class ContextMenuControllerEfl : public download::DownloadItem::Observer { static void ContextMenuItemSelectedCallback(void* data, Evas_Object* obj, void* event_info); static void ContextMenuHWBackKey(void* data, Evas_Object* obj, void* event_info); - ContextMenuControllerEfl(EWebView* wv, WebContents& web_contents) - : webview_(wv), - native_view_(static_cast(web_contents.GetNativeView())), - popup_(NULL), - menu_items_(NULL), - web_contents_(web_contents), - weak_ptr_factory_(this) { - } - + ContextMenuControllerEfl(EWebView* wv, WebContents& web_contents); ~ContextMenuControllerEfl(); bool PopulateAndShowContextMenu(const ContextMenuParams& params); @@ -129,13 +121,13 @@ class ContextMenuControllerEfl : public download::DownloadItem::Observer { Eina_List* menu_items_; ContextMenuParams params_; WebContents& web_contents_; - base::WeakPtrFactory weak_ptr_factory_; gfx::Point context_menu_show_pos_; bool is_text_selection_; std::set clipboard_download_items_; std::set disk_download_items_; std::unique_ptr file_saved_dialog_; std::unique_ptr save_fail_dialog_; + base::WeakPtrFactory weak_ptr_factory_; }; } // namespace diff --git a/tizen_src/ewk/efl_integration/devtools_delegate_efl.cc b/tizen_src/ewk/efl_integration/devtools_delegate_efl.cc index 1187d24..49caec4 100644 --- a/tizen_src/ewk/efl_integration/devtools_delegate_efl.cc +++ b/tizen_src/ewk/efl_integration/devtools_delegate_efl.cc @@ -68,8 +68,7 @@ class TCPServerSocketFactory : public content::DevToolsSocketFactory { namespace content { -DevToolsDelegateEfl::DevToolsDelegateEfl(int port) - : port_(0), browser_context_(NULL) { +DevToolsDelegateEfl::DevToolsDelegateEfl(int port) : port_(0) { // It's a hacky way to early detected if port is available. The problem is // that the only thing we can do after checking is hope that noone will take // the port until it's initialized on IO thread again. The best approach would diff --git a/tizen_src/ewk/efl_integration/devtools_delegate_efl.h b/tizen_src/ewk/efl_integration/devtools_delegate_efl.h index 9c68bb9..ceb8f42 100644 --- a/tizen_src/ewk/efl_integration/devtools_delegate_efl.h +++ b/tizen_src/ewk/efl_integration/devtools_delegate_efl.h @@ -11,7 +11,6 @@ namespace content { -class BrowserContext; class DevToolsHttpHandler; // This class is to create RemoteInspector Server(Remote Debugger) and return devtools front resources. @@ -39,7 +38,6 @@ class DevToolsDelegateEfl : public DevToolsManagerDelegate { private: int port_; - content::BrowserContext* browser_context_; std::unique_ptr devtools_http_handler_; }; diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 7e4ed2f..a9f8e7b 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -1940,6 +1940,9 @@ bool EWebView::RestoreFromSessionData(const char* data, unsigned length) { if (!entryCount) return true; + if (!context()) + return false; + std::vector> scopedEntries = sessions::ContentSerializedNavigationBuilder::ToNavigationEntries( serializedEntries, context()->browser_context()); diff --git a/tizen_src/ewk/efl_integration/private/ewk_settings_private.h b/tizen_src/ewk/efl_integration/private/ewk_settings_private.h index d11756b..598e8f7 100644 --- a/tizen_src/ewk/efl_integration/private/ewk_settings_private.h +++ b/tizen_src/ewk/efl_integration/private/ewk_settings_private.h @@ -131,7 +131,6 @@ class Ewk_Settings { bool m_defaultKeypadEnabled; bool m_useKeyPadWithoutUserAction; bool m_textStyleState; - bool m_autoFitting; bool m_detectContentsAutomatically; Evas_Object* m_evas_object; diff --git a/tizen_src/ewk/efl_integration/private/ewk_user_media_private.cc b/tizen_src/ewk/efl_integration/private/ewk_user_media_private.cc index 76e6bcf..6c0f637 100644 --- a/tizen_src/ewk/efl_integration/private/ewk_user_media_private.cc +++ b/tizen_src/ewk/efl_integration/private/ewk_user_media_private.cc @@ -13,7 +13,9 @@ _Ewk_User_Media_Permission_Request::_Ewk_User_Media_Permission_Request( : web_contents_(web_contents), request_(media_request), callback_(std::move(callback)), - origin_(new _Ewk_Security_Origin(media_request.security_origin)) {} + origin_(new _Ewk_Security_Origin(media_request.security_origin)), + decided_(false), + suspended_(false) {} void _Ewk_User_Media_Permission_Request::ProceedPermissionCallback(bool allowed) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/tizen_src/ewk/efl_integration/public/ewk_view.cc b/tizen_src/ewk/efl_integration/public/ewk_view.cc index 4ae1287..9ab82e1 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_view.cc @@ -998,8 +998,9 @@ char* ewk_view_get_cookies_for_url(Evas_Object* view, const char* url) { EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0); - std::string cookiesForURL; - cookiesForURL = impl->context()->cookieManager()->GetCookiesForURL(std::string(url)); + EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(), 0); + std::string cookiesForURL = + impl->context()->cookieManager()->GetCookiesForURL(std::string(url)); if (cookiesForURL.empty()) return NULL; return strndup(cookiesForURL.c_str(), cookiesForURL.length()); diff --git a/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc b/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc index a960709..d0854a1 100644 --- a/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc +++ b/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc @@ -281,17 +281,17 @@ void URLRequestContextGetterEfl::SetCookieStoragePath( } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - // Remove below "false" this was added as part of M67 Brinup to avoid - // crash related to CreateSQLitePersistentCookieStore - if (file_storage == EWK_COOKIE_PERSISTENT_STORAGE_SQLITE -#if defined(EWK_BRINGUP) // FIXME: m67 bringup - && false -#endif - ) { + +// This was added as part of M67 Brinup to avoid crash related to +// CreateSQLitePersistentCookieStore. +#if !defined(EWK_BRINGUP) // FIXME: m67 bringup + if (file_storage == EWK_COOKIE_PERSISTENT_STORAGE_SQLITE) CreateSQLitePersistentCookieStore(path, persist_session_cookies); - } else { + else CreatePersistentCookieStore(path, persist_session_cookies); - } +#else + CreatePersistentCookieStore(path, persist_session_cookies); +#endif } void URLRequestContextGetterEfl::CreateSQLitePersistentCookieStore( diff --git a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc index da3a827..b4e9d4c 100644 --- a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc +++ b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc @@ -98,13 +98,13 @@ WebContentsDelegateEfl::WebContentsDelegateEfl(EWebView* view) weak_ptr_factory_(this) { #if defined(TIZEN_AUTOFILL_SUPPORT) AutofillClientEfl::CreateForWebContents(&web_contents_); - AutofillClientEfl* autofill_manager = + AutofillClientEfl* autofill_client = AutofillClientEfl::FromWebContents(&web_contents_); - autofill_manager->SetEWebView(view); + autofill_client->SetEWebView(view); PasswordManagerClientEfl::CreateForWebContentsWithAutofillClient( - &web_contents_, autofill_manager); + &web_contents_, autofill_client); ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( - &web_contents_, autofill_manager, EWebView::GetPlatformLocale(), + &web_contents_, autofill_client, EWebView::GetPlatformLocale(), AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); #endif } diff --git a/tizen_src/ewk/efl_webview_app/app.c b/tizen_src/ewk/efl_webview_app/app.c index 49a6efe..98b1f4f 100644 --- a/tizen_src/ewk/efl_webview_app/app.c +++ b/tizen_src/ewk/efl_webview_app/app.c @@ -39,8 +39,8 @@ uint64_t current_notification_id; static Ewk_Auth_Challenge* auth_challenge_holder = NULL; static Evas_Object* credentials[2] = {0};//username and password -static Eina_Bool fullscreen_enabled; -static Eina_Bool clear_cache; +static Eina_Bool fullscreen_enabled = EINA_FALSE; +static Eina_Bool clear_cache = EINA_FALSE; static Eina_Bool disable_cache = EINA_FALSE; static char* pdf_filename = NULL; static char* cache_policy = NULL; @@ -456,7 +456,7 @@ int main(int argc, char** argv) int idx = ecore_getopt_parse(&options, values, argc, argv); for (; idx < argc; ++idx) { // Treat first argument not starting with - as the url to load - if (argv[idx][0] != '-') { + if (argv[idx][0] != '-' && start_url == NULL) { start_url = strdup(argv[idx]); } else if (strcmp(argv[idx], "--incognito") == 0) { incognito = EINA_TRUE; @@ -486,13 +486,6 @@ int main(int argc, char** argv) ecore_evas_callback_delete_request_set(ee, _evas_close_cb); -#if defined(OS_TIZEN) - // Ignore fullscreen option, we should always go fullscreen on device. - Eina_Bool use_fullscreen = EINA_TRUE; -#else - Eina_Bool use_fullscreen = fullscreen_enabled; -#endif - if (incognito == EINA_TRUE) { fprintf(stderr, "Creating incognito web view\n"); view = ewk_view_add_in_incognito_mode(e); @@ -502,13 +495,18 @@ int main(int argc, char** argv) view = ewk_view_add_with_context(e, context); } - if (use_fullscreen) { - ecore_evas_fullscreen_set(ee, EINA_TRUE); +#if defined(OS_TIZEN) + // we should always go fullscreen on device. + ecore_evas_fullscreen_set(ee, EINA_TRUE); +#else + if (fullscreen_enabled) { // When in fullscreen, we don't need to manually specify the dimensions of // EwkView. + ecore_evas_fullscreen_set(ee, EINA_TRUE); } else { evas_object_resize(view, width, height); } +#endif ecore_evas_callback_resize_set(ee, &on_evas_resize); -- 2.7.4 From bb338a28df06f54e05eb0a502550211189c28d1c Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Thu, 5 Mar 2020 15:27:33 +0530 Subject: [PATCH 16/16] [Coverity] Fix coverity defects This commit also includes changes from https://review.tizen.org/gerrit/#/c/213680/. Change-Id: Iccccadb1cf718bd102ab51e80a656cec87416107 Signed-off-by: Chandan Padhi --- .../browser/ssl_host_state_delegate_efl.cc | 22 +++------------- .../browser/ssl_host_state_delegate_efl.h | 5 +--- .../ewk/efl_integration/devtools_delegate_efl.cc | 4 +-- .../renderer/print_web_view_helper_efl.cc | 12 ++++++--- .../url_request_context_getter_efl.cc | 18 +++++++------ .../ewk/efl_integration/wrt/wrt_widget_host.cc | 7 ++++- tizen_src/ewk/ubrowser/logger.cc | 30 ++++++++++------------ 7 files changed, 44 insertions(+), 54 deletions(-) diff --git a/tizen_src/ewk/efl_integration/browser/ssl_host_state_delegate_efl.cc b/tizen_src/ewk/efl_integration/browser/ssl_host_state_delegate_efl.cc index 2a1935e3..9375715 100644 --- a/tizen_src/ewk/efl_integration/browser/ssl_host_state_delegate_efl.cc +++ b/tizen_src/ewk/efl_integration/browser/ssl_host_state_delegate_efl.cc @@ -11,16 +11,6 @@ using content::SSLHostStateDelegate; namespace content { namespace internal { -net::SHA256HashValue getChainFingerprint256(const net::X509Certificate& cert) { -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - net::SHA256HashValue fingerprint = - net::X509Certificate::CalculateChainFingerprint256( - cert.os_cert_handle(), cert.GetIntermediateCertificates()); -#else - net::SHA256HashValue fingerprint; -#endif - return fingerprint; -} CertPolicy::CertPolicy() { } @@ -33,16 +23,13 @@ CertPolicy::~CertPolicy() { // in the saved CertStatus. bool CertPolicy::Check(const net::X509Certificate& cert, net::CertStatus error) const { -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - net::SHA256HashValue fingerprint = getChainFingerprint256(cert); - std::map::const_iterator allowed_iter = + net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256(); + std::map::const_iterator allowed_iter = allowed_.find(fingerprint); if ((allowed_iter != allowed_.end()) && (allowed_iter->second & error) && ((allowed_iter->second & error) == error)) { return true; } -#endif return false; } @@ -50,10 +37,8 @@ void CertPolicy::Allow(const net::X509Certificate& cert, net::CertStatus error) { // If this same cert had already been saved with a different error status, // this will replace it with the new error status. -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - net::SHA256HashValue fingerprint = getChainFingerprint256(cert); + net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256(); allowed_[fingerprint] = error; -#endif } } // namespace internal @@ -106,7 +91,6 @@ void SSLHostStateDelegateEfl::RevokeUserAllowExceptions( } bool SSLHostStateDelegateEfl::HasAllowException(const std::string& host) const { - NOTIMPLEMENTED(); return false; } diff --git a/tizen_src/ewk/efl_integration/browser/ssl_host_state_delegate_efl.h b/tizen_src/ewk/efl_integration/browser/ssl_host_state_delegate_efl.h index b3a19fb2..5e9992d 100644 --- a/tizen_src/ewk/efl_integration/browser/ssl_host_state_delegate_efl.h +++ b/tizen_src/ewk/efl_integration/browser/ssl_host_state_delegate_efl.h @@ -32,10 +32,7 @@ class CertPolicy { private: // The set of fingerprints of allowed certificates. -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - std::map - allowed_; -#endif + std::map allowed_; }; } // namespace internal diff --git a/tizen_src/ewk/efl_integration/devtools_delegate_efl.cc b/tizen_src/ewk/efl_integration/devtools_delegate_efl.cc index 49caec4..c88678c 100644 --- a/tizen_src/ewk/efl_integration/devtools_delegate_efl.cc +++ b/tizen_src/ewk/efl_integration/devtools_delegate_efl.cc @@ -86,8 +86,8 @@ DevToolsDelegateEfl::DevToolsDelegateEfl(int port) : port_(0) { int temp_port = 0; std::string port_str = command_line->GetSwitchValueASCII(switches::kRemoteDebuggingPort); - base::StringToInt(port_str, &temp_port); - if (temp_port > 0 && temp_port < 65535) { + if (base::StringToInt(port_str, &temp_port) && (temp_port > 0) && + (temp_port < 65535)) { port = temp_port; } else { DLOG(WARNING) << "Invalid http debugger port number " << temp_port; diff --git a/tizen_src/ewk/efl_integration/renderer/print_web_view_helper_efl.cc b/tizen_src/ewk/efl_integration/renderer/print_web_view_helper_efl.cc index a68026b..67d494d 100644 --- a/tizen_src/ewk/efl_integration/renderer/print_web_view_helper_efl.cc +++ b/tizen_src/ewk/efl_integration/renderer/print_web_view_helper_efl.cc @@ -116,7 +116,9 @@ bool PrintWebViewHelperEfl::RenderPagesForPrint(blink::WebFrame* frame) { const PrintParams& print_params = params.params; blink::WebPrintParams webkit_print_params; ComputeWebKitPrintParamsInDesiredDpi(print_params, &webkit_print_params); -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup +#if defined(EWK_BRINGUP) // FIXME: m67 bringup + return false; +#else int page_count = frame->printBegin(webkit_print_params); gfx::Size print_canvas_size(webkit_print_params.printContentArea.width, webkit_print_params.printContentArea.height); @@ -128,7 +130,9 @@ bool PrintWebViewHelperEfl::RenderPagesForPrint(blink::WebFrame* frame) { bool PrintWebViewHelperEfl::PrintPagesToPdf(blink::WebFrame* frame, int page_count, const gfx::Size& canvas_size) { -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup +#if defined(EWK_BRINGUP) // FIXME: m67 bringup + return false; +#else printing::PdfMetafileSkia metafile(printing::PDF_SKIA_DOCUMENT_TYPE); if (!metafile.Init()) return false; @@ -200,7 +204,9 @@ bool PrintWebViewHelperEfl::PrintPageInternal( PrintParams result; double scale_factor = 1.0f; gfx::Rect canvas_area(canvas_size); -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup +#if defined(EWK_BRINGUP) // FIXME: m67 bringup + return false; +#else // FIXME: cannot convert ‘cc::PaintCanvas*’ to ‘skia::VectorCanvas* {aka // SkCanvas*}’ in initialization skia::VectorCanvas* canvas = metafile->GetVectorCanvasForNewPage( diff --git a/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc b/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc index d0854a1..9f37947 100644 --- a/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc +++ b/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc @@ -195,17 +195,19 @@ net::URLRequestContext* URLRequestContextGetterEfl::GetURLRequestContext() { ignore_certificate_errors_; if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) { int value; - base::StringToInt( - command_line.GetSwitchValueASCII(switches::kTestingFixedHttpPort), - &value); - network_session_params.testing_fixed_http_port = value; + if (base::StringToInt( + command_line.GetSwitchValueASCII(switches::kTestingFixedHttpPort), + &value)) { + network_session_params.testing_fixed_http_port = value; + } } if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { int value; - base::StringToInt( - command_line.GetSwitchValueASCII(switches::kTestingFixedHttpsPort), - &value); - network_session_params.testing_fixed_https_port = value; + if (base::StringToInt(command_line.GetSwitchValueASCII( + switches::kTestingFixedHttpsPort), + &value)) { + network_session_params.testing_fixed_https_port = value; + } } http_network_session_.reset(new net::HttpNetworkSession( diff --git a/tizen_src/ewk/efl_integration/wrt/wrt_widget_host.cc b/tizen_src/ewk/efl_integration/wrt/wrt_widget_host.cc index 5f75ddd..d57a495 100644 --- a/tizen_src/ewk/efl_integration/wrt/wrt_widget_host.cc +++ b/tizen_src/ewk/efl_integration/wrt/wrt_widget_host.cc @@ -34,7 +34,12 @@ bool SendToAllRenderers(IPC::Message* message) { } bool SendToRenderer(int renderer_id, IPC::Message* message) { - return content::RenderProcessHost::FromID(renderer_id)->Send(message); + content::RenderProcessHost* host = + content::RenderProcessHost::FromID(renderer_id); + if (!host) + return false; + + return host->Send(message); } } diff --git a/tizen_src/ewk/ubrowser/logger.cc b/tizen_src/ewk/ubrowser/logger.cc index e2c38fb..373619e 100644 --- a/tizen_src/ewk/ubrowser/logger.cc +++ b/tizen_src/ewk/ubrowser/logger.cc @@ -92,26 +92,25 @@ _make_format(MESSAGE_TYPE type, int add_newline, const char* fmt) { void log_message(MESSAGE_TYPE type, int add_newline, const char* fmt, ...) { - char* msg_fmt = NULL; - va_list list; - - if (!logger_show_trace && type == TRACE) { + if (!logger_show_trace && type == TRACE) return; - } - msg_fmt = _make_format(type, add_newline, fmt); + char* msg_fmt = _make_format(type, add_newline, fmt); + va_list list; va_start(list, fmt); if (msg_fmt == NULL) { vfprintf(stderr, fmt, list); + va_end(list); + return; } - if (type == ERROR) { + if (type == ERROR) vfprintf(stderr, msg_fmt, list); - } else { + else vfprintf(stdout, msg_fmt, list); - } + va_end(list); free(msg_fmt); @@ -119,23 +118,20 @@ log_message(MESSAGE_TYPE type, int add_newline, const char* fmt, ...) { void vlog_message(MESSAGE_TYPE type, int add_newline, const char* fmt, va_list vl) { - char* msg_fmt = NULL; - - if (!logger_show_trace && type == TRACE) { + if (!logger_show_trace && type == TRACE) return; - } - msg_fmt = _make_format(type, add_newline, fmt); + char* msg_fmt = _make_format(type, add_newline, fmt); if (msg_fmt == NULL) { vfprintf(stderr, fmt, vl); + return; } - if (type == ERROR) { + if (type == ERROR) vfprintf(stderr, msg_fmt, vl); - } else { + else vfprintf(stdout, msg_fmt, vl); - } free(msg_fmt); } -- 2.7.4