diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-15 09:56:37 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-15 09:56:37 +0000 |
commit | 044f4ac2d290e07388fcc4a8c5d960188f5e8c10 (patch) | |
tree | 14b8ed8153f693817d26a459ac7b806f86efa015 /content | |
parent | 4b18dfdffd04ea6dca824612243f6f6b8b896b53 (diff) | |
download | chromium_src-044f4ac2d290e07388fcc4a8c5d960188f5e8c10.zip chromium_src-044f4ac2d290e07388fcc4a8c5d960188f5e8c10.tar.gz chromium_src-044f4ac2d290e07388fcc4a8c5d960188f5e8c10.tar.bz2 |
Remove files previously meant to be deleted.
BUG=98716
Review URL: https://chromiumcodereview.appspot.com/9361063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122070 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/browser_message_filter.cc | 128 | ||||
-rw-r--r-- | content/browser/browser_message_filter.h | 71 |
2 files changed, 0 insertions, 199 deletions
diff --git a/content/browser/browser_message_filter.cc b/content/browser/browser_message_filter.cc deleted file mode 100644 index 82600a2..0000000 --- a/content/browser/browser_message_filter.cc +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/browser_message_filter.h" - -#include "base/bind.h" -#include "base/bind_helpers.h" -#include "base/logging.h" -#include "base/process.h" -#include "base/process_util.h" -#include "content/public/browser/user_metrics.h" -#include "content/public/common/result_codes.h" -#include "ipc/ipc_sync_message.h" - -using content::BrowserThread; -using content::UserMetricsAction; - -BrowserMessageFilter::BrowserMessageFilter() - : channel_(NULL), peer_handle_(base::kNullProcessHandle) { -} - -BrowserMessageFilter::~BrowserMessageFilter() { - base::CloseProcessHandle(peer_handle_); -} - -void BrowserMessageFilter::OnFilterAdded(IPC::Channel* channel) { - channel_ = channel; -} - -void BrowserMessageFilter::OnChannelClosing() { - channel_ = NULL; -} - -void BrowserMessageFilter::OnChannelConnected(int32 peer_pid) { - if (!base::OpenProcessHandle(peer_pid, &peer_handle_)) { - NOTREACHED(); - } -} - -bool BrowserMessageFilter::Send(IPC::Message* message) { - if (message->is_sync()) { - // We don't support sending synchronous messages from the browser. If we - // really needed it, we can make this class derive from SyncMessageFilter - // but it seems better to not allow sending synchronous messages from the - // browser, since it might allow a corrupt/malicious renderer to hang us. - NOTREACHED() << "Can't send sync message through BrowserMessageFilter!"; - return false; - } - - if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - BrowserThread::PostTask( - BrowserThread::IO, - FROM_HERE, - base::Bind(base::IgnoreResult(&BrowserMessageFilter::Send), this, - message)); - return true; - } - - if (channel_) - return channel_->Send(message); - - delete message; - return false; -} - -void BrowserMessageFilter::OverrideThreadForMessage(const IPC::Message& message, - BrowserThread::ID* thread) { -} - -bool BrowserMessageFilter::OnMessageReceived(const IPC::Message& message) { - BrowserThread::ID thread = BrowserThread::IO; - OverrideThreadForMessage(message, &thread); - if (thread == BrowserThread::IO) - return DispatchMessage(message); - - if (thread == BrowserThread::UI && !CheckCanDispatchOnUI(message, this)) - return true; - - BrowserThread::PostTask( - thread, FROM_HERE, - base::Bind(base::IgnoreResult(&BrowserMessageFilter::DispatchMessage), - this, message)); - return true; -} - -bool BrowserMessageFilter::DispatchMessage(const IPC::Message& message) { - bool message_was_ok = true; - bool rv = OnMessageReceived(message, &message_was_ok); - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO) || rv) << - "Must handle messages that were dispatched to another thread!"; - if (!message_was_ok) { - content::RecordAction(UserMetricsAction("BadMessageTerminate_BMF")); - BadMessageReceived(); - } - - return rv; -} - -void BrowserMessageFilter::BadMessageReceived() { - base::KillProcess(peer_handle(), content::RESULT_CODE_KILLED_BAD_MESSAGE, - false); -} - -bool BrowserMessageFilter::CheckCanDispatchOnUI(const IPC::Message& message, - IPC::Message::Sender* sender) { -#if defined(OS_WIN) && !defined(USE_AURA) - // On Windows there's a potential deadlock with sync messsages going in - // a circle from browser -> plugin -> renderer -> browser. - // On Linux we can avoid this by avoiding sync messages from browser->plugin. - // On Mac we avoid this by not supporting windowed plugins. - if (message.is_sync() && !message.is_caller_pumping_messages()) { - // NOTE: IF YOU HIT THIS ASSERT, THE SOLUTION IS ALMOST NEVER TO RUN A - // NESTED MESSAGE LOOP IN THE RENDERER!!! - // That introduces reentrancy which causes hard to track bugs. You should - // find a way to either turn this into an asynchronous message, or one - // that can be answered on the IO thread. - NOTREACHED() << "Can't send sync messages to UI thread without pumping " - "messages in the renderer or else deadlocks can occur if the page " - "has windowed plugins! (message type " << message.type() << ")"; - IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message); - reply->set_reply_error(); - sender->Send(reply); - return false; - } -#endif - return true; -} diff --git a/content/browser/browser_message_filter.h b/content/browser/browser_message_filter.h deleted file mode 100644 index 78f5095..0000000 --- a/content/browser/browser_message_filter.h +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_BROWSER_MESSAGE_FILTER_H_ -#define CONTENT_BROWSER_BROWSER_MESSAGE_FILTER_H_ -#pragma once - -#include "base/process.h" -#include "content/common/content_export.h" -#include "content/public/browser/browser_thread.h" -#include "ipc/ipc_channel_proxy.h" - -// Base class for message filters in the browser process. You can receive and -// send messages on any thread. -class CONTENT_EXPORT BrowserMessageFilter : - public IPC::ChannelProxy::MessageFilter, - public IPC::Message::Sender { - public: - BrowserMessageFilter(); - virtual ~BrowserMessageFilter(); - - // IPC::ChannelProxy::MessageFilter methods. If you override them, make sure - // to call them as well. These are always called on the IO thread. - virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; - virtual void OnChannelClosing() OVERRIDE; - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - // DON'T OVERRIDE THIS! Override the other version below. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - - // IPC::Message::Sender implementation. Can be called on any thread. Can't - // send sync messages (since we don't want to block the browser on any other - // process). - virtual bool Send(IPC::Message* message) OVERRIDE; - - // If you want the given message to be dispatched to your OnMessageReceived on - // a different thread, change |thread| to the id of the target thread. - // If you don't handle this message, or want to keep it on the IO thread, do - // nothing. - virtual void OverrideThreadForMessage(const IPC::Message& message, - content::BrowserThread::ID* thread); - - // Override this to receive messages. - // Your function will normally be called on the IO thread. However, if your - // OverrideThreadForMessage modifies the thread used to dispatch the message, - // your function will be called on the requested thread. - virtual bool OnMessageReceived(const IPC::Message& message, - bool* message_was_ok) = 0; - - // Can be called on any thread, after OnChannelConnected is called. - base::ProcessHandle peer_handle() { return peer_handle_; } - - // Checks that the given message can be dispatched on the UI thread, depending - // on the platform. If not, returns false and an error ot the sender. - static bool CheckCanDispatchOnUI(const IPC::Message& message, - IPC::Message::Sender* sender); - - protected: - // Call this if a message couldn't be deserialized. This kills the renderer. - // Can be called on any thread. - virtual void BadMessageReceived(); - - private: - // Dispatches a message to the derived class. - bool DispatchMessage(const IPC::Message& message); - - IPC::Channel* channel_; - base::ProcessHandle peer_handle_; -}; - -#endif // CONTENT_BROWSER_BROWSER_MESSAGE_FILTER_H_ |