| OLD | NEW |
| 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/indexed_db_key_utility_client.h" | 5 #include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "content/browser/utility_process_host.h" | 10 #include "content/browser/utility_process_host.h" |
| 11 #include "content/common/indexed_db_key.h" | 11 #include "content/common/indexed_db_key.h" |
| 12 #include "content/common/indexed_db_messages.h" | 12 #include "content/common/indexed_db_messages.h" |
| 13 #include "content/common/utility_messages.h" | 13 #include "content/common/utility_messages.h" |
| 14 #include "content/public/common/serialized_script_value.h" | 14 #include "content/public/common/serialized_script_value.h" |
| 15 | 15 |
| 16 using content::BrowserThread; |
| 17 |
| 16 // This class is used to obtain IndexedDBKeys from SerializedScriptValues | 18 // This class is used to obtain IndexedDBKeys from SerializedScriptValues |
| 17 // given an IDBKeyPath. It uses UtilityProcess to do this inside a sandbox | 19 // given an IDBKeyPath. It uses UtilityProcess to do this inside a sandbox |
| 18 // (a V8 lock is required there). At this level, all methods are synchronous | 20 // (a V8 lock is required there). At this level, all methods are synchronous |
| 19 // as required by the caller. The public API is used on WEBKIT thread, | 21 // as required by the caller. The public API is used on WEBKIT thread, |
| 20 // but internally it moves around to UI and IO as needed. | 22 // but internally it moves around to UI and IO as needed. |
| 21 class KeyUtilityClientImpl | 23 class KeyUtilityClientImpl |
| 22 : public base::RefCountedThreadSafe<KeyUtilityClientImpl> { | 24 : public base::RefCountedThreadSafe<KeyUtilityClientImpl> { |
| 23 public: | 25 public: |
| 24 KeyUtilityClientImpl(); | 26 KeyUtilityClientImpl(); |
| 25 | 27 |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 void KeyUtilityClientImpl::Client::OnInjectIDBKeyFinished( | 386 void KeyUtilityClientImpl::Client::OnInjectIDBKeyFinished( |
| 385 const content::SerializedScriptValue& value) { | 387 const content::SerializedScriptValue& value) { |
| 386 parent_->SetValueAfterInjection(value); | 388 parent_->SetValueAfterInjection(value); |
| 387 parent_->FinishInjectingKey(); | 389 parent_->FinishInjectingKey(); |
| 388 } | 390 } |
| 389 | 391 |
| 390 void KeyUtilityClientImpl::Client::OnIDBKeysFromValuesAndKeyPathFailed( | 392 void KeyUtilityClientImpl::Client::OnIDBKeysFromValuesAndKeyPathFailed( |
| 391 int id) { | 393 int id) { |
| 392 parent_->FinishCreatingKeys(); | 394 parent_->FinishCreatingKeys(); |
| 393 } | 395 } |
| OLD | NEW |