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

Unified Diff: ppapi/native_client/src/trusted/plugin/service_runtime.cc

Issue 183793007: Pepper: Cleanup in PepperReverseInterface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/native_client/src/trusted/plugin/service_runtime.cc
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index 5a18f5af94cfa640c13c9c5245227014cd1b0a5d..ca3c4b78c0356d2f724626eb2da7e74fc08864e0 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -137,13 +137,7 @@ void PluginReverseInterface::PostMessage_MainThreadContinuation(
bool PluginReverseInterface::EnumerateManifestKeys(
std::set<nacl::string>* out_keys) {
- Manifest const* mp = manifest_;
-
- if (!mp->GetFileKeys(out_keys)) {
- return false;
- }
-
- return true;
+ return manifest_->GetFileKeys(out_keys);
}
// TODO(bsy): OpenManifestEntry should use the manifest to ResolveKey
@@ -173,34 +167,23 @@ bool PluginReverseInterface::OpenManifestEntry(nacl::string url_key,
NaClLog(4,
"PluginReverseInterface::OpenManifestEntry:"
" waiting on main thread\n");
- bool shutting_down;
- do {
+
+ {
nacl::MutexLocker take(&mu_);
- for (;;) {
+ while (!shutting_down_ && !op_complete)
+ NaClXCondVarWait(&cv_, &mu_);
+ NaClLog(4, "PluginReverseInterface::OpenManifestEntry: done!\n");
+ if (shutting_down_) {
NaClLog(4,
"PluginReverseInterface::OpenManifestEntry:"
- " got lock, checking shutdown and completion: (%s, %s)\n",
- shutting_down_ ? "yes" : "no",
- op_complete ? "yes" : "no");
- shutting_down = shutting_down_;
- if (op_complete || shutting_down) {
- NaClLog(4,
- "PluginReverseInterface::OpenManifestEntry:"
- " done!\n");
- break;
- }
- NaClXCondVarWait(&cv_, &mu_);
+ " plugin is shutting down\n");
+ return false;
}
- } while (0);
- if (shutting_down) {
- NaClLog(4,
- "PluginReverseInterface::OpenManifestEntry:"
- " plugin is shutting down\n");
- return false;
}
- // out_desc has the returned descriptor if successful, else -1.
- // The caller is responsible for not closing *out_desc. If it is
+ // info->desc has the returned descriptor if successful, else -1.
+
+ // The caller is responsible for not closing info->desc. If it is
// closed prematurely, then another open could re-use the OS
// descriptor, confusing the opened_ map. If the caller is going to
// want to make a NaClDesc object and transfer it etc., then the
@@ -208,8 +191,7 @@ bool PluginReverseInterface::OpenManifestEntry(nacl::string url_key,
// value) for use by the NaClDesc object, which closes when the
// object is destroyed.
NaClLog(4,
- "PluginReverseInterface::OpenManifestEntry:"
- " *out_desc = %d\n",
+ "PluginReverseInterface::OpenManifestEntry: info->desc = %d\n",
info->desc);
if (info->desc == -1) {
// TODO(bsy,ncbray): what else should we do with the error? This
@@ -359,7 +341,6 @@ bool PluginReverseInterface::CloseManifestEntry(int32_t desc) {
CloseManifestEntryResource* to_close =
new CloseManifestEntryResource(desc, &op_complete, &op_result);
- bool shutting_down;
plugin::WeakRefCallOnMainThread(
anchor_,
0,
@@ -367,19 +348,16 @@ bool PluginReverseInterface::CloseManifestEntry(int32_t desc) {
&plugin::PluginReverseInterface::
CloseManifestEntry_MainThreadContinuation,
to_close);
+
// wait for completion or surf-away.
- do {
+ {
nacl::MutexLocker take(&mu_);
- for (;;) {
- shutting_down = shutting_down_;
- if (op_complete || shutting_down) {
- break;
- }
+ while (!shutting_down_ && !op_complete)
NaClXCondVarWait(&cv_, &mu_);
- }
- } while (0);
+ if (shutting_down_)
+ return false;
+ }
- if (shutting_down) return false;
// op_result true if close was successful; false otherwise (e.g., bad desc).
return op_result;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698