Skip to content

Commit

Permalink
Remove dead code from RenderMessageFilter
Browse files Browse the repository at this point in the history
- Clean up class removing methods and includes that aren't used

Bug: 993189
Change-Id: I7232600a27bb18ecbf5a22630acde3205919c644
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4985902
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216687}
  • Loading branch information
dtapuska authored and Chromium LUCI CQ committed Oct 29, 2023
1 parent 59179b4 commit a07eacf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 118 deletions.
74 changes: 2 additions & 72 deletions content/browser/renderer_host/render_message_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,70 +7,11 @@
#include <errno.h>
#include <string.h>

#include <map>
#include <utility>

#include "base/command_line.h"
#include "base/debug/alias.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/numerics/safe_math.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/thread_pool.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "components/download/public/common/download_stats.h"
#include "content/browser/bad_message.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/browser_main_loop.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/gpu/gpu_process_host.h"
#include "content/browser/media/media_internals.h"
#include "content/browser/renderer_host/pepper/pepper_security_helper.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_widget_helper.h"
#include "content/common/content_constants_internal.h"
#include "content/common/render_message_filter.mojom.h"
#include "content/public/browser/browser_child_process_host.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "gpu/ipc/common/gpu_memory_buffer_impl.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_platform_file.h"
#include "media/base/media_log_record.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "net/base/io_buffer.h"
#include "net/base/mime_util.h"
#include "net/base/request_priority.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "url/gurl.h"
#include "url/origin.h"

#if BUILDFLAG(IS_WIN)
#include "content/public/common/font_cache_dispatcher_win.h"
#endif

#if BUILDFLAG(IS_POSIX)
#include "base/file_descriptor_posix.h"
#endif

#if BUILDFLAG(IS_MAC)
#include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#include "base/linux_util.h"
#include "base/threading/platform_thread.h"
#include "content/public/browser/child_process_launcher_utils.h"
#endif

namespace content {
namespace {
Expand All @@ -91,12 +32,10 @@ void GetHasGpuProcess(RenderMessageFilter::HasGpuProcessCallback callback) {
RenderMessageFilter::RenderMessageFilter(
int render_process_id,
BrowserContext* browser_context,
RenderWidgetHelper* render_widget_helper,
MediaInternals* media_internals)
RenderWidgetHelper* render_widget_helper)
: BrowserAssociatedInterface<mojom::RenderMessageFilter>(this),
render_widget_helper_(render_widget_helper),
render_process_id_(render_process_id),
media_internals_(media_internals) {
render_process_id_(render_process_id) {
if (render_widget_helper)
render_widget_helper_->Init(render_process_id_);
}
Expand Down Expand Up @@ -131,15 +70,6 @@ void RenderMessageFilter::GenerateFrameRoutingID(
document_token);
}

void RenderMessageFilter::OnMediaLogRecords(
const std::vector<media::MediaLogRecord>& events) {
// OnMediaLogRecords() is always dispatched to the UI thread for handling.
// See OverrideThreadForMessage().
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (media_internals_)
media_internals_->OnMediaEvents(render_process_id_, events);
}

void RenderMessageFilter::HasGpuProcess(HasGpuProcessCallback callback) {
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(GetHasGpuProcess, std::move(callback)));
Expand Down
43 changes: 1 addition & 42 deletions content/browser/renderer_host/render_message_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,13 @@
#include <stddef.h>
#include <stdint.h>

#include <vector>

#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/task/sequenced_task_runner_helpers.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "content/common/render_message_filter.mojom.h"
#include "content/public/browser/browser_associated_interface.h"
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/widget_type.h"
#include "gpu/config/gpu_info.h"
#include "ipc/message_filter.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/surface/transport_dib.h"

#if BUILDFLAG(IS_WIN)
#include <windows.h>
#endif

class GURL;

namespace media {
struct MediaLogRecord;
}

namespace content {
class BrowserContext;
class MediaInternals;
class RenderWidgetHelper;

// This class filters out incoming IPC messages for the renderer process on the
Expand All @@ -53,8 +26,7 @@ class RenderMessageFilter
// Create the filter.
RenderMessageFilter(int render_process_id,
BrowserContext* browser_context,
RenderWidgetHelper* render_widget_helper,
MediaInternals* media_internals);
RenderWidgetHelper* render_widget_helper);

RenderMessageFilter(const RenderMessageFilter&) = delete;
RenderMessageFilter& operator=(const RenderMessageFilter&) = delete;
Expand All @@ -72,27 +44,14 @@ class RenderMessageFilter
friend class BrowserThread;
friend class base::DeleteHelper<RenderMessageFilter>;

void OnGetProcessMemorySizes(size_t* private_bytes, size_t* shared_bytes);

// mojom::RenderMessageFilter:
void GenerateRoutingID(GenerateRoutingIDCallback routing_id) override;
void GenerateFrameRoutingID(GenerateFrameRoutingIDCallback callback) override;
void HasGpuProcess(HasGpuProcessCallback callback) override;

void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);

void OnMediaLogRecords(const std::vector<media::MediaLogRecord>&);

bool CheckBenchmarkingEnabled() const;
bool CheckPreparsedJsCachingEnabled() const;

scoped_refptr<RenderWidgetHelper> render_widget_helper_;

int render_process_id_;

raw_ptr<MediaInternals> media_internals_;

base::WeakPtrFactory<RenderMessageFilter> weak_ptr_factory_{this};
};

} // namespace content
Expand Down
6 changes: 2 additions & 4 deletions content/browser/renderer_host/render_process_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1825,11 +1825,9 @@ void RenderProcessHostImpl::ResetChannelProxy() {

void RenderProcessHostImpl::CreateMessageFilters() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
MediaInternals* media_internals = MediaInternals::GetInstance();

scoped_refptr<RenderMessageFilter> render_message_filter =
base::MakeRefCounted<RenderMessageFilter>(
GetID(), GetBrowserContext(), widget_helper_.get(), media_internals);
base::MakeRefCounted<RenderMessageFilter>(GetID(), GetBrowserContext(),
widget_helper_.get());
AddFilter(render_message_filter.get());

#if BUILDFLAG(ENABLE_PPAPI)
Expand Down

0 comments on commit a07eacf

Please sign in to comment.