Don't preload rarely seen large images
[chromium-blink-merge.git] / sandbox / win / src / handle_closer_agent.h
bloba3e15024d434b03723e504ff6036e4999d5d94b5
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 SANDBOX_SRC_HANDLE_CLOSER_AGENT_H_
6 #define SANDBOX_SRC_HANDLE_CLOSER_AGENT_H_
8 #include "base/basictypes.h"
9 #include "base/strings/string16.h"
10 #include "base/win/scoped_handle.h"
11 #include "sandbox/win/src/handle_closer.h"
12 #include "sandbox/win/src/sandbox_types.h"
14 namespace sandbox {
16 // Target process code to close the handle list copied over from the broker.
17 class HandleCloserAgent {
18 public:
19 HandleCloserAgent();
20 ~HandleCloserAgent();
22 // Reads the serialized list from the broker and creates the lookup map.
23 void InitializeHandlesToClose();
25 // Closes any handles matching those in the lookup map.
26 bool CloseHandles();
28 // True if we have handles waiting to be closed.
29 static bool NeedsHandlesClosed();
31 private:
32 // Attempt to stuff a closed handle with a dummy Event.
33 bool AttemptToStuffHandleSlot(HANDLE closed_handle,
34 const base::string16& type);
36 HandleMap handles_to_close_;
37 base::win::ScopedHandle dummy_handle_;
39 DISALLOW_COPY_AND_ASSIGN(HandleCloserAgent);
42 } // namespace sandbox
44 #endif // SANDBOX_SRC_HANDLE_CLOSER_AGENT_H_