OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/web_resource/json_asynchronous_unpacker.h" | 5 #include "chrome/browser/web_resource/json_asynchronous_unpacker.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/web_resource/web_resource_service.h" | 8 #include "chrome/browser/web_resource/web_resource_service.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/chrome_utility_messages.h" | 10 #include "chrome/common/chrome_utility_messages.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Release reference and set got_response_. | 99 // Release reference and set got_response_. |
100 void Cleanup() { | 100 void Cleanup() { |
101 DCHECK(!got_response_); | 101 DCHECK(!got_response_); |
102 got_response_ = true; | 102 got_response_ = true; |
103 Release(); | 103 Release(); |
104 } | 104 } |
105 | 105 |
106 void StartProcessOnIOThread(BrowserThread::ID thread_id, | 106 void StartProcessOnIOThread(BrowserThread::ID thread_id, |
107 const std::string& json_data) { | 107 const std::string& json_data) { |
108 UtilityProcessHost* host = UtilityProcessHost::Create( | 108 UtilityProcessHost* host = UtilityProcessHost::Create( |
109 this, BrowserThread::GetMessageLoopProxyForThread(thread_id)); | 109 this, BrowserThread::GetMessageLoopProxyForThread(thread_id).get()); |
110 host->EnableZygote(); | 110 host->EnableZygote(); |
111 // TODO(mrc): get proper file path when we start using web resources | 111 // TODO(mrc): get proper file path when we start using web resources |
112 // that need to be unpacked. | 112 // that need to be unpacked. |
113 host->Send(new ChromeUtilityMsg_UnpackWebResource(json_data)); | 113 host->Send(new ChromeUtilityMsg_UnpackWebResource(json_data)); |
114 } | 114 } |
115 | 115 |
116 // True if we got a response from the utility process and have cleaned up | 116 // True if we got a response from the utility process and have cleaned up |
117 // already. | 117 // already. |
118 bool got_response_; | 118 bool got_response_; |
119 }; | 119 }; |
120 | 120 |
121 JSONAsynchronousUnpacker* JSONAsynchronousUnpacker::Create( | 121 JSONAsynchronousUnpacker* JSONAsynchronousUnpacker::Create( |
122 JSONAsynchronousUnpackerDelegate* delegate) { | 122 JSONAsynchronousUnpackerDelegate* delegate) { |
123 return new JSONAsynchronousUnpackerImpl(delegate); | 123 return new JSONAsynchronousUnpackerImpl(delegate); |
124 } | 124 } |
125 | 125 |
OLD | NEW |