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

Unified Diff: chrome/common/db_message_filter.cc

Issue 1601005: Allow synchronous messages to be sent from threads other than the main thread... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/db_message_filter.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/db_message_filter.cc
===================================================================
--- chrome/common/db_message_filter.cc (revision 43588)
+++ chrome/common/db_message_filter.cc (working copy)
@@ -1,69 +1,18 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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 "chrome/common/db_message_filter.h"
-#include "chrome/common/child_process.h"
#include "chrome/common/render_messages.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h"
-DBMessageFilter* DBMessageFilter::instance_ = NULL;
-
-DBMessageFilter::DBMessageFilter()
- : io_thread_message_loop_(ChildProcess::current()->io_message_loop()),
- channel_(NULL),
- shutdown_event_(ChildProcess::current()->GetShutDownEvent()),
- messages_awaiting_replies_(new IDMap<DBMessageState>()),
- unique_id_generator_(new base::AtomicSequenceNumber()) {
- DCHECK(!instance_);
- instance_ = this;
+DBMessageFilter::DBMessageFilter() {
}
-int DBMessageFilter::GetUniqueID() {
- return unique_id_generator_->GetNext();
-}
-
-static void SendMessageOnIOThread(IPC::Message* message,
- IPC::Channel* channel,
- Lock* channel_lock) {
- AutoLock channel_auto_lock(*channel_lock);
- if (channel)
- channel->Send(message);
- else
- delete message;
-}
-
-void DBMessageFilter::Send(IPC::Message* message) {
- io_thread_message_loop_->PostTask(FROM_HERE,
- NewRunnableFunction(SendMessageOnIOThread, message, channel_,
- &channel_lock_));
-}
-
-void DBMessageFilter::OnFilterAdded(IPC::Channel* channel) {
- AutoLock channel_auto_lock(channel_lock_);
- channel_ = channel;
-}
-
-void DBMessageFilter::OnChannelError() {
- AutoLock channel_auto_lock(channel_lock_);
- channel_ = NULL;
-}
-
-void DBMessageFilter::OnChannelClosing() {
- AutoLock channel_auto_lock(channel_lock_);
- channel_ = NULL;
-}
-
bool DBMessageFilter::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(DBMessageFilter, message)
- IPC_MESSAGE_HANDLER(ViewMsg_DatabaseOpenFileResponse,
- OnResponse<ViewMsg_DatabaseOpenFileResponse_Params>)
- IPC_MESSAGE_HANDLER(ViewMsg_DatabaseDeleteFileResponse, OnResponse<int>)
- IPC_MESSAGE_HANDLER(ViewMsg_DatabaseGetFileAttributesResponse,
- OnResponse<uint32>)
- IPC_MESSAGE_HANDLER(ViewMsg_DatabaseGetFileSizeResponse, OnResponse<int64>)
IPC_MESSAGE_HANDLER(ViewMsg_DatabaseUpdateSize, OnDatabaseUpdateSize)
IPC_MESSAGE_HANDLER(ViewMsg_DatabaseCloseImmediately,
OnDatabaseCloseImmediately)
« no previous file with comments | « chrome/common/db_message_filter.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698