Update mojo sdk to rev cb6c5abfadfea0ca73dca466e2894554ac1ae144
[chromium-blink-merge.git] / cc / resources / ui_resource_client.h
blob24309a52bb7d81342c3d49be0d759e2cf2739cd4
1 // Copyright 2013 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 CC_RESOURCES_UI_RESOURCE_CLIENT_H_
6 #define CC_RESOURCES_UI_RESOURCE_CLIENT_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/memory/ref_counted.h"
11 #include "cc/base/cc_export.h"
13 namespace cc {
15 class UIResourceBitmap;
17 typedef int UIResourceId;
19 class CC_EXPORT UIResourceClient {
20 public:
21 // GetBitmap() will be called once soon after resource creation and then will
22 // be called afterwards whenever the GL context is lost, on the same thread
23 // that LayerTreeHost::CreateUIResource was called on. It is only safe to
24 // delete a UIResourceClient object after DeleteUIResource has been called for
25 // all IDs associated with it. A valid bitmap always must be returned but it
26 // doesn't need to be the same size or format as the original.
27 virtual UIResourceBitmap GetBitmap(UIResourceId uid,
28 bool resource_lost) = 0;
29 virtual ~UIResourceClient() {}
32 } // namespace cc
34 #endif // CC_RESOURCES_UI_RESOURCE_CLIENT_H_