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

Side by Side Diff: chrome/common/db_message_filter.h

Issue 340067: database_dispatcher_host changes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Addressed Michael's latest comments. Created 11 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_DB_MESSAGE_FILTER_H_ 5 #ifndef CHROME_COMMON_DB_MESSAGE_FILTER_H_
6 #define CHROME_COMMON_DB_MESSAGE_FILTER_H_ 6 #define CHROME_COMMON_DB_MESSAGE_FILTER_H_
7 7
8 #include "base/atomic_sequence_num.h" 8 #include "base/atomic_sequence_num.h"
9 #include "base/id_map.h" 9 #include "base/id_map.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 virtual void OnFilterAdded(IPC::Channel* channel); 74 virtual void OnFilterAdded(IPC::Channel* channel);
75 75
76 // Called when the channel encounters a problem. The filter should clean up 76 // Called when the channel encounters a problem. The filter should clean up
77 // its internal data and not accept any more messages. 77 // its internal data and not accept any more messages.
78 virtual void OnChannelError(); 78 virtual void OnChannelError();
79 79
80 // Called when the channel is closing. The filter should clean up its internal 80 // Called when the channel is closing. The filter should clean up its internal
81 // and not accept any more messages. 81 // and not accept any more messages.
82 virtual void OnChannelClosing(); 82 virtual void OnChannelClosing();
83 83
84 // Processes the reply to a DB request. 84 // Processes the reply to a sync DB request.
85 template<class ResultType> 85 template<class ResultType>
86 void OnResponse(int32 message_id, ResultType result) { 86 void OnResponse(int32 message_id, ResultType result) {
87 DBMessageState *state = messages_awaiting_replies_->Lookup(message_id); 87 DBMessageState *state = messages_awaiting_replies_->Lookup(message_id);
88 if (state) { 88 if (state) {
89 messages_awaiting_replies_->Remove(message_id); 89 messages_awaiting_replies_->Remove(message_id);
90 *reinterpret_cast<ResultType*>(state->result_address_) = result; 90 *reinterpret_cast<ResultType*>(state->result_address_) = result;
91 state->waitable_event_->Signal(); 91 state->waitable_event_->Signal();
92 } 92 }
93 } 93 }
94 94
95 // Processes IPCs that indicate a change in the size of a DB file.
96 void OnDatabaseUpdateSize(const string16& origin_identifier,
97 const string16& database_name,
98 int64 database_size,
99 int64 space_available);
100
95 // The message loop for the IO thread. 101 // The message loop for the IO thread.
96 MessageLoop* io_thread_message_loop_; 102 MessageLoop* io_thread_message_loop_;
97 103
98 // The channel to which this filter was added. 104 // The channel to which this filter was added.
99 IPC::Channel* channel_; 105 IPC::Channel* channel_;
100 106
101 // A lock around the channel. 107 // A lock around the channel.
102 scoped_ptr<Lock> channel_lock_; 108 scoped_ptr<Lock> channel_lock_;
103 109
104 // The shutdown event. 110 // The shutdown event.
105 base::WaitableEvent* shutdown_event_; 111 base::WaitableEvent* shutdown_event_;
106 112
107 // The list of messages awaiting replies. For each such message we store a 113 // The list of messages awaiting replies. For each such message we store a
108 // DBMessageState instance. 114 // DBMessageState instance.
109 scoped_ptr<IDMap<DBMessageState> > messages_awaiting_replies_; 115 scoped_ptr<IDMap<DBMessageState> > messages_awaiting_replies_;
110 116
111 // A thread-safe unique number generator. 117 // A thread-safe unique number generator.
112 scoped_ptr<base::AtomicSequenceNumber> unique_id_generator_; 118 scoped_ptr<base::AtomicSequenceNumber> unique_id_generator_;
113 119
114 // The singleton. 120 // The singleton.
115 static DBMessageFilter* instance_; 121 static DBMessageFilter* instance_;
116 }; 122 };
117 123
118 #endif // CHROME_COMMON_DB_MESSAGE_FILTER_H_ 124 #endif // CHROME_COMMON_DB_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.cc ('k') | chrome/common/db_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698