1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
|
// 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 "chrome/browser/net/sqlite_persistent_cookie_store.h"
#include <list>
#include "app/sql/meta_table.h"
#include "app/sql/statement.h"
#include "app/sql/transaction.h"
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/file_util.h"
#ifdef ANDROID
#include "base/lazy_instance.h"
#endif
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/string_util.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/diagnostics/sqlite_diagnostics.h"
#ifndef ANDROID
#include "content/browser/browser_thread.h"
#endif
#include "googleurl/src/gurl.h"
#ifdef ANDROID
namespace {
// This class is used by CookieMonster, which is threadsafe, so this class must
// be threadsafe too.
base::LazyInstance<base::Lock> db_thread_lock(base::LINKER_INITIALIZED);
base::Thread* getDbThread() {
base::AutoLock lock(*db_thread_lock.Pointer());
// FIXME: We should probably be using LazyInstance here.
static base::Thread* db_thread = NULL;
if (db_thread && db_thread->IsRunning())
return db_thread;
if (!db_thread)
db_thread = new base::Thread("db");
if (!db_thread)
return NULL;
base::Thread::Options options;
options.message_loop_type = MessageLoop::TYPE_DEFAULT;
if (!db_thread->StartWithOptions(options)) {
delete db_thread;
db_thread = NULL;
}
return db_thread;
}
} // namespace
#endif
using base::Time;
// This class is designed to be shared between any calling threads and the
// database thread. It batches operations and commits them on a timer.
class SQLitePersistentCookieStore::Backend
: public base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend> {
public:
explicit Backend(const FilePath& path)
: path_(path),
db_(NULL),
num_pending_(0),
clear_local_state_on_exit_(false)
#if defined(ANDROID)
, cookie_count_(0)
#endif
{
}
// Creates or load the SQLite database.
bool Load(std::vector<net::CookieMonster::CanonicalCookie*>* cookies);
// Batch a cookie addition.
void AddCookie(const net::CookieMonster::CanonicalCookie& cc);
// Batch a cookie access time update.
void UpdateCookieAccessTime(const net::CookieMonster::CanonicalCookie& cc);
// Batch a cookie deletion.
void DeleteCookie(const net::CookieMonster::CanonicalCookie& cc);
// Commit pending operations as soon as possible.
void Flush(Task* completion_task);
// Commit any pending operations and close the database. This must be called
// before the object is destructed.
void Close();
void SetClearLocalStateOnExit(bool clear_local_state);
#if defined(ANDROID)
int get_cookie_count() const { return cookie_count_; }
void set_cookie_count(int count) { cookie_count_ = count; }
#endif
private:
friend class base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend>;
// You should call Close() before destructing this object.
~Backend() {
DCHECK(!db_.get()) << "Close should have already been called.";
DCHECK(num_pending_ == 0 && pending_.empty());
}
// Database upgrade statements.
bool EnsureDatabaseVersion();
class PendingOperation {
public:
typedef enum {
COOKIE_ADD,
COOKIE_UPDATEACCESS,
COOKIE_DELETE,
} OperationType;
PendingOperation(OperationType op,
const net::CookieMonster::CanonicalCookie& cc)
: op_(op), cc_(cc) { }
OperationType op() const { return op_; }
const net::CookieMonster::CanonicalCookie& cc() const { return cc_; }
private:
OperationType op_;
net::CookieMonster::CanonicalCookie cc_;
};
private:
// Batch a cookie operation (add or delete)
void BatchOperation(PendingOperation::OperationType op,
const net::CookieMonster::CanonicalCookie& cc);
// Commit our pending operations to the database.
#if defined(ANDROID)
void Commit(Task* completion_task);
#else
void Commit();
#endif
// Close() executed on the background thread.
void InternalBackgroundClose();
FilePath path_;
scoped_ptr<sql::Connection> db_;
sql::MetaTable meta_table_;
typedef std::list<PendingOperation*> PendingOperationsList;
PendingOperationsList pending_;
PendingOperationsList::size_type num_pending_;
// True if the persistent store should be deleted upon destruction.
bool clear_local_state_on_exit_;
// Guard |pending_|, |num_pending_| and |clear_local_state_on_exit_|.
base::Lock lock_;
#if defined(ANDROID)
// Number of cookies that have actually been saved. Updated during Commit().
volatile int cookie_count_;
#endif
DISALLOW_COPY_AND_ASSIGN(Backend);
};
// Version number of the database. In version 4, we migrated the time epoch.
// If you open the DB with an older version on Mac or Linux, the times will
// look wonky, but the file will likely be usable. On Windows version 3 and 4
// are the same.
//
// Version 3 updated the database to include the last access time, so we can
// expire them in decreasing order of use when we've reached the maximum
// number of cookies.
static const int kCurrentVersionNumber = 4;
static const int kCompatibleVersionNumber = 3;
namespace {
// Initializes the cookies table, returning true on success.
bool InitTable(sql::Connection* db) {
if (!db->DoesTableExist("cookies")) {
if (!db->Execute("CREATE TABLE cookies ("
"creation_utc INTEGER NOT NULL UNIQUE PRIMARY KEY,"
"host_key TEXT NOT NULL,"
"name TEXT NOT NULL,"
"value TEXT NOT NULL,"
"path TEXT NOT NULL,"
#if defined(ANDROID)
// On some mobile platforms, we persist session cookies
// because the OS can kill the browser during a session.
// If so, expires_utc is set to 0. When the field is read
// into a Time object, Time::is_null() will return true.
#else
// We only store persistent, so we know it expires
#endif
"expires_utc INTEGER NOT NULL,"
"secure INTEGER NOT NULL,"
"httponly INTEGER NOT NULL,"
"last_access_utc INTEGER NOT NULL)"))
return false;
}
// Try to create the index every time. Older versions did not have this index,
// so we want those people to get it. Ignore errors, since it may exist.
db->Execute(
"CREATE INDEX IF NOT EXISTS cookie_times ON cookies (creation_utc)");
return true;
}
} // namespace
bool SQLitePersistentCookieStore::Backend::Load(
std::vector<net::CookieMonster::CanonicalCookie*>* cookies) {
// This function should be called only once per instance.
DCHECK(!db_.get());
// Ensure the parent directory for storing cookies is created before reading
// from it. We make an exception to allow IO on the UI thread here because
// we are going to disk anyway in db_->Open. (This code will be moved to the
// DB thread as part of http://crbug.com/52909.)
{
base::ThreadRestrictions::ScopedAllowIO allow_io;
const FilePath dir = path_.DirName();
if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir))
return false;
}
db_.reset(new sql::Connection);
if (!db_->Open(path_)) {
NOTREACHED() << "Unable to open cookie DB.";
db_.reset();
return false;
}
#ifndef ANDROID
// GetErrorHandlerForCookieDb is defined in sqlite_diagnostics.h
// which we do not currently include on Android
db_->set_error_delegate(GetErrorHandlerForCookieDb());
#endif
if (!EnsureDatabaseVersion() || !InitTable(db_.get())) {
NOTREACHED() << "Unable to open cookie DB.";
db_.reset();
return false;
}
db_->Preload();
// Slurp all the cookies into the out-vector.
sql::Statement smt(db_->GetUniqueStatement(
"SELECT creation_utc, host_key, name, value, path, expires_utc, secure, "
"httponly, last_access_utc FROM cookies"));
if (!smt) {
NOTREACHED() << "select statement prep failed";
db_.reset();
return false;
}
while (smt.Step()) {
#if defined(ANDROID)
base::Time expires = Time::FromInternalValue(smt.ColumnInt64(5));
#endif
scoped_ptr<net::CookieMonster::CanonicalCookie> cc(
new net::CookieMonster::CanonicalCookie(
// The "source" URL is not used with persisted cookies.
GURL(), // Source
smt.ColumnString(2), // name
smt.ColumnString(3), // value
smt.ColumnString(1), // domain
smt.ColumnString(4), // path
Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc
Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc
Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc
smt.ColumnInt(6) != 0, // secure
smt.ColumnInt(7) != 0, // httponly
#if defined(ANDROID)
!expires.is_null())); // has_expires
#else
true)); // has_expires
#endif
DLOG_IF(WARNING,
cc->CreationDate() > Time::Now()) << L"CreationDate too recent";
cookies->push_back(cc.release());
}
#ifdef ANDROID
set_cookie_count(cookies->size());
#endif
return true;
}
bool SQLitePersistentCookieStore::Backend::EnsureDatabaseVersion() {
// Version check.
if (!meta_table_.Init(
db_.get(), kCurrentVersionNumber, kCompatibleVersionNumber)) {
return false;
}
if (meta_table_.GetCompatibleVersionNumber() > kCurrentVersionNumber) {
LOG(WARNING) << "Cookie database is too new.";
return false;
}
int cur_version = meta_table_.GetVersionNumber();
if (cur_version == 2) {
sql::Transaction transaction(db_.get());
if (!transaction.Begin())
return false;
if (!db_->Execute("ALTER TABLE cookies ADD COLUMN last_access_utc "
"INTEGER DEFAULT 0") ||
!db_->Execute("UPDATE cookies SET last_access_utc = creation_utc")) {
LOG(WARNING) << "Unable to update cookie database to version 3.";
return false;
}
++cur_version;
meta_table_.SetVersionNumber(cur_version);
meta_table_.SetCompatibleVersionNumber(
std::min(cur_version, kCompatibleVersionNumber));
transaction.Commit();
}
if (cur_version == 3) {
// The time epoch changed for Mac & Linux in this version to match Windows.
// This patch came after the main epoch change happened, so some
// developers have "good" times for cookies added by the more recent
// versions. So we have to be careful to only update times that are under
// the old system (which will appear to be from before 1970 in the new
// system). The magic number used below is 1970 in our time units.
sql::Transaction transaction(db_.get());
transaction.Begin();
#if !defined(OS_WIN)
db_->Execute(
"UPDATE cookies "
"SET creation_utc = creation_utc + 11644473600000000 "
"WHERE rowid IN "
"(SELECT rowid FROM cookies WHERE "
"creation_utc > 0 AND creation_utc < 11644473600000000)");
db_->Execute(
"UPDATE cookies "
"SET expires_utc = expires_utc + 11644473600000000 "
"WHERE rowid IN "
"(SELECT rowid FROM cookies WHERE "
"expires_utc > 0 AND expires_utc < 11644473600000000)");
db_->Execute(
"UPDATE cookies "
"SET last_access_utc = last_access_utc + 11644473600000000 "
"WHERE rowid IN "
"(SELECT rowid FROM cookies WHERE "
"last_access_utc > 0 AND last_access_utc < 11644473600000000)");
#endif
++cur_version;
meta_table_.SetVersionNumber(cur_version);
transaction.Commit();
}
// Put future migration cases here.
// When the version is too old, we just try to continue anyway, there should
// not be a released product that makes a database too old for us to handle.
LOG_IF(WARNING, cur_version < kCurrentVersionNumber) <<
"Cookie database version " << cur_version << " is too old to handle.";
return true;
}
void SQLitePersistentCookieStore::Backend::AddCookie(
const net::CookieMonster::CanonicalCookie& cc) {
BatchOperation(PendingOperation::COOKIE_ADD, cc);
}
void SQLitePersistentCookieStore::Backend::UpdateCookieAccessTime(
const net::CookieMonster::CanonicalCookie& cc) {
BatchOperation(PendingOperation::COOKIE_UPDATEACCESS, cc);
}
void SQLitePersistentCookieStore::Backend::DeleteCookie(
const net::CookieMonster::CanonicalCookie& cc) {
BatchOperation(PendingOperation::COOKIE_DELETE, cc);
}
void SQLitePersistentCookieStore::Backend::BatchOperation(
PendingOperation::OperationType op,
const net::CookieMonster::CanonicalCookie& cc) {
// Commit every 30 seconds.
static const int kCommitIntervalMs = 30 * 1000;
// Commit right away if we have more than 512 outstanding operations.
static const size_t kCommitAfterBatchSize = 512;
#ifndef ANDROID
DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::DB));
#endif
// We do a full copy of the cookie here, and hopefully just here.
scoped_ptr<PendingOperation> po(new PendingOperation(op, cc));
PendingOperationsList::size_type num_pending;
{
base::AutoLock locked(lock_);
pending_.push_back(po.release());
num_pending = ++num_pending_;
}
#ifdef ANDROID
if (!getDbThread())
return;
MessageLoop* loop = getDbThread()->message_loop();
#endif
if (num_pending == 1) {
// We've gotten our first entry for this batch, fire off the timer.
#ifdef ANDROID
loop->PostDelayedTask(FROM_HERE, NewRunnableMethod(
this, &Backend::Commit, static_cast<Task*>(NULL)), kCommitIntervalMs);
#else
BrowserThread::PostDelayedTask(
BrowserThread::DB, FROM_HERE,
NewRunnableMethod(this, &Backend::Commit), kCommitIntervalMs);
#endif
} else if (num_pending == kCommitAfterBatchSize) {
// We've reached a big enough batch, fire off a commit now.
#ifdef ANDROID
loop->PostTask(FROM_HERE, NewRunnableMethod(
this, &Backend::Commit, static_cast<Task*>(NULL)));
#else
BrowserThread::PostTask(
BrowserThread::DB, FROM_HERE,
NewRunnableMethod(this, &Backend::Commit));
#endif
}
}
#if defined(ANDROID)
void SQLitePersistentCookieStore::Backend::Commit(Task* completion_task) {
#else
void SQLitePersistentCookieStore::Backend::Commit() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
#endif
#if defined(ANDROID)
if (completion_task) {
// We post this task to the current thread, so it won't run until we exit.
MessageLoop::current()->PostTask(FROM_HERE, completion_task);
}
#endif
PendingOperationsList ops;
{
base::AutoLock locked(lock_);
pending_.swap(ops);
num_pending_ = 0;
}
// Maybe an old timer fired or we are already Close()'ed.
if (!db_.get() || ops.empty())
return;
sql::Statement add_smt(db_->GetCachedStatement(SQL_FROM_HERE,
"INSERT INTO cookies (creation_utc, host_key, name, value, path, "
"expires_utc, secure, httponly, last_access_utc) "
"VALUES (?,?,?,?,?,?,?,?,?)"));
if (!add_smt) {
NOTREACHED();
return;
}
sql::Statement update_access_smt(db_->GetCachedStatement(SQL_FROM_HERE,
"UPDATE cookies SET last_access_utc=? WHERE creation_utc=?"));
if (!update_access_smt) {
NOTREACHED();
return;
}
sql::Statement del_smt(db_->GetCachedStatement(SQL_FROM_HERE,
"DELETE FROM cookies WHERE creation_utc=?"));
if (!del_smt) {
NOTREACHED();
return;
}
sql::Transaction transaction(db_.get());
if (!transaction.Begin()) {
NOTREACHED();
return;
}
#if defined(ANDROID)
int cookie_delta = 0;
#endif
for (PendingOperationsList::iterator it = ops.begin();
it != ops.end(); ++it) {
// Free the cookies as we commit them to the database.
scoped_ptr<PendingOperation> po(*it);
switch (po->op()) {
case PendingOperation::COOKIE_ADD:
#if defined(ANDROID)
++cookie_delta;
#endif
add_smt.Reset();
add_smt.BindInt64(0, po->cc().CreationDate().ToInternalValue());
add_smt.BindString(1, po->cc().Domain());
add_smt.BindString(2, po->cc().Name());
add_smt.BindString(3, po->cc().Value());
add_smt.BindString(4, po->cc().Path());
add_smt.BindInt64(5, po->cc().ExpiryDate().ToInternalValue());
add_smt.BindInt(6, po->cc().IsSecure());
add_smt.BindInt(7, po->cc().IsHttpOnly());
add_smt.BindInt64(8, po->cc().LastAccessDate().ToInternalValue());
if (!add_smt.Run())
NOTREACHED() << "Could not add a cookie to the DB.";
break;
case PendingOperation::COOKIE_UPDATEACCESS:
update_access_smt.Reset();
update_access_smt.BindInt64(0,
po->cc().LastAccessDate().ToInternalValue());
update_access_smt.BindInt64(1,
po->cc().CreationDate().ToInternalValue());
if (!update_access_smt.Run())
NOTREACHED() << "Could not update cookie last access time in the DB.";
break;
case PendingOperation::COOKIE_DELETE:
#if defined(ANDROID)
--cookie_delta;
#endif
del_smt.Reset();
del_smt.BindInt64(0, po->cc().CreationDate().ToInternalValue());
if (!del_smt.Run())
NOTREACHED() << "Could not delete a cookie from the DB.";
break;
default:
NOTREACHED();
break;
}
}
bool succeeded = transaction.Commit();
#if defined(ANDROID)
if (succeeded)
cookie_count_ += cookie_delta;
#endif
UMA_HISTOGRAM_ENUMERATION("Cookie.BackingStoreUpdateResults",
succeeded ? 0 : 1, 2);
}
void SQLitePersistentCookieStore::Backend::Flush(Task* completion_task) {
#if defined(ANDROID)
if (!getDbThread()) {
if (completion_task)
MessageLoop::current()->PostTask(FROM_HERE, completion_task);
return;
}
MessageLoop* loop = getDbThread()->message_loop();
loop->PostTask(FROM_HERE, NewRunnableMethod(
this, &Backend::Commit, completion_task));
#else
DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::DB));
BrowserThread::PostTask(
BrowserThread::DB, FROM_HERE, NewRunnableMethod(this, &Backend::Commit));
if (completion_task) {
// We want the completion task to run immediately after Commit() returns.
// Posting it from here means there is less chance of another task getting
// onto the message queue first, than if we posted it from Commit() itself.
BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, completion_task);
}
#endif
}
// Fire off a close message to the background thread. We could still have a
// pending commit timer that will be holding a reference on us, but if/when
// this fires we will already have been cleaned up and it will be ignored.
void SQLitePersistentCookieStore::Backend::Close() {
#ifndef ANDROID
DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::DB));
#endif
#ifdef ANDROID
if (!getDbThread())
return;
MessageLoop* loop = getDbThread()->message_loop();
loop->PostTask(FROM_HERE,
NewRunnableMethod(this, &Backend::InternalBackgroundClose));
#else
// Must close the backend on the background thread.
BrowserThread::PostTask(
BrowserThread::DB, FROM_HERE,
NewRunnableMethod(this, &Backend::InternalBackgroundClose));
#endif
}
void SQLitePersistentCookieStore::Backend::InternalBackgroundClose() {
#ifndef ANDROID
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
#endif
// Commit any pending operations
#if defined(ANDROID)
Commit(NULL);
#else
Commit();
#endif
db_.reset();
if (clear_local_state_on_exit_)
file_util::Delete(path_, false);
}
void SQLitePersistentCookieStore::Backend::SetClearLocalStateOnExit(
bool clear_local_state) {
base::AutoLock locked(lock_);
clear_local_state_on_exit_ = clear_local_state;
}
SQLitePersistentCookieStore::SQLitePersistentCookieStore(const FilePath& path)
: backend_(new Backend(path)) {
}
SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
if (backend_.get()) {
backend_->Close();
// Release our reference, it will probably still have a reference if the
// background thread has not run Close() yet.
backend_ = NULL;
}
}
bool SQLitePersistentCookieStore::Load(
std::vector<net::CookieMonster::CanonicalCookie*>* cookies) {
return backend_->Load(cookies);
}
void SQLitePersistentCookieStore::AddCookie(
const net::CookieMonster::CanonicalCookie& cc) {
if (backend_.get())
backend_->AddCookie(cc);
}
void SQLitePersistentCookieStore::UpdateCookieAccessTime(
const net::CookieMonster::CanonicalCookie& cc) {
if (backend_.get())
backend_->UpdateCookieAccessTime(cc);
}
void SQLitePersistentCookieStore::DeleteCookie(
const net::CookieMonster::CanonicalCookie& cc) {
if (backend_.get())
backend_->DeleteCookie(cc);
}
void SQLitePersistentCookieStore::SetClearLocalStateOnExit(
bool clear_local_state) {
if (backend_.get())
backend_->SetClearLocalStateOnExit(clear_local_state);
}
void SQLitePersistentCookieStore::Flush(Task* completion_task) {
if (backend_.get())
backend_->Flush(completion_task);
else if (completion_task)
MessageLoop::current()->PostTask(FROM_HERE, completion_task);
}
#if defined(ANDROID)
int SQLitePersistentCookieStore::GetCookieCount() {
int result = backend_ ? backend_->get_cookie_count() : 0;
return result;
}
#endif
|