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

Side by Side Diff: chrome/common/web_database_observer_impl.cc

Issue 6691002: Move AppCache common code to content and split off AppCache messages into the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/web_database_observer_impl.h ('k') | chrome/common/webmessageportchannel_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/common/web_database_observer_impl.h"
6
7 #include "base/auto_reset.h"
8 #include "base/message_loop.h"
9 #include "base/string16.h"
10 #include "content/common/database_messages.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
13
14 WebDatabaseObserverImpl::WebDatabaseObserverImpl(
15 IPC::Message::Sender* sender)
16 : sender_(sender),
17 waiting_for_dbs_to_close_(false) {
18 }
19
20 void WebDatabaseObserverImpl::databaseOpened(
21 const WebKit::WebDatabase& database) {
22 string16 origin_identifier = database.securityOrigin().databaseIdentifier();
23 string16 database_name = database.name();
24 sender_->Send(new DatabaseHostMsg_Opened(
25 origin_identifier, database_name,
26 database.displayName(), database.estimatedSize()));
27 database_connections_.AddConnection(origin_identifier, database_name);
28 }
29
30 void WebDatabaseObserverImpl::databaseModified(
31 const WebKit::WebDatabase& database) {
32 sender_->Send(new DatabaseHostMsg_Modified(
33 database.securityOrigin().databaseIdentifier(), database.name()));
34 }
35
36 void WebDatabaseObserverImpl::databaseClosed(
37 const WebKit::WebDatabase& database) {
38 string16 origin_identifier = database.securityOrigin().databaseIdentifier();
39 string16 database_name = database.name();
40 sender_->Send(new DatabaseHostMsg_Closed(
41 origin_identifier, database_name));
42 database_connections_.RemoveConnection(origin_identifier, database_name);
43 if (waiting_for_dbs_to_close_ && database_connections_.IsEmpty())
44 MessageLoop::current()->Quit();
45 }
46
47 void WebDatabaseObserverImpl::WaitForAllDatabasesToClose() {
48 if (!database_connections_.IsEmpty()) {
49 AutoReset<bool> waiting_for_dbs_auto_reset(&waiting_for_dbs_to_close_, true) ;
50 MessageLoop::ScopedNestableTaskAllower nestable(MessageLoop::current());
51 MessageLoop::current()->Run();
52 }
53 }
OLDNEW
« no previous file with comments | « chrome/common/web_database_observer_impl.h ('k') | chrome/common/webmessageportchannel_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698