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

Side by Side Diff: components/resource_provider/public/cpp/resource_loader.cc

Issue 1157843002: Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « components/html_viewer/web_cookie_jar_impl.cc ('k') | mandoline/ui/aura/surface_binding.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/resource_provider/public/cpp/resource_loader.h" 5 #include "components/resource_provider/public/cpp/resource_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "mojo/application/public/cpp/connect.h" 9 #include "mojo/application/public/cpp/connect.h"
10 #include "mojo/application/public/interfaces/shell.mojom.h" 10 #include "mojo/application/public/interfaces/shell.mojom.h"
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 ResourceLoader::~ResourceLoader() { 33 ResourceLoader::~ResourceLoader() {
34 } 34 }
35 35
36 bool ResourceLoader::BlockUntilLoaded() { 36 bool ResourceLoader::BlockUntilLoaded() {
37 if (did_block_ || loaded_) 37 if (did_block_ || loaded_)
38 return loaded_; 38 return loaded_;
39 39
40 did_block_ = true; 40 did_block_ = true;
41 resource_provider_.WaitForIncomingMethodCall(); 41 resource_provider_.WaitForIncomingResponse();
42 return loaded_; 42 return loaded_;
43 } 43 }
44 44
45 base::File ResourceLoader::ReleaseFile(const std::string& path) { 45 base::File ResourceLoader::ReleaseFile(const std::string& path) {
46 CHECK(resource_map_.count(path)); 46 CHECK(resource_map_.count(path));
47 scoped_ptr<base::File> file_wrapper(resource_map_[path].Pass()); 47 scoped_ptr<base::File> file_wrapper(resource_map_[path].Pass());
48 resource_map_.erase(path); 48 resource_map_.erase(path);
49 return file_wrapper->Pass(); 49 return file_wrapper->Pass();
50 } 50 }
51 51
52 void ResourceLoader::OnGotResources(const std::vector<std::string>& paths, 52 void ResourceLoader::OnGotResources(const std::vector<std::string>& paths,
53 mojo::Array<mojo::ScopedHandle> resources) { 53 mojo::Array<mojo::ScopedHandle> resources) {
54 // We no longer need the connection to ResourceProvider. 54 // We no longer need the connection to ResourceProvider.
55 resource_provider_.reset(); 55 resource_provider_.reset();
56 resource_provider_service_provider_.reset(); 56 resource_provider_service_provider_.reset();
57 57
58 CHECK(!resources.is_null()); 58 CHECK(!resources.is_null());
59 CHECK_EQ(resources.size(), paths.size()); 59 CHECK_EQ(resources.size(), paths.size());
60 for (size_t i = 0; i < resources.size(); ++i) { 60 for (size_t i = 0; i < resources.size(); ++i) {
61 CHECK(resources[i].is_valid()); 61 CHECK(resources[i].is_valid());
62 MojoPlatformHandle platform_handle; 62 MojoPlatformHandle platform_handle;
63 CHECK(MojoExtractPlatformHandle(resources[i].release().value(), 63 CHECK(MojoExtractPlatformHandle(resources[i].release().value(),
64 &platform_handle) == MOJO_RESULT_OK); 64 &platform_handle) == MOJO_RESULT_OK);
65 resource_map_[paths[i]].reset(new base::File(platform_handle)); 65 resource_map_[paths[i]].reset(new base::File(platform_handle));
66 } 66 }
67 loaded_ = true; 67 loaded_ = true;
68 } 68 }
69 69
70 } // namespace resource_provider 70 } // namespace resource_provider
OLDNEW
« no previous file with comments | « components/html_viewer/web_cookie_jar_impl.cc ('k') | mandoline/ui/aura/surface_binding.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698