Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: mojo/services/public/cpp/view_manager/lib/bitmap_uploader.h

Issue 534843002: Convert view manager to surfaces with uploading shim in client lib (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove overzealous shutdown check in cc/surfaces, add NON_EXPORTED_BASE for windows build, saturate… Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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.
4
5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_BITMAP_UPLOADER_H_
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_BITMAP_UPLOADER_H_
7
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "cc/surfaces/surface_id.h"
12 #include "mojo/public/c/gles2/gles2.h"
13 #include "mojo/services/public/interfaces/gpu/gpu.mojom.h"
14 #include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h"
15 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h"
16 #include "third_party/skia/include/core/SkBitmap.h"
17 #include "ui/gfx/geometry/size.h"
18
19 namespace cc {
20 class SurfaceIdAllocator;
21 }
22
23 namespace mojo {
24
25 class BitmapUploader : public SurfaceClient {
26 public:
27 BitmapUploader(SurfacesServicePtr surfaces_service, GpuPtr gpu_service);
28 virtual ~BitmapUploader();
29
30 void Upload(SkBitmap bitmap,
31 const base::Callback<void(SurfaceIdPtr)>& done_callback);
32
33 private:
34 void OnSurfaceConnectionCreated(SurfacePtr surface, uint32_t id_namespace);
35 uint32_t BindTextureForSize(const gfx::Size size);
36
37 // SurfaceClient implementation.
38 virtual void ReturnResources(Array<ReturnedResourcePtr> resources) OVERRIDE;
39
40 SurfacesServicePtr surfaces_service_;
41 GpuPtr gpu_service_;
42 MojoGLES2Context gles2_context_;
43
44 // Used to hold on to the bitmap until we can upload it.
45 SkBitmap bitmap_;
46 base::Callback<void(SurfaceIdPtr)> done_callback_;
47 SurfacePtr surface_;
48 cc::SurfaceId id_;
49 scoped_ptr<cc::SurfaceIdAllocator> id_allocator_;
50 gfx::Size surface_size_;
51 uint32_t next_resource_id_;
52 base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_;
53
54 base::WeakPtrFactory<BitmapUploader> weak_factory_;
55
56 DISALLOW_COPY_AND_ASSIGN(BitmapUploader);
57 };
58
59 } // namespace mojo
60
61 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_BITMAP_UPLOADER_H_
OLDNEW
« no previous file with comments | « mojo/services/public/cpp/view_manager/lib/DEPS ('k') | mojo/services/public/cpp/view_manager/lib/bitmap_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698