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
3 // found in the LICENSE file.
5 #ifndef CONTENT_UTILITY_UTILITY_THREAD_H_
6 #define CONTENT_UTILITY_UTILITY_THREAD_H_
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/string16.h"
15 #include "content/common/child_thread.h"
18 class SerializedScriptValue
;
20 namespace webkit_glue
{
21 class WebKitPlatformSupportImpl
;
24 // This class represents the background thread where the utility task runs.
25 class UtilityThread
: public ChildThread
{
28 virtual ~UtilityThread();
30 // Releases the process if we are not (or no longer) in batch mode.
31 void ReleaseProcessIfNeeded();
33 // Returns the one utility thread.
34 static UtilityThread
* current() {
35 return static_cast<UtilityThread
*>(ChildThread::current());
39 // ChildThread implementation.
40 virtual bool OnControlMessageReceived(const IPC::Message
& msg
) OVERRIDE
;
42 // IPC message handlers.
43 void OnIDBKeysFromValuesAndKeyPath(
45 const std::vector
<SerializedScriptValue
>& serialized_script_values
,
46 const string16
& idb_key_path
);
47 void OnInjectIDBKey(const IndexedDBKey
& key
,
48 const SerializedScriptValue
& value
,
49 const string16
& key_path
);
50 void OnBatchModeStarted();
51 void OnBatchModeFinished();
53 // True when we're running in batch mode.
56 scoped_ptr
<webkit_glue::WebKitPlatformSupportImpl
> webkit_platform_support_
;
58 DISALLOW_COPY_AND_ASSIGN(UtilityThread
);
61 #endif // CONTENT_UTILITY_UTILITY_THREAD_H_