Commit 1cad6da0 authored by Ayu Ishii's avatar Ayu Ishii Committed by Commit Bot

Convert base::Bind and base::Callback in chrome/test to Once/Repeating

Tracing
- CompletionCallback

AdbClientSocket
- CommandCallback
- SocketCallback
- ParserCallback

HttpServer / HttpHandler
- HttpRequestHandlerFunc
- HttpResponseSenderFunc
- QuitFunc

NaClBrowser
- ListenerCallback

Bug: 1007643
Change-Id: I51dbb4ea5dcdaac2f63279826239c2e8a02bdfa1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2311060
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Reviewed-by: default avataroysteine <oysteine@chromium.org>
Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Reviewed-by: default avatarMark Seaborn <mseaborn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791142}
parent 981f0b7c
...@@ -27,7 +27,8 @@ using content::BrowserThread; ...@@ -27,7 +27,8 @@ using content::BrowserThread;
class StringTraceEndpoint class StringTraceEndpoint
: public content::TracingController::TraceDataEndpoint { : public content::TracingController::TraceDataEndpoint {
public: public:
StringTraceEndpoint(std::string* result, const base::Closure& callback) StringTraceEndpoint(std::string* result,
const base::RepeatingClosure& callback)
: result_(result), completion_callback_(callback) {} : result_(result), completion_callback_(callback) {}
void ReceiveTraceChunk(std::unique_ptr<std::string> chunk) override { void ReceiveTraceChunk(std::unique_ptr<std::string> chunk) override {
...@@ -46,7 +47,7 @@ class StringTraceEndpoint ...@@ -46,7 +47,7 @@ class StringTraceEndpoint
~StringTraceEndpoint() override {} ~StringTraceEndpoint() override {}
std::string* result_; std::string* result_;
base::Closure completion_callback_; base::RepeatingClosure completion_callback_;
DISALLOW_COPY_AND_ASSIGN(StringTraceEndpoint); DISALLOW_COPY_AND_ASSIGN(StringTraceEndpoint);
}; };
...@@ -73,8 +74,9 @@ class InProcessTraceController { ...@@ -73,8 +74,9 @@ class InProcessTraceController {
if (!content::TracingController::GetInstance()->StopTracing( if (!content::TracingController::GetInstance()->StopTracing(
new StringTraceEndpoint( new StringTraceEndpoint(
json_trace_output, json_trace_output,
base::Bind(&InProcessTraceController::OnTracingComplete, base::BindRepeating(
base::Unretained(this))), &InProcessTraceController::OnTracingComplete,
base::Unretained(this))),
tracing::mojom::kChromeTraceEventLabel)) { tracing::mojom::kChromeTraceEventLabel)) {
return false; return false;
} }
......
...@@ -79,8 +79,8 @@ class AdbTransportSocket : public AdbClientSocket { ...@@ -79,8 +79,8 @@ class AdbTransportSocket : public AdbClientSocket {
return; return;
SendCommand(base::StringPrintf(kHostTransportCommand, serial_.c_str()), SendCommand(base::StringPrintf(kHostTransportCommand, serial_.c_str()),
false, true, false, true,
base::Bind(&AdbTransportSocket::SendLocalAbstract, base::BindRepeating(&AdbTransportSocket::SendLocalAbstract,
base::Unretained(this))); base::Unretained(this)));
} }
void SendLocalAbstract(int result, const std::string& response) { void SendLocalAbstract(int result, const std::string& response) {
...@@ -88,8 +88,8 @@ class AdbTransportSocket : public AdbClientSocket { ...@@ -88,8 +88,8 @@ class AdbTransportSocket : public AdbClientSocket {
return; return;
SendCommand(base::StringPrintf(kLocalAbstractCommand, socket_name_.c_str()), SendCommand(base::StringPrintf(kLocalAbstractCommand, socket_name_.c_str()),
false, true, false, true,
base::Bind(&AdbTransportSocket::OnSocketAvailable, base::BindRepeating(&AdbTransportSocket::OnSocketAvailable,
base::Unretained(this))); base::Unretained(this)));
} }
void OnSocketAvailable(int result, const std::string& response) { void OnSocketAvailable(int result, const std::string& response) {
...@@ -145,8 +145,8 @@ class HttpOverAdbSocket { ...@@ -145,8 +145,8 @@ class HttpOverAdbSocket {
const std::string& socket_name) { const std::string& socket_name) {
AdbClientSocket::TransportQuery( AdbClientSocket::TransportQuery(
port, serial, socket_name, port, serial, socket_name,
base::Bind(&HttpOverAdbSocket::OnSocketAvailable, base::BindRepeating(&HttpOverAdbSocket::OnSocketAvailable,
base::Unretained(this))); base::Unretained(this)));
} }
void OnSocketAvailable(int result, void OnSocketAvailable(int result,
...@@ -287,9 +287,9 @@ class AdbQuerySocket : AdbClientSocket { ...@@ -287,9 +287,9 @@ class AdbQuerySocket : AdbClientSocket {
// doesn't include a length at the beginning of the data stream. // doesn't include a length at the beginning of the data stream.
bool has_length = bool has_length =
!base::StartsWith(query, "shell:", base::CompareCase::SENSITIVE); !base::StartsWith(query, "shell:", base::CompareCase::SENSITIVE);
SendCommand( SendCommand(query, has_output, has_length,
query, has_output, has_length, base::BindRepeating(&AdbQuerySocket::OnResponse,
base::Bind(&AdbQuerySocket::OnResponse, base::Unretained(this))); base::Unretained(this)));
} }
void OnResponse(int result, const std::string& response) { void OnResponse(int result, const std::string& response) {
...@@ -347,17 +347,18 @@ class AdbSendFileSocket : AdbClientSocket { ...@@ -347,17 +347,18 @@ class AdbSendFileSocket : AdbClientSocket {
void SendTransport(int result) { void SendTransport(int result) {
if (!CheckNetResultOrDie(result)) if (!CheckNetResultOrDie(result))
return; return;
SendCommand( SendCommand(base::StringPrintf(kHostTransportCommand, serial_.c_str()),
base::StringPrintf(kHostTransportCommand, serial_.c_str()), false, true, false, true,
base::Bind(&AdbSendFileSocket::SendSync, base::Unretained(this))); base::BindRepeating(&AdbSendFileSocket::SendSync,
base::Unretained(this)));
} }
void SendSync(int result, const std::string& response) { void SendSync(int result, const std::string& response) {
if (!CheckNetResultOrDie(result)) if (!CheckNetResultOrDie(result))
return; return;
SendCommand( SendCommand(kSyncCommand, false, true,
kSyncCommand, false, true, base::BindRepeating(&AdbSendFileSocket::SendSend,
base::Bind(&AdbSendFileSocket::SendSend, base::Unretained(this))); base::Unretained(this)));
} }
void SendSend(int result, const std::string& response) { void SendSend(int result, const std::string& response) {
...@@ -541,7 +542,7 @@ void AdbClientSocket::ReadResponse(const CommandCallback& response_callback, ...@@ -541,7 +542,7 @@ void AdbClientSocket::ReadResponse(const CommandCallback& response_callback,
base::MakeRefCounted<net::GrowableIOBuffer>(); base::MakeRefCounted<net::GrowableIOBuffer>();
socket_buffer->SetCapacity(kBufferSize); socket_buffer->SetCapacity(kBufferSize);
if (has_output) { if (has_output) {
const ParserCallback& parse_output_callback = base::Bind( const ParserCallback& parse_output_callback = base::BindRepeating(
&AdbClientSocket::ParseOutput, has_length, response_callback); &AdbClientSocket::ParseOutput, has_length, response_callback);
int socket_result = socket_->Read( int socket_result = socket_->Read(
socket_buffer.get(), kBufferSize, socket_buffer.get(), kBufferSize,
......
...@@ -13,10 +13,11 @@ ...@@ -13,10 +13,11 @@
class AdbClientSocket { class AdbClientSocket {
public: public:
typedef base::Callback<void(int, const std::string&)> CommandCallback; typedef base::RepeatingCallback<void(int, const std::string&)>
typedef base::Callback<void(int result, CommandCallback;
net::StreamSocket*)> SocketCallback; typedef base::RepeatingCallback<void(int result, net::StreamSocket*)>
typedef base::Callback<void(const std::string&)> ParserCallback; SocketCallback;
typedef base::RepeatingCallback<void(const std::string&)> ParserCallback;
static void AdbQuery(int port, static void AdbQuery(int port,
const std::string& query, const std::string& query,
......
...@@ -58,8 +58,8 @@ namespace { ...@@ -58,8 +58,8 @@ namespace {
// need to support messages that are too large. // need to support messages that are too large.
const int kBufferSize = 256 * 1024 * 1024; // 256 MB const int kBufferSize = 256 * 1024 * 1024; // 256 MB
typedef base::Callback< typedef base::RepeatingCallback<void(const net::HttpServerRequestInfo&,
void(const net::HttpServerRequestInfo&, const HttpResponseSenderFunc&)> const HttpResponseSenderFunc&)>
HttpRequestHandlerFunc; HttpRequestHandlerFunc;
int ListenOnIPv4(net::ServerSocket* socket, uint16_t port, bool allow_remote) { int ListenOnIPv4(net::ServerSocket* socket, uint16_t port, bool allow_remote) {
...@@ -194,11 +194,9 @@ class HttpServer : public net::HttpServer::Delegate { ...@@ -194,11 +194,9 @@ class HttpServer : public net::HttpServer::Delegate {
return; return;
} }
handle_request_func_.Run( handle_request_func_.Run(
info, info, base::BindRepeating(&HttpServer::OnResponse,
base::Bind(&HttpServer::OnResponse, weak_factory_.GetWeakPtr(), connection_id,
weak_factory_.GetWeakPtr(), !info.HasHeaderValue("connection", "close")));
connection_id,
!info.HasHeaderValue("connection", "close")));
} }
void OnWebSocketRequest(int connection_id, void OnWebSocketRequest(int connection_id,
...@@ -318,10 +316,11 @@ void HandleRequestOnIOThread( ...@@ -318,10 +316,11 @@ void HandleRequestOnIOThread(
const net::HttpServerRequestInfo& request, const net::HttpServerRequestInfo& request,
const HttpResponseSenderFunc& send_response_func) { const HttpResponseSenderFunc& send_response_func) {
cmd_task_runner->PostTask( cmd_task_runner->PostTask(
FROM_HERE, base::BindOnce(handle_request_on_cmd_func, request, FROM_HERE,
base::Bind(&SendResponseOnCmdThread, base::BindOnce(handle_request_on_cmd_func, request,
base::ThreadTaskRunnerHandle::Get(), base::BindRepeating(&SendResponseOnCmdThread,
send_response_func))); base::ThreadTaskRunnerHandle::Get(),
send_response_func)));
} }
base::LazyInstance<base::ThreadLocalPointer<HttpServer>>::DestructorAtExit base::LazyInstance<base::ThreadLocalPointer<HttpServer>>::DestructorAtExit
...@@ -466,14 +465,15 @@ void RunServer(uint16_t port, ...@@ -466,14 +465,15 @@ void RunServer(uint16_t port,
HttpHandler handler(cmd_run_loop.QuitClosure(), io_thread.task_runner(), HttpHandler handler(cmd_run_loop.QuitClosure(), io_thread.task_runner(),
url_base, adb_port); url_base, adb_port);
HttpRequestHandlerFunc handle_request_func = HttpRequestHandlerFunc handle_request_func =
base::Bind(&HandleRequestOnCmdThread, &handler, whitelisted_ips); base::BindRepeating(&HandleRequestOnCmdThread, &handler, whitelisted_ips);
io_thread.task_runner()->PostTask( io_thread.task_runner()->PostTask(
FROM_HERE, FROM_HERE,
base::BindOnce( base::BindOnce(&StartServerOnIOThread, port, allow_remote, url_base,
&StartServerOnIOThread, port, allow_remote, url_base, whitelisted_ips, whitelisted_ips,
base::Bind(&HandleRequestOnIOThread, main_task_executor.task_runner(), base::BindRepeating(&HandleRequestOnIOThread,
handle_request_func))); main_task_executor.task_runner(),
handle_request_func)));
// Run the command loop. This loop is quit after the response for a shutdown // Run the command loop. This loop is quit after the response for a shutdown
// request is posted to the IO loop. After the command loop quits, a task // request is posted to the IO loop. After the command loop quits, a task
// is posted to the IO loop to stop the server. Lastly, the IO thread is // is posted to the IO loop to stop the server. Lastly, the IO thread is
......
...@@ -64,13 +64,14 @@ struct CommandMapping { ...@@ -64,13 +64,14 @@ struct CommandMapping {
extern const char kCreateWebSocketPath[]; extern const char kCreateWebSocketPath[];
extern const char kSendCommandFromWebSocket[]; extern const char kSendCommandFromWebSocket[];
typedef base::Callback<void(std::unique_ptr<net::HttpServerResponseInfo>)> typedef base::RepeatingCallback<void(
std::unique_ptr<net::HttpServerResponseInfo>)>
HttpResponseSenderFunc; HttpResponseSenderFunc;
class HttpHandler { class HttpHandler {
public: public:
explicit HttpHandler(const std::string& url_base); explicit HttpHandler(const std::string& url_base);
HttpHandler(const base::Closure& quit_func, HttpHandler(const base::RepeatingClosure& quit_func,
const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
const std::string& url_base, const std::string& url_base,
int adb_port); int adb_port);
...@@ -119,7 +120,7 @@ class HttpHandler { ...@@ -119,7 +120,7 @@ class HttpHandler {
const std::string& session_id); const std::string& session_id);
base::ThreadChecker thread_checker_; base::ThreadChecker thread_checker_;
base::Closure quit_func_; base::RepeatingClosure quit_func_;
std::string url_base_; std::string url_base_;
bool received_shutdown_; bool received_shutdown_;
scoped_refptr<URLRequestContextGetter> context_getter_; scoped_refptr<URLRequestContextGetter> context_getter_;
......
...@@ -43,7 +43,7 @@ TEST(HttpHandlerTest, HandleOutsideOfBaseUrl) { ...@@ -43,7 +43,7 @@ TEST(HttpHandlerTest, HandleOutsideOfBaseUrl) {
request.path = "base/path"; request.path = "base/path";
request.data = "body"; request.data = "body";
net::HttpServerResponseInfo response; net::HttpServerResponseInfo response;
handler.Handle(request, base::Bind(&OnResponse, &response)); handler.Handle(request, base::BindRepeating(&OnResponse, &response));
ASSERT_EQ(net::HTTP_BAD_REQUEST, response.status_code()); ASSERT_EQ(net::HTTP_BAD_REQUEST, response.status_code());
} }
...@@ -53,7 +53,7 @@ TEST(HttpHandlerTest, HandleUnknownCommand) { ...@@ -53,7 +53,7 @@ TEST(HttpHandlerTest, HandleUnknownCommand) {
request.method = "get"; request.method = "get";
request.path = "/path"; request.path = "/path";
net::HttpServerResponseInfo response; net::HttpServerResponseInfo response;
handler.Handle(request, base::Bind(&OnResponse, &response)); handler.Handle(request, base::BindRepeating(&OnResponse, &response));
ASSERT_EQ(net::HTTP_NOT_FOUND, response.status_code()); ASSERT_EQ(net::HTTP_NOT_FOUND, response.status_code());
} }
...@@ -68,7 +68,7 @@ TEST(HttpHandlerTest, HandleNewSession) { ...@@ -68,7 +68,7 @@ TEST(HttpHandlerTest, HandleNewSession) {
request.path = "/base/session"; request.path = "/base/session";
request.data = "{}"; request.data = "{}";
net::HttpServerResponseInfo response; net::HttpServerResponseInfo response;
handler.Handle(request, base::Bind(&OnResponse, &response)); handler.Handle(request, base::BindRepeating(&OnResponse, &response));
ASSERT_EQ(net::HTTP_OK, response.status_code()); ASSERT_EQ(net::HTTP_OK, response.status_code());
base::DictionaryValue body; base::DictionaryValue body;
body.SetInteger("status", kOk); body.SetInteger("status", kOk);
...@@ -88,7 +88,7 @@ TEST(HttpHandlerTest, HandleInvalidPost) { ...@@ -88,7 +88,7 @@ TEST(HttpHandlerTest, HandleInvalidPost) {
request.path = "/path"; request.path = "/path";
request.data = "should be a dictionary"; request.data = "should be a dictionary";
net::HttpServerResponseInfo response; net::HttpServerResponseInfo response;
handler.Handle(request, base::Bind(&OnResponse, &response)); handler.Handle(request, base::BindRepeating(&OnResponse, &response));
ASSERT_EQ(net::HTTP_BAD_REQUEST, response.status_code()); ASSERT_EQ(net::HTTP_BAD_REQUEST, response.status_code());
} }
...@@ -102,7 +102,7 @@ TEST(HttpHandlerTest, HandleUnimplementedCommand) { ...@@ -102,7 +102,7 @@ TEST(HttpHandlerTest, HandleUnimplementedCommand) {
request.path = "/path"; request.path = "/path";
request.data = "{}"; request.data = "{}";
net::HttpServerResponseInfo response; net::HttpServerResponseInfo response;
handler.Handle(request, base::Bind(&OnResponse, &response)); handler.Handle(request, base::BindRepeating(&OnResponse, &response));
ASSERT_EQ(net::HTTP_NOT_IMPLEMENTED, response.status_code()); ASSERT_EQ(net::HTTP_NOT_IMPLEMENTED, response.status_code());
} }
...@@ -115,7 +115,7 @@ TEST(HttpHandlerTest, HandleCommand) { ...@@ -115,7 +115,7 @@ TEST(HttpHandlerTest, HandleCommand) {
request.path = "/path"; request.path = "/path";
request.data = "{}"; request.data = "{}";
net::HttpServerResponseInfo response; net::HttpServerResponseInfo response;
handler.Handle(request, base::Bind(&OnResponse, &response)); handler.Handle(request, base::BindRepeating(&OnResponse, &response));
ASSERT_EQ(net::HTTP_OK, response.status_code()); ASSERT_EQ(net::HTTP_OK, response.status_code());
base::DictionaryValue body; base::DictionaryValue body;
body.SetInteger("status", kOk); body.SetInteger("status", kOk);
......
...@@ -320,8 +320,8 @@ class NaClBrowserTestPnaclDebug : public NaClBrowserTestPnacl { ...@@ -320,8 +320,8 @@ class NaClBrowserTestPnaclDebug : public NaClBrowserTestPnacl {
base::Process test_script; base::Process test_script;
std::unique_ptr<base::Environment> env(base::Environment::Create()); std::unique_ptr<base::Environment> env(base::Environment::Create());
nacl::NaClBrowser::SetGdbDebugStubPortListenerForTest( nacl::NaClBrowser::SetGdbDebugStubPortListenerForTest(
base::Bind(&NaClBrowserTestPnaclDebug::StartTestScript, base::BindRepeating(&NaClBrowserTestPnaclDebug::StartTestScript,
base::Unretained(this), &test_script)); base::Unretained(this), &test_script));
// Turn on debug stub logging. // Turn on debug stub logging.
env->SetVar("NACLVERBOSITY", "1"); env->SetVar("NACLVERBOSITY", "1");
RunLoadTest(test_url); RunLoadTest(test_url);
......
...@@ -53,8 +53,8 @@ void PnaclHeaderTest::StartServer() { ...@@ -53,8 +53,8 @@ void PnaclHeaderTest::StartServer() {
// that watches for the .pexe fetch also. // that watches for the .pexe fetch also.
base::FilePath test_data_dir; base::FilePath test_data_dir;
ASSERT_TRUE(base::PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); ASSERT_TRUE(base::PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir));
embedded_test_server()->RegisterRequestHandler( embedded_test_server()->RegisterRequestHandler(base::BindRepeating(
base::Bind(&PnaclHeaderTest::WatchForPexeFetch, base::Unretained(this))); &PnaclHeaderTest::WatchForPexeFetch, base::Unretained(this)));
embedded_test_server()->ServeFilesFromDirectory(test_data_dir); embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(embedded_test_server()->Start());
} }
......
...@@ -41,16 +41,6 @@ const base::FilePath::CharType kValidationCacheFileName[] = ...@@ -41,16 +41,6 @@ const base::FilePath::CharType kValidationCacheFileName[] =
const bool kValidationCacheEnabledByDefault = true; const bool kValidationCacheEnabledByDefault = true;
// Keep the cache bounded to an arbitrary size. If it's too small, useful
// entries could be evicted when multiple .nexes are loaded at once. On the
// other hand, entries are not always claimed (and hence removed), so the size
// of the cache will likely saturate at its maximum size.
// Entries may not be claimed for two main reasons. 1) the NaCl process could
// be killed while it is loading. 2) the trusted NaCl plugin opens files using
// the code path but doesn't resolve them.
// TODO(ncbray) don't cache files that the plugin will not resolve.
const int kFilePathCacheSize = 100;
const base::FilePath::StringType NaClIrtName() { const base::FilePath::StringType NaClIrtName() {
base::FilePath::StringType irt_name(FILE_PATH_LITERAL("nacl_irt_")); base::FilePath::StringType irt_name(FILE_PATH_LITERAL("nacl_irt_"));
...@@ -152,15 +142,7 @@ base::File OpenNaClReadExecImpl(const base::FilePath& file_path, ...@@ -152,15 +142,7 @@ base::File OpenNaClReadExecImpl(const base::FilePath& file_path,
return file; return file;
} }
NaClBrowser::NaClBrowser() NaClBrowser::NaClBrowser() {
: irt_filepath_(),
irt_state_(NaClResourceUninitialized),
validation_cache_file_path_(),
validation_cache_is_enabled_(false),
validation_cache_is_modified_(false),
validation_cache_state_(NaClResourceUninitialized),
path_cache_(kFilePathCacheSize),
has_failed_(false) {
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
validation_cache_is_enabled_ = validation_cache_is_enabled_ =
CheckEnvVar("NACL_VALIDATION_CACHE", CheckEnvVar("NACL_VALIDATION_CACHE",
...@@ -326,7 +308,7 @@ void NaClBrowser::SetProcessGdbDebugStubPort(int process_id, int port) { ...@@ -326,7 +308,7 @@ void NaClBrowser::SetProcessGdbDebugStubPort(int process_id, int port) {
// static // static
void NaClBrowser::SetGdbDebugStubPortListenerForTest( void NaClBrowser::SetGdbDebugStubPortListenerForTest(
base::Callback<void(int)> listener) { base::RepeatingCallback<void(int)> listener) {
GetInstanceInternal()->debug_stub_port_listener_ = listener; GetInstanceInternal()->debug_stub_port_listener_ = listener;
} }
......
...@@ -30,6 +30,16 @@ namespace nacl { ...@@ -30,6 +30,16 @@ namespace nacl {
static const int kGdbDebugStubPortUnknown = -1; static const int kGdbDebugStubPortUnknown = -1;
static const int kGdbDebugStubPortUnused = 0; static const int kGdbDebugStubPortUnused = 0;
// Keep the cache bounded to an arbitrary size. If it's too small, useful
// entries could be evicted when multiple .nexes are loaded at once. On the
// other hand, entries are not always claimed (and hence removed), so the size
// of the cache will likely saturate at its maximum size.
// Entries may not be claimed for two main reasons. 1) the NaCl process could
// be killed while it is loading. 2) the trusted NaCl plugin opens files using
// the code path but doesn't resolve them.
// TODO(ncbray) don't cache files that the plugin will not resolve.
static const int kFilePathCacheSize = 100;
// Open an immutable executable file that can be mmapped (or a read-only file). // Open an immutable executable file that can be mmapped (or a read-only file).
// This function should only be called on a thread that can perform file IO. // This function should only be called on a thread that can perform file IO.
base::File OpenNaClReadExecImpl(const base::FilePath& file_path, base::File OpenNaClReadExecImpl(const base::FilePath& file_path,
...@@ -75,7 +85,7 @@ class NaClBrowser { ...@@ -75,7 +85,7 @@ class NaClBrowser {
// currently-unused TCP port to the debug stub server, instead of a fixed // currently-unused TCP port to the debug stub server, instead of a fixed
// one. // one.
static void SetGdbDebugStubPortListenerForTest( static void SetGdbDebugStubPortListenerForTest(
base::Callback<void(int)> listener); base::RepeatingCallback<void(int)> listener);
static void ClearGdbDebugStubPortListenerForTest(); static void ClearGdbDebugStubPortListenerForTest();
enum ValidationCacheStatus { enum ValidationCacheStatus {
...@@ -182,24 +192,24 @@ class NaClBrowser { ...@@ -182,24 +192,24 @@ class NaClBrowser {
base::File irt_file_; base::File irt_file_;
base::FilePath irt_filepath_; base::FilePath irt_filepath_;
NaClResourceState irt_state_; NaClResourceState irt_state_ = NaClResourceUninitialized;
NaClValidationCache validation_cache_; NaClValidationCache validation_cache_;
NaClValidationCache off_the_record_validation_cache_; NaClValidationCache off_the_record_validation_cache_;
base::FilePath validation_cache_file_path_; base::FilePath validation_cache_file_path_;
bool validation_cache_is_enabled_; bool validation_cache_is_enabled_ = false;
bool validation_cache_is_modified_; bool validation_cache_is_modified_ = false;
NaClResourceState validation_cache_state_; NaClResourceState validation_cache_state_ = NaClResourceUninitialized;
base::Callback<void(int)> debug_stub_port_listener_; base::RepeatingCallback<void(int)> debug_stub_port_listener_;
// Map from process id to debug stub port if any. // Map from process id to debug stub port if any.
typedef std::map<int, int> GdbDebugStubPortMap; typedef std::map<int, int> GdbDebugStubPortMap;
GdbDebugStubPortMap gdb_debug_stub_port_map_; GdbDebugStubPortMap gdb_debug_stub_port_map_;
typedef base::HashingMRUCache<std::string, base::FilePath> PathCacheType; typedef base::HashingMRUCache<std::string, base::FilePath> PathCacheType;
PathCacheType path_cache_; PathCacheType path_cache_{kFilePathCacheSize};
// True if it is no longer possible to launch NaCl processes. // True if it is no longer possible to launch NaCl processes.
bool has_failed_; bool has_failed_ = false;
// A list of pending tasks to start NaCl processes. // A list of pending tasks to start NaCl processes.
std::vector<base::OnceClosure> waiting_; std::vector<base::OnceClosure> waiting_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment