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

Side by Side Diff: content/browser/in_process_webkit/webkit_context.cc

Issue 8879013: Deprecate WEBKIT thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update after rebase Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "content/browser/in_process_webkit/webkit_context.h" 5 #include "content/browser/in_process_webkit/webkit_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 10
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 WebKitContext::~WebKitContext() { 31 WebKitContext::~WebKitContext() {
32 // If the WebKit thread was ever spun up, delete the object there. The task 32 // If the WebKit thread was ever spun up, delete the object there. The task
33 // will just get deleted if the WebKit thread isn't created (which only 33 // will just get deleted if the WebKit thread isn't created (which only
34 // happens during testing). 34 // happens during testing).
35 dom_storage_context_->set_clear_local_state_on_exit_( 35 dom_storage_context_->set_clear_local_state_on_exit_(
36 clear_local_state_on_exit_); 36 clear_local_state_on_exit_);
37 DOMStorageContext* dom_storage_context = dom_storage_context_.release(); 37 DOMStorageContext* dom_storage_context = dom_storage_context_.release();
38 if (!BrowserThread::DeleteSoon( 38 if (!BrowserThread::DeleteSoon(
39 BrowserThread::WEBKIT, FROM_HERE, dom_storage_context)) { 39 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, dom_storage_context)) {
40 // The WebKit thread wasn't created, and the task got deleted without 40 // The WebKit thread wasn't created, and the task got deleted without
41 // freeing the DOMStorageContext, so delete it manually. 41 // freeing the DOMStorageContext, so delete it manually.
42 delete dom_storage_context; 42 delete dom_storage_context;
43 } 43 }
44 44
45 indexed_db_context_->set_clear_local_state_on_exit( 45 indexed_db_context_->set_clear_local_state_on_exit(
46 clear_local_state_on_exit_); 46 clear_local_state_on_exit_);
47 } 47 }
48 48
49 void WebKitContext::PurgeMemory() { 49 void WebKitContext::PurgeMemory() {
50 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)) { 50 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)) {
51 BrowserThread::PostTask( 51 BrowserThread::PostTask(
52 BrowserThread::WEBKIT, FROM_HERE, 52 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
53 base::Bind(&WebKitContext::PurgeMemory, this)); 53 base::Bind(&WebKitContext::PurgeMemory, this));
54 return; 54 return;
55 } 55 }
56 56
57 dom_storage_context_->PurgeMemory(); 57 dom_storage_context_->PurgeMemory();
58 } 58 }
59 59
60 void WebKitContext::DeleteDataModifiedSince(const base::Time& cutoff) { 60 void WebKitContext::DeleteDataModifiedSince(const base::Time& cutoff) {
61 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)) { 61 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)) {
62 BrowserThread::PostTask( 62 BrowserThread::PostTask(
63 BrowserThread::WEBKIT, FROM_HERE, 63 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
64 base::Bind(&WebKitContext::DeleteDataModifiedSince, this, cutoff)); 64 base::Bind(&WebKitContext::DeleteDataModifiedSince, this, cutoff));
65 return; 65 return;
66 } 66 }
67 67
68 dom_storage_context_->DeleteDataModifiedSince(cutoff); 68 dom_storage_context_->DeleteDataModifiedSince(cutoff);
69 } 69 }
70 70
71 void WebKitContext::DeleteSessionStorageNamespace( 71 void WebKitContext::DeleteSessionStorageNamespace(
72 int64 session_storage_namespace_id) { 72 int64 session_storage_namespace_id) {
73 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)) { 73 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)) {
74 BrowserThread::PostTask( 74 BrowserThread::PostTask(
75 BrowserThread::WEBKIT, FROM_HERE, 75 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
76 base::Bind(&WebKitContext::DeleteSessionStorageNamespace, this, 76 base::Bind(&WebKitContext::DeleteSessionStorageNamespace, this,
77 session_storage_namespace_id)); 77 session_storage_namespace_id));
78 return; 78 return;
79 } 79 }
80 80
81 dom_storage_context_->DeleteSessionStorageNamespace( 81 dom_storage_context_->DeleteSessionStorageNamespace(
82 session_storage_namespace_id); 82 session_storage_namespace_id);
83 } 83 }
84 84
85 void WebKitContext::SaveSessionState() { 85 void WebKitContext::SaveSessionState() {
86 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)) { 86 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)) {
87 BrowserThread::PostTask( 87 BrowserThread::PostTask(
88 BrowserThread::WEBKIT, FROM_HERE, 88 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
89 base::Bind(&WebKitContext::SaveSessionState, this)); 89 base::Bind(&WebKitContext::SaveSessionState, this));
90 return; 90 return;
91 } 91 }
92 dom_storage_context_->SaveSessionState(); 92 dom_storage_context_->SaveSessionState();
93 indexed_db_context_->SaveSessionState(); 93 indexed_db_context_->SaveSessionState();
94 } 94 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698